ManifestHal: add "override" attribute
"override" is a boolean attribute on <hal> tags
that suggest the <hal> tag can override any existing <hal>
tags, even if there is a major version conflict.
Test: libvintf_test
Bug: 69051162
Change-Id: I388dc15b9e45170b6c9778f4e7efc8fd27869892
diff --git a/test/LibVintfTest.cpp b/test/LibVintfTest.cpp
index 1c2536d..2001f0c 100644
--- a/test/LibVintfTest.cpp
+++ b/test/LibVintfTest.cpp
@@ -2389,6 +2389,30 @@
}
}
+TEST_F(LibVintfTest, ManifestHalOverride) {
+ HalManifest manifest;
+ std::string xml =
+ "<manifest version=\"1.0\" type=\"device\">\n"
+ " <hal format=\"hidl\" override=\"true\">\n"
+ " <name>android.hardware.foo</name>\n"
+ " <transport>hwbinder</transport>\n"
+ " <version>1.0</version>\n"
+ " </hal>\n"
+ " <hal format=\"hidl\">\n"
+ " <name>android.hardware.bar</name>\n"
+ " <transport>hwbinder</transport>\n"
+ " <version>1.0</version>\n"
+ " </hal>\n"
+ "</manifest>\n";
+ EXPECT_TRUE(gHalManifestConverter(&manifest, xml)) << gHalManifestConverter.lastError();
+ const ManifestHal* foo = manifest.getHal("android.hardware.foo", {1, 0});
+ ASSERT_NE(nullptr, foo);
+ EXPECT_TRUE(foo->isOverride);
+ const ManifestHal* bar = manifest.getHal("android.hardware.bar", {1, 0});
+ ASSERT_NE(nullptr, bar);
+ EXPECT_FALSE(bar->isOverride);
+}
+
} // namespace vintf
} // namespace android