From 089586fd9178873eee9791bfae6eb11e30a52d35 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Mon, 20 Jun 2016 14:16:22 -0700 Subject: Don't re-launch stopped activities while the device is sleeping Don't ensure configuration for stopped activities while the device is sleeping as we don't want to relaunch activities in this state. Note that the right configuration will be applied to the activity the next time we try to make it visible. The re-launch will happen then. Bug: 28518380 Change-Id: Id79d7817ba8f213d89cae6964de09cafe17481f9 --- services/core/java/com/android/server/am/ActivityStack.java | 11 ++++++++++- 1 file changed, 10 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 c5eacd615ec1..36238c824405 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -4448,7 +4448,7 @@ final class ActivityStack { } } if (updatedConfig) { - // Ensure the resumed state of the focus activity if we updated the confiugaration of + // Ensure the resumed state of the focus activity if we updated the configuration of // any activity. mStackSupervisor.resumeFocusedStackTopActivityLocked(); } @@ -4468,6 +4468,15 @@ final class ActivityStack { return true; } + // TODO: We could probably make the condition below just check that the activity state is + // stopped, but also checking the sleep state for now to reduce change impact late in + // development cycle. + if (mService.isSleepingOrShuttingDownLocked() && r.state == ActivityState.STOPPED) { + if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, + "Skipping config check (stopped while sleeping): " + r); + return true; + } + if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Ensuring correct configuration: " + r); -- cgit v1.2.3-59-g8ed1b