Allow touchpads to expose associated display
After landing ag/24209603, a touchpad test started failing; the
reason is that the device never exposed the associated display id,
even though it became associated to a viewport. This CL makes the
necessary changes so the associated display id is properly
propagated.
Bug: 293488187
Test: atest of the failing test
Change-Id: Ia1480012bd339de92abd284c6d00f7ac93505735
diff --git a/services/inputflinger/reader/mapper/TouchpadInputMapper.h b/services/inputflinger/reader/mapper/TouchpadInputMapper.h
index 73ca5af..47d712e 100644
--- a/services/inputflinger/reader/mapper/TouchpadInputMapper.h
+++ b/services/inputflinger/reader/mapper/TouchpadInputMapper.h
@@ -64,6 +64,8 @@
using MetricsIdentifier = std::tuple<uint16_t /*busId*/, uint16_t /*vendorId*/,
uint16_t /*productId*/, uint16_t /*version*/>;
+ std::optional<int32_t> getAssociatedDisplayId() override;
+
private:
void resetGestureInterpreter(nsecs_t when);
explicit TouchpadInputMapper(InputDeviceContext& deviceContext,
@@ -102,6 +104,11 @@
std::set<int32_t> mLastFrameTrackingIds;
// Tracking IDs for touches that have at some point been reported as palms by the touchpad.
std::set<int32_t> mPalmTrackingIds;
+
+ // The display that events generated by this mapper should target. This can be set to
+ // ADISPLAY_ID_NONE to target the focused display. If there is no display target (i.e.
+ // std::nullopt), all events will be ignored.
+ std::optional<int32_t> mDisplayId;
};
} // namespace android