From 298da246f0e5aa7a6469ff2f888171977df501ea Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 15 Jun 2021 10:31:15 -0700 Subject: [PATCH] Do not skip onMovementBoundsChanged if already in PiP If the Task is already in PiP mode and fixed rotation is happening, we still need the onMovementBoundsChanged callback to go through in PipTaskOrganizer. Note that there seems to be an existing bug that Launcher shelf height is ignored with the following steps - Enter PiP and open another app to fullscreen - Rotate screen and swipe the other app to home Video: http://recall/-/aaaaaabFQoRHlzixHdtY/gs08EEyHyNcn86lsIcbIRe Bug: 191143521 Test: follow the reproduce steps in bug, see the video Change-Id: I601c7493794316883445e9c69e5cdd6a808e8933 --- .../src/com/android/wm/shell/pip/PipTaskOrganizer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 25b68d590037a..fbd606478419b 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 @@ -828,11 +828,14 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, WindowContainerTransaction wct) { // 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) { + final boolean waitForFixedRotationOnEnteringPip = mWaitForFixedRotation + && (mPipTransitionState.getTransitionState() != PipTransitionState.ENTERED_PIP); + if ((mInSwipePipToHomeTransition || waitForFixedRotationOnEnteringPip) && fromRotation) { if (DEBUG) { Log.d(TAG, "Skip onMovementBoundsChanged on rotation change" + " mInSwipePipToHomeTransition=" + mInSwipePipToHomeTransition - + " mWaitForFixedRotation=" + mWaitForFixedRotation); + + " mWaitForFixedRotation=" + mWaitForFixedRotation + + " getTransitionState=" + mPipTransitionState.getTransitionState()); } return; }