InputDevice: return std::optional from getAbsoluteAxisInfo
This also allows us to remove the valid field from RawAbsoluteAxisInfo,
since we can represent "invalid" axes (which usually just meant absent
ones) using std::nullopt.
Test: atest inputflinger_tests
Test: m checkinput
Test: Check "Raw Touch Axes" section of touch input mapper info in
dumpsys input
Bug: 245989146
Flag: EXEMPT refactor
Change-Id: I045a2e0b61a84657f2f8171c1fee3cc3e331ac86
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.h b/services/inputflinger/reader/mapper/TouchInputMapper.h
index 30c58a5..beab6e7 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.h
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.h
@@ -61,17 +61,17 @@
struct RawPointerAxes {
RawAbsoluteAxisInfo x{};
RawAbsoluteAxisInfo y{};
- RawAbsoluteAxisInfo pressure{};
- RawAbsoluteAxisInfo touchMajor{};
- RawAbsoluteAxisInfo touchMinor{};
- RawAbsoluteAxisInfo toolMajor{};
- RawAbsoluteAxisInfo toolMinor{};
- RawAbsoluteAxisInfo orientation{};
- RawAbsoluteAxisInfo distance{};
- RawAbsoluteAxisInfo tiltX{};
- RawAbsoluteAxisInfo tiltY{};
- RawAbsoluteAxisInfo trackingId{};
- RawAbsoluteAxisInfo slot{};
+ std::optional<RawAbsoluteAxisInfo> pressure{};
+ std::optional<RawAbsoluteAxisInfo> touchMajor{};
+ std::optional<RawAbsoluteAxisInfo> touchMinor{};
+ std::optional<RawAbsoluteAxisInfo> toolMajor{};
+ std::optional<RawAbsoluteAxisInfo> toolMinor{};
+ std::optional<RawAbsoluteAxisInfo> orientation{};
+ std::optional<RawAbsoluteAxisInfo> distance{};
+ std::optional<RawAbsoluteAxisInfo> tiltX{};
+ std::optional<RawAbsoluteAxisInfo> tiltY{};
+ std::optional<RawAbsoluteAxisInfo> trackingId{};
+ std::optional<RawAbsoluteAxisInfo> slot{};
inline int32_t getRawWidth() const { return x.maxValue - x.minValue + 1; }
inline int32_t getRawHeight() const { return y.maxValue - y.minValue + 1; }