From 0619545be9adca4458cb627c18c211faad6b6275 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Thu, 16 Jun 2016 10:03:40 -0700 Subject: [PATCH] Don't re-launch activities while the device is sleeping - Don't ensure configuration for top running activity that is in the stopped state if the configuration change while the device is sleeping as we don't want to relaunch activities in this state. - Don't make activities visible while the device is sleeping and the activity isn't in voice interaction mode. Making it visible can also lead to the activity been relaunched due to configuration changing. Note the 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: Ic22193db645dec358065cb05e7f1afc6fc8ac49f --- .../java/com/android/server/am/ActivityManagerService.java | 2 +- services/core/java/com/android/server/am/ActivityStack.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 09f24edd72cad..79257e64d507a 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -18714,7 +18714,7 @@ public final class ActivityManagerService extends ActivityManagerNative starting = mainStack.topRunningActivityLocked(); } - if (starting != null) { + if (starting != null && starting.state != ActivityState.STOPPED) { kept = mainStack.ensureActivityConfigurationLocked(starting, changes, false); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index d83a750ccbb36..2393089f3b658 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1820,7 +1820,8 @@ final class ActivityStack { boolean stackVisibleBehind, ActivityRecord visibleBehind, boolean behindFullscreenActivity) { - if (!okToShowLocked(r)) { + if (!okToShowLocked(r) + || (mService.isSleepingOrShuttingDown() && r.voiceSession == null)) { return false; }