From a2249ac4e0a516f169ea6a79683623d548e989f9 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 30 Mar 2017 18:15:30 -0700 Subject: [PATCH] Fixing rotation issues. - Ensuring that we can update the stack bounds of non-docked stacks upon rotation while split screen is enabled (previously disabled) - Fix issue where subsequent bounds calculations were using the animation target bounds from the prior orientation Bug: 36657966 Test: android.server.cts.ActivityManagerPinnedStackTests Change-Id: I810e35f907721ef5c781b914adac3273ea8da5c8 --- .../com/android/server/am/ActivityStackSupervisor.java | 7 ++++--- services/core/java/com/android/server/wm/TaskStack.java | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index b623b2f2b1804..c65ca798a7b00 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2252,9 +2252,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return; } - if (!allowResizeInDockedMode && getStack(DOCKED_STACK_ID) != null) { - // If the docked stack exist we don't allow resizes of stacks not caused by the docked - // stack size changing so things don't get out of sync. + if (!allowResizeInDockedMode && !StackId.tasksAreFloating(stackId) && + getStack(DOCKED_STACK_ID) != null) { + // If the docked stack exists, don't resize non-floating stacks independently of the + // size computed from the docked stack size (otherwise they will be out of sync) return; } diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index dc437ea723159..8b5f5acc5c28f 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -340,7 +340,7 @@ public class TaskStack extends WindowContainer implements DimLayer.DimLaye * @return the source bounds for the bounds animation. */ void getAnimatingSourceBounds(Rect outBounds) { - if (mBoundsAnimationSourceBounds != null) { + if (!mBoundsAnimationSourceBounds.isEmpty()) { outBounds.set(mBoundsAnimationSourceBounds); return; } @@ -419,6 +419,11 @@ public class TaskStack extends WindowContainer implements DimLayer.DimLaye // we can just update and return them here setBounds(mBounds); mBoundsAfterRotation.set(mBounds); + + // Once we've set the bounds based on the rotation of the old bounds in the new + // orientation, clear the animation target bounds since they are obsolete + mBoundsAnimationTarget.setEmpty(); + mBoundsAnimationSourceBounds.setEmpty(); return true; }