summaryrefslogtreecommitdiff
path: root/libs/input/PointerController.h
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2022-03-10 14:39:46 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2022-04-14 18:56:49 +0000
commit0e3d66523da54a5df03cd7a73a797c1812b1dd0e (patch)
tree21d59ead2a29cfeea4b47987147c47642ad4490a /libs/input/PointerController.h
parent294b44d0c740fb8e454517db6c4cc24488df7d64 (diff)
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
Diffstat (limited to 'libs/input/PointerController.h')
-rw-r--r--libs/input/PointerController.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index 2e6e851ee15a..eab030f71e1a 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -104,6 +104,7 @@ private:
struct Locked {
Presentation presentation;
+ int32_t pointerDisplayId = ADISPLAY_ID_NONE;
std::vector<gui::DisplayInfo> mDisplayInfos;
std::unordered_map<int32_t /* displayId */, TouchSpotController> spotControllers;