Skip to content

Commit f4d23f3

Browse files
Christopher TateSuprabh Shukla
Christopher Tate
authored and
Suprabh Shukla
committed
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 2c61c57)
1 parent 2cd4383 commit f4d23f3

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

services/core/java/com/android/server/am/ActivityManagerService.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ private class Identity {
983983
* For example, references to the commonly used services.
984984
*/
985985
HashMap<String, IBinder> mAppBindArgs;
986+
HashMap<String, IBinder> mIsolatedAppBindArgs;
986987

987988
/**
988989
* Temporary to avoid allocations. Protected by main lock.
@@ -2586,18 +2587,24 @@ public void batterySendBroadcast(Intent intent) {
25862587
* lazily setup to make sure the services are running when they're asked for.
25872588
*/
25882589
private HashMap<String, IBinder> getCommonServicesLocked(boolean isolated) {
2590+
// Isolated processes won't get this optimization, so that we don't
2591+
// violate the rules about which services they have access to.
2592+
if (isolated) {
2593+
if (mIsolatedAppBindArgs == null) {
2594+
mIsolatedAppBindArgs = new HashMap<>();
2595+
mIsolatedAppBindArgs.put("package", ServiceManager.getService("package"));
2596+
}
2597+
return mIsolatedAppBindArgs;
2598+
}
2599+
25892600
if (mAppBindArgs == null) {
25902601
mAppBindArgs = new HashMap<>();
25912602

2592-
// Isolated processes won't get this optimization, so that we don't
2593-
// violate the rules about which services they have access to.
2594-
if (!isolated) {
2595-
// Setup the application init args
2596-
mAppBindArgs.put("package", ServiceManager.getService("package"));
2597-
mAppBindArgs.put("window", ServiceManager.getService("window"));
2598-
mAppBindArgs.put(Context.ALARM_SERVICE,
2599-
ServiceManager.getService(Context.ALARM_SERVICE));
2600-
}
2603+
// Setup the application init args
2604+
mAppBindArgs.put("package", ServiceManager.getService("package"));
2605+
mAppBindArgs.put("window", ServiceManager.getService("window"));
2606+
mAppBindArgs.put(Context.ALARM_SERVICE,
2607+
ServiceManager.getService(Context.ALARM_SERVICE));
26012608
}
26022609
return mAppBindArgs;
26032610
}

0 commit comments

Comments
 (0)