diff options
author | Christopher Tate <ctate@google.com> | 2015-05-08 22:46:13 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-08 22:46:13 +0000 |
commit | f2f37781701407acfc64098370b6db1ee70613a2 (patch) | |
tree | e2d2120b13e46f977e3aa91e819a6630686c9ff0 /services | |
parent | b2fa5f3160cfc9b1703c6970649a926370971ea9 (diff) | |
parent | e83342540b2b7dc7571c12768007697685a6add5 (diff) | |
download | frameworks_base-f2f37781701407acfc64098370b6db1ee70613a2.zip frameworks_base-f2f37781701407acfc64098370b6db1ee70613a2.tar.gz frameworks_base-f2f37781701407acfc64098370b6db1ee70613a2.tar.bz2 |
am e8334254: am 4f35e169: am 4475e7df: am ea2c4033: Mark persistent apps as such when the ProcessRecord is created
* commit 'e83342540b2b7dc7571c12768007697685a6add5':
Mark persistent apps as such when the ProcessRecord is created
Diffstat (limited to 'services')
-rw-r--r-- | 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 f25f588..ab7fba5 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -375,6 +375,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; @@ -9843,10 +9847,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 @@ -9870,7 +9874,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, @@ -9902,8 +9912,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; } |