summaryrefslogtreecommitdiff
path: root/include/input
AgeCommit message (Collapse)Author
2021-12-29Merge changes from topic ↵Prabir Pradhan
"revert-16371733-revert-16336498-revert-16306432-revert-16295572-ORWQJPYRMQ-IQBEBXXQNX-CARGQZNFNA-ZVFVBFSHNR" * changes: Reland^2 "Remove x/y offset from MotionEntry" Reland^2 "Input injection: Assume transformed values are i..."
2021-12-24Reland^2 "Remove x/y offset from MotionEntry"Prabir Pradhan
f7c99f3f2404f9605c2801caa20b236a595afa3d Bug: 206842332 Change-Id: Id42790e6c1d562c61efb6673407a2861927df40b
2021-12-09Reorder VerifiedKey/MotionEvent structs for hwasanSiarhei Vishniakou
Now, the 'nsecs_t' fields of this struct will no longer be falling on 4-byte boundaries. This prevents a hwasan crash. Bug: 209991446 Test: atest inputflinger_tests Change-Id: If28c7ff66b9495a3d61f590464d2b995afbe0c2b
2021-12-03Merge changes from topic ↵TreeHugger Robot
"revert-16336498-revert-16306432-revert-16295572-ORWQJPYRMQ-IQBEBXXQNX-CARGQZNFNA" * changes: Revert "Reland "Input injection: Assume transformed values are i..."" Revert "Reland "Remove x/y offset from MotionEntry""
2021-12-03Revert "Reland "Remove x/y offset from MotionEntry""Alex Chau
Revert submission 16336498-revert-16306432-revert-16295572-ORWQJPYRMQ-IQBEBXXQNX Reason for revert: b/208849306 Reverted Changes: I5afb6f7fd:Reland "Remove x/y offset from MotionEntry" I68b5619bf:Reland "Input injection: Assume transformed values... Change-Id: Id944e4eb39b26e3ffd51998b315a06e87a2af3d5
2021-12-01Merge changes from topic "revert-16306432-revert-16295572-ORWQJPYRMQ-IQBEBXXQNX"TreeHugger Robot
* changes: Reland "Remove x/y offset from MotionEntry" Reland "Input injection: Assume transformed values are i..."
2021-12-01Add getSurfaceRotation API to MotionEventPrabir Pradhan
Add an API to get the current rotation value of the transform of the MotionEvent. Bug: 207771136 Test: atest MotionEventTest Change-Id: I05fb4455d0dcfc0de8c8564473ee8d43ac86c0bd
2021-12-01Reland "Remove x/y offset from MotionEntry"Prabir Pradhan
2b80b386c4ed5a1b3240da32080280b0a1ec9cef Change-Id: I5afb6f7fd25cd13e42a9b4368fa387bf574e5ec0
2021-11-22Reland "Change PointerController to display space"Prabir Pradhan
259a2122aeafea0f20bfcc7c9bcd089511a5aa56 Bug: 188939842 Bug: 144544464 Bug: 206817973 Test: forrest run - CtsHardwareTestCases Change-Id: I8f0312a502ec5c79038ef1697cf2d5b23db9fcfc
2021-11-20Revert "Remove x/y offset from MotionEntry"Jay Wang
Revert submission 16295572 Reason for revert: DroidMonitor-triggered revert due to breakage bug http://b/207128427. BUG: 207128427 Reverted Changes: I65c284e5e:Input injection: Assume transformed values are in ... Ifd359ebb0:Remove x/y offset from MotionEntry Change-Id: Iab395d41d49db17c0a682bdd6c77fe2aacc004f4
2021-11-19Remove x/y offset from MotionEntryPrabir Pradhan
Window or display offsets are now captured in the various transforms, so we can remove the ability to specify the offset by itself. Bug: 188939842 Test: presubmit Test: atest inputflinger_tests Change-Id: Ifd359ebb03850bb30efb358e84f0a7e77260a8b2
2021-11-17Revert "Change PointerController to display space"Prabir Pradhan
Revert submission 16194643-pointer-controller-in-display-space Reason for revert: b/206817973 Reverted Changes: I764c070ad:Change PointerController to display space I5e9e19c36:Change PointerController to display space Change-Id: If6e96f41873dd9601f49fc9f9f514a95394f3c58
2021-11-17Change PointerController to display spacePrabir Pradhan
PointerController used to work in the logical display space, so TouchInputMapper and CursorInputMapper would need to transform the coordinates before interacting with it. This CL makes PointerController work in the display space. It will transform incoming and outgoing coordinates to stay in the display space using the DisplayInfo provided by SurfaceFlinger. Using info provided by SF also means that there will be better synchonization between the pointers and display changes like rotation. Bug: 188939842 Bug: 144544464 Test: manual: ensure mouse and touch spots work in different display orientations and sizes set using "adb shell wm size" Change-Id: I764c070adef7e9f26c0062f1b3466c7115a305ac
2021-11-16Merge "Look up source using & instead of equality"TreeHugger Robot
2021-11-15Look up source using & instead of equalitySiarhei Vishniakou
Source for an input device may be composite. On some devices, the source is specified as TOUCHSCREEN | STYLUS. That means a regular lookup of a MotionRange using just SOURCE_TOUCHSCREEN fails. Update the code to allow composite sources. Also, improve the source dump by printing words instead of numbers. Bug: 198472780 Test: adb shell dumpsys input Change-Id: I8d395f2bb5a6db031e5c2aa6c1f5152ff067a2bb
2021-11-11TouchMode (6.2/n) Fully detaching touch mode from focus event (native)Antonio Kantek
Bug: 193718270 Test: atest inputflinger_tests Test: atest libinput_tests Test: atest FrameworksCoreTests Test: atest CtsInputMethodTestCases Test: atest CtsInputTestCases Test: atest CtsSecurityTestCases Test: atest CtsWindowManagerDeviceTestCases Change-Id: I334c63d781ee8e8c13d21cc4a6cf323d885fc985
2021-11-08Move Joystick and Touchpad event transformation logic to MotionEventPrabir Pradhan
We would like to have all source and axis based transformations calculated in the same place, which will be in the MotionEvent class. This has the added benefit that MotionEvents created by developers through MotionEvent.obtain() in Java will behave like motion events generated from input devices in terms of how they're affected by transformations. Since axes from joysticks and touchpads should never be transfomred, we previously solved this by using identity matrices for them in InputDispatcher. Now, we move that logic to MotionEvent when applying the transform. Bug: 179274888 Test: atest libinput_test Test: atest inputflinger_tests Change-Id: Ic02466e01f2ba3131aca73bd10933ff81cb38cc9
2021-10-26MotionEvent: Report transformed orientation valuesPrabir Pradhan
Previously, the AXIS_ORIENTATION value reported by MotionEvent was unaffected by the window transform. This meant that whatever value that was generated by InputReader was the value reported to the window. This meant that if the window was rotated or scaled respective to the logical display and the window received an event, it could be the case that the 0 value no longer corresponds with the "up" direction of the window. Now that the input pipeline works in the display panel's coordinate system, we need the orientation value reported by MotionEvent to be affected by the window transform. This CL also refactors the shared logic by which transformed axis values are calculated into a common function. Bug: 179274888 Test: atest libinput_tests Test: atest inputflinger_tests Test: manual with test app and stylus Change-Id: Ibb6f135de47f7c1cbde3c023931a760dfbe08e45
2021-10-04VerifiedMotionEvent: Sign transformed raw valuesPrabir Pradhan
The values for axes X/Y that are stored in MotionEvent are transformed to values used for its getRaw API based on the source. This is because non-pointer sources should not have translation applied to them. We need to ensure that we use the same raw coordinates when we sign a VerifiedMotionEvent in InputDispatcher that we would get with the MotionEvent#getRaw API. To do this, we re-use the same logic used to transform the raw coordinates in MotionEvent in InputDispatcher. Bug: 179274888 Test: atest inputflinger_tests Test: atest VerifyInputEventTest Change-Id: I552f94064f15573ddda8f7c0b588cd3b984b6a94
2021-09-17Add display transform to MotionEvent for raw coordsPrabir Pradhan
Since input now works in display coordinates, we need to include the display projection with MotionEvent so that the getRaw API can continue to report logical display coordinates. It is also important to highlight the difference in the coordinate systems used by regular input windows and input monitors. MotionEvents coming from input monitors will always report values in unrotated logical display coordinates, because we do not yet have an API to report unrotated values in MotionEvents. Bug: 179274888 Test: presubmit Test: manual, ensure input works Change-Id: Ief3b2b31c6644beaa2f8c4b90302f441f93ab960
2021-09-14Cancel wallpaper touch stream when foreground window is goneSiarhei Vishniakou
When the foreground window is gone, we should also cancel the touch stream for its wallpaper window. We already cancel touch for the window itself, and for global monitor. Without this patch, the wallpaper window simply stops receiving touches, and never gets CANCEL, either. The behaviour is slightly strange for the global monitor in this case. First of all, the global monitor receives CANCEL, which is questionable (things like pointer location stop working). Also, it only gets cancel when a *new* event comes in. That said, it's probably fine, so let's just document this behaviour by adding a test for it. Bug: 192981537 Test: atest inputflinger_tests Change-Id: I8a2ef7cd552acc5cf64b2e13a6df5d5988bd1808
2021-09-09FTL: Extend enum utilities imported from IFDominik Laskowski
Generalize compile-time and run-time lookup of enumerator names by recognizing ftl_first and ftl_last to customize the range. Add enum_range<E>() for iteration using range-based `for` loop. Bug: 185536303 Test: Check assembly for small LUT in .rodata, and unrolled loops. Test: ftl_test, libinput_tests, inputflinger_tests Test: m libinputflinger Change-Id: I0581611f4cfcf5837b0293867cb323742afb2c87
2021-09-01Use sequence numbers to synchronize enabling Pointer Capture (1/2)Prabir Pradhan
InputReader only processes configuration change from its main thread. This means that if there is more than one Pointer Capture change request when the thread is busy or sleeping, it will only process the latest one. To ensure requests to enable Pointer Capture are synchronized with Dispatcher, we must use sequence numbers. Requests to enable Pointer Capture have a sequence number. Requests to disable Pointer Capture do not have a value. Bug: 195312888 Test: atest inputflinger_tests Test: manual with GeforceNow app, see bug. Change-Id: I6ae9c5498dc2f783b4c7211fa3665d42e29d2919
2021-07-20Merge "TouchEvent (1/n): Adding TouchModeEvent to InputChannel"Antonio Kantek
2021-07-15Plumb through display orientation separate from transform am: 0957669e41 am: ↵Evan Rosky
f854dad748 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15177988 Change-Id: I4715756a8369f7b8b7c00698cba480828eeb9128
2021-07-14TouchEvent (1/n): Adding TouchModeEvent to InputChannelAntonio Kantek
This CL detaches the touch mode state update from focus update. It does that by introducing a new internal event (TouchModeEvent). This CL also adds this event to InputChannel and related processing logic to InputPublisher and InputConsumer. InputDispatcher will process two different events now: FocusEvent when gaining/losing focus and TouchModeEvent when entering/leaving touch mode. Test: atest libinput_tests Bug: 193718270 Change-Id: Ie4e5b6e8e798f12d7203127b4559fa40d38788de
2021-07-14Plumb through display orientation separate from transformEvan Rosky
This is exclusively used for getRaw compatibility. The input transform can include window rotation and also, apparently, nested view rotations as it the events get mutated by ui-toolkit. Bug: 187686656 Test: cd frameworks/native/services/inputflinger && atest Change-Id: I2fd7a2b2acbe422d962d0646d41c60eb48160620
2021-07-06Merge "Fix AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT for non-linux builds" ↵Diego Perez
into sc-dev am: 199ca20ef4 am: c77cf4d087 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15215271 Change-Id: I3af369e7d59295e38b42ff1fd1cecac1167b3711
2021-07-06Merge "Fix AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT for non-linux builds" ↵Diego Perez
into sc-dev am: 199ca20ef4 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15215271 Change-Id: I2e468854742a154f04b476e7a86bbd3343ef93dc
2021-07-06Fix AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT for non-linux buildsDiego Perez
Remove semicolon as there are more enum elements. Bug: 192643379 Test: build for non-linux host Change-Id: Ia9e90f382d50ec52f0bad9c186031fd7ca29053a
2021-07-02Merge "Fix FLAG_IS_ACCESSIBILITY_EVENT for non-linux builds" into sc-dev am: ↵TreeHugger Robot
8f5d73a62a am: 1d8759d3ec Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15175856 Change-Id: I2e2ca25c365284cb47238988eef8f3f016916868
2021-07-02Merge "Fix FLAG_IS_ACCESSIBILITY_EVENT for non-linux builds" into sc-dev am: ↵TreeHugger Robot
8f5d73a62a Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15175856 Change-Id: If03ba00992ed22420e1642d8f57d334376cdb7bf
2021-07-02Fix FLAG_IS_ACCESSIBILITY_EVENT for non-linux buildsDiego Perez
Remove semicolon as there are more enum elements. Bug: 192643379 Test: build for non-linux host Change-Id: Id1f622180d7c567d68cb9997317d14868453395b
2021-07-01Merge "Set FLAG_IS_ACCESSIBILITY_EVENT for events injected from ↵TreeHugger Robot
accessibility" into sc-dev am: 61cfde719b am: 1e15906653 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15019654 Change-Id: Iba2cea16c808097d222538bfb52e193bfb5759b0
2021-07-01Merge "Set FLAG_IS_ACCESSIBILITY_EVENT for events injected from ↵TreeHugger Robot
accessibility" into sc-dev am: 61cfde719b Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15019654 Change-Id: I8dae253b5b0a54beb9696d3e6e2395be6b3a08e6
2021-06-30Set FLAG_IS_ACCESSIBILITY_EVENT for events injected from accessibilitySiarhei Vishniakou
If an input event was modified or injected by accessibility, set the appropriate flag. This helps applications distinguish the real hardware events from synthesized events. This also allows a11y services more flexibility in modifying the event streams coming from real hardware. Bug: 152399927 Bug: 175069843 Test: atest inputflinger_tests libinput_tests Change-Id: I805cba4c84582fa4cd4e0892ec00428d4b255ec6
2021-06-29Renamed and moved InputWindow and related fileschaviw
In preparation for the hierarchy listener interface, moved the InputWindow structs into libgui and have libinput dependant on libgui. Also renamed InputWindow to exclude Input since it will be used for more generic purposes. Test: Builds and flashes Bug: 188792659 Change-Id: I24262cbc14d409c00273de0024a672394a959e5f Merged-In: I24262cbc14d409c00273de0024a672394a959e5f
2021-06-28Renamed and moved InputWindow and related fileschaviw
In preparation for the hierarchy listener interface, moved the InputWindow structs into libgui and have libinput dependant on libgui. Also renamed InputWindow to exclude Input since it will be used for more generic purposes. Test: Builds and flashes Bug: 188792659 Change-Id: I24262cbc14d409c00273de0024a672394a959e5f
2021-06-16Merge "Avoid aidl usage on mac builds" into sc-dev am: 6123a6d95d am: ff52a643dfTreeHugger Robot
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14994078 Change-Id: Ie365b72de628cdddc3b851b8ad9bc149149c1d62
2021-06-16Avoid aidl usage on mac buildsSiarhei Vishniakou
We do not have libbinder on mac, so that rules out using aidl files for mac builds. To unbreak sdk_mac build targets, just use constant values directly on mac instead of trying to use IInputConstants. Bug: 152399927 Test: forrest Change-Id: I21697ec02dbb215edd89d2f6849c9147f490af99
2021-06-15Merge "Use the injected device id for events that are a11y trusted" into ↵Siarhei Vishniakou
sc-dev am: 9473f5563a am: 5210e8e564 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14673429 Change-Id: I681ba7105fa4d88edb972cb77fe94f64e16ea96a
2021-06-15Merge "Use the injected device id for events that are a11y trusted" into sc-devSiarhei Vishniakou
2021-06-09Merge "Return a copy of InputDeviceLightInfo instead of pointer" into sc-dev ↵TreeHugger Robot
am: 0d1e6c8331 am: 5f07e97c2a Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14847816 Change-Id: I8c25030bd75d3b2cab8ae07ca30e4b9a757cd4de
2021-06-08Return a copy of InputDeviceLightInfo instead of pointerSiarhei Vishniakou
Refactor InputReaderInterface to return a copy instead of pointer. This will ensure that we don't read from memory that's been freed. Also, refactor InputDevice api's to return a list of infos instead of having to query each individually. In all usages so far, there's no need to get a specific info by type. Bug: 190126442 Test: atest inputflinger_tests libinput_tests Change-Id: I7f993a14259bb802e2631663c1c8bb65cc9b6702
2021-06-04Use the injected device id for events that are a11y trustedSiarhei Vishniakou
If an event is a trusted event coming from accessibility, then allow the device id that's provided in the InputEvent to be used during injection. That means, events injected from accessibility will not always have device id == -1 (VIRTUAL_DEVICE_ID). The only exception are the events coming from external accessibility services (MotionEventInjector). For simplicity, we mark all of those events as untrusted. The flow is as follows: 1. When a11y is enabled, mInputFilterEnabled is set in InputDispatcher 2. Every event processed by dispatcher is first sent to InputFilter (=== accessibility). 3. The event from dispatcher sent to a11y has new flag, POLICY_FLAG_ACCESSIBILITY_TRUSTED. 4. By default, a11y passes all the policy flags back to inputdispatcher when it tries to reinject the event. 5. If a11y hits a path where untrusted events may be injected, it removes the FLAG_A11Y_TRUSTED from the policyFlags and continues the event handling. 6. Eventually, if a11y does not handle the input event, it sends it back to InputDispatcher using 'injectInputEvent(..., policyFlags)'. 7. InputDispatcher will look at the policyFlags of the injected event. If the new flag is present, InputDispatcher will create EventEntry with the provided device id. Otherwise, it will create EventEntry with the virtual device id (-1). 8. The events received by the apps will now have the original device id if a11y is enabled. Test: atest CtsInputTestCases:android.input.cts.GamepadWithAccessibilityTest Test: atest VerifyInputEventTest Bug: 175069843 Change-Id: Ie6399654f4434fdc8232e50373b6277d2f43a864
2021-05-24Merge "Change native lights to be consistent with java API." into sc-dev am: ↵Chris Ye
3a7faf308a am: cc454264f0 am: ccf806b97f Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14597492 Change-Id: Id88888f8e1a7b0af1e49a663bdc13e2f2d31d61a
2021-05-24Merge "Change native lights to be consistent with java API." into sc-devChris Ye
2021-05-21Merge changes from topic "input statistics" into sc-dev am: 9a049d867e am: ↵TreeHugger Robot
f32251f986 am: 5663acef80 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14058367 Change-Id: I93abcd11fd4a579ade54141151f7f8218daf2776
2021-05-17Remove LatencyStatistics from dispatcherSiarhei Vishniakou
Currently, InputDispatcher is sending touch event information to westworld. We will now be transitioning to new atoms that have better coverage and statistical significance. In this intermediate CL, we remove the LatencyStatistics so that we can replace it with something better in the upcoming CLs. Bug: 167947340 Test: m libinput_tests inputflinger_tests Change-Id: I8fcb846321245011c3b6e6f896b99b8d9037a2a4
2021-05-16Change native lights to be consistent with java API.Chris Ye
Change native lights type to match java API light types. Bug: 181743615 Test: atest InputDeviceLightsManagerTest, atest LightsManagerTest, atest android.hardware.input.cts.tests Change-Id: I45fe0489fdc070bb4057f4bea061f0cbeacad0de