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

Commit 1979bad2 authored by Dieter Hsu's avatar Dieter Hsu
Browse files

Remove dupe events while 2-fingers scrolling

Move events may contain a history of other move events. When we split
the event, each of the resulting events has history. When the system
dispatches the events, it also dispatches the ones in the history.

We change these events with actions which are NOT ACTION_MOVE and
inject to input. But those histories are no longer consistent with what
happened and are causing InputDispatcher::injectInputEvent to enqueue
duplicated events of each historical pointer coord.

Bug: 74069091
Test: manual
Test: atest CtsAccessibilityTestCases
Test: atest CtsAccessibilityServiceTestCases

Change-Id: I2a9f5526cbeecfcc379f86624607190e16265405
parent 683fa6d1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -572,6 +572,8 @@ class TouchExplorer extends BaseEventStreamTransformation
                            }
                        }

                        // Remove move history before send injected non-move events
                        event = MotionEvent.obtainNoHistory(event);
                        if (isDraggingGesture(event)) {
                            // Two pointers moving in the same direction within
                            // a given distance perform a drag.
@@ -602,6 +604,7 @@ class TouchExplorer extends BaseEventStreamTransformation

                        // More than two pointers are delegated to the view hierarchy.
                        mCurrentState = STATE_DELEGATING;
                        event = MotionEvent.obtainNoHistory(event);
                        sendDownForAllNotInjectedPointers(event, policyFlags);
                    }
                }
@@ -690,6 +693,8 @@ class TouchExplorer extends BaseEventStreamTransformation
                            // The two pointers are moving either in different directions or
                            // no close enough => delegate the gesture to the view hierarchy.
                            mCurrentState = STATE_DELEGATING;
                            // Remove move history before send injected non-move events
                            event = MotionEvent.obtainNoHistory(event);
                            // Send an event to the end of the drag gesture.
                            sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits,
                                    policyFlags);
@@ -699,6 +704,7 @@ class TouchExplorer extends BaseEventStreamTransformation
                    } break;
                    default: {
                        mCurrentState = STATE_DELEGATING;
                        event = MotionEvent.obtainNoHistory(event);
                        // Send an event to the end of the drag gesture.
                        sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits,
                                policyFlags);