diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/TaskFragment.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index 4e0d84c67d03..e0346544d528 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -1034,19 +1034,19 @@ class TaskFragment extends WindowContainer<WindowContainer> { // If the top activity is the resumed one, nothing to do. if (mResumedActivity == next && next.isState(RESUMED) && taskDisplayArea.allResumedActivitiesComplete()) { + // Ensure the visibility gets updated before execute app transition. + taskDisplayArea.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, + false /* preserveWindows */, true /* notifyClients */); // Make sure we have executed any pending transitions, since there // should be nothing left to do at this point. executeAppTransition(options); - // For devices that are not in fullscreen mode (e.g. freeform windows), it's possible - // we still want to check if the visibility of other windows have changed (e.g. bringing - // a fullscreen window forward to cover another freeform activity.) - if (taskDisplayArea.inMultiWindowMode()) { - if (taskDisplayArea.mDisplayContent != null - && taskDisplayArea.mDisplayContent.mFocusedApp != next) { - taskDisplayArea.mDisplayContent.setFocusedApp(next); - } - taskDisplayArea.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, - false /* preserveWindows */, true /* notifyClients */); + + // In a multi-resumed environment, like in a freeform device, the top + // activity can be resumed, but it might not be the focused app. + // Set focused app when top activity is resumed + if (taskDisplayArea.inMultiWindowMode() && taskDisplayArea.mDisplayContent != null + && taskDisplayArea.mDisplayContent.mFocusedApp != next) { + taskDisplayArea.mDisplayContent.setFocusedApp(next); } ProtoLog.d(WM_DEBUG_STATES, "resumeTopActivity: Top activity " + "resumed %s", next); |