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

Commit 7c2370a6 authored by Gavin Williams's avatar Gavin Williams Committed by Android (Google) Code Review
Browse files

Merge "Autoclick: Fix autoclick dragging" into main

parents de016b41 69533eef
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1631,15 +1631,15 @@ public class AutoclickController extends BaseEventStreamTransformation implement
                            mTempPointerProperties,
                            mTempPointerCoords,
                            mMetaState,
                            BUTTON_PRIMARY,
                            /* buttonState= */ 0,
                            /* xPrecision= */ 1.0f,
                            /* yPrecision= */ 1.0f,
                            mLastMotionEvent.getDeviceId(),
                            /* edgeFlags= */ 0,
                            mLastMotionEvent.getSource(),
                            mLastMotionEvent.getFlags());
            releaseEvent.setActionButton(BUTTON_PRIMARY);
            MotionEvent upEvent = MotionEvent.obtain(releaseEvent);
            releaseEvent.setActionButton(BUTTON_PRIMARY);
            upEvent.setAction(MotionEvent.ACTION_UP);
            AutoclickController.super.onMotionEvent(releaseEvent, releaseEvent,
                    mEventPolicyFlags);
+7 −0
Original line number Diff line number Diff line
@@ -1235,6 +1235,13 @@ public class AutoclickControllerTest {
        assertThat(mMotionEventCaptor.upEvent).isNotNull();
        assertThat(mMotionEventCaptor.upEvent.getDownTime()).isEqualTo(
                mMotionEventCaptor.downEvent.getDownTime());

        // Verify the button release & up event have the correct click parameters.
        assertThat(mMotionEventCaptor.buttonReleaseEvent.getActionButton()).isEqualTo(
                MotionEvent.BUTTON_PRIMARY);
        assertThat(mMotionEventCaptor.buttonReleaseEvent.getButtonState()).isEqualTo(0);
        assertThat(mMotionEventCaptor.upEvent.getActionButton()).isEqualTo(0);
        assertThat(mMotionEventCaptor.upEvent.getButtonState()).isEqualTo(0);
    }