diff options
| author | 2023-05-15 17:43:48 -0700 | |
|---|---|---|
| committer | 2023-05-16 09:11:13 -0700 | |
| commit | 70c6ee8fff6c40fa78d4cff5643c6156d99b764f (patch) | |
| tree | dbc2611f41ed18c15697755c7d5147ba65ce36ca | |
| parent | 9e9933f21713872eb073c698e9bc4cde92af8f75 (diff) | |
Set cursor position to the first pointer for mouse events
In tests, a common task is to create an instance of NotifyMotionArgs.
A builder is used to define it.
Before this CL, the builder used to set cursor position only for the
cases where there is exactly 1 pointer in the event.
However, now, with the new touchpad stack, there may be > 1 pointer
created for the SOURCE_MOUSE events.
Relax the restriction to avoid the boilderplate of setting the
cursorposition for mouse events in the tests.
This patch is a temporary workaround for the ubsan failure in a newly
added test TouchpadThreeFingerSwipeNotSentToSingleWindow.
Bug: 263319225
Test: m inputflinger_tests && $ANDROID_HOST_OUT/nativetest64/inputflinger_tests/inputflinger_tests
Change-Id: Ifa8858c3f0f22978de822473d2362e70aba4e01c
| -rw-r--r-- | services/inputflinger/tests/InputDispatcher_test.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp index fecd0d1315..3f2658a71d 100644 --- a/services/inputflinger/tests/InputDispatcher_test.cpp +++ b/services/inputflinger/tests/InputDispatcher_test.cpp @@ -1564,8 +1564,7 @@ public: // Set mouse cursor position for the most common cases to avoid boilerplate. if (mSource == AINPUT_SOURCE_MOUSE && - !MotionEvent::isValidCursorPosition(mRawXCursorPosition, mRawYCursorPosition) && - mPointers.size() == 1) { + !MotionEvent::isValidCursorPosition(mRawXCursorPosition, mRawYCursorPosition)) { mRawXCursorPosition = pointerCoords[0].getX(); mRawYCursorPosition = pointerCoords[0].getY(); } @@ -1677,8 +1676,7 @@ public: // Set mouse cursor position for the most common cases to avoid boilerplate. if (mSource == AINPUT_SOURCE_MOUSE && - !MotionEvent::isValidCursorPosition(mRawXCursorPosition, mRawYCursorPosition) && - mPointers.size() == 1) { + !MotionEvent::isValidCursorPosition(mRawXCursorPosition, mRawYCursorPosition)) { mRawXCursorPosition = pointerCoords[0].getX(); mRawYCursorPosition = pointerCoords[0].getY(); } |