summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bryce Lee <brycelee@google.com> 2017-09-11 10:44:35 -0700
committer Bryce Lee <brycelee@google.com> 2017-09-11 14:38:16 -0700
commit5b21f521ff58fabf5323e5defc66bd251b613fcf (patch)
tree3a25235925163e1f7c62572a8e7f6b71ca65a1d8
parent2f35f15ab0f35da44aced6bb44933a70a6a7fb59 (diff)
Make sure top activity is stopped on sleep if paused.
Currently we have logic in place to handle moving a top resumed activity to paused and eventually stopped if entering sleep. However, we do not handle the case when the top activity is already paused. This changelist addresses this issue by identifying this condition and moving the activity to the stopped state. Change-Id: Ib9fff1efeb33719d008508cf21a17b95fc17efd0 Fixes: 65457314 Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerDisplayTests#testExternalDisplayActivityTurnPrimaryOff
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 791b2c066821..09541f66633d 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1214,6 +1214,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
// Still waiting for something to pause; can't sleep yet.
if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Sleep still waiting to pause " + mPausingActivity);
shouldSleep = false;
+ } else if (topActivity() != null && topActivity().state == ActivityState.PAUSED) {
+ // Our top activity is currently paused, we need to ensure we move it to the stopped
+ // state.
+ stopActivityLocked(mLastPausedActivity);
+ shouldSleep = false;
}
if (!shuttingDown) {