lshal: uses instances API for --init-vintf
Use the legacy <interface><instance> API.
Test: lshal_test
Test: lshal --init-vintf
Bug: 73738616
Change-Id: I7b3b01e45735bcf35f78e429da211e68c9654901
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp
index 3dfb7e0..29ef648 100644
--- a/cmds/lshal/ListCommand.cpp
+++ b/cmds/lshal/ListCommand.cpp
@@ -378,8 +378,7 @@
}
if (findAndBumpVersion(hal, version)) {
if (&table != &mImplementationsTable) {
- hal->interfaces[interfaceName].name = interfaceName;
- hal->interfaces[interfaceName].instances.insert(instanceName);
+ hal->insertLegacyInstance(interfaceName, instanceName);
}
hal->transportArch.arch |= arch;
done = true;
@@ -389,17 +388,16 @@
if (done) {
continue; // to next TableEntry
}
- decltype(vintf::ManifestHal::interfaces) interfaces;
- if (&table != &mImplementationsTable) {
- interfaces[interfaceName].name = interfaceName;
- interfaces[interfaceName].instances.insert(instanceName);
- }
- if (!manifest.add(vintf::ManifestHal{
+ vintf::ManifestHal manifestHal{
vintf::HalFormat::HIDL,
std::string{fqName.package()},
{version},
{transport, arch},
- std::move(interfaces)})) {
+ {}};
+ if (&table != &mImplementationsTable) {
+ manifestHal.insertLegacyInstance(interfaceName, instanceName);
+ }
+ if (!manifest.add(std::move(manifestHal))) {
err() << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl;
}
}
@@ -408,7 +406,7 @@
<< " This is a skeleton " << manifest.type() << " manifest. Notes: " << std::endl
<< INIT_VINTF_NOTES
<< "-->" << std::endl;
- out << vintf::gHalManifestConverter(manifest, vintf::SerializeFlag::HALS_ONLY);
+ out << vintf::gHalManifestConverter(manifest, vintf::SerializeFlag::HALS_NO_FQNAME);
}
std::string ListCommand::INIT_VINTF_NOTES{