diff options
| author | 2020-06-02 16:43:39 -0700 | |
|---|---|---|
| committer | 2020-06-02 16:43:39 -0700 | |
| commit | 9be3e7878d67c6f006e536a5d79caabf4fbfe0b1 (patch) | |
| tree | 477ba218a0ed720ce13d564f10bce360557d10fa | |
| parent | 83e9ba45a4f874ecd81aeda3a4ff7964b1eba3ba (diff) | |
PiP: Potentially hide menu immediately after it appears.
PiP currently shows and hides depending on HOVER_ENTER/HOVER_EXIT
events. However, it is possible that user does ENTER/EXIT so quickly
(e.g. fling the cursor across the PIP screen from one corner to the
other), that by the time HOVER_EXIT has happened, the menu activity
hastn' finished showing up yet. If that's the case, #hideMenu would be
called too early, which ends up not hiding anything.
This saves a temporary check such that when the menu appears, if there
is already a signal to hide the menu, then we choose to hide the menu
immediately after.
Bug: 122982825
Test: Fling the cursor from one edge to the other, no longer see the PIP
menu stuck showing.
Change-Id: I946cd2614c0270ffacbaf7d7e6942891095c03ba
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java index c274ee96b170..7a9dcdebb18e 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java @@ -161,6 +161,7 @@ public class PipTouchHandler { private float mSavedSnapFraction = -1f; private boolean mSendingHoverAccessibilityEvents; private boolean mMovementWithinDismiss; + private boolean mHideMenuAfterShown = false; private PipAccessibilityInteractionConnection mConnection; // Touch state @@ -677,6 +678,7 @@ public class PipTouchHandler { break; } case MotionEvent.ACTION_HOVER_EXIT: { + mHideMenuAfterShown = true; // If Touch Exploration is enabled, some a11y services (e.g. Talkback) is probably // on and changing MotionEvents into HoverEvents. // Let's not enable menu show/hide for a11y services. @@ -767,6 +769,9 @@ public class PipTouchHandler { mSavedSnapFraction = mMotionHelper.animateToExpandedState(expandedBounds, mMovementBounds, mExpandedMovementBounds, callback); } + if (mHideMenuAfterShown) { + mMenuController.hideMenu(); + } } else if (menuState == MENU_STATE_NONE && mMenuState == MENU_STATE_FULL) { // Try and restore the PiP to the closest edge, using the saved snap fraction // if possible @@ -804,6 +809,7 @@ public class PipTouchHandler { } } mMenuState = menuState; + mHideMenuAfterShown = false; updateMovementBounds(); // If pip menu has dismissed, we should register the A11y ActionReplacingConnection for pip // as well, or it can't handle a11y focus and pip menu can't perform any action. |