Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2c5ea92 authored by Ben Lin's avatar Ben Lin Committed by Automerger Merge Worker
Browse files

Merge "PiP: Potentially hide menu immediately after it appears." into rvc-dev am: 4757e892

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11710013

Change-Id: Ic26c9005e3775151ef4a65106999c9e4e61cd971
parents 4219c436 4757e892
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -161,6 +161,7 @@ public class PipTouchHandler {
    private float mSavedSnapFraction = -1f;
    private float mSavedSnapFraction = -1f;
    private boolean mSendingHoverAccessibilityEvents;
    private boolean mSendingHoverAccessibilityEvents;
    private boolean mMovementWithinDismiss;
    private boolean mMovementWithinDismiss;
    private boolean mHideMenuAfterShown = false;
    private PipAccessibilityInteractionConnection mConnection;
    private PipAccessibilityInteractionConnection mConnection;


    // Touch state
    // Touch state
@@ -677,6 +678,7 @@ public class PipTouchHandler {
                break;
                break;
            }
            }
            case MotionEvent.ACTION_HOVER_EXIT: {
            case MotionEvent.ACTION_HOVER_EXIT: {
                mHideMenuAfterShown = true;
                // If Touch Exploration is enabled, some a11y services (e.g. Talkback) is probably
                // If Touch Exploration is enabled, some a11y services (e.g. Talkback) is probably
                // on and changing MotionEvents into HoverEvents.
                // on and changing MotionEvents into HoverEvents.
                // Let's not enable menu show/hide for a11y services.
                // Let's not enable menu show/hide for a11y services.
@@ -767,6 +769,9 @@ public class PipTouchHandler {
                mSavedSnapFraction = mMotionHelper.animateToExpandedState(expandedBounds,
                mSavedSnapFraction = mMotionHelper.animateToExpandedState(expandedBounds,
                        mMovementBounds, mExpandedMovementBounds, callback);
                        mMovementBounds, mExpandedMovementBounds, callback);
            }
            }
            if (mHideMenuAfterShown) {
                mMenuController.hideMenu();
            }
        } else if (menuState == MENU_STATE_NONE && mMenuState == MENU_STATE_FULL) {
        } else if (menuState == MENU_STATE_NONE && mMenuState == MENU_STATE_FULL) {
            // Try and restore the PiP to the closest edge, using the saved snap fraction
            // Try and restore the PiP to the closest edge, using the saved snap fraction
            // if possible
            // if possible
@@ -804,6 +809,7 @@ public class PipTouchHandler {
            }
            }
        }
        }
        mMenuState = menuState;
        mMenuState = menuState;
        mHideMenuAfterShown = false;
        updateMovementBounds();
        updateMovementBounds();
        // If pip menu has dismissed, we should register the A11y ActionReplacingConnection for pip
        // 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.
        // as well, or it can't handle a11y focus and pip menu can't perform any action.