aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common.h5
-rw-r--r--install.cpp2
-rw-r--r--recovery.cpp6
3 files changed, 9 insertions, 4 deletions
diff --git a/common.h b/common.h
index 62fb1324..8b336f80 100644
--- a/common.h
+++ b/common.h
@@ -22,8 +22,9 @@
22 22
23#include <string> 23#include <string>
24 24
25#define STRINGIFY(x) #x 25// Not using the command-line defined macro here because this header could be included by
26#define EXPAND(x) STRINGIFY(x) 26// device-specific recovery libraries. We static assert the value consistency in recovery.cpp.
27static constexpr int kRecoveryApiVersion = 3;
27 28
28class RecoveryUI; 29class RecoveryUI;
29 30
diff --git a/install.cpp b/install.cpp
index 586dbbe2..507161c2 100644
--- a/install.cpp
+++ b/install.cpp
@@ -290,7 +290,7 @@ int update_binary_command(const std::string& package, ZipArchiveHandle zip,
290 290
291 *cmd = { 291 *cmd = {
292 binary_path, 292 binary_path,
293 EXPAND(RECOVERY_API_VERSION), // defined in Android.mk 293 std::to_string(kRecoveryApiVersion),
294 std::to_string(status_fd), 294 std::to_string(status_fd),
295 package, 295 package,
296 }; 296 };
diff --git a/recovery.cpp b/recovery.cpp
index 6f62ff17..d037b797 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -125,6 +125,10 @@ static const int BATTERY_WITH_CHARGER_OK_PERCENTAGE = 15;
125static constexpr const char* RECOVERY_WIPE = "/etc/recovery.wipe"; 125static constexpr const char* RECOVERY_WIPE = "/etc/recovery.wipe";
126static constexpr const char* DEFAULT_LOCALE = "en-US"; 126static constexpr const char* DEFAULT_LOCALE = "en-US";
127 127
128// We define RECOVERY_API_VERSION in Android.mk, which will be picked up by build system and packed
129// into target_files.zip. Assert the version defined in code and in Android.mk are consistent.
130static_assert(kRecoveryApiVersion == RECOVERY_API_VERSION, "Mismatching recovery API versions.");
131
128static std::string locale; 132static std::string locale;
129static bool has_cache = false; 133static bool has_cache = false;
130 134
@@ -1498,7 +1502,7 @@ int main(int argc, char **argv) {
1498 property_list(print_property, NULL); 1502 property_list(print_property, NULL);
1499 printf("\n"); 1503 printf("\n");
1500 1504
1501 ui->Print("Supported API: %d\n", RECOVERY_API_VERSION); 1505 ui->Print("Supported API: %d\n", kRecoveryApiVersion);
1502 1506
1503 int status = INSTALL_SUCCESS; 1507 int status = INSTALL_SUCCESS;
1504 1508