Allow OTA package to contain fake AVB version
The system_matrix.xml in compatibility.zip can contain a fake
AVB version as specified by BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE.
This allows OTA to pass compatibility check when the AVB version is
updated *during* the OTA.
Bug: 112291283
Test: specify BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE.
and manual test.
Change-Id: I250bf3b547eb6edfdcdcee4dff64405f97e74b15
diff --git a/AssembleVintf.cpp b/AssembleVintf.cpp
index faab3e1..272301e 100644
--- a/AssembleVintf.cpp
+++ b/AssembleVintf.cpp
@@ -89,11 +89,13 @@
}
template <typename T>
- bool getFlag(const std::string& key, T* value) const {
+ bool getFlag(const std::string& key, T* value, bool log = true) const {
std::string envValue = getEnv(key);
if (envValue.empty()) {
- std::cerr << "Warning: " << key << " is missing, defaulted to " << (*value) << "."
- << std::endl;
+ if (log) {
+ std::cerr << "Warning: " << key << " is missing, defaulted to " << (*value) << "."
+ << std::endl;
+ }
return true;
}
@@ -559,6 +561,9 @@
deviceLevel == Level::UNSPECIFIED /* log */);
getFlagIfUnset("FRAMEWORK_VBMETA_VERSION", &matrix->framework.mAvbMetaVersion,
deviceLevel == Level::UNSPECIFIED /* log */);
+ // Hard-override existing AVB version
+ getFlag("FRAMEWORK_VBMETA_VERSION_OVERRIDE", &matrix->framework.mAvbMetaVersion,
+ false /* log */);
}
outputInputs(*matrices);
out() << gCompatibilityMatrixConverter(*matrix, mSerializeFlags);