libinit_test_utils: don't assume interface format
These can be AIDL or HIDL interfaces. Avoiding assuming the format here.
Bug: 141008902
Test: vts_ibase_test
Change-Id: If60367e3a46c74a1d28548379655f5e211f58b73
diff --git a/init/test_utils/include/init-test-utils/service_utils.h b/init/test_utils/include/init-test-utils/service_utils.h
index 3ec61d4..1b59c7b 100644
--- a/init/test_utils/include/init-test-utils/service_utils.h
+++ b/init/test_utils/include/init-test-utils/service_utils.h
@@ -25,7 +25,16 @@
namespace android {
namespace init {
-using ServiceInterfacesMap = std::map<std::string, std::set<android::FqInstance>>;
+// this is service name -> interface declaration
+//
+// So, for:
+// service foo ..
+// interface aidl baz
+// interface android.hardware.foo@1.0 IFoo
+//
+// We have:
+// foo -> { aidl/baz, android.hardware.foo@1.0/IFoo }
+using ServiceInterfacesMap = std::map<std::string, std::set<std::string>>;
android::base::Result<ServiceInterfacesMap> GetOnDeviceServiceInterfacesMap();
} // namespace init
diff --git a/init/test_utils/service_utils.cpp b/init/test_utils/service_utils.cpp
index bc00702..ae68679 100644
--- a/init/test_utils/service_utils.cpp
+++ b/init/test_utils/service_utils.cpp
@@ -47,14 +47,7 @@
for (const auto& service : service_list.services()) {
// Create an entry for all services, including services that may not
// have any declared interfaces.
- result[service->name()] = std::set<android::FqInstance>();
- for (const auto& intf : service->interfaces()) {
- android::FqInstance fqInstance;
- if (!fqInstance.setTo(intf)) {
- return android::base::Error() << "Unable to parse interface: '" << intf << "'";
- }
- result[service->name()].insert(fqInstance);
- }
+ result[service->name()] = service->interfaces();
}
return result;
}