Synchronize pointer display change requests
Previously, when InputManagerService requests for PointerController to
change the pointer display, there was no way to know when the request
was completed or whether it succeeded. This could lead to a few issues:
- WM's MousePositionTracker's coordinates would not be updated until the
next mouse event was generated, meaning the position would be out of
sync.
- The creation of a virtual mouse device moves the pointer to a specific
displayId. In order to test this behavior, we would need to sleep in
the test code to wait for the system to update the pointer display and
position, resulting in generally flaky tests.
Here, we add a way to synchonize changes to the pointer display so that
InputMangerService can know the current pointer display with certainty.
PointerController, which is updated in the InputReader thread, is the
source of truth of the pointer display. We add a policy call to notify
IMS when the pointer display changes.
When the pointer display is changed, the cursor position on the updated
display is also updated so that the VirtualMouse#getCursorPosition() API
is synchronized to the pointer display change.
Bug: 216792538
Test: atest FrameworksServicesTests:InputManagerServiceTests
Test: atest PointerIconTest
Change-Id: I578fd1aba9335e2e078d749321e55a6d05299f3b
13 files changed