From f87717293035fc03e4a07993cd54e1f4b3912f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Thu, 27 Jul 2023 21:52:36 +0000 Subject: [PATCH] Fix usage of temporary restricted keep clear area for hotseat Add proto logs for easier debugging of keep clear area changes. Originally the change was meant to be harmless, as it would have been quickly updated with next keepClearAreasChanged callback. However, we have switched the shelf height to no longer use the API and instead provide the Rect to avoid directly to PiP, which stopped issuing the callback and that lingering restricted keep clear area was hanging over the future invocations for PiP. It is eventually cleared once the callback is called, but otherwise creates inconsistent behavior. Bug: 292813143 Test: manually, enter YT PiP, observe shelf height change movements Test: after http://recall/-/g8x7ZkgdfbqscttAA9wzl9/f6qcvXMt8A6s5LsC0Rx9Hs Test: before http://recall/-/g8x7ZkgdfbqscttAA9wzl9/hfcWIBOuMrddsDM5qMv4xj Change-Id: Ia644bf4ea8c887c7612608bfd867041cb5d8b32a --- .../com/android/wm/shell/pip/phone/PipController.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 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 5b9e47fb51884..7d82dc17ae728 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 @@ -352,6 +352,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb mMainExecutor.executeDelayed( mMovePipInResponseToKeepClearAreasChangeCallback, PIP_KEEP_CLEAR_AREAS_DELAY); + + ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, + "onKeepClearAreasChanged: restricted=%s, unrestricted=%s", + restricted, unrestricted); } } } @@ -950,6 +954,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb } private void setLauncherKeepClearAreaHeight(boolean visible, int height) { + ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, + "setLauncherKeepClearAreaHeight: visible=%b, height=%d", visible, height); if (visible) { Rect rect = new Rect( 0, mPipBoundsState.getDisplayBounds().bottom - height, @@ -1007,9 +1013,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb int launcherRotation, Rect hotseatKeepClearArea) { if (mEnablePipKeepClearAlgorithm) { - // pre-emptively add the keep clear area for Hotseat, so that it is taken into account + // preemptively add the keep clear area for Hotseat, so that it is taken into account // when calculating the entry destination bounds of PiP window - mPipBoundsState.getRestrictedKeepClearAreas().add(hotseatKeepClearArea); + mPipBoundsState.addNamedUnrestrictedKeepClearArea(LAUNCHER_KEEP_CLEAR_AREA_TAG, + hotseatKeepClearArea); } else { int shelfHeight = hotseatKeepClearArea.height(); setShelfHeightLocked(shelfHeight > 0 /* visible */, shelfHeight);