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
This commit is contained in:
Mateusz Cicheński
2023-07-27 21:52:36 +00:00
parent 4c84b10193
commit f877172930

View File

@@ -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);