ServiceManager: add getDeclaredInstances

Corresponding to change in IServiceManager API, for finding out what
instances of a VINTF service are installed.

Bug: 168715768
Test: manual
Change-Id: Ic54b0cfd1bd42e45dc66858dbd614db7ba22083f
This commit is contained in:
Steven Moreland
2020-09-24 00:46:56 +00:00
parent 97165aa09e
commit d243d23f84
2 changed files with 19 additions and 0 deletions

View File

@@ -234,6 +234,21 @@ public final class ServiceManager {
}
}
/**
* Returns the list of declared instances for an interface.
*
* @return true if the service is declared somewhere (eg. VINTF manifest) and
* waitForService should always be able to return the service.
*/
public static String[] getDeclaredInstances(@NonNull String iface) {
try {
return getIServiceManager().getDeclaredInstances(iface);
} catch (RemoteException e) {
Log.e(TAG, "error in getDeclaredInstances", e);
return null;
}
}
/**
* Returns the specified service from the service manager.
*

View File

@@ -90,6 +90,10 @@ class ServiceManagerProxy implements IServiceManager {
return mServiceManager.isDeclared(name);
}
public String[] getDeclaredInstances(String iface) throws RemoteException {
return mServiceManager.getDeclaredInstances(iface);
}
public void registerClientCallback(String name, IBinder service, IClientCallback cb)
throws RemoteException {
throw new RemoteException();