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

Commit 502a725b authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

InputDispatcher: Reset touched window dispatch mode to AS_IS

After generating input targets for an event, reset all touched windows'
dispatch mode to AS_IS, since the dispatch mode in touched window should
only be used for generating the targets.

Bug: 210460522
Test: atest inpuflinger_tests
Change-Id: I7288b24fe232a780d5dc283420d6f2b103ef0691
parent 4b09c1f9
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2682,12 +2682,11 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked(

    outInjectionResult = InputEventInjectionResult::SUCCEEDED;

    // Now that we have generated all of the input targets for this event, reset the dispatch
    // mode for all touched window to AS_IS.
    for (TouchedWindow& touchedWindow : tempTouchState.windows) {
        // Targets that we entered in a slippery way will now become AS-IS targets
        if (touchedWindow.dispatchMode == InputTarget::DispatchMode::SLIPPERY_ENTER) {
        touchedWindow.dispatchMode = InputTarget::DispatchMode::AS_IS;
    }
    }

    // Update final pieces of touch state if the injector had permission.
    if (maskedAction == AMOTION_EVENT_ACTION_UP) {
+6 −0
Original line number Diff line number Diff line
@@ -4320,6 +4320,12 @@ TEST_F(InputDispatcherTest, ActionOutsideForOwnedWindowHasValidCoordinates) {
    // Therefore, we should offset them by (100, 100) relative to the screen's top left corner.
    outsideWindow->consumeMotionEvent(
            AllOf(WithMotionAction(ACTION_OUTSIDE), WithCoords(-50, -50)));
    // Ensure outsideWindow doesn't get any more events for the gesture.
    mDispatcher->notifyMotion(generateMotionArgs(ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
                                                 ADISPLAY_ID_DEFAULT, {PointF{51, 51}}));
    window->consumeMotionMove();
    outsideWindow->assertNoEvents();
}
/**