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

Skip to content
Commit b6f1128f authored by Michael Crimando's avatar Michael Crimando Committed by Antonio Kantek
Browse files

Bind an input device via descriptor



These changes solve a problem for systems that have multiple displays
as well as 2 or more input devices with the exact same name. (e.g. 2
Xbox Series X controllers will report the exact same device name).

Currently the default behavior for overall Android is that input
device inputs go towards the last screen that the user touched.
On systems where a single computer is used for displaying content to
multiple people, this can be a problem. A user may be trying to play a
game with a controller on screen 1, while a second user tries to
browse the internet on screen 2. If the user on screen 2 touches the
screen, it'll keep sending the controller input events to screen 2
instead of the game on screen 1.

To fix this, the system can use a function to bind controllers to a
display. The system can just find an input device by device name
and make sure all inputs from that controller go to the correct
display. That ensures that no matter what, the controller inputs go to
the desired game on screen 1.

Now consider a single system with 2 screens and 2 different users
trying to play controller games. User A will want their controller
inputs to go to screen 1 and User B will want their controller inputs
to go to screen 2. This is possible with the current functionality.
That is, unless the controllers have the exact same device name. In
that case the controllers can only be locked to one screen or another.

Device names are not unique. However, descriptors are unique per
device. This would allow the system to uniquely identify each input
device and bind them to the correct screen.

Descriptors also cover certain scenarios. Such as a keyboard with a
track pad built into it. It'll be 2 different input devices with 2
different device names but the same descriptor.

Test: Built and run on hardware, (Adopted to run on Android 12L)
Test: Passed all tests under atest InputManagerServiceTests with lunch sdk_phone_x86_64-eng
Test: atest FrameworksServicesTests InputTests InputManagerServiceTests
Test: atest libsurfaceflinger_unittest
Bug: 324075859

Signed-off-by: default avatarMichael Crimando <mcriman1@ford.com>
Change-Id: I5c65b61652e5f4946d63d8ab7309093e49e65083
parent 85c0cb10
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment