Native HALs don't require <transport>.
This is stated in go/android-treble-vintf-object but the code
was not well tested. Fortunately, native HALs are not used (until now),
so we need to conform to the documentation here.
Test: libvintf_test
Bug: 64447338
Change-Id: I00d96137d4052d9da50f696ef665a73d09d818a7
Merged-In: I00d96137d4052d9da50f696ef665a73d09d818a7
diff --git a/test/main.cpp b/test/main.cpp
index 8dc5ddb..42932e5 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -304,6 +304,28 @@
"</manifest>"));
}
+TEST_F(LibVintfTest, HalManifestNative) {
+ HalManifest vm;
+ EXPECT_TRUE(gHalManifestConverter(&vm,
+ "<manifest version=\"1.0\" type=\"device\">"
+ " <hal format=\"native\">"
+ " <name>foo</name>"
+ " <version>1.0</version>"
+ " </hal>"
+ "</manifest>"))
+ << gHalManifestConverter.lastError();
+ EXPECT_FALSE(gHalManifestConverter(&vm,
+ "<manifest version=\"1.0\" type=\"device\">"
+ " <hal format=\"native\">"
+ " <name>foo</name>"
+ " <version>1.0</version>"
+ " <transport>hwbinder</transport>"
+ " </hal>"
+ "</manifest>"));
+ EXPECT_TRUE(gHalManifestConverter.lastError().find(
+ "Native HAL 'foo' should not have <transport> defined") != std::string::npos);
+}
+
TEST_F(LibVintfTest, HalManifestDuplicate) {
HalManifest vm;
EXPECT_FALSE(gHalManifestConverter(&vm,