DO NOT MERGE Isolated processes don't get precached system service binders

More specifically, they get a PackageManager binder -- necessary for
Android process startup and configuration -- but none of the other
usual preloaded service binders.

Bug 30202228

Change-Id: I3810649f504cd631665ece338a83d2e54d41ad05
(cherry picked from commit 2c61c57ac5)
This commit is contained in:
Christopher Tate
2016-08-16 16:03:44 -07:00
committed by Suprabh Shukla
parent 2cd4383c31
commit f4d23f30c9

View File

@@ -983,6 +983,7 @@ public final class ActivityManagerService extends ActivityManagerNative
* For example, references to the commonly used services. * For example, references to the commonly used services.
*/ */
HashMap<String, IBinder> mAppBindArgs; HashMap<String, IBinder> mAppBindArgs;
HashMap<String, IBinder> mIsolatedAppBindArgs;
/** /**
* Temporary to avoid allocations. Protected by main lock. * Temporary to avoid allocations. Protected by main lock.
@@ -2586,18 +2587,24 @@ public final class ActivityManagerService extends ActivityManagerNative
* lazily setup to make sure the services are running when they're asked for. * lazily setup to make sure the services are running when they're asked for.
*/ */
private HashMap<String, IBinder> getCommonServicesLocked(boolean isolated) { private HashMap<String, IBinder> getCommonServicesLocked(boolean isolated) {
// Isolated processes won't get this optimization, so that we don't
// violate the rules about which services they have access to.
if (isolated) {
if (mIsolatedAppBindArgs == null) {
mIsolatedAppBindArgs = new HashMap<>();
mIsolatedAppBindArgs.put("package", ServiceManager.getService("package"));
}
return mIsolatedAppBindArgs;
}
if (mAppBindArgs == null) { if (mAppBindArgs == null) {
mAppBindArgs = new HashMap<>(); mAppBindArgs = new HashMap<>();
// Isolated processes won't get this optimization, so that we don't // Setup the application init args
// violate the rules about which services they have access to. mAppBindArgs.put("package", ServiceManager.getService("package"));
if (!isolated) { mAppBindArgs.put("window", ServiceManager.getService("window"));
// Setup the application init args mAppBindArgs.put(Context.ALARM_SERVICE,
mAppBindArgs.put("package", ServiceManager.getService("package")); ServiceManager.getService(Context.ALARM_SERVICE));
mAppBindArgs.put("window", ServiceManager.getService("window"));
mAppBindArgs.put(Context.ALARM_SERVICE,
ServiceManager.getService(Context.ALARM_SERVICE));
}
} }
return mAppBindArgs; return mAppBindArgs;
} }