diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-10-31 12:26:15 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-31 12:26:15 +0000 |
commit | f82621dc3c62db55f8dce71e5d835cae1967bafb (patch) | |
tree | 4fd98e2237ee88fb7909d644af4c654443f6228e | |
parent | aa7cbf90ca53046bd923949bae99e199b8f284fe (diff) | |
parent | e02c88af7935c72fb90a478375e61e4a94465587 (diff) | |
download | frameworks_base-f82621dc3c62db55f8dce71e5d835cae1967bafb.zip frameworks_base-f82621dc3c62db55f8dce71e5d835cae1967bafb.tar.gz frameworks_base-f82621dc3c62db55f8dce71e5d835cae1967bafb.tar.bz2 |
am e02c88af: Work on process management.
* commit 'e02c88af7935c72fb90a478375e61e4a94465587':
Work on process management.
6 files changed, 102 insertions, 81 deletions
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index 7d683a5..b2909b3 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -416,7 +416,8 @@ public class SyncManager implements OnAccountsUpdateListener { intent.setComponent(syncAdapterInfo.componentName); if (!mContext.bindService(intent, new InitializerServiceConnection(account, authority, mContext, mMainHandler), - Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND)) { + Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND + | Context.BIND_ALLOW_OOM_MANAGEMENT)) { Log.w(TAG, "initializeSyncAdapter: failed to bind to " + intent); } } @@ -971,7 +972,8 @@ public class SyncManager implements OnAccountsUpdateListener { mContext, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0)); mBound = true; final boolean bindResult = mContext.bindService(intent, this, - Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND); + Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND + | Context.BIND_ALLOW_OOM_MANAGEMENT); if (!bindResult) { mBound = false; } diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 994201b..e97ee7a 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -2193,25 +2193,21 @@ public class PowerManagerService extends IPowerManager.Stub } public void run() { - if (mAnimateScreenLights) { - synchronized (mLocks) { + synchronized (mLocks) { + // we're turning off + final boolean turningOff = animating && targetValue == Power.BRIGHTNESS_OFF; + if (mAnimateScreenLights || !turningOff) { long now = SystemClock.uptimeMillis(); boolean more = mScreenBrightness.stepLocked(); if (more) { mScreenOffHandler.postAtTime(this, now+(1000/60)); } - } - } else { - synchronized (mLocks) { - // we're turning off - final boolean animate = animating && targetValue == Power.BRIGHTNESS_OFF; - if (animate) { - // It's pretty scary to hold mLocks for this long, and we should - // redesign this, but it works for now. - nativeStartSurfaceFlingerAnimation( - mScreenOffReason == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR - ? 0 : mAnimationSetting); - } + } else { + // It's pretty scary to hold mLocks for this long, and we should + // redesign this, but it works for now. + nativeStartSurfaceFlingerAnimation( + mScreenOffReason == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR + ? 0 : mAnimationSetting); mScreenBrightness.jumpToTargetLocked(); } } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 24f4779..04bbc11 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -721,6 +721,13 @@ public final class ActivityManagerService extends ActivityManagerNative int mLruSeq = 0; /** + * Keep track of the number of service processes we last found, to + * determine on the next iteration which should be B services. + */ + int mNumServiceProcs = 0; + int mNewNumServiceProcs = 0; + + /** * System monitoring: number of processes that died since the last * N procs were started. */ @@ -3123,7 +3130,7 @@ public final class ActivityManagerService extends ActivityManagerNative return; } killPackageProcessesLocked(packageName, pkgUid, - ProcessList.SECONDARY_SERVER_ADJ, false, true, true, false); + ProcessList.SERVICE_ADJ, false, true, true, false); } } finally { Binder.restoreCallingIdentity(callingId); @@ -4922,7 +4929,7 @@ public final class ActivityManagerService extends ActivityManagerNative outInfo.lowMemory = outInfo.availMem < (homeAppMem + ((hiddenAppMem-homeAppMem)/2)); outInfo.hiddenAppThreshold = hiddenAppMem; outInfo.secondaryServerThreshold = mProcessList.getMemLevel( - ProcessList.SECONDARY_SERVER_ADJ); + ProcessList.SERVICE_ADJ); outInfo.visibleAppThreshold = mProcessList.getMemLevel( ProcessList.VISIBLE_APP_ADJ); outInfo.foregroundAppThreshold = mProcessList.getMemLevel( @@ -6113,7 +6120,7 @@ public final class ActivityManagerService extends ActivityManagerNative if ((info.flags&(ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT)) == (ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT)) { app.persistent = true; - app.maxAdj = ProcessList.CORE_SERVER_ADJ; + app.maxAdj = ProcessList.PERSISTENT_PROC_ADJ; } if (app.thread == null && mPersistentStartingProcesses.indexOf(app) < 0) { mPersistentStartingProcesses.add(app); @@ -6511,14 +6518,15 @@ public final class ActivityManagerService extends ActivityManagerNative // If the worst oom_adj is somewhere in the hidden proc LRU range, // then constrain it so we will kill all hidden procs. - if (worstType < ProcessList.EMPTY_APP_ADJ && worstType > ProcessList.HIDDEN_APP_MIN_ADJ) { + if (worstType < ProcessList.HIDDEN_APP_MAX_ADJ + && worstType > ProcessList.HIDDEN_APP_MIN_ADJ) { worstType = ProcessList.HIDDEN_APP_MIN_ADJ; } // If this is not a secure call, don't let it kill processes that // are important. - if (!secure && worstType < ProcessList.SECONDARY_SERVER_ADJ) { - worstType = ProcessList.SECONDARY_SERVER_ADJ; + if (!secure && worstType < ProcessList.SERVICE_ADJ) { + worstType = ProcessList.SERVICE_ADJ; } Slog.w(TAG, "Killing processes " + reason + " at adjustment " + worstType); @@ -7657,19 +7665,19 @@ public final class ActivityManagerService extends ActivityManagerNative } static int oomAdjToImportance(int adj, ActivityManager.RunningAppProcessInfo currApp) { - if (adj >= ProcessList.EMPTY_APP_ADJ) { - return ActivityManager.RunningAppProcessInfo.IMPORTANCE_EMPTY; - } else if (adj >= ProcessList.HIDDEN_APP_MIN_ADJ) { + if (adj >= ProcessList.HIDDEN_APP_MIN_ADJ) { if (currApp != null) { currApp.lru = adj - ProcessList.HIDDEN_APP_MIN_ADJ + 1; } return ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND; + } else if (adj >= ProcessList.SERVICE_B_ADJ) { + return ActivityManager.RunningAppProcessInfo.IMPORTANCE_SERVICE; } else if (adj >= ProcessList.HOME_APP_ADJ) { if (currApp != null) { currApp.lru = 0; } return ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND; - } else if (adj >= ProcessList.SECONDARY_SERVER_ADJ) { + } else if (adj >= ProcessList.SERVICE_ADJ) { return ActivityManager.RunningAppProcessInfo.IMPORTANCE_SERVICE; } else if (adj >= ProcessList.HEAVY_WEIGHT_APP_ADJ) { return ActivityManager.RunningAppProcessInfo.IMPORTANCE_CANT_SAVE_STATE; @@ -8158,6 +8166,8 @@ public final class ActivityManagerService extends ActivityManagerNative pw.println(" mGoingToSleep=" + mMainStack.mGoingToSleep); pw.println(" mLaunchingActivity=" + mMainStack.mLaunchingActivity); pw.println(" mAdjSeq=" + mAdjSeq + " mLruSeq=" + mLruSeq); + pw.println(" mNumServiceProcs=" + mNumServiceProcs + + " mNewNumServiceProcs=" + mNewNumServiceProcs); } return true; @@ -8194,16 +8204,17 @@ public final class ActivityManagerService extends ActivityManagerNative needSep = true; pw.println(" OOM levels:"); pw.print(" SYSTEM_ADJ: "); pw.println(ProcessList.SYSTEM_ADJ); - pw.print(" CORE_SERVER_ADJ: "); pw.println(ProcessList.CORE_SERVER_ADJ); + pw.print(" PERSISTENT_PROC_ADJ: "); pw.println(ProcessList.PERSISTENT_PROC_ADJ); pw.print(" FOREGROUND_APP_ADJ: "); pw.println(ProcessList.FOREGROUND_APP_ADJ); pw.print(" VISIBLE_APP_ADJ: "); pw.println(ProcessList.VISIBLE_APP_ADJ); pw.print(" PERCEPTIBLE_APP_ADJ: "); pw.println(ProcessList.PERCEPTIBLE_APP_ADJ); pw.print(" HEAVY_WEIGHT_APP_ADJ: "); pw.println(ProcessList.HEAVY_WEIGHT_APP_ADJ); pw.print(" BACKUP_APP_ADJ: "); pw.println(ProcessList.BACKUP_APP_ADJ); - pw.print(" SECONDARY_SERVER_ADJ: "); pw.println(ProcessList.SECONDARY_SERVER_ADJ); + pw.print(" SERVICE_ADJ: "); pw.println(ProcessList.SERVICE_ADJ); pw.print(" HOME_APP_ADJ: "); pw.println(ProcessList.HOME_APP_ADJ); + pw.print(" SERVICE_B_ADJ: "); pw.println(ProcessList.SERVICE_B_ADJ); pw.print(" HIDDEN_APP_MIN_ADJ: "); pw.println(ProcessList.HIDDEN_APP_MIN_ADJ); - pw.print(" EMPTY_APP_ADJ: "); pw.println(ProcessList.EMPTY_APP_ADJ); + pw.print(" HIDDEN_APP_MAX_ADJ: "); pw.println(ProcessList.HIDDEN_APP_MAX_ADJ); if (needSep) pw.println(" "); needSep = true; @@ -8994,14 +9005,14 @@ public final class ActivityManagerService extends ActivityManagerNative for (int i=N; i>=0; i--) { ProcessRecord r = list.get(i).first; String oomAdj; - if (r.setAdj >= ProcessList.EMPTY_APP_ADJ) { - oomAdj = buildOomTag("empty", null, r.setAdj, ProcessList.EMPTY_APP_ADJ); - } else if (r.setAdj >= ProcessList.HIDDEN_APP_MIN_ADJ) { + if (r.setAdj >= ProcessList.HIDDEN_APP_MIN_ADJ) { oomAdj = buildOomTag("bak", " ", r.setAdj, ProcessList.HIDDEN_APP_MIN_ADJ); + } else if (r.setAdj >= ProcessList.SERVICE_B_ADJ) { + oomAdj = buildOomTag("svcb ", null, r.setAdj, ProcessList.SERVICE_B_ADJ); } else if (r.setAdj >= ProcessList.HOME_APP_ADJ) { oomAdj = buildOomTag("home ", null, r.setAdj, ProcessList.HOME_APP_ADJ); - } else if (r.setAdj >= ProcessList.SECONDARY_SERVER_ADJ) { - oomAdj = buildOomTag("svc", " ", r.setAdj, ProcessList.SECONDARY_SERVER_ADJ); + } else if (r.setAdj >= ProcessList.SERVICE_ADJ) { + oomAdj = buildOomTag("svc ", null, r.setAdj, ProcessList.SERVICE_ADJ); } else if (r.setAdj >= ProcessList.BACKUP_APP_ADJ) { oomAdj = buildOomTag("bckup", null, r.setAdj, ProcessList.BACKUP_APP_ADJ); } else if (r.setAdj >= ProcessList.HEAVY_WEIGHT_APP_ADJ) { @@ -9012,8 +9023,8 @@ public final class ActivityManagerService extends ActivityManagerNative oomAdj = buildOomTag("vis ", null, r.setAdj, ProcessList.VISIBLE_APP_ADJ); } else if (r.setAdj >= ProcessList.FOREGROUND_APP_ADJ) { oomAdj = buildOomTag("fore ", null, r.setAdj, ProcessList.FOREGROUND_APP_ADJ); - } else if (r.setAdj >= ProcessList.CORE_SERVER_ADJ) { - oomAdj = buildOomTag("core ", null, r.setAdj, ProcessList.CORE_SERVER_ADJ); + } else if (r.setAdj >= ProcessList.PERSISTENT_PROC_ADJ) { + oomAdj = buildOomTag("pers ", null, r.setAdj, ProcessList.PERSISTENT_PROC_ADJ); } else if (r.setAdj >= ProcessList.SYSTEM_ADJ) { oomAdj = buildOomTag("sys ", null, r.setAdj, ProcessList.SYSTEM_ADJ); } else { @@ -9273,14 +9284,15 @@ public final class ActivityManagerService extends ActivityManagerNative long[] miscPss = new long[Debug.MemoryInfo.NUM_OTHER_STATS]; final int[] oomAdj = new int[] { - ProcessList.SYSTEM_ADJ, ProcessList.CORE_SERVER_ADJ, ProcessList.FOREGROUND_APP_ADJ, + ProcessList.SYSTEM_ADJ, ProcessList.PERSISTENT_PROC_ADJ, ProcessList.FOREGROUND_APP_ADJ, ProcessList.VISIBLE_APP_ADJ, ProcessList.PERCEPTIBLE_APP_ADJ, ProcessList.HEAVY_WEIGHT_APP_ADJ, - ProcessList.BACKUP_APP_ADJ, ProcessList.SECONDARY_SERVER_ADJ, ProcessList.HOME_APP_ADJ, ProcessList.EMPTY_APP_ADJ + ProcessList.BACKUP_APP_ADJ, ProcessList.SERVICE_ADJ, ProcessList.HOME_APP_ADJ, + ProcessList.SERVICE_B_ADJ, ProcessList.HIDDEN_APP_MAX_ADJ }; final String[] oomLabel = new String[] { "System", "Persistent", "Foreground", "Visible", "Perceptible", "Heavy Weight", - "Backup", "Services", "Home", "Background" + "Backup", "A Services", "Home", "B Services", "Background" }; long oomPss[] = new long[oomLabel.length]; ArrayList<MemItem>[] oomProcs = (ArrayList<MemItem>[])new ArrayList[oomLabel.length]; @@ -12935,7 +12947,7 @@ public final class ActivityManagerService extends ActivityManagerNative // ========================================================= private final int computeOomAdjLocked(ProcessRecord app, int hiddenAdj, - ProcessRecord TOP_APP, boolean recursed) { + ProcessRecord TOP_APP, boolean recursed, boolean doingAll) { if (mAdjSeq == app.adjSeq) { // This adjustment has already been computed. If we are calling // from the top, we may have already computed our adjustment with @@ -12950,7 +12962,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (app.thread == null) { app.adjSeq = mAdjSeq; app.curSchedGroup = Process.THREAD_GROUP_BG_NONINTERACTIVE; - return (app.curAdj=ProcessList.EMPTY_APP_ADJ); + return (app.curAdj=ProcessList.HIDDEN_APP_MAX_ADJ); } app.adjTypeCode = ActivityManager.RunningAppProcessInfo.REASON_UNKNOWN; @@ -13134,7 +13146,7 @@ public final class ActivityManagerService extends ActivityManagerNative // go to the LRU list because it may be pretty heavy with // UI stuff. We'll tag it with a label just to help // debug and understand what is going on. - if (adj > ProcessList.SECONDARY_SERVER_ADJ) { + if (adj > ProcessList.SERVICE_ADJ) { app.adjType = "started-bg-ui-services"; } } else { @@ -13142,8 +13154,8 @@ public final class ActivityManagerService extends ActivityManagerNative // This service has seen some activity within // recent memory, so we will keep its process ahead // of the background processes. - if (adj > ProcessList.SECONDARY_SERVER_ADJ) { - adj = ProcessList.SECONDARY_SERVER_ADJ; + if (adj > ProcessList.SERVICE_ADJ) { + adj = ProcessList.SERVICE_ADJ; app.adjType = "started-services"; app.hidden = false; } @@ -13151,7 +13163,7 @@ public final class ActivityManagerService extends ActivityManagerNative // If we have let the service slide into the background // state, still have some text describing what it is doing // even though the service no longer has an impact. - if (adj > ProcessList.SECONDARY_SERVER_ADJ) { + if (adj > ProcessList.SERVICE_ADJ) { app.adjType = "started-bg-services"; } } @@ -13185,7 +13197,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } clientAdj = computeOomAdjLocked( - client, myHiddenAdj, TOP_APP, true); + client, myHiddenAdj, TOP_APP, true, doingAll); String adjType = null; if ((cr.flags&Context.BIND_ALLOW_OOM_MANAGEMENT) != 0) { // Not doing bind OOM management, so treat @@ -13315,7 +13327,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } int clientAdj = computeOomAdjLocked( - client, myHiddenAdj, TOP_APP, true); + client, myHiddenAdj, TOP_APP, true, doingAll); if (adj > clientAdj) { if (app.hasShownUi && app != mHomeProcess && clientAdj > ProcessList.PERCEPTIBLE_APP_ADJ) { @@ -13386,11 +13398,23 @@ public final class ActivityManagerService extends ActivityManagerNative adj = ProcessList.PERCEPTIBLE_APP_ADJ; } else if (adj < ProcessList.HIDDEN_APP_MIN_ADJ) { adj = ProcessList.HIDDEN_APP_MIN_ADJ; - } else if (adj < ProcessList.EMPTY_APP_ADJ) { + } else if (adj < ProcessList.HIDDEN_APP_MAX_ADJ) { adj++; } } + if (adj == ProcessList.SERVICE_ADJ) { + if (doingAll) { + app.serviceb = mNewNumServiceProcs > (mNumServiceProcs/3); + mNewNumServiceProcs++; + } + if (app.serviceb) { + adj = ProcessList.SERVICE_B_ADJ; + } + } else { + app.serviceb = false; + } + app.curAdj = adj; app.curSchedGroup = schedGroup; @@ -13631,7 +13655,7 @@ public final class ActivityManagerService extends ActivityManagerNative } private final boolean updateOomAdjLocked( - ProcessRecord app, int hiddenAdj, ProcessRecord TOP_APP) { + ProcessRecord app, int hiddenAdj, ProcessRecord TOP_APP, boolean doingAll) { app.hiddenAdj = hiddenAdj; if (app.thread == null) { @@ -13642,7 +13666,7 @@ public final class ActivityManagerService extends ActivityManagerNative boolean success = true; - computeOomAdjLocked(app, hiddenAdj, TOP_APP, false); + computeOomAdjLocked(app, hiddenAdj, TOP_APP, false, doingAll); if (app.curRawAdj != app.setRawAdj) { if (false) { @@ -13676,11 +13700,12 @@ public final class ActivityManagerService extends ActivityManagerNative app.setRawAdj = app.curRawAdj; } + if (app.curAdj != app.setAdj) { if (Process.setOomAdj(app.pid, app.curAdj)) { - if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v( - TAG, "Set app " + app.processName + - " oom adj to " + app.curAdj + " because " + app.adjType); + if (true || DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v( + TAG, "Set " + app.pid + " " + app.processName + + " adj " + app.curAdj + ": " + app.adjType); app.setAdj = app.curAdj; } else { success = false; @@ -13744,7 +13769,7 @@ public final class ActivityManagerService extends ActivityManagerNative mAdjSeq++; - boolean success = updateOomAdjLocked(app, app.hiddenAdj, TOP_APP); + boolean success = updateOomAdjLocked(app, app.hiddenAdj, TOP_APP, false); final boolean nowHidden = app.curAdj >= ProcessList.HIDDEN_APP_MIN_ADJ && app.curAdj <= ProcessList.HIDDEN_APP_MAX_ADJ; if (nowHidden != wasHidden) { @@ -13766,6 +13791,7 @@ public final class ActivityManagerService extends ActivityManagerNative } mAdjSeq++; + mNewNumServiceProcs = 0; // Let's determine how many processes we have running vs. // how many slots we have for background processes; we may want @@ -13786,8 +13812,8 @@ public final class ActivityManagerService extends ActivityManagerNative i--; ProcessRecord app = mLruProcesses.get(i); //Slog.i(TAG, "OOM " + app + ": cur hidden=" + curHiddenAdj); - updateOomAdjLocked(app, curHiddenAdj, TOP_APP); - if (curHiddenAdj < ProcessList.EMPTY_APP_ADJ + updateOomAdjLocked(app, curHiddenAdj, TOP_APP, true); + if (curHiddenAdj < ProcessList.HIDDEN_APP_MAX_ADJ && app.curAdj == curHiddenAdj) { step++; if (step >= factor) { @@ -13814,6 +13840,8 @@ public final class ActivityManagerService extends ActivityManagerNative } } + mNumServiceProcs = mNewNumServiceProcs; + // Now determine the memory trimming level of background processes. // Unfortunately we need to start at the back of the list to do this // properly. We only do this if the number of background apps we diff --git a/services/java/com/android/server/am/ProcessList.java b/services/java/com/android/server/am/ProcessList.java index 131255f..f368a70 100644 --- a/services/java/com/android/server/am/ProcessList.java +++ b/services/java/com/android/server/am/ProcessList.java @@ -16,7 +16,6 @@ package com.android.server.am; -import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -24,7 +23,6 @@ import com.android.internal.util.MemInfoReader; import com.android.server.wm.WindowManagerService; import android.graphics.Point; -import android.os.StrictMode; import android.util.Slog; /** @@ -37,27 +35,23 @@ class ProcessList { // OOM adjustments for processes in various states: - // This is a process without anything currently running in it. Definitely - // the first to go! Value set in system/rootdir/init.rc on startup. - // This value is initalized in the constructor, careful when refering to - // this static variable externally. - static final int EMPTY_APP_ADJ = 15; - // This is a process only hosting activities that are not visible, - // so it can be killed without any disruption. Value set in - // system/rootdir/init.rc on startup. + // so it can be killed without any disruption. static final int HIDDEN_APP_MAX_ADJ = 15; - static int HIDDEN_APP_MIN_ADJ = 7; + static int HIDDEN_APP_MIN_ADJ = 8; + + // The B list of SERVICE_ADJ -- these are the old and decrepit + // services that aren't as shiny and interesting as the ones in the A list. + static final int SERVICE_B_ADJ = 7; // This is a process holding the home application -- we want to try // avoiding killing it, even if it would normally be in the background, // because the user interacts with it so much. static final int HOME_APP_ADJ = 6; - // This is a process holding a secondary server -- killing it will not - // have much of an impact as far as the user is concerned. Value set in - // system/rootdir/init.rc on startup. - static final int SECONDARY_SERVER_ADJ = 5; + // This is a process holding an application service -- killing it will not + // have much of an impact as far as the user is concerned. + static final int SERVICE_ADJ = 5; // This is a process currently hosting a backup operation. Killing it // is not entirely fatal but is generally a bad idea. @@ -70,22 +64,20 @@ class ProcessList { // This is a process only hosting components that are perceptible to the // user, and we really want to avoid killing them, but they are not - // immediately visible. An example is background music playback. Value set in - // system/rootdir/init.rc on startup. + // immediately visible. An example is background music playback. static final int PERCEPTIBLE_APP_ADJ = 2; // This is a process only hosting activities that are visible to the - // user, so we'd prefer they don't disappear. Value set in - // system/rootdir/init.rc on startup. + // user, so we'd prefer they don't disappear. static final int VISIBLE_APP_ADJ = 1; // This is the process running the current foreground app. We'd really - // rather not kill it! Value set in system/rootdir/init.rc on startup. + // rather not kill it! static final int FOREGROUND_APP_ADJ = 0; - // This is a process running a core server, such as telephony. Definitely + // This is a system persistent process, such as telephony. Definitely // don't want to kill it, but doing so is not completely fatal. - static final int CORE_SERVER_ADJ = -12; + static final int PERSISTENT_PROC_ADJ = -12; // The system process runs at the default adjustment. static final int SYSTEM_ADJ = -16; @@ -115,7 +107,7 @@ class ProcessList { // can't give it a different value for every possible kind of process. private final int[] mOomAdj = new int[] { FOREGROUND_APP_ADJ, VISIBLE_APP_ADJ, PERCEPTIBLE_APP_ADJ, - BACKUP_APP_ADJ, HIDDEN_APP_MIN_ADJ, EMPTY_APP_ADJ + BACKUP_APP_ADJ, HIDDEN_APP_MIN_ADJ, HIDDEN_APP_MAX_ADJ }; // These are the low-end OOM level limits. This is appropriate for an // HVGA or smaller phone with less than 512MB. Values are in KB. diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java index 9392bb4..72292be 100644 --- a/services/java/com/android/server/am/ProcessRecord.java +++ b/services/java/com/android/server/am/ProcessRecord.java @@ -63,6 +63,7 @@ class ProcessRecord { int curSchedGroup; // Currently desired scheduling class int setSchedGroup; // Last set to background scheduling class int trimMemoryLevel; // Last selected memory trimming level + boolean serviceb; // Process currently is on the service B list boolean keeping; // Actively running code so don't kill due to that? boolean setIsForeground; // Running foreground UI when last set? boolean foregroundServices; // Running any services that are foreground? @@ -179,6 +180,7 @@ class ProcessRecord { pw.print(prefix); pw.print("lastActivityTime="); TimeUtils.formatDuration(lastActivityTime, now, pw); pw.print(" lruWeight="); pw.print(lruWeight); + pw.print(" serviceb="); pw.print(serviceb); pw.print(" keeping="); pw.print(keeping); pw.print(" hidden="); pw.print(hidden); pw.print(" empty="); pw.println(empty); @@ -271,7 +273,7 @@ class ProcessRecord { processName = _processName; pkgList.add(_info.packageName); thread = _thread; - maxAdj = ProcessList.EMPTY_APP_ADJ; + maxAdj = ProcessList.HIDDEN_APP_MAX_ADJ; hiddenAdj = ProcessList.HIDDEN_APP_MIN_ADJ; curRawAdj = setRawAdj = -100; curAdj = setAdj = -100; diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index f442003..23ec2d9 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -612,7 +612,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { if (mSurface == null) { mReportDestroySurface = false; mSurfacePendingDestroy = false; - Slog.i(WindowManagerService.TAG, "createSurface " + this + ": DRAW NOW PENDING"); + if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(WindowManagerService.TAG, + "createSurface " + this + ": DRAW NOW PENDING"); mDrawPending = true; mCommitDrawPending = false; mReadyToShow = false; |