From 330fc27924cf1a11e90c025b37ae66a670f369e0 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 Merged-In: I601c7493794316883445e9c69e5cdd6a808e8933 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 6451b94caaba9..324a6e27a242d 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 @@ -835,11 +835,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 + && (mState != State.ENTERED_PIP); + if ((mInSwipePipToHomeTransition || waitForFixedRotationOnEnteringPip) && fromRotation) { if (DEBUG) { Log.d(TAG, "Skip onMovementBoundsChanged on rotation change" + " mInSwipePipToHomeTransition=" + mInSwipePipToHomeTransition - + " mWaitForFixedRotation=" + mWaitForFixedRotation); + + " mWaitForFixedRotation=" + mWaitForFixedRotation + + " mState=" + mState); } return; }