Check that PIP is active before setting the PIP exclusion bounds

Fixes issue that caused the exclusion bounds to be set to the
last PIP bounds even if the PIP window did not exist anymore,
leading to the back gesture to not work.

Bug: 176302696
Test: enter PIP, stash, exit via drag to bottom, enter dark mode -
the back gesture should work on the region that was previously stashed
pip

Change-Id: Ife9abf6382c7d973d9cefbc6a3dc1f355989fa42
This commit is contained in:
jorgegil@google.com
2021-03-11 15:40:06 -08:00
parent 0ec8d259d5
commit b9e67286a0

View File

@@ -73,6 +73,7 @@ public class PipTouchHandler {
// Allow PIP to resize to a slightly bigger state upon touch
private boolean mEnableResize;
private final Context mContext;
private final PipTaskOrganizer mPipTaskOrganizer;
private final PipBoundsAlgorithm mPipBoundsAlgorithm;
private final @NonNull PipBoundsState mPipBoundsState;
private final PipUiEventLogger mPipUiEventLogger;
@@ -169,6 +170,7 @@ public class PipTouchHandler {
mContext = context;
mMainExecutor = mainExecutor;
mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
mPipTaskOrganizer = pipTaskOrganizer;
mPipBoundsAlgorithm = pipBoundsAlgorithm;
mPipBoundsState = pipBoundsState;
mMenuController = menuController;
@@ -982,7 +984,9 @@ public class PipTouchHandler {
void setPipExclusionBoundsChangeListener(Consumer<Rect> pipExclusionBoundsChangeListener) {
mPipExclusionBoundsChangeListener = new WeakReference<>(pipExclusionBoundsChangeListener);
pipExclusionBoundsChangeListener.accept(mPipBoundsState.getBounds());
pipExclusionBoundsChangeListener.accept(mPipTaskOrganizer.isInPip()
? mPipBoundsState.getBounds() : new Rect());
}
/**