From 5c42e508d1c76d99bb95edd43e1e12a282a05344 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Wed, 8 Apr 2015 09:18:54 -0700 Subject: Move visibleBehind activities into stop state when sleeping/powerDown Bug: 19523564 Change-Id: I95273a659edc91c5636d6a0d9cd7fe5683ec4f3e --- services/core/java/com/android/server/am/ActivityStack.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 62d70d2fa799..951b9a94e4e5 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -747,6 +747,14 @@ final class ActivityStack { return true; } + if (hasVisibleBehindActivity()) { + // Stop visible behind activity before going to sleep. + final ActivityRecord r = mActivityContainer.mActivityDisplay.mVisibleBehindActivity; + mStackSupervisor.mStoppingActivities.add(r); + if (DEBUG_STATES) Slog.v(TAG, "Sleep still waiting to stop visible behind " + r); + return true; + } + return false; } @@ -1006,7 +1014,7 @@ final class ActivityStack { // the current instance before starting the new one. if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Destroying after pause: " + prev); destroyActivityLocked(prev, true, "pause-config"); - } else if (!hasVisibleBehindActivity()) { + } else if (!hasVisibleBehindActivity() || mService.isSleepingOrShuttingDown()) { // If we were visible then resumeTopActivities will release resources before // stopping. mStackSupervisor.mStoppingActivities.add(prev); -- cgit v1.2.3-59-g8ed1b