Skip to content

Commit

Permalink
Merge "Fix issue #25727069: Top sleeping activity overrides foregroun…
Browse files Browse the repository at this point in the history
…d service"
  • Loading branch information
marwahvikas authored and Gerrit Code Review committed May 3, 2016
2 parents 0d14c01 + 7064c01 commit 683168c
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17747,7 +17747,7 @@ private final int computeOomAdjLocked(ProcessRecord app, int cachedAdj, ProcessR

app.systemNoUi = false;

final int PROCESS_STATE_TOP = mTopProcessState;
final int PROCESS_STATE_CUR_TOP = mTopProcessState;

// Determine the importance of the process, starting with most
// important to least, and assign an appropriate OOM adjustment.
Expand All @@ -17762,7 +17762,7 @@ private final int computeOomAdjLocked(ProcessRecord app, int cachedAdj, ProcessR
schedGroup = Process.THREAD_GROUP_DEFAULT;
app.adjType = "top-activity";
foregroundActivities = true;
procState = PROCESS_STATE_TOP;
procState = PROCESS_STATE_CUR_TOP;
} else if (app.instrumentationClass != null) {
// Don't want to kill running instrumentation.
adj = ProcessList.FOREGROUND_APP_ADJ;
Expand Down Expand Up @@ -17815,8 +17815,8 @@ private final int computeOomAdjLocked(ProcessRecord app, int cachedAdj, ProcessR
adj = ProcessList.VISIBLE_APP_ADJ;
app.adjType = "visible";
}
if (procState > PROCESS_STATE_TOP) {
procState = PROCESS_STATE_TOP;
if (procState > PROCESS_STATE_CUR_TOP) {
procState = PROCESS_STATE_CUR_TOP;
}
schedGroup = Process.THREAD_GROUP_DEFAULT;
app.cached = false;
Expand All @@ -17828,8 +17828,8 @@ private final int computeOomAdjLocked(ProcessRecord app, int cachedAdj, ProcessR
adj = ProcessList.PERCEPTIBLE_APP_ADJ;
app.adjType = "pausing";
}
if (procState > PROCESS_STATE_TOP) {
procState = PROCESS_STATE_TOP;
if (procState > PROCESS_STATE_CUR_TOP) {
procState = PROCESS_STATE_CUR_TOP;
}
schedGroup = Process.THREAD_GROUP_DEFAULT;
app.cached = false;
Expand Down Expand Up @@ -17864,7 +17864,8 @@ private final int computeOomAdjLocked(ProcessRecord app, int cachedAdj, ProcessR
}
}

if (adj > ProcessList.PERCEPTIBLE_APP_ADJ) {
if (adj > ProcessList.PERCEPTIBLE_APP_ADJ
|| procState > ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE) {
if (app.foregroundServices) {
// The user is aware of this app, so make it visible.
adj = ProcessList.PERCEPTIBLE_APP_ADJ;
Expand Down

0 comments on commit 683168c

Please sign in to comment.