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

Commit c73eb5d3 authored by jorgegil@google.com's avatar jorgegil@google.com
Browse files

Start pinchResize only if pointers are inside PIP

The PipResizeGestureHandler was previusly signaling a start
of the pinch resize without checking that both pointers were
within the PIP bounds region. This caused the TouchState to
be reset with a single tap outside the PIP window while
drag-moving it with another finger, which led to PIP becoming
stuck without snapping to the edges.
With this CL, we make sure that both fingers are inside PIP
before starting resetting the touch state and allowing the
pinch resize to start.

Bug: 188640607
Bug: 186607893
Test: move the PIP with one finger and while still holding it
tap anywhere outside of PIP with another finger - verify you
can still keep moving the PIP with the first finger normally.

Change-Id: I2137180ea1f333fe2e0b67e52d57da5ff9a2d094
parent fe788b0b
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -235,15 +235,20 @@ public class PipResizeGestureHandler {


    @VisibleForTesting
    @VisibleForTesting
    void onInputEvent(InputEvent ev) {
    void onInputEvent(InputEvent ev) {
        if (!mEnableDragCornerResize && !mEnablePinchResize) {
            // No need to handle anything if neither form of resizing is enabled.
            return;
        }

        // Don't allow resize when PiP is stashed.
        // Don't allow resize when PiP is stashed.
        if (mPipBoundsState.isStashed()) {
        if (mPipBoundsState.isStashed()) {
            return;
            return;
        }
        }


        if (ev instanceof MotionEvent) {
        if (ev instanceof MotionEvent) {
            if (mOngoingPinchToResize) {
            if (mEnablePinchResize && mOngoingPinchToResize) {
                onPinchResize((MotionEvent) ev);
                onPinchResize((MotionEvent) ev);
            } else {
            } else if (mEnableDragCornerResize) {
                onDragCornerResize((MotionEvent) ev);
                onDragCornerResize((MotionEvent) ev);
            }
            }
        }
        }
@@ -318,8 +323,8 @@ public class PipResizeGestureHandler {
                case MotionEvent.ACTION_POINTER_DOWN:
                case MotionEvent.ACTION_POINTER_DOWN:
                    if (mEnablePinchResize && ev.getPointerCount() == 2) {
                    if (mEnablePinchResize && ev.getPointerCount() == 2) {
                        onPinchResize(ev);
                        onPinchResize(ev);
                        mOngoingPinchToResize = true;
                        mOngoingPinchToResize = mAllowGesture;
                        return true;
                        return mAllowGesture;
                    }
                    }
                    break;
                    break;