Remove EXPAND/STRINGIFY macros.

This reverts commit 8be0f39fec 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
This commit is contained in:
Tao Bao
2017-05-04 13:03:18 -07:00
parent 64307daf5b
commit bd0ddcd5e8
3 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -290,7 +290,7 @@ int update_binary_command(const std::string& package, ZipArchiveHandle zip,
*cmd = {
binary_path,
EXPAND(RECOVERY_API_VERSION), // defined in Android.mk
std::to_string(kRecoveryApiVersion),
std::to_string(status_fd),
package,
};