From 6f009f903b8364ef50eb0b20faaaefb4920fa951 Mon Sep 17 00:00:00 2001 From: "jorgegil@google.com" Date: Mon, 13 Jun 2022 17:54:09 -0700 Subject: [PATCH] Only restore to mLastNonFullscreenBounds if requested bounds unset Whenever a task changes windowing mode to freeform (or undefined and its parent is freeform), the last non-fullscreen bounds are restored. This CL changes that so that the restore bounds are used only when the requested override window config bounds are null/empty, to prevent overwriting bounds set by wm shell in a transition's WCT. Bug: 235885662 Test: atest TaskTests Change-Id: Iba9c94d700ad4e1ef05073353c0d47c34daf5b26 --- services/core/java/com/android/server/wm/Task.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 4a643ef6a7876..719e2d44eb575 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -1862,6 +1862,11 @@ class Task extends TaskFragment { if (getRequestedOverrideWindowingMode() == WINDOWING_MODE_UNDEFINED) { nextPersistTaskBounds = newParentConfig.windowConfiguration.persistTaskBounds(); } + // Only restore to the last non-fullscreen bounds when the requested override bounds + // have not been explicitly set already. + nextPersistTaskBounds &= + (getRequestedOverrideConfiguration().windowConfiguration.getBounds() == null + || getRequestedOverrideConfiguration().windowConfiguration.getBounds().isEmpty()); if (!prevPersistTaskBounds && nextPersistTaskBounds && mLastNonFullscreenBounds != null && !mLastNonFullscreenBounds.isEmpty()) { // Bypass onRequestedOverrideConfigurationChanged here to avoid infinite loop.