diff options
author | Christopher Tate <ctate@google.com> | 2015-05-08 22:14:53 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-08 22:14:53 +0000 |
commit | 4f35e1699a4b62bd71bed27fece85e2c026210d1 (patch) | |
tree | 2fbe617af26b7466ed46ddb01c795f49eb903102 /services | |
parent | 504bb9e7709cd51500b68f4220fffb61e11a5e1b (diff) | |
parent | 4475e7dfa12e684df64c59a9053c110d79d83c1f (diff) | |
download | frameworks_base-4f35e1699a4b62bd71bed27fece85e2c026210d1.zip frameworks_base-4f35e1699a4b62bd71bed27fece85e2c026210d1.tar.gz frameworks_base-4f35e1699a4b62bd71bed27fece85e2c026210d1.tar.bz2 |
am 4475e7df: am ea2c4033: Mark persistent apps as such when the ProcessRecord is created
* commit '4475e7dfa12e684df64c59a9053c110d79d83c1f':
Mark persistent apps as such when the ProcessRecord is created
Diffstat (limited to 'services')
-rwxr-xr-x | services/core/java/com/android/server/am/ActivityManagerService.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 2ab447a..213e436 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -376,6 +376,10 @@ public final class ActivityManagerService extends ActivityManagerNative // Delay in notifying task stack change listeners (in millis) static final int NOTIFY_TASK_STACK_CHANGE_LISTENERS_DELAY = 1000; + // Necessary ApplicationInfo flags to mark an app as persistent + private static final int PERSISTENT_MASK = + ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT; + /** All system services */ SystemServiceManager mSystemServiceManager; @@ -9871,10 +9875,10 @@ public final class ActivityManagerService extends ActivityManagerNative String proc = customProcess != null ? customProcess : info.processName; BatteryStatsImpl.Uid.Proc ps = null; BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics(); + final int userId = UserHandle.getUserId(info.uid); int uid = info.uid; if (isolated) { if (isolatedUid == 0) { - int userId = UserHandle.getUserId(uid); int stepsLeft = Process.LAST_ISOLATED_UID - Process.FIRST_ISOLATED_UID + 1; while (true) { if (mNextIsolatedProcessUid < Process.FIRST_ISOLATED_UID @@ -9898,7 +9902,13 @@ public final class ActivityManagerService extends ActivityManagerNative uid = isolatedUid; } } - return new ProcessRecord(stats, info, proc, uid); + final ProcessRecord r = new ProcessRecord(stats, info, proc, uid); + if (!mBooted && !mBooting + && userId == UserHandle.USER_OWNER + && (info.flags & PERSISTENT_MASK) == PERSISTENT_MASK) { + r.persistent = true; + } + return r; } final ProcessRecord addAppLocked(ApplicationInfo info, boolean isolated, @@ -9930,8 +9940,7 @@ public final class ActivityManagerService extends ActivityManagerNative + info.packageName + ": " + e); } - if ((info.flags&(ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT)) - == (ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT)) { + if ((info.flags & PERSISTENT_MASK) == PERSISTENT_MASK) { app.persistent = true; app.maxAdj = ProcessList.PERSISTENT_PROC_ADJ; } |