From 48a0820666f1c7c652fc7fdf6160709f86eb630f Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Thu, 10 Jun 2021 12:36:09 -0700 Subject: [PATCH] Skip onMovementBoundsChanged when waiting for fixed rotation When entering PiP from landscape mode with non-default aspect ratio, the onMovementBoundsChanged callback will try to reset the surface with the default bounds. Skip it if we are waiting for fixed rotation to be completed, similar to the exiting swipe-pip-to-home check. Video: http://recall/-/aaaaaabFQoRHlzixHdtY/cTmovQdIAyqu5rCrJGtf0q Bug: 190651955 Test: follow the reproduce steps, see video Change-Id: I71a427351f5e080b4307ebe0a30659a3617d4a58 --- .../com/android/wm/shell/pip/PipTaskOrganizer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 afd7d2694ad6a..6451b94caaba9 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 @@ -833,10 +833,14 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, public void onMovementBoundsChanged(Rect destinationBoundsOut, boolean fromRotation, boolean fromImeAdjustment, boolean fromShelfAdjustment, WindowContainerTransaction wct) { - // note that this can be called when swiping pip to home is happening. For instance, - // swiping an app in landscape to portrait home. skip this entirely if that's the case. - if (mInSwipePipToHomeTransition && fromRotation) { - if (DEBUG) Log.d(TAG, "skip onMovementBoundsChanged due to swipe-pip-to-home"); + // note that this can be called when swipe-to-home or fixed-rotation is happening. + // Skip this entirely if that's the case. + if ((mInSwipePipToHomeTransition || mWaitForFixedRotation) && fromRotation) { + if (DEBUG) { + Log.d(TAG, "Skip onMovementBoundsChanged on rotation change" + + " mInSwipePipToHomeTransition=" + mInSwipePipToHomeTransition + + " mWaitForFixedRotation=" + mWaitForFixedRotation); + } return; } final PipAnimationController.PipTransitionAnimator animator =