From 80b2cb70803b2600d562c37280753206570872e0 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Fri, 31 May 2019 20:18:02 -0700 Subject: Update visibility in moveTaskToBack if nothing is resumed If it's possible that nothing will be resumed by moveTaskToBack (ie. moving a freeform window to back in a multi-resume environment), then we need to ensure that visibility is updated after re-ordering since there will be no lifecycle changes to do it. Bug: 134182971 Test: Open an app in freeform and move it to back. Observe it going invisible with a transition. Change-Id: Iee7457ba7b8a7dc8385bed3a9434ab7c2490f14a --- services/core/java/com/android/server/wm/ActivityStack.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 3d59e66d13ef..8754ddfd8fca 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -4979,6 +4979,17 @@ class ActivityStack extends ConfigurationContainer { return true; } + ActivityRecord topActivity = getDisplay().topRunningActivity(); + ActivityStack topStack = topActivity.getActivityStack(); + if (topStack != null && topStack != this && topActivity.isState(RESUMED)) { + // The new top activity is already resumed, so there's a good chance that nothing will + // get resumed below. So, update visibility now in case the transition is closed + // prematurely. + mRootActivityContainer.ensureVisibilityAndConfig(null /* starting */, + getDisplay().mDisplayId, false /* markFrozenIfConfigChanged */, + false /* deferResume */); + } + mRootActivityContainer.resumeFocusedStacksTopActivities(); return true; } -- cgit v1.2.3-59-g8ed1b