From d9df20c23f30be9b2f9c17aae794ea7662fd682d Mon Sep 17 00:00:00 2001 From: Ben Lin Date: Mon, 1 Aug 2022 12:52:03 -0700 Subject: [PATCH] Don't resize PiP on aspect ratio change if nothing changed. Aspect ratio changes could be deferred, and thus only the aspect ratio itself needs to be updated, but the bounds itself is already correct. Bug: 234615306 Bug: 241096069 Test: Enter PiP and move it around right after animation finishes Change-Id: Ia1078a6492358e694d4eadf97fa0f242a4033c6f --- .../wm/shell/pip/phone/PipController.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index 420d6067f4201..586e3a0145069 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -495,14 +495,15 @@ public class PipController implements PipTransitionController.PipTransitionCallb mPipBoundsState.getBounds(), mPipBoundsState.getAspectRatio()); Objects.requireNonNull(destinationBounds, "Missing destination bounds"); - mPipTaskOrganizer.scheduleAnimateResizePip(destinationBounds, - mEnterAnimationDuration, - null /* updateBoundsCallback */); - - mTouchHandler.onAspectRatioChanged(); - updateMovementBounds(null /* toBounds */, false /* fromRotation */, - false /* fromImeAdjustment */, false /* fromShelfAdjustment */, - null /* windowContainerTransaction */); + if (!destinationBounds.equals(mPipBoundsState.getBounds())) { + mPipTaskOrganizer.scheduleAnimateResizePip(destinationBounds, + mEnterAnimationDuration, + null /* updateBoundsCallback */); + mTouchHandler.onAspectRatioChanged(); + updateMovementBounds(null /* toBounds */, false /* fromRotation */, + false /* fromImeAdjustment */, false /* fromShelfAdjustment */, + null /* windowContainerTransaction */); + } } @Override