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
This commit is contained in:
parent
62662cf189
commit
bb44cd6ea1
2 changed files with 11 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -47,14 +47,7 @@ android::base::Result<ServiceInterfacesMap> GetOnDeviceServiceInterfacesMap() {
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue