From 911486490dd544dfe8d8c164a6d374e941a9d32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Thu, 11 May 2023 22:48:05 +0000 Subject: [PATCH] Fix Maps PiP entrance to not bounce down and up Quickstep hides itself for moment, which resets setLauncherKeepClearAreaHeight and causes the bounce. Adding delay prevents the movement to trigger too soon. Bug: 282068601 Test: manually, enter PiP in Maps Test: before http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/c0eQkqhMV58ESQTwP6UKSm Test: after http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/gCTmeKSerYbRKsHM5ZsVjp Change-Id: Ic070f63be805ef249f270a6dd1b2180c08e0fa0c --- .../src/com/android/wm/shell/pip/phone/PipController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 f8e1435755830..9e6bd47609005 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 @@ -946,10 +946,15 @@ public class PipController implements PipTransitionController.PipTransitionCallb mPipBoundsState.getDisplayBounds().right, mPipBoundsState.getDisplayBounds().bottom); mPipBoundsState.addNamedUnrestrictedKeepClearArea(LAUNCHER_KEEP_CLEAR_AREA_TAG, rect); + updatePipPositionForKeepClearAreas(); } else { mPipBoundsState.removeNamedUnrestrictedKeepClearArea(LAUNCHER_KEEP_CLEAR_AREA_TAG); + // postpone moving in response to hide of Launcher in case there's another change + mMainExecutor.removeCallbacks(mMovePipInResponseToKeepClearAreasChangeCallback); + mMainExecutor.executeDelayed( + mMovePipInResponseToKeepClearAreasChangeCallback, + PIP_KEEP_CLEAR_AREAS_DELAY); } - updatePipPositionForKeepClearAreas(); } private void setLauncherAppIconSize(int iconSizePx) {