diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/os/IServiceManager.java | 3 | ||||
-rw-r--r-- | core/java/android/os/ServiceManager.java | 19 | ||||
-rw-r--r-- | core/java/android/os/ServiceManagerNative.java | 6 | ||||
-rw-r--r-- | core/java/android/os/UserId.java | 5 |
4 files changed, 29 insertions, 4 deletions
diff --git a/core/java/android/os/IServiceManager.java b/core/java/android/os/IServiceManager.java index 9a5ff47..7b11c28 100644 --- a/core/java/android/os/IServiceManager.java +++ b/core/java/android/os/IServiceManager.java @@ -45,7 +45,8 @@ public interface IServiceManager extends IInterface * Place a new @a service called @a name into the service * manager. */ - public void addService(String name, IBinder service) throws RemoteException; + public void addService(String name, IBinder service, boolean allowIsolated) + throws RemoteException; /** * Return a list of all currently running services. diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java index 1af24f4..13b8b66 100644 --- a/core/java/android/os/ServiceManager.java +++ b/core/java/android/os/ServiceManager.java @@ -69,7 +69,24 @@ public final class ServiceManager { */ public static void addService(String name, IBinder service) { try { - getIServiceManager().addService(name, service); + getIServiceManager().addService(name, service, false); + } catch (RemoteException e) { + Log.e(TAG, "error in addService", e); + } + } + + /** + * 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 + * to access this service + */ + public static void addService(String name, IBinder service, boolean allowIsolated) { + try { + getIServiceManager().addService(name, service, allowIsolated); } catch (RemoteException e) { Log.e(TAG, "error in addService", e); } diff --git a/core/java/android/os/ServiceManagerNative.java b/core/java/android/os/ServiceManagerNative.java index 2aab0e6..43b5128 100644 --- a/core/java/android/os/ServiceManagerNative.java +++ b/core/java/android/os/ServiceManagerNative.java @@ -71,7 +71,8 @@ public abstract class ServiceManagerNative extends Binder implements IServiceMan data.enforceInterface(IServiceManager.descriptor); String name = data.readString(); IBinder service = data.readStrongBinder(); - addService(name, service); + boolean allowIsolated = data.readInt() != 0; + addService(name, service, allowIsolated); return true; } @@ -136,13 +137,14 @@ class ServiceManagerProxy implements IServiceManager { return binder; } - public void addService(String name, IBinder service) + public void addService(String name, IBinder service, boolean allowIsolated) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IServiceManager.descriptor); data.writeString(name); data.writeStrongBinder(service); + data.writeInt(allowIsolated ? 1 : 0); mRemote.transact(ADD_SERVICE_TRANSACTION, data, reply, 0); reply.recycle(); data.recycle(); diff --git a/core/java/android/os/UserId.java b/core/java/android/os/UserId.java index 4124d51..286b674 100644 --- a/core/java/android/os/UserId.java +++ b/core/java/android/os/UserId.java @@ -56,6 +56,11 @@ public final class UserId { return getAppId(uid1) == getAppId(uid2); } + public static final boolean isIsolated(int uid) { + uid = getAppId(uid); + return uid >= Process.FIRST_ISOLATED_UID && uid <= Process.LAST_ISOLATED_UID; + } + /** * Returns the user id for a given uid. * @hide |