summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hui Yu <huiyu@google.com> 2023-03-23 00:19:36 +0000
committer Hui Yu <huiyu@google.com> 2023-03-23 15:43:29 +0000
commitfbc0b2c92dde34099d0a4ac6ef7c87b86acad8a3 (patch)
tree93159f7f3ccf218aa8e5df7719a4cb3bbe91f45f
parent0db4c8ea84cffcbb15f9e8677bc6abbdec16cb5e (diff)
Check for current procState before demoting it.
Otherwise, when adj value is set to CACHED_APP_MIN_ADJ(900), AppFreezer will freeze the process. Bug: 273519603 Test: presubmit and b/273519603. Change-Id: Ia554aabd07ce9635b77319e62429e3e50659a970
-rw-r--r--services/core/java/com/android/server/am/OomAdjuster.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java
index a944f6fe8b7e..7a92434a4ba4 100644
--- a/services/core/java/com/android/server/am/OomAdjuster.java
+++ b/services/core/java/com/android/server/am/OomAdjuster.java
@@ -2048,8 +2048,9 @@ public class OomAdjuster {
// around switching between two apps. However, we don't want to keep the
// process in this privileged state indefinitely. Eventually, allow the
// app to be demoted to cached.
- if ((state.getSetProcState() == PROCESS_STATE_LAST_ACTIVITY
- && (state.getLastStateTime() + mConstants.MAX_PREVIOUS_TIME) < now)) {
+ if (procState >= PROCESS_STATE_LAST_ACTIVITY
+ && state.getSetProcState() == PROCESS_STATE_LAST_ACTIVITY
+ && (state.getLastStateTime() + mConstants.MAX_PREVIOUS_TIME) < now) {
procState = PROCESS_STATE_LAST_ACTIVITY;
schedGroup = SCHED_GROUP_BACKGROUND;
state.setAdjType("previous-expired");