From abd0fc80c99a4ab9d3b75a76e2643ce9853f5646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Sat, 25 Mar 2023 08:20:49 +0000 Subject: [PATCH] Fix enter pip animation in fixed rotation with KCA flag on The animator is running using old rotation bounds, so we need to provide the KCA update in the old rotation as well. Bug: 274875324 Test: manually, enter pip in fixed rotation in both nav modes with flag on and off Change-Id: I75a860d94eb8c267b0f37103d910f87f61cac2bc --- .../wm/shell/pip/PipTaskOrganizer.java | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index 1dd2ef94a959e..194acde0177df 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -1171,20 +1171,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, final Rect newDestinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds(); if (newDestinationBounds.equals(currentDestinationBounds)) return; - if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) { - if (mWaitForFixedRotation) { - // The new destination bounds are in next rotation (DisplayLayout has been rotated - // in computeRotatedBounds). The animation runs in previous rotation so the end - // bounds need to be transformed. - final Rect displayBounds = mPipBoundsState.getDisplayBounds(); - final Rect rotatedEndBounds = new Rect(newDestinationBounds); - rotateBounds(rotatedEndBounds, displayBounds, mNextRotation, mCurrentRotation); - animator.updateEndValue(rotatedEndBounds); - } else { - animator.updateEndValue(newDestinationBounds); - } - } - animator.setDestinationBounds(newDestinationBounds); + updateAnimatorBounds(newDestinationBounds); destinationBoundsOut.set(newDestinationBounds); } @@ -1196,7 +1183,17 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mPipAnimationController.getCurrentAnimator(); if (animator != null && animator.isRunning()) { if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) { - animator.updateEndValue(bounds); + if (mWaitForFixedRotation) { + // The new destination bounds are in next rotation (DisplayLayout has been + // rotated in computeRotatedBounds). The animation runs in previous rotation so + // the end bounds need to be transformed. + final Rect displayBounds = mPipBoundsState.getDisplayBounds(); + final Rect rotatedEndBounds = new Rect(bounds); + rotateBounds(rotatedEndBounds, displayBounds, mNextRotation, mCurrentRotation); + animator.updateEndValue(rotatedEndBounds); + } else { + animator.updateEndValue(bounds); + } } animator.setDestinationBounds(bounds); }