summaryrefslogtreecommitdiff
path: root/libs/input
AgeCommit message (Collapse)Author
2025-02-06Use Display Events from DisplayEventType Enum class Manasi Navare
Display Events are now defined as part of the new DisplayEventType Enum class in android namespace. Use it from there instead of DisplayEventReceiver enum. Bug: 393133868 Test: Manual Flag: com.android.graphics.surfaceflinger.flags.display_config_error_hal Change-Id: Idcd2bc3f0ab532a3e5c86e52e59367c22351b994 Signed-off-by: Manasi Navare <navaremanasi@google.com>
2024-12-03Refactor to replace FloatPoint by vec2 Arpit Singh
Using FloatPoint requires unnecessory conversion between vec2 and FloatPoint, which is inefficient. This CL replaces FloatPoint by vec2 everywhere. Test: atest inputflinger_tests Bug: 245989146 Flag: EXEMPT refactor Change-Id: I0bf9cd35392bff424ec65bbaa43918176d31de37
2024-12-02Expose current viewport transform of PointerController Arpit Singh
This CL adds API to expose the current viewport transform of the PointerController. This will be used by Choreographer to find the target display and cursor position in the topology, when cursor moves across the displays. Test: presubmit Bug: 367660694 Flag: com.android.input.flags.connected_displays_cursor Change-Id: If4fe9fade2bf55f29db377661820ef7a8ca73ba2
2024-12-02Check if cursor has moved out of viewport bounds in CursorController Arpit Singh
This CL updates CursorController to check if and which boundary the cursor has crossed. This will be used to enable cursor moving between different connected displays. Test: atest inputflinger_tests Test: verify cursor can move between displays as expected Bug: 367660694 Flag: com.android.input.flags.connected_displays_cursor Change-Id: Ida11e897d4e6767549dcc40da5c83e4c6be178c9
2024-11-19Check SpriteIcon validity before drawing Prabir Pradhan
Bug: 376270995 Change-Id: I14dfdd9b4777075fe3b04ad69fa2d048de68479d Flag: EXEMPT adding precondition check Test: presubmit
2024-11-18Revert "Check if cursor has moved out of viewport bounds in Curs..." Liana Kazanova (xWF)
Revert submission 30111126-cd-cursor Reason for revert: DroidMonitor: Potential culprit for http://b/379706345 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Reverted changes: /q/submissionid:30111126-cd-cursor Change-Id: Ibff6c02be1359729802d4c85fa8dc0fdb4c75492
2024-11-18Check if cursor has moved out of viewport bounds in CursorController Arpit Singh
This CL updates CursorController to check if and which boundary the cursor has crossed. This will be used to enable cursor moving between different connected displays. Test: presubmit and manual Bug: 367660694 Flag: com.android.input.flags.connected_displays_cursor Change-Id: Ib559e0d72364f446269e73cfa1671ee9d2f715ac
2024-09-17Use integer coordinates as the cursor starting point on a display Prabir Pradhan
Ensure that the mouse cursor starts off with integer coordinates. Also, remove the unused getBounds method. Bug: 332973324 Test: atest PointerIconTest Test: Presubmit Flag: EXEMPT refactor Change-Id: Ieb26e443d047b016980001ec51002d3d40d00e91
2024-09-02Add CursorController to the input dump Arpit Singh
Test: manually validate `adb shell dumpsys input` Bug: 245989146 FLAG: EXEMPT log only update Change-Id: Ibab15f613e3076df2ac2ac2e672ce9e699de7f67
2024-06-04Remove unused libui dependency Siarhei Vishniakou
This dependency is not needed. Bug: 343933987 Test: presubmit Change-Id: I13e0f3c40b7c1ef39c1fa7ab499254ace10d0396
2024-05-31Merge "Remove libnativewindow dependency" into main Siarhei Vishniakou
2024-05-31Fix race condition in PointerControllerTest Arpit Singh
A previous CL ag/27261516 moved initialisation of thread before the looper it uses. It introduced a race condition causing tests failures. This CL changes order of initliation to ensure looper is always initilised befor the thread. Bug: 343818855 Test: atest libinputservice_test Change-Id: Ibcb4d31be6a607f37eeee7207182cdd5eb1d7ead
2024-05-31Remove libnativewindow dependency Siarhei Vishniakou
This is not needed to build the code that links it. Bug: 343933987 Test: m libinputservice_test libinputservice Change-Id: I181c8c42c343e43e0b592ea8af97b41fb704da34
2024-05-30Add method to set SkipScreenshot flag on cursorcontroller sprites Arpit Singh
Add a methods to be able to set ISurfaceComposerClient::eSkipScreenshot flag on MouseCursorController. This will be used to hide mouse and stylus pointers on mirrored displays when a privacy sensitive window is present on source display. Test: manual test & atest PointerControllerTest Bug: 325252005 Change-Id: Ide428e8daf96a1d919adb9d6374a9ea738f87cc5
2024-05-14Replace ADISPLAY_ID_ constants with LogicalDisplayId equivalents Siarhei Vishniakou
This will help remove ADISPLAY_ID_ constants. Bug: 339106983 Test: m checkinput Change-Id: I37e1ccf4872c0758b2817121199ef5beee7e107f
2024-05-09Use a strongly typed LogicalDisplayId for displayId(1/n) Linnan Li
Currently, we use int32_t for displayId, which is not a safe type, and it may also lead to misdefinition of types. Here, we introduce LogicalDisplayId as a strong type for displayId and move all contents of constants.h into LogicalDisplayId.h. Bug: 339106983 Test: atest inputflinger_tests Test: atest InputTests Test: presubmit Change-Id: I1c348d7f08524471391b21eaba938501506a7772 Signed-off-by: Linnan Li <lilinnan@xiaomi.corp-partner.google.com>
2024-05-09Merge "Initialize skipScreenshot field and use default initialization ↵ Arpit Singh
syntax" into main
2024-05-09Initialize skipScreenshot field and use default initialization syntax Arpit Singh
Initialize the skipScreenshot field missed in ag/26732951. This CL also removes default constructor in favour of default member initialization syntax. Test: presubmit Bug: 325252005 Flag: N/A Change-Id: I33b9513ac5ea27b48da2aa30ab52c75cf6a27996
2024-05-08PointerController: Cleanup after PointerChoreographer refactor Prabir Pradhan
Bug: 311416205 Test: build, presubmit Change-Id: I7a5d801f2988b37f81afe999a9143e2ff1055bc4
2024-05-08NativeInputManager: Cleanup after PointerChoreographer refactor Prabir Pradhan
Bug: 311416205 Test: build, presubmit Change-Id: Ic52e122f6f2c14f401cea534afef3a7a1822aa40
2024-05-07Hide touch indicators on mirrored displays if a secure window is present Arpit Singh
Utilise ISurfaceComposerClient::eSkipScreenshot to remove the tap indicators from mirrored displays when a secure window is present. End-to-end test will be added in an upcoming CL. Test: manual test & atest PointerChoreographerTest PointerControllerTest Bug: 325252005 Change-Id: I72a77b1a1b2c02a5e94f05e67d0cd39588086c81
2024-03-25Update sprite surface when desired width or height changes. Pat Manning
Previously only updating when increasing. Bug: 331260947 Bug: 305193969 Test: Manual Flag: ACONFIG com.android.systemui.enable_vector_cursors TRUNKFOOD Change-Id: I3ae6fb398e31a7b9aca6bfdcc5a39136cc6d85af
2024-03-06Set draw drop shadow for vector pointer icons when sprite is set. Pat Manning
Drop shadow was not being retained when reloading pointers, like when the display size changes. Bug: 305193969 Test: Manual Flag: ACONFIG com.android.systemui.enable_vector_cursors STAGING Change-Id: Ic6c80166df0d64ca5709aac7ca401f442564698d
2024-02-26Read pointer choreographer flag at boot Prabir Pradhan
In native code, we are sometimes reading the enable_pointer_choreographer flag value at boot, and sometimes later during runtime. Since DeviceConfig flag values can change at runtime, the flag values loaded later can sometimes change, resulting in an unexpected state where some code relies on the boot-time value and others on the "current" value. While we should have been using read-only flags in the first place, we cannot convert existing flags to be read-only. So to increase consistency within native code, change all reads of the enable_pointer_choreographer flag to happen at boot. Bug: 324534774 Test: Presubmit Change-Id: Id31496d987e2647fc1176dbdbba67bd6e4443aa1
2024-02-09SpriteIcon: Clean up header Prabir Pradhan
Bug: 305193969 Test: build Change-Id: Ib1c910a11810b2eb4910c455363273ea20a2d080
2024-02-08Add support for drawing drop shadow for PointerIcons in native code. Pat Manning
Bug: 305193969 Test: Manual Flag: ACONFIG com.android.systemui.enable_vector_cursors DEVELOPMENT Change-Id: Id19c11ccc4b528afdad19f6b68b36411108853c4
2024-01-23PointerController: Simplify display info listener registration Prabir Pradhan
Bug: 313033164 Test: Presubmit Change-Id: I71e4943d36e0e3b5b0c9eaaaef7c8d04a82ba90d
2024-01-23PointerController: Get initial DisplayInfos from SurfaceComposerClient Linnan Li
After the PointerController is created, if SurfaceFlinger hasn't called back to notify DisplayInfo,the PointerController won't have DisplayInfo, if the actual display exists and transforms at this time, using the display touch position will result in the wrong actual display position. Steps to reproduce the problem. 1. Switch the device to landscape. 2. Execute `adb shell settings put system show_touch 1`. 3. Touch the screen. 4. At this point, you can observe that the screen flashes an incorrect touch point location. How to fix it The addWindowInfosListener method has a parameter to get the initial position, which we use to get the current DisplayInfo at creation time. Even though this information would not exist if there were no other listeners, it doesn't matter here because the InputDispatcher was created long before the PointerController, and the InputDispatcher already added a listener, so the DisplayInfo information must exist, so we don't have to worry about this. Bug: 313033164 Test: Manual Change-Id: Ia942c85d1b2204690f69e6a2ba43cfb7542af27c Signed-off-by: Linnan Li <lilinnan@xiaomi.corp-partner.google.com>
2023-12-12Pointer Icon Refactor: Update PointerController tests Prabir Pradhan
When PointerChoreographer is enabled, the PointerControllers are used in a different way, where the presentation mode is set once and never changed. This should be reflected in the tests. When the flag is enabled, ensure that the tests call the APIs in the expected manner. Bug: 293587049 Bug: 315538661 Test: atest libinputservice_test Change-Id: I24205c4c02484c4a28946c152a2c507bfc371b8e
2023-12-07Pointer Icon Refactor: Allow presentation mode to be set without display Prabir Pradhan
When PointerChoreographer is enabled, each PointerController will have its mode set during construction, and the mode will never change. Allow the mode to be set before the viewport is assigned to it. Bug: 293587049 Test: manual Change-Id: I1329a5635407f4af4c201ab876f540085b3747d7
2023-12-04Add setPointerIcon for PointerChoreographer (base) Byoungho Jung
To set pointer icon for mouse or stylus, we are going to use setPointerIcon with more parameters which will be useful for multi-device experience and security. Test: Manual Bug: 293587049 Change-Id: I17bb047b0bfbff6cf3a129e4fa742ec489420faf
2023-11-08Address additional comments: Pointer icon refactor for touch/stylus Prabir Pradhan
Bug: 293587049 Test: atest inputflinger_tests Change-Id: I831feaf0921dfdc389e79a88690f75fa51c43720
2023-11-08Modify getPosition of disabled PointerController Byoungho Jung
PointerChoreographer has to combine fake finger coordinates with the position of MousePointerController to process some touchpad events. The legacy PointerController which is disabled should return (0, 0) instead of (nan, nan) on getPosition, so that GestureConverter can set x-y axes correctly. Test: atest libinputservice_test Bug: 293587049 Change-Id: I7630cd16defc9324970f0c29851c80f1b9943977
2023-11-08Pointer icon refactor for stylus (base) Byoungho Jung
When PointerChoreographer is enabled, PointerChoreographer can create multiple StylusPointerControllers for each stylus device. A StylusPointerController is created when the corresponding stylus sends the first hover event. It can show and hide a hover pointer on the associated display. Test: atest libinputservice_test Bug: 293587049 Change-Id: I208f09f0e0f73a6396d60f5b2bd0242dddd3c66b
2023-11-08Pointer icon refactor for touch (base) Byoungho Jung
When PointerChoreographer is enabled, PointerChoreographer can create multiple TouchPointerControllers for each touch device when 'Show taps' is enabled. A TouchPointerController is reponsible for one touch device and it can show touch spots on the associated display. Test: atest libinputservice_test Bug: 293587049 Change-Id: I1a624a6a50023c530e709cc5fc0704b0b997125b
2023-11-03Pointer icon refactor for mouse (base) Byoungho Jung
When PointerChoreographer is enabled, CursorInputMapper no longer depends on the legacy PointerController. PointerChoreographer is responsible for accumulating movements, fading/unfading pointers, and deciding display/coordinates. Test: atest libinputservice_test Bug: 293587049 Change-Id: Ie35b385a99623bbcb2e47b394b7cf2c0f7c5bc0e
2023-09-27Use TestPointerController in libinputservice_test Siarhei Vishniakou
This test is currently affecting SF state. Even though the bug is in SF, add a workaround here while the SF is getting fixed to unbreak our presubmit. In the future, we can consider adding a proper integration test for checking PointerController behaviour with the real SF. Bug: 301657737 Test: atest libinputservice_test Test: atest VirtualDpadTest Change-Id: Ia70e13add397ba10bde36a07d132e8dbc252eacd
2023-09-06Addressed missed comments from ag/24539449 Prabir Pradhan
The CL with Change-ID Ib6b124db4108d11260b220cc57444007b9d865a6 was submitted before all reviewers had a chance to take a look. Addressing missed comments here. Bug: 293587049 Bug: 278783893 Test: presubmit Change-Id: I2946c0216935a35af05a3f74f1e2a5bd8e23fed1
2023-08-28Allow PointerController to be disabled on creation Prabir Pradhan
Disable the legacy PointerController when the PointerChoreographer is enabled. Bug: 278783893 Test: manual Change-Id: I475f3286c83b90e161e186e62c2842e539434603
2023-08-24Introduce PointerChoreographer stage in C++ Prabir Pradhan
PointerChoreographer will be the new inputflinger component responsible for managing the pointer icons drawn on the screen. In this CL, we set up the PointerChoreographer, which will be created when the choreographer is enabled. Bug: 293587049 Bug: 278783893 Test: adb shell setprop persist.input.enable_pointer_choreographer 1; boot Change-Id: Ib6b124db4108d11260b220cc57444007b9d865a6
2023-08-18Use std::shared_ptr for SpriteController Prabir Pradhan
Remove RefBase from SpriteController, and use std::shared_ptr. We cannot migrate to std::unique_ptr because we have to post messages to the handler, which needs to have a weak reference to the object. Bug: 278783893 Test: presubmit Change-Id: I0ea4bb220e5b1866375ed39335f9035cd4bb766c
2023-08-17Strong pointer fixes in libinputservice Prabir Pradhan
Make components of libinputservice work with implicit conversions disabled for strong pointers. Bug: 278783893 Test: Build Change-Id: Ibe1e97c845662113437635efd7a1e875e8407c64
2023-07-06Merge "Update OWNERS of libs/input" am: 60a6004712 am: 8767ca9302 am: 030335dc97 Prabir Pradhan
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2647579 Change-Id: I12f7f16815cad14d2daaf214f9a181b4f37b602e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-30Update OWNERS of libs/input Prabir Pradhan
Bug: 289544381 Test: Upload Change-Id: Iff5feb3ce994497ce5aac15c09cbf7c0d57c2a64
2023-05-03Add vsync id and timestamp to WindowInfosListener Patrick Williams
Bug: 279792237 Test: presubmits Change-Id: I6396800fe7673f592a79c0e9a9f43f68c6443300
2023-03-15Remove getButtonState/setButtonState from PointerController Siarhei Vishniakou
These APIs are not being used. Bug: 217579815 Test: m libinputservice_test Change-Id: I47fb5478caff7d77217c1da600c37556e6a288a8
2023-03-13Return values in PointerController's getters Prabir Pradhan
Rather than passing pointers in to get output from the functions, return values from getPosition() and getBounds(). Bug: 245989146 Bug: 21566609 Test: Build, presubmit Change-Id: Ie5b44a433c94b6c455486922f6894ccde1f1b127
2023-03-13Get mouse cursor position from PointerController instead of WM Prabir Pradhan
PointerController is the source of truth of the mouse cursor position. When the VirtualDevice APIs queried the cursor position, we were previously getting the position from WM. WM's values only update once system_server's global monitor has processed the input event, which leads us into a race condition. Remove the race consition by querying the mouse cursor position directly from PointerController. Bug: 266687189 Test: atest VirtualMouseTest Change-Id: Id0e0e20a0d547f969d3a27d43fdfdca34d0fa7c0
2023-02-02Separate default pointer for mouse and stylus (frameworks/base part) Seunghwan Choi
PointerIcon.TYPE_NOT_SPECIFIED will be used for requesting default pointer. For the type, MouseCursorController will decide whether to show mouse or stylus icon, based on the active source. Need complement: the resource for default stylus icon should be added. Test: Manual Test(hover pointer on handwriting area) Bug: b/215436642 Change-Id: I6a337cb69bea57427f676e561900802270d206ae
2022-11-30Convert orientation values in input to ui::Rotation. Michael Wright
ui::Rotation both provides better typesafety as well as some convenience functions (e.g. operator+, operator-). Test: atest TouchVideoFrame_test.cpp InputReader_test.cpp Change-Id: I142e0a8d121316e2c9ac8ca8f1de040e56bc8ddd