Loading core/java/android/os/IServiceManager.java +18 −9 Original line number Diff line number Diff line Loading @@ -33,31 +33,31 @@ public interface IServiceManager extends IInterface * service manager. Blocks for a few seconds waiting for it to be * published if it does not already exist. */ public IBinder getService(String name) throws RemoteException; IBinder getService(String name) throws RemoteException; /** * Retrieve an existing service called @a name from the * service manager. Non-blocking. */ public IBinder checkService(String name) throws RemoteException; IBinder checkService(String name) throws RemoteException; /** * Place a new @a service called @a name into the service * manager. */ public void addService(String name, IBinder service, boolean allowIsolated) void addService(String name, IBinder service, boolean allowIsolated, int dumpPriority) throws RemoteException; /** * Return a list of all currently running services. */ public String[] listServices() throws RemoteException; String[] listServices(int dumpPriority) throws RemoteException; /** * Assign a permission controller to the service manager. After set, this * interface is checked before any services are added. */ public void setPermissionController(IPermissionController controller) void setPermissionController(IPermissionController controller) throws RemoteException; static final String descriptor = "android.os.IServiceManager"; Loading @@ -68,4 +68,13 @@ public interface IServiceManager extends IInterface int LIST_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3; int CHECK_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4; int SET_PERMISSION_CONTROLLER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5; /* * Must update values in IServiceManager.h */ int DUMP_PRIORITY_CRITICAL = 1 << 0; int DUMP_PRIORITY_HIGH = 1 << 1; int DUMP_PRIORITY_NORMAL = 1 << 2; int DUMP_PRIORITY_ALL = DUMP_PRIORITY_CRITICAL | DUMP_PRIORITY_HIGH | DUMP_PRIORITY_NORMAL; } core/java/android/os/ServiceManager.java +23 −13 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import java.util.Map; /** @hide */ public final class ServiceManager { private static final String TAG = "ServiceManager"; private static IServiceManager sServiceManager; private static HashMap<String, IBinder> sCache = new HashMap<String, IBinder>(); Loading Loading @@ -84,11 +83,7 @@ public final class ServiceManager { * @param service the service object */ public static void addService(String name, IBinder service) { try { getIServiceManager().addService(name, service, false); } catch (RemoteException e) { Log.e(TAG, "error in addService", e); } addService(name, service, false, IServiceManager.DUMP_PRIORITY_NORMAL); } /** Loading @@ -101,8 +96,23 @@ public final class ServiceManager { * to access this service */ public static void addService(String name, IBinder service, boolean allowIsolated) { addService(name, service, allowIsolated, IServiceManager.DUMP_PRIORITY_NORMAL); } /** * Place a new @a service called @a name into the service * manager. * * @param name the name of the new service * @param service the service object * @param allowIsolated set to true to allow isolated sandboxed processes * @param dumpPriority supported dump priority levels as a bitmask * to access this service */ public static void addService(String name, IBinder service, boolean allowIsolated, int dumpPriority) { try { getIServiceManager().addService(name, service, allowIsolated); getIServiceManager().addService(name, service, allowIsolated, dumpPriority); } catch (RemoteException e) { Log.e(TAG, "error in addService", e); } Loading Loading @@ -133,7 +143,7 @@ public final class ServiceManager { */ public static String[] listServices() { try { return getIServiceManager().listServices(); return getIServiceManager().listServices(IServiceManager.DUMP_PRIORITY_ALL); } catch (RemoteException e) { Log.e(TAG, "error in listServices", e); return null; Loading core/java/android/os/ServiceManagerNative.java +53 −49 Original line number Diff line number Diff line Loading @@ -74,21 +74,23 @@ public abstract class ServiceManagerNative extends Binder implements IServiceMan String name = data.readString(); IBinder service = data.readStrongBinder(); boolean allowIsolated = data.readInt() != 0; addService(name, service, allowIsolated); int dumpPriority = data.readInt(); addService(name, service, allowIsolated, dumpPriority); return true; } case IServiceManager.LIST_SERVICES_TRANSACTION: { data.enforceInterface(IServiceManager.descriptor); String[] list = listServices(); int dumpPriority = data.readInt(); String[] list = listServices(dumpPriority); reply.writeStringArray(list); return true; } case IServiceManager.SET_PERMISSION_CONTROLLER_TRANSACTION: { data.enforceInterface(IServiceManager.descriptor); IPermissionController controller = IPermissionController.Stub.asInterface( IPermissionController controller = IPermissionController.Stub.asInterface( data.readStrongBinder()); setPermissionController(controller); return true; Loading Loading @@ -139,7 +141,7 @@ class ServiceManagerProxy implements IServiceManager { return binder; } public void addService(String name, IBinder service, boolean allowIsolated) public void addService(String name, IBinder service, boolean allowIsolated, int dumpPriority) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Loading @@ -147,12 +149,13 @@ class ServiceManagerProxy implements IServiceManager { data.writeString(name); data.writeStrongBinder(service); data.writeInt(allowIsolated ? 1 : 0); data.writeInt(dumpPriority); mRemote.transact(ADD_SERVICE_TRANSACTION, data, reply, 0); reply.recycle(); data.recycle(); } public String[] listServices() throws RemoteException { public String[] listServices(int dumpPriority) throws RemoteException { ArrayList<String> services = new ArrayList<String>(); int n = 0; while (true) { Loading @@ -160,6 +163,7 @@ class ServiceManagerProxy implements IServiceManager { Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IServiceManager.descriptor); data.writeInt(n); data.writeInt(dumpPriority); n++; try { boolean res = mRemote.transact(LIST_SERVICES_TRANSACTION, data, reply, 0); Loading Loading
core/java/android/os/IServiceManager.java +18 −9 Original line number Diff line number Diff line Loading @@ -33,31 +33,31 @@ public interface IServiceManager extends IInterface * service manager. Blocks for a few seconds waiting for it to be * published if it does not already exist. */ public IBinder getService(String name) throws RemoteException; IBinder getService(String name) throws RemoteException; /** * Retrieve an existing service called @a name from the * service manager. Non-blocking. */ public IBinder checkService(String name) throws RemoteException; IBinder checkService(String name) throws RemoteException; /** * Place a new @a service called @a name into the service * manager. */ public void addService(String name, IBinder service, boolean allowIsolated) void addService(String name, IBinder service, boolean allowIsolated, int dumpPriority) throws RemoteException; /** * Return a list of all currently running services. */ public String[] listServices() throws RemoteException; String[] listServices(int dumpPriority) throws RemoteException; /** * Assign a permission controller to the service manager. After set, this * interface is checked before any services are added. */ public void setPermissionController(IPermissionController controller) void setPermissionController(IPermissionController controller) throws RemoteException; static final String descriptor = "android.os.IServiceManager"; Loading @@ -68,4 +68,13 @@ public interface IServiceManager extends IInterface int LIST_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3; int CHECK_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4; int SET_PERMISSION_CONTROLLER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5; /* * Must update values in IServiceManager.h */ int DUMP_PRIORITY_CRITICAL = 1 << 0; int DUMP_PRIORITY_HIGH = 1 << 1; int DUMP_PRIORITY_NORMAL = 1 << 2; int DUMP_PRIORITY_ALL = DUMP_PRIORITY_CRITICAL | DUMP_PRIORITY_HIGH | DUMP_PRIORITY_NORMAL; }
core/java/android/os/ServiceManager.java +23 −13 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import java.util.Map; /** @hide */ public final class ServiceManager { private static final String TAG = "ServiceManager"; private static IServiceManager sServiceManager; private static HashMap<String, IBinder> sCache = new HashMap<String, IBinder>(); Loading Loading @@ -84,11 +83,7 @@ public final class ServiceManager { * @param service the service object */ public static void addService(String name, IBinder service) { try { getIServiceManager().addService(name, service, false); } catch (RemoteException e) { Log.e(TAG, "error in addService", e); } addService(name, service, false, IServiceManager.DUMP_PRIORITY_NORMAL); } /** Loading @@ -101,8 +96,23 @@ public final class ServiceManager { * to access this service */ public static void addService(String name, IBinder service, boolean allowIsolated) { addService(name, service, allowIsolated, IServiceManager.DUMP_PRIORITY_NORMAL); } /** * Place a new @a service called @a name into the service * manager. * * @param name the name of the new service * @param service the service object * @param allowIsolated set to true to allow isolated sandboxed processes * @param dumpPriority supported dump priority levels as a bitmask * to access this service */ public static void addService(String name, IBinder service, boolean allowIsolated, int dumpPriority) { try { getIServiceManager().addService(name, service, allowIsolated); getIServiceManager().addService(name, service, allowIsolated, dumpPriority); } catch (RemoteException e) { Log.e(TAG, "error in addService", e); } Loading Loading @@ -133,7 +143,7 @@ public final class ServiceManager { */ public static String[] listServices() { try { return getIServiceManager().listServices(); return getIServiceManager().listServices(IServiceManager.DUMP_PRIORITY_ALL); } catch (RemoteException e) { Log.e(TAG, "error in listServices", e); return null; Loading
core/java/android/os/ServiceManagerNative.java +53 −49 Original line number Diff line number Diff line Loading @@ -74,21 +74,23 @@ public abstract class ServiceManagerNative extends Binder implements IServiceMan String name = data.readString(); IBinder service = data.readStrongBinder(); boolean allowIsolated = data.readInt() != 0; addService(name, service, allowIsolated); int dumpPriority = data.readInt(); addService(name, service, allowIsolated, dumpPriority); return true; } case IServiceManager.LIST_SERVICES_TRANSACTION: { data.enforceInterface(IServiceManager.descriptor); String[] list = listServices(); int dumpPriority = data.readInt(); String[] list = listServices(dumpPriority); reply.writeStringArray(list); return true; } case IServiceManager.SET_PERMISSION_CONTROLLER_TRANSACTION: { data.enforceInterface(IServiceManager.descriptor); IPermissionController controller = IPermissionController.Stub.asInterface( IPermissionController controller = IPermissionController.Stub.asInterface( data.readStrongBinder()); setPermissionController(controller); return true; Loading Loading @@ -139,7 +141,7 @@ class ServiceManagerProxy implements IServiceManager { return binder; } public void addService(String name, IBinder service, boolean allowIsolated) public void addService(String name, IBinder service, boolean allowIsolated, int dumpPriority) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Loading @@ -147,12 +149,13 @@ class ServiceManagerProxy implements IServiceManager { data.writeString(name); data.writeStrongBinder(service); data.writeInt(allowIsolated ? 1 : 0); data.writeInt(dumpPriority); mRemote.transact(ADD_SERVICE_TRANSACTION, data, reply, 0); reply.recycle(); data.recycle(); } public String[] listServices() throws RemoteException { public String[] listServices(int dumpPriority) throws RemoteException { ArrayList<String> services = new ArrayList<String>(); int n = 0; while (true) { Loading @@ -160,6 +163,7 @@ class ServiceManagerProxy implements IServiceManager { Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IServiceManager.descriptor); data.writeInt(n); data.writeInt(dumpPriority); n++; try { boolean res = mRemote.transact(LIST_SERVICES_TRANSACTION, data, reply, 0); Loading