diff options
authorTao Bao2017-05-04 15:03:18 -0500
committerTao Bao2017-09-13 12:51:09 -0500
commitbd0ddcd5e8794511395bf668833acc5c2da69fb0 (patch)
tree4e9b138c4234d80b88cc856effa3f55e340044f5 /recovery.cpp
parent64307daf5b178af9c899f3a17be42fb294eeac1c (diff)
This reverts commit 8be0f39fec7f26164fd0791ff6d15bde65fc849c to reland the change that removes EXPAND/STRINGIFY macros. It's error-prone by putting anything into a string (e.g. EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we forgot to pass -DRECOVERY_API_VERSION=3). The initial attempt put RECOVERY_API_VERSION into common.h, which might be included by device-specific codes but without defining that when compiling the module. This CL avoids the issue by using a constant in the header, with a static_assert in recovery.cpp that guards the consistency. Test: recovery_component_test Test: Sideload OTAs on bullhead and sailfish respectively. Change-Id: I12af3f73392a85554ba703f04970ec9d984ccbaa
Diffstat (limited to 'recovery.cpp')
1 files changed, 5 insertions, 1 deletions
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.");
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