Do not attach <impl> tag if level is empty.
<impl level=""></impl> used to be emitted for hal.format=native and for
framework HAL manifest. This is misleading. Hence, drop the element if
level is empty.
Test: libvintf_test
Change-Id: I4135e562ea9db57e2d7b41778eb6a9d9b3b9b8b0
diff --git a/test/main.cpp b/test/main.cpp
index 5eaca81..28ef4c9 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -30,6 +30,7 @@
namespace vintf {
extern const XmlConverter<Version> &gVersionConverter;
+extern const XmlConverter<ManifestHal> &gManifestHalConverter;
extern const XmlConverter<MatrixHal> &gMatrixHalConverter;
extern const XmlConverter<KernelConfigTypedValue> &gKernelConfigTypedValueConverter;
extern const XmlConverter<HalImplementation> &gHalImplementationConverter;
@@ -161,6 +162,21 @@
"</manifest>\n");
}
+TEST_F(LibVintfTest, EmptyImpl) {
+ EXPECT_EQ(gManifestHalConverter(
+ ManifestHal{
+ .format = HalFormat::HIDL,
+ .name = "android.hidl.manager",
+ .impl = HalImplementation{},
+ .transport = Transport::HWBINDER,
+ }),
+ "<hal format=\"hidl\">\n"
+ " <name>android.hidl.manager</name>\n"
+ " <transport>hwbinder</transport>\n"
+ "</hal>\n"
+ ) << "HalImplementation should be missing.";
+}
+
TEST_F(LibVintfTest, HalManifestOptional) {
HalManifest vm;
EXPECT_TRUE(gHalManifestConverter(&vm,