Methods Summary |
---|
public static void | addService(java.lang.String name, IBinder service)Place a new @a service called @a name into the service
manager.
try {
getIServiceManager().addService(name, service);
} catch (RemoteException e) {
Log.e(TAG, "error in addService", e);
}
|
public static IBinder | checkService(java.lang.String name)Retrieve an existing service called @a name from the
service manager. Non-blocking.
try {
IBinder service = sCache.get(name);
if (service != null) {
return service;
} else {
return getIServiceManager().checkService(name);
}
} catch (RemoteException e) {
Log.e(TAG, "error in checkService", e);
return null;
}
|
private static IServiceManager | getIServiceManager()
if (sServiceManager != null) {
return sServiceManager;
}
// Find the service manager
sServiceManager = ServiceManagerNative.asInterface(BinderInternal.getContextObject());
return sServiceManager;
|
public static IBinder | getService(java.lang.String name)Returns a reference to a service with the given name.
try {
IBinder service = sCache.get(name);
if (service != null) {
return service;
} else {
return getIServiceManager().getService(name);
}
} catch (RemoteException e) {
Log.e(TAG, "error in getService", e);
}
return null;
|
public static void | initServiceCache(java.util.Map cache)This is only intended to be called when the process is first being brought
up and bound by the activity manager. There is only one thread in the process
at that time, so no locking is done.
if (sCache.size() != 0 && Process.supportsProcesses()) {
throw new IllegalStateException("setServiceCache may only be called once");
}
sCache.putAll(cache);
|
public static java.lang.String[] | listServices()Return a list of all currently running services.
try {
return getIServiceManager().listServices();
} catch (RemoteException e) {
Log.e(TAG, "error in listServices", e);
return null;
}
|