ServiceManager APIs for Remote Key Provisioning mainline module.

ServiceManager.getDeclaredInstances is needed for Remote Key
Provisioning mainline module to get all the implementations for
IRemotelyProvisionedComponent.

Test: build + usage in Remote Key Provisioning mainline module.
Change-Id: I92545104fa9bc190fe7c2f84b33d5f8693fcc2a4
This commit is contained in:
Vikram Gaur
2022-11-11 20:45:44 +00:00
parent 57ff4b4589
commit 81a458a73c
2 changed files with 4 additions and 1 deletions

View File

@@ -348,6 +348,7 @@ package android.os {
}
public final class ServiceManager {
method @NonNull public static String[] getDeclaredInstances(@NonNull String);
method public static boolean isDeclared(@NonNull String);
method @Nullable public static android.os.IBinder waitForDeclaredService(@NonNull String);
}

View File

@@ -258,12 +258,14 @@ public final class ServiceManager {
* waitForService should always be able to return the service.
* @hide
*/
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
@NonNull
public static String[] getDeclaredInstances(@NonNull String iface) {
try {
return getIServiceManager().getDeclaredInstances(iface);
} catch (RemoteException e) {
Log.e(TAG, "error in getDeclaredInstances", e);
return null;
throw e.rethrowFromSystemServer();
}
}