From 49b0ea6fecda66be07bed82a3c69f8545620b0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Tue, 21 Mar 2023 00:32:48 +0000 Subject: [PATCH] Don't move PiP if keyguard is showing or animating. Without this there will be a PiP window shadow lingering around on the screen, which looks like menu overlay, but it's actually the shadow. Similar precaution is already implemented in the shelf height change callback, so this is further adding the same logic to other places that trigger movement, with or without keep clear areas flag. Bug: 269402344 Test: manually, move PiP to the bottom, enter keyguard - no shadow Change-Id: Id2b69c98c6a9d6afdc10d8f601c3e38a063084d0 --- .../android/wm/shell/pip/phone/PipController.java | 14 ++++++++++++-- 1 file changed, 12 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 b59f95ce54c99..9807320afb03e 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 @@ -161,6 +161,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb this::onKeepClearAreasChangedCallback; private void onKeepClearAreasChangedCallback() { + if (mIsKeyguardShowingOrAnimating) { + // early bail out if the change was caused by keyguard showing up + return; + } if (!mEnablePipKeepClearAlgorithm) { // early bail out if the keep clear areas feature is disabled return; @@ -186,6 +190,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb // early bail out if the keep clear areas feature is disabled return; } + if (mIsKeyguardShowingOrAnimating) { + // early bail out if the change was caused by keyguard showing up + return; + } // only move if we're in PiP or transitioning into PiP if (!mPipTransitionState.shouldBlockResizeRequest()) { Rect destBounds = mPipKeepClearAlgorithm.adjust(mPipBoundsState, @@ -635,9 +643,11 @@ public class PipController implements PipTransitionController.PipTransitionCallb DisplayLayout pendingLayout = mDisplayController.getDisplayLayout(mPipBoundsState.getDisplayId()); if (mIsInFixedRotation + || mIsKeyguardShowingOrAnimating || pendingLayout.rotation() != mPipBoundsState.getDisplayLayout().rotation()) { - // bail out if there is a pending rotation or fixed rotation change + // bail out if there is a pending rotation or fixed rotation change or + // there's a keyguard present return; } int oldMaxMovementBound = mPipBoundsState.getMovementBounds().bottom; @@ -931,10 +941,10 @@ 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); } + updatePipPositionForKeepClearAreas(); } private void setLauncherAppIconSize(int iconSizePx) {