frameworks/base
Revision | 37648d47981bf9a52738dbe534982e0bdfd98eff (tree) |
---|---|
Time | 2016-11-04 05:59:58 |
Author | Christopher Tate <ctate@goog...> |
Commiter | gitbuildkicker |
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 2c61c57ac53cbb270b4e76b9d04465f8a3f6eadc)
(cherry picked from commit f4d23f30c92bc80808f57677caab0282c8d28dc6)
@@ -1001,6 +1001,7 @@ public final class ActivityManagerService extends ActivityManagerNative | ||
1001 | 1001 | * For example, references to the commonly used services. |
1002 | 1002 | */ |
1003 | 1003 | HashMap<String, IBinder> mAppBindArgs; |
1004 | + HashMap<String, IBinder> mIsolatedAppBindArgs; | |
1004 | 1005 | |
1005 | 1006 | /** |
1006 | 1007 | * Temporary to avoid allocations. Protected by main lock. |
@@ -2626,18 +2627,24 @@ public final class ActivityManagerService extends ActivityManagerNative | ||
2626 | 2627 | * lazily setup to make sure the services are running when they're asked for. |
2627 | 2628 | */ |
2628 | 2629 | private HashMap<String, IBinder> getCommonServicesLocked(boolean isolated) { |
2630 | + // Isolated processes won't get this optimization, so that we don't | |
2631 | + // violate the rules about which services they have access to. | |
2632 | + if (isolated) { | |
2633 | + if (mIsolatedAppBindArgs == null) { | |
2634 | + mIsolatedAppBindArgs = new HashMap<>(); | |
2635 | + mIsolatedAppBindArgs.put("package", ServiceManager.getService("package")); | |
2636 | + } | |
2637 | + return mIsolatedAppBindArgs; | |
2638 | + } | |
2639 | + | |
2629 | 2640 | if (mAppBindArgs == null) { |
2630 | 2641 | mAppBindArgs = new HashMap<>(); |
2631 | 2642 | |
2632 | - // Isolated processes won't get this optimization, so that we don't | |
2633 | - // violate the rules about which services they have access to. | |
2634 | - if (!isolated) { | |
2635 | - // Setup the application init args | |
2636 | - mAppBindArgs.put("package", ServiceManager.getService("package")); | |
2637 | - mAppBindArgs.put("window", ServiceManager.getService("window")); | |
2638 | - mAppBindArgs.put(Context.ALARM_SERVICE, | |
2639 | - ServiceManager.getService(Context.ALARM_SERVICE)); | |
2640 | - } | |
2643 | + // Setup the application init args | |
2644 | + mAppBindArgs.put("package", ServiceManager.getService("package")); | |
2645 | + mAppBindArgs.put("window", ServiceManager.getService("window")); | |
2646 | + mAppBindArgs.put(Context.ALARM_SERVICE, | |
2647 | + ServiceManager.getService(Context.ALARM_SERVICE)); | |
2641 | 2648 | } |
2642 | 2649 | return mAppBindArgs; |
2643 | 2650 | } |