From 13a4b762034de659af5e70ec42d39c7b4820e918 Mon Sep 17 00:00:00 2001 From: Ben Lin Date: Wed, 30 Sep 2020 15:41:24 -0700 Subject: [PATCH] Don't no-op on resuming top activity if display is in freeform. Currently, when we try to resume the top activity of the task, we exit early if the activity is already resumed. However in the case of freeform display area and multi-resume, it's possible we want to proceed with the rest of the operation (pausing the back stack based on visibility check) since multi-resume is possible. For example, in the case of a maximized app behind a freeform app, when we bring the maximized, fullscreen app to the front (which is already resumed), we want to then pause the back stacks since everything is covered up. Bug: 168852384 Test: atest PinnedStackTests#testAutoEnterPictureInPictureOnUserLeaveHintWhenPipRequestedNotOverridden Change-Id: If2dc3f97ca2afd2992c7546e91a36d826cbf9c72 --- services/core/java/com/android/server/wm/Task.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index a236699209a0b..79c0ada8700b2 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -5870,7 +5870,11 @@ class Task extends WindowContainer { final TaskDisplayArea taskDisplayArea = getDisplayArea(); // If the top activity is the resumed one, nothing to do. + // For devices that are not in fullscreen mode (e.g. freeform windows), it's possible + // we still want to proceed if the visibility of other windows have changed (e.g. bringing + // a fullscreen window forward to cover another freeform activity.) if (mResumedActivity == next && next.isState(RESUMED) + && taskDisplayArea.getWindowingMode() != WINDOWING_MODE_FREEFORM && taskDisplayArea.allResumedActivitiesComplete()) { // Make sure we have executed any pending transitions, since there // should be nothing left to do at this point.