Allow optional elements and attributes.
Per the document, allowed optional elements and attributes are:
* compatibility-matrix.hal.format
* compatibility-matrix.hal.optional
* manifest.hal.format
* manifest.hal.impl
This change is needed to support system/manifest.xml because
manifest.hal.impl is missing.
Test: `adb shell vintf` correctly shows system/manifest.xml
Test: libvintf
Change-Id: Ia54842d128ba1bc614c29f3b364642393d800086
diff --git a/test/main.cpp b/test/main.cpp
index f3c7161..5eaca81 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -161,6 +161,27 @@
"</manifest>\n");
}
+TEST_F(LibVintfTest, HalManifestOptional) {
+ HalManifest vm;
+ EXPECT_TRUE(gHalManifestConverter(&vm,
+ "<manifest version=\"1.0\"></manifest>"));
+ EXPECT_TRUE(gHalManifestConverter(&vm,
+ "<manifest version=\"1.0\">"
+ " <hal>"
+ " <name>android.hidl.manager</name>"
+ " <transport>hwbinder</transport>"
+ " <version>1.0</version>"
+ " </hal>"
+ "</manifest>"));
+ EXPECT_FALSE(gHalManifestConverter(&vm,
+ "<manifest version=\"1.0\">"
+ " <hal>"
+ " <name>android.hidl.manager</name>"
+ " <version>1.0</version>"
+ " </hal>"
+ "</manifest>"));
+}
+
TEST_F(LibVintfTest, HalManifestInstances) {
HalManifest vm = testHalManifest();
EXPECT_EQ(vm.getInstances("android.hardware.camera", "ICamera"),