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

Commit 96a1557c authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Fix event stream in DragAndDropNotCancelledIfSomeOtherPointerIsPilfered

Before this CL, this test injected two POINTER_1_DOWN events in a row,
which is incorrect.

Fix this by sending the ACTION_MOVE event for the last injection.

Bug: 316915830
Test: add fatal log locally on double pointer add and then run the tests
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: If47ad8cd3e43f4b4d36eec20e5de4df3a6d142c5
parent 4191ac8e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -9702,13 +9702,13 @@ TEST_F(InputDispatcherDragTests, DragAndDropNotCancelledIfSomeOtherPointerIsPilf
    mDragWindow->assertNoEvents();
    const MotionEvent firstFingerMoveEvent =
            MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN)
            MotionEventBuilder(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN)
                    .eventTime(systemTime(SYSTEM_TIME_MONOTONIC))
                    .pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(60).y(60))
                    .pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(60).y(60))
                    .build();
    ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
              injectMotionEvent(*mDispatcher, secondFingerDownEvent, INJECT_EVENT_TIMEOUT,
              injectMotionEvent(*mDispatcher, firstFingerMoveEvent, INJECT_EVENT_TIMEOUT,
                                InputEventInjectionSync::WAIT_FOR_RESULT))
            << "Inject motion event should return InputEventInjectionResult::SUCCEEDED";