Loading core/java/android/app/ActivityManager.java +16 −13 Original line number Diff line number Diff line Loading @@ -279,51 +279,54 @@ public class ActivityManager { * all activities that are visible to the user. */ public static final int PROCESS_STATE_TOP = 2; /** @hide Process is hosting a foreground service due to a system binding. */ public static final int PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 3; /** @hide Process is hosting a foreground service. */ public static final int PROCESS_STATE_FOREGROUND_SERVICE = 3; public static final int PROCESS_STATE_FOREGROUND_SERVICE = 4; /** @hide Same as {@link #PROCESS_STATE_TOP} but while device is sleeping. */ public static final int PROCESS_STATE_TOP_SLEEPING = 4; public static final int PROCESS_STATE_TOP_SLEEPING = 5; /** @hide Process is important to the user, and something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_FOREGROUND = 5; public static final int PROCESS_STATE_IMPORTANT_FOREGROUND = 6; /** @hide Process is important to the user, but not something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 6; public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 7; /** @hide Process is in the background running a backup/restore operation. */ public static final int PROCESS_STATE_BACKUP = 7; public static final int PROCESS_STATE_BACKUP = 8; /** @hide Process is in the background, but it can't restore its state so we want * to try to avoid killing it. */ public static final int PROCESS_STATE_HEAVY_WEIGHT = 8; public static final int PROCESS_STATE_HEAVY_WEIGHT = 9; /** @hide Process is in the background running a service. Unlike oom_adj, this level * is used for both the normal running in background state and the executing * operations state. */ public static final int PROCESS_STATE_SERVICE = 9; public static final int PROCESS_STATE_SERVICE = 10; /** @hide Process is in the background running a receiver. Note that from the * perspective of oom_adj receivers run at a higher foreground level, but for our * prioritization here that is not necessary and putting them below services means * many fewer changes in some process states as they receive broadcasts. */ public static final int PROCESS_STATE_RECEIVER = 10; public static final int PROCESS_STATE_RECEIVER = 11; /** @hide Process is in the background but hosts the home activity. */ public static final int PROCESS_STATE_HOME = 11; public static final int PROCESS_STATE_HOME = 12; /** @hide Process is in the background but hosts the last shown activity. */ public static final int PROCESS_STATE_LAST_ACTIVITY = 12; public static final int PROCESS_STATE_LAST_ACTIVITY = 13; /** @hide Process is being cached for later use and contains activities. */ public static final int PROCESS_STATE_CACHED_ACTIVITY = 13; public static final int PROCESS_STATE_CACHED_ACTIVITY = 14; /** @hide Process is being cached for later use and is a client of another cached * process that contains activities. */ public static final int PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 14; public static final int PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 15; /** @hide Process is being cached for later use and is empty. */ public static final int PROCESS_STATE_CACHED_EMPTY = 15; public static final int PROCESS_STATE_CACHED_EMPTY = 16; /** @hide requestType for assist context: only basic information. */ public static final int ASSIST_CONTEXT_BASIC = 0; Loading core/java/com/android/internal/app/ProcessStats.java +1 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ public final class ProcessStats implements Parcelable { STATE_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT STATE_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI STATE_TOP, // ActivityManager.PROCESS_STATE_TOP STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE STATE_TOP, // ActivityManager.PROCESS_STATE_TOP_SLEEPING STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading services/core/java/com/android/server/am/ActivityManagerService.java +37 −9 Original line number Diff line number Diff line Loading @@ -355,6 +355,10 @@ public final class ActivityManagerService extends ActivityManagerNative // giving up on them and unfreezing the screen. static final int USER_SWITCH_TIMEOUT = 2*1000; // This is the amount of time an app needs to be running a foreground service before // we will consider it to be doing interaction for usage stats. static final int SERVICE_USAGE_INTERACTION_TIME = 30*60*1000; // Maximum number of users we allow to be running at a time. static final int MAX_RUNNING_USERS = 3; Loading Loading @@ -17752,13 +17756,13 @@ public final class ActivityManagerService extends ActivityManagerNative // give them the best state after that. if ((cr.flags&Context.BIND_FOREGROUND_SERVICE) != 0) { clientProcState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; } else if (mWakefulness == PowerManagerInternal.WAKEFULNESS_AWAKE && (cr.flags&Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE) != 0) { clientProcState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; } else { clientProcState = ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; Loading Loading @@ -17872,7 +17876,7 @@ public final class ActivityManagerService extends ActivityManagerNative // into the top state, since they are not on top. Instead // give them the best state after that. clientProcState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; } } if (procState > clientProcState) { Loading Loading @@ -17912,7 +17916,7 @@ public final class ActivityManagerService extends ActivityManagerNative case ActivityManager.PROCESS_STATE_SERVICE: // These all are longer-term states, so pull them up to the top // of the background states, but not all the way to the top state. procState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; procState = ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; break; default: // Otherwise, top is a better choice, so take it. Loading Loading @@ -18482,7 +18486,7 @@ public final class ActivityManagerService extends ActivityManagerNative } // Inform UsageStats of important process state change // Must be called before updating setProcState maybeUpdateUsageStats(app); maybeUpdateUsageStatsLocked(app); app.setProcState = app.curProcState; if (app.setProcState >= ActivityManager.PROCESS_STATE_HOME) { Loading Loading @@ -18571,7 +18575,7 @@ public final class ActivityManagerService extends ActivityManagerNative uidRec.pendingChange.processState = uidRec.setProcState; } private void maybeUpdateUsageStats(ProcessRecord app) { private void maybeUpdateUsageStatsLocked(ProcessRecord app) { if (DEBUG_USAGE_STATS) { Slog.d(TAG, "Checking proc [" + Arrays.toString(app.getPackageList()) + "] state changes: old = " + app.setProcState + ", new = " Loading @@ -18580,9 +18584,32 @@ public final class ActivityManagerService extends ActivityManagerNative if (mUsageStatsService == null) { return; } if (app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND && (app.setProcState > ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND || app.setProcState < 0)) { boolean isInteraction; if (!mSleeping) { isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } else { // If the display is off, we are going to be more restrictive about what we consider // to be an app interaction. Being the top activity doesn't count, nor do generally // foreground services. if (app.curProcState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) { isInteraction = true; app.fgInteractionTime = 0; } else if (app.curProcState <= ActivityManager.PROCESS_STATE_TOP_SLEEPING) { final long now = SystemClock.elapsedRealtime(); if (app.fgInteractionTime == 0) { app.fgInteractionTime = now; isInteraction = false; } else { isInteraction = now > app.fgInteractionTime + SERVICE_USAGE_INTERACTION_TIME; } } else { isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } } if (isInteraction && !app.reportedInteraction) { String[] packages = app.getPackageList(); if (packages != null) { for (int i = 0; i < packages.length; i++) { Loading @@ -18591,6 +18618,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } } app.reportedInteraction = isInteraction; } private final void setProcessTrackerStateLocked(ProcessRecord proc, int memFactor, long now) { services/core/java/com/android/server/am/ProcessList.java +9 −1 Original line number Diff line number Diff line Loading @@ -368,8 +368,11 @@ final class ProcessList { case ActivityManager.PROCESS_STATE_TOP: procState = "T "; break; case ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE: procState = "SB"; break; case ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE: procState = "FS"; procState = "SF"; break; case ActivityManager.PROCESS_STATE_TOP_SLEEPING: procState = "TS"; Loading Loading @@ -481,6 +484,7 @@ final class ProcessList { PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PROC_MEM_TOP, // ActivityManager.PROCESS_STATE_TOP PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PROC_MEM_TOP, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -500,6 +504,7 @@ final class ProcessList { PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -519,6 +524,7 @@ final class ProcessList { PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -538,6 +544,7 @@ final class ProcessList { PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_TEST_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -557,6 +564,7 @@ final class ProcessList { PSS_TEST_SAME_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_TEST_SAME_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading services/core/java/com/android/server/am/ProcessRecord.java +11 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,8 @@ final class ProcessRecord { boolean killedByAm; // True when proc has been killed by activity manager, not for RAM boolean killed; // True once we know the process has been killed boolean procStateChanged; // Keep track of whether we changed 'setAdj'. boolean reportedInteraction;// Whether we have told usage stats about it being an interaction long fgInteractionTime; // When we became foreground for interaction purposes String waitingToKill; // Process is waiting to be killed when in the bg, and reason IBinder forcingToForeground;// Token that is forcing this process to be foreground int adjSeq; // Sequence id for identifying oom_adj assignment cycles Loading Loading @@ -291,6 +293,15 @@ final class ProcessRecord { pw.print(" foregroundServices="); pw.print(foregroundServices); pw.print(" forcingToForeground="); pw.println(forcingToForeground); } if (reportedInteraction || fgInteractionTime != 0) { pw.print(prefix); pw.print("reportedInteraction="); pw.print(reportedInteraction); if (fgInteractionTime != 0) { pw.print(" fgInteractionTime="); TimeUtils.formatDuration(fgInteractionTime, SystemClock.elapsedRealtime(), pw); } pw.println(); } if (persistent || removed) { pw.print(prefix); pw.print("persistent="); pw.print(persistent); pw.print(" removed="); pw.println(removed); Loading Loading
core/java/android/app/ActivityManager.java +16 −13 Original line number Diff line number Diff line Loading @@ -279,51 +279,54 @@ public class ActivityManager { * all activities that are visible to the user. */ public static final int PROCESS_STATE_TOP = 2; /** @hide Process is hosting a foreground service due to a system binding. */ public static final int PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 3; /** @hide Process is hosting a foreground service. */ public static final int PROCESS_STATE_FOREGROUND_SERVICE = 3; public static final int PROCESS_STATE_FOREGROUND_SERVICE = 4; /** @hide Same as {@link #PROCESS_STATE_TOP} but while device is sleeping. */ public static final int PROCESS_STATE_TOP_SLEEPING = 4; public static final int PROCESS_STATE_TOP_SLEEPING = 5; /** @hide Process is important to the user, and something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_FOREGROUND = 5; public static final int PROCESS_STATE_IMPORTANT_FOREGROUND = 6; /** @hide Process is important to the user, but not something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 6; public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 7; /** @hide Process is in the background running a backup/restore operation. */ public static final int PROCESS_STATE_BACKUP = 7; public static final int PROCESS_STATE_BACKUP = 8; /** @hide Process is in the background, but it can't restore its state so we want * to try to avoid killing it. */ public static final int PROCESS_STATE_HEAVY_WEIGHT = 8; public static final int PROCESS_STATE_HEAVY_WEIGHT = 9; /** @hide Process is in the background running a service. Unlike oom_adj, this level * is used for both the normal running in background state and the executing * operations state. */ public static final int PROCESS_STATE_SERVICE = 9; public static final int PROCESS_STATE_SERVICE = 10; /** @hide Process is in the background running a receiver. Note that from the * perspective of oom_adj receivers run at a higher foreground level, but for our * prioritization here that is not necessary and putting them below services means * many fewer changes in some process states as they receive broadcasts. */ public static final int PROCESS_STATE_RECEIVER = 10; public static final int PROCESS_STATE_RECEIVER = 11; /** @hide Process is in the background but hosts the home activity. */ public static final int PROCESS_STATE_HOME = 11; public static final int PROCESS_STATE_HOME = 12; /** @hide Process is in the background but hosts the last shown activity. */ public static final int PROCESS_STATE_LAST_ACTIVITY = 12; public static final int PROCESS_STATE_LAST_ACTIVITY = 13; /** @hide Process is being cached for later use and contains activities. */ public static final int PROCESS_STATE_CACHED_ACTIVITY = 13; public static final int PROCESS_STATE_CACHED_ACTIVITY = 14; /** @hide Process is being cached for later use and is a client of another cached * process that contains activities. */ public static final int PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 14; public static final int PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 15; /** @hide Process is being cached for later use and is empty. */ public static final int PROCESS_STATE_CACHED_EMPTY = 15; public static final int PROCESS_STATE_CACHED_EMPTY = 16; /** @hide requestType for assist context: only basic information. */ public static final int ASSIST_CONTEXT_BASIC = 0; Loading
core/java/com/android/internal/app/ProcessStats.java +1 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ public final class ProcessStats implements Parcelable { STATE_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT STATE_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI STATE_TOP, // ActivityManager.PROCESS_STATE_TOP STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE STATE_TOP, // ActivityManager.PROCESS_STATE_TOP_SLEEPING STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading
services/core/java/com/android/server/am/ActivityManagerService.java +37 −9 Original line number Diff line number Diff line Loading @@ -355,6 +355,10 @@ public final class ActivityManagerService extends ActivityManagerNative // giving up on them and unfreezing the screen. static final int USER_SWITCH_TIMEOUT = 2*1000; // This is the amount of time an app needs to be running a foreground service before // we will consider it to be doing interaction for usage stats. static final int SERVICE_USAGE_INTERACTION_TIME = 30*60*1000; // Maximum number of users we allow to be running at a time. static final int MAX_RUNNING_USERS = 3; Loading Loading @@ -17752,13 +17756,13 @@ public final class ActivityManagerService extends ActivityManagerNative // give them the best state after that. if ((cr.flags&Context.BIND_FOREGROUND_SERVICE) != 0) { clientProcState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; } else if (mWakefulness == PowerManagerInternal.WAKEFULNESS_AWAKE && (cr.flags&Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE) != 0) { clientProcState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; } else { clientProcState = ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; Loading Loading @@ -17872,7 +17876,7 @@ public final class ActivityManagerService extends ActivityManagerNative // into the top state, since they are not on top. Instead // give them the best state after that. clientProcState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; } } if (procState > clientProcState) { Loading Loading @@ -17912,7 +17916,7 @@ public final class ActivityManagerService extends ActivityManagerNative case ActivityManager.PROCESS_STATE_SERVICE: // These all are longer-term states, so pull them up to the top // of the background states, but not all the way to the top state. procState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE; procState = ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE; break; default: // Otherwise, top is a better choice, so take it. Loading Loading @@ -18482,7 +18486,7 @@ public final class ActivityManagerService extends ActivityManagerNative } // Inform UsageStats of important process state change // Must be called before updating setProcState maybeUpdateUsageStats(app); maybeUpdateUsageStatsLocked(app); app.setProcState = app.curProcState; if (app.setProcState >= ActivityManager.PROCESS_STATE_HOME) { Loading Loading @@ -18571,7 +18575,7 @@ public final class ActivityManagerService extends ActivityManagerNative uidRec.pendingChange.processState = uidRec.setProcState; } private void maybeUpdateUsageStats(ProcessRecord app) { private void maybeUpdateUsageStatsLocked(ProcessRecord app) { if (DEBUG_USAGE_STATS) { Slog.d(TAG, "Checking proc [" + Arrays.toString(app.getPackageList()) + "] state changes: old = " + app.setProcState + ", new = " Loading @@ -18580,9 +18584,32 @@ public final class ActivityManagerService extends ActivityManagerNative if (mUsageStatsService == null) { return; } if (app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND && (app.setProcState > ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND || app.setProcState < 0)) { boolean isInteraction; if (!mSleeping) { isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } else { // If the display is off, we are going to be more restrictive about what we consider // to be an app interaction. Being the top activity doesn't count, nor do generally // foreground services. if (app.curProcState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) { isInteraction = true; app.fgInteractionTime = 0; } else if (app.curProcState <= ActivityManager.PROCESS_STATE_TOP_SLEEPING) { final long now = SystemClock.elapsedRealtime(); if (app.fgInteractionTime == 0) { app.fgInteractionTime = now; isInteraction = false; } else { isInteraction = now > app.fgInteractionTime + SERVICE_USAGE_INTERACTION_TIME; } } else { isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } } if (isInteraction && !app.reportedInteraction) { String[] packages = app.getPackageList(); if (packages != null) { for (int i = 0; i < packages.length; i++) { Loading @@ -18591,6 +18618,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } } app.reportedInteraction = isInteraction; } private final void setProcessTrackerStateLocked(ProcessRecord proc, int memFactor, long now) {
services/core/java/com/android/server/am/ProcessList.java +9 −1 Original line number Diff line number Diff line Loading @@ -368,8 +368,11 @@ final class ProcessList { case ActivityManager.PROCESS_STATE_TOP: procState = "T "; break; case ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE: procState = "SB"; break; case ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE: procState = "FS"; procState = "SF"; break; case ActivityManager.PROCESS_STATE_TOP_SLEEPING: procState = "TS"; Loading Loading @@ -481,6 +484,7 @@ final class ProcessList { PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PROC_MEM_TOP, // ActivityManager.PROCESS_STATE_TOP PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PROC_MEM_TOP, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -500,6 +504,7 @@ final class ProcessList { PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -519,6 +524,7 @@ final class ProcessList { PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -538,6 +544,7 @@ final class ProcessList { PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_TEST_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading @@ -557,6 +564,7 @@ final class ProcessList { PSS_TEST_SAME_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_TEST_SAME_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND Loading
services/core/java/com/android/server/am/ProcessRecord.java +11 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,8 @@ final class ProcessRecord { boolean killedByAm; // True when proc has been killed by activity manager, not for RAM boolean killed; // True once we know the process has been killed boolean procStateChanged; // Keep track of whether we changed 'setAdj'. boolean reportedInteraction;// Whether we have told usage stats about it being an interaction long fgInteractionTime; // When we became foreground for interaction purposes String waitingToKill; // Process is waiting to be killed when in the bg, and reason IBinder forcingToForeground;// Token that is forcing this process to be foreground int adjSeq; // Sequence id for identifying oom_adj assignment cycles Loading Loading @@ -291,6 +293,15 @@ final class ProcessRecord { pw.print(" foregroundServices="); pw.print(foregroundServices); pw.print(" forcingToForeground="); pw.println(forcingToForeground); } if (reportedInteraction || fgInteractionTime != 0) { pw.print(prefix); pw.print("reportedInteraction="); pw.print(reportedInteraction); if (fgInteractionTime != 0) { pw.print(" fgInteractionTime="); TimeUtils.formatDuration(fgInteractionTime, SystemClock.elapsedRealtime(), pw); } pw.println(); } if (persistent || removed) { pw.print(prefix); pw.print("persistent="); pw.print(persistent); pw.print(" removed="); pw.println(removed); Loading