frameworks/base
修訂 | 54bd7b85b2e3c8c43e9d710d4b592921c96c3846 (tree) |
---|---|
時間 | 2016-12-13 04:56:48 |
作者 | Christopher Tate <ctate@goog...> |
Commiter | Jessica Wagantall |
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.
CYNGNOS-3312
Bug 30202228
Change-Id: I3810649f504cd631665ece338a83d2e54d41ad05
(cherry picked from commit 2c61c57ac53cbb270b4e76b9d04465f8a3f6eadc)
(cherry picked from commit f4d23f30c92bc80808f57677caab0282c8d28dc6)
(cherry picked from commit 9357830a380c8174ce5130941a7a53915d680819)
@@ -1030,6 +1030,7 @@ public final class ActivityManagerService extends ActivityManagerNative | ||
1030 | 1030 | * For example, references to the commonly used services. |
1031 | 1031 | */ |
1032 | 1032 | HashMap<String, IBinder> mAppBindArgs; |
1033 | + HashMap<String, IBinder> mIsolatedAppBindArgs; | |
1033 | 1034 | |
1034 | 1035 | /** |
1035 | 1036 | * Temporary to avoid allocations. Protected by main lock. |
@@ -2831,18 +2832,24 @@ public final class ActivityManagerService extends ActivityManagerNative | ||
2831 | 2832 | * lazily setup to make sure the services are running when they're asked for. |
2832 | 2833 | */ |
2833 | 2834 | private HashMap<String, IBinder> getCommonServicesLocked(boolean isolated) { |
2835 | + // Isolated processes won't get this optimization, so that we don't | |
2836 | + // violate the rules about which services they have access to. | |
2837 | + if (isolated) { | |
2838 | + if (mIsolatedAppBindArgs == null) { | |
2839 | + mIsolatedAppBindArgs = new HashMap<>(); | |
2840 | + mIsolatedAppBindArgs.put("package", ServiceManager.getService("package")); | |
2841 | + } | |
2842 | + return mIsolatedAppBindArgs; | |
2843 | + } | |
2844 | + | |
2834 | 2845 | if (mAppBindArgs == null) { |
2835 | 2846 | mAppBindArgs = new HashMap<>(); |
2836 | 2847 | |
2837 | - // Isolated processes won't get this optimization, so that we don't | |
2838 | - // violate the rules about which services they have access to. | |
2839 | - if (!isolated) { | |
2840 | - // Setup the application init args | |
2841 | - mAppBindArgs.put("package", ServiceManager.getService("package")); | |
2842 | - mAppBindArgs.put("window", ServiceManager.getService("window")); | |
2843 | - mAppBindArgs.put(Context.ALARM_SERVICE, | |
2844 | - ServiceManager.getService(Context.ALARM_SERVICE)); | |
2845 | - } | |
2848 | + // Setup the application init args | |
2849 | + mAppBindArgs.put("package", ServiceManager.getService("package")); | |
2850 | + mAppBindArgs.put("window", ServiceManager.getService("window")); | |
2851 | + mAppBindArgs.put(Context.ALARM_SERVICE, | |
2852 | + ServiceManager.getService(Context.ALARM_SERVICE)); | |
2846 | 2853 | } |
2847 | 2854 | return mAppBindArgs; |
2848 | 2855 | } |