Allow to disable certain checks in VintfObject::CheckCompatibility
Allow to disable AVB version checks.
Test: builds
Test: vintf_object_test
Test: libvintf_test
Bug: 38325029
Bug: 65270190
Change-Id: Iadc2408f635a5487a5af4e19f516147930f4bc4b
Merged-In: Iadc2408f635a5487a5af4e19f516147930f4bc4b
diff --git a/RuntimeInfo.cpp b/RuntimeInfo.cpp
index 0bcb363..b343138 100644
--- a/RuntimeInfo.cpp
+++ b/RuntimeInfo.cpp
@@ -101,8 +101,8 @@
minLts.minorRev <= mKernelVersion.minorRev;
}
-bool RuntimeInfo::checkCompatibility(const CompatibilityMatrix &mat,
- std::string *error) const {
+bool RuntimeInfo::checkCompatibility(const CompatibilityMatrix& mat, std::string* error,
+ DisabledChecks disabledChecks) const {
if (mat.mType != SchemaType::FRAMEWORK) {
if (error != nullptr) {
*error = "Should not check runtime info against " + to_string(mat.mType)
@@ -160,25 +160,28 @@
error->clear();
}
- const Version &matAvb = mat.framework.mAvbMetaVersion;
- if (mBootAvbVersion.majorVer != matAvb.majorVer || mBootAvbVersion.minorVer < matAvb.minorVer) {
- if (error != nullptr) {
- std::stringstream ss;
- ss << "AVB version " << mBootAvbVersion << " does not match framework matrix "
- << matAvb;
- *error = ss.str();
+ if ((disabledChecks & DISABLE_AVB_CHECK) == 0) {
+ const Version& matAvb = mat.framework.mAvbMetaVersion;
+ if (mBootAvbVersion.majorVer != matAvb.majorVer ||
+ mBootAvbVersion.minorVer < matAvb.minorVer) {
+ if (error != nullptr) {
+ std::stringstream ss;
+ ss << "AVB version " << mBootAvbVersion << " does not match framework matrix "
+ << matAvb;
+ *error = ss.str();
+ }
+ return false;
}
- return false;
- }
- if (mBootVbmetaAvbVersion.majorVer != matAvb.majorVer ||
- mBootVbmetaAvbVersion.minorVer < matAvb.minorVer) {
- if (error != nullptr) {
- std::stringstream ss;
- ss << "Vbmeta version " << mBootVbmetaAvbVersion << " does not match framework matrix "
- << matAvb;
- *error = ss.str();
+ if (mBootVbmetaAvbVersion.majorVer != matAvb.majorVer ||
+ mBootVbmetaAvbVersion.minorVer < matAvb.minorVer) {
+ if (error != nullptr) {
+ std::stringstream ss;
+ ss << "Vbmeta version " << mBootVbmetaAvbVersion
+ << " does not match framework matrix " << matAvb;
+ *error = ss.str();
+ }
+ return false;
}
- return false;
}
return true;