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
This commit is contained in:
Mateusz Cicheński
2023-03-25 08:20:49 +00:00
parent e455bc8e0a
commit abd0fc80c9

View File

@@ -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);
}