Update uniqueId association native methods
Change the association mechanism from names to physical port locations
(PHYS). In addtion, read and match the associations for touchscreens as
well as for cursor input devices.
Bug: 202273865
Test: atest inputflinger_tests
Change-Id: I4ed2f140d2125833f239ffcb16f5efff9d342acf
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index 4772beb..f729ba9 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -565,6 +565,12 @@
return getDeviceContext().getAssociatedViewport();
}
+ const std::optional<std::string> associatedDisplayUniqueId =
+ getDeviceContext().getAssociatedDisplayUniqueId();
+ if (associatedDisplayUniqueId) {
+ return getDeviceContext().getAssociatedViewport();
+ }
+
if (mDeviceMode == DeviceMode::POINTER) {
std::optional<DisplayViewport> viewport =
mConfig.getDisplayViewportById(mConfig.defaultPointerDisplayId);