Add ServiceManager.registerForNotifications

Add the API to call into IServiceManager.registerForNotifications.

Test: pass
Change-Id: Ia74d8a1bd5be767a076560bf8ee4af3095b4623a
This commit is contained in:
Yifan Hong
2021-11-05 14:31:16 -07:00
parent a8c0faa120
commit 6a2929d6ce
2 changed files with 12 additions and 1 deletions

View File

@@ -297,6 +297,17 @@ public final class ServiceManager {
return isDeclared(name) ? waitForService(name) : null;
}
/**
* Register callback for service registration notifications.
*
* @throws RemoteException for underlying error.
* @hide
*/
public static void registerForNotifications(
@NonNull String name, @NonNull IServiceCallback callback) throws RemoteException {
getIServiceManager().registerForNotifications(name, callback);
}
/**
* Return a list of all currently running services.
* @return an array of all currently running services, or <code>null</code> in

View File

@@ -78,7 +78,7 @@ class ServiceManagerProxy implements IServiceManager {
public void registerForNotifications(String name, IServiceCallback cb)
throws RemoteException {
throw new RemoteException();
mServiceManager.registerForNotifications(name, cb);
}
public void unregisterForNotifications(String name, IServiceCallback cb)