Combine version tag with fqname for AIDL HALs
For AIDL HALs (but not HIDL HALs), when
iterating over <fqname>, the <version> tag of a HAL mangles with the
HAL. For example:
<hal format="aidl">
<name>foo</name>
<version>1</version>
<fqname>IFoo/default</fqname>
</hal>
... results in foo.IFoo/default (version 1). If <version> is not
specified, libvintf injects a <version>0</version> for AIDL HALs.
Test: libvintf_test
Test: vintf_object_test
Change-Id: Id86fdfd6e186e84d05bd4535eeabe0bfda3b6ee7
diff --git a/ManifestHal.cpp b/ManifestHal.cpp
index 3fdc6e2..cb60331 100644
--- a/ManifestHal.cpp
+++ b/ManifestHal.cpp
@@ -86,8 +86,19 @@
}
for (const auto& manifestInstance : mAdditionalInstances) {
- if (!func(manifestInstance)) {
- return false;
+ // For AIDL HALs, <version> tag is mangled with <fqname>. Note that if there's no
+ // <version> tag, libvintf will create one by default, so each <fqname> is executed
+ // at least once.
+ if (format == HalFormat::AIDL) {
+ for (const auto& v : versions) {
+ if (!func(manifestInstance.withVersion(v))) {
+ return false;
+ }
+ }
+ } else {
+ if (!func(manifestInstance)) {
+ return false;
+ }
}
}