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

Commit 3892e8e0 authored by Ben Lin's avatar Ben Lin
Browse files

PiP: Move tap-outside-hide block one level higher.

This used to be only check for drag resize case, but now that it is
disabled, this is no longer called. Move it at a higher call block so
that it is also checked for pinch resizing case.

Bug: 191529856
Test: Tap outside PIP when menu is showing, it hides
Change-Id: I810a0825a96224b395dde7d51df077fed996c3ff
parent 6a674072
Loading
Loading
Loading
Loading
+12 −8
Original line number Original line Diff line number Diff line
@@ -246,10 +246,20 @@ public class PipResizeGestureHandler {
        }
        }


        if (ev instanceof MotionEvent) {
        if (ev instanceof MotionEvent) {
            MotionEvent mv = (MotionEvent) ev;
            int action = mv.getActionMasked();
            final Rect pipBounds = mPipBoundsState.getBounds();
            if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
                if (!pipBounds.contains((int) mv.getRawX(), (int) mv.getRawY())
                        && mPhonePipMenuController.isMenuVisible()) {
                    mPhonePipMenuController.hideMenu();
                }
            }

            if (mEnablePinchResize && mOngoingPinchToResize) {
            if (mEnablePinchResize && mOngoingPinchToResize) {
                onPinchResize((MotionEvent) ev);
                onPinchResize(mv);
            } else if (mEnableDragCornerResize) {
            } else if (mEnableDragCornerResize) {
                onDragCornerResize((MotionEvent) ev);
                onDragCornerResize(mv);
            }
            }
        }
        }
    }
    }
@@ -450,7 +460,6 @@ public class PipResizeGestureHandler {
        float x = ev.getX();
        float x = ev.getX();
        float y = ev.getY() - mOhmOffset;
        float y = ev.getY() - mOhmOffset;
        if (action == MotionEvent.ACTION_DOWN) {
        if (action == MotionEvent.ACTION_DOWN) {
            final Rect currentPipBounds = mPipBoundsState.getBounds();
            mLastResizeBounds.setEmpty();
            mLastResizeBounds.setEmpty();
            mAllowGesture = isInValidSysUiState() && isWithinDragResizeRegion((int) x, (int) y);
            mAllowGesture = isInValidSysUiState() && isWithinDragResizeRegion((int) x, (int) y);
            if (mAllowGesture) {
            if (mAllowGesture) {
@@ -458,11 +467,6 @@ public class PipResizeGestureHandler {
                mDownPoint.set(x, y);
                mDownPoint.set(x, y);
                mDownBounds.set(mPipBoundsState.getBounds());
                mDownBounds.set(mPipBoundsState.getBounds());
            }
            }
            if (!currentPipBounds.contains((int) x, (int) y)
                    && mPhonePipMenuController.isMenuVisible()) {
                mPhonePipMenuController.hideMenu();
            }

        } else if (mAllowGesture) {
        } else if (mAllowGesture) {
            switch (action) {
            switch (action) {
                case MotionEvent.ACTION_POINTER_DOWN:
                case MotionEvent.ACTION_POINTER_DOWN: