Make virtual input device creation synchronous
To ensure that virtual device creation is synchronized with changing
other system parameters (such as changing the display of the mouse
pointer), we must make virtual input device creation synchronous.
This is required to ensure that the VirtualMouse#getCursorPosition API
returns the correct value as soon as the virtual mouse device is
created.
The system only holds on to a PointerController when there is an input
device that can control the pointer that is connected. This is so that
we don't need to hold on to cursor graphics resources when there's no
mouse or touchpad connected. This means we can only synchronize updating
the pointer display once we know such an input device is connected.
In this CL, we update the virtual input device creation to wait on the
binder thread until the system recognizes the new virtual input device.
We also clean up the virtual device creation logic to ensure the proper
cleanup is done if creation fails at any point.
Bug: 216792538
Test: atest VirtualDeviceManagerServiceTest InputControllerTest
Test: atest VirtualMouseTest
Change-Id: I3b893d23cacec988eb49c9fd3a79cebe31a59c05
Merged-In: I3b893d23cacec988eb49c9fd3a79cebe31a59c05
5 files changed