Revert "InputDevice: return std::optional from getAbsoluteAxisInfo"
This reverts commit 67e1ae63301dc02f4d940b5f480b1f495b3b977e.
Reason for revert: b/353921348
Change-Id: I6148dec70b7ca1c9a21d841b791168b5bfc67ca3
diff --git a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
index daab636..24efae8 100644
--- a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
@@ -240,15 +240,14 @@
mGestureConverter(*getContext(), deviceContext, getDeviceId()),
mCapturedEventConverter(*getContext(), deviceContext, mMotionAccumulator, getDeviceId()),
mMetricsId(metricsIdFromInputDeviceIdentifier(deviceContext.getDeviceIdentifier())) {
- if (std::optional<RawAbsoluteAxisInfo> slotAxis =
- deviceContext.getAbsoluteAxisInfo(ABS_MT_SLOT);
- slotAxis && slotAxis->maxValue >= 0) {
- mMotionAccumulator.configure(deviceContext, slotAxis->maxValue + 1, true);
- } else {
+ RawAbsoluteAxisInfo slotAxisInfo;
+ deviceContext.getAbsoluteAxisInfo(ABS_MT_SLOT, &slotAxisInfo);
+ if (!slotAxisInfo.valid || slotAxisInfo.maxValue < 0) {
LOG(WARNING) << "Touchpad " << deviceContext.getName()
<< " doesn't have a valid ABS_MT_SLOT axis, and probably won't work properly.";
- mMotionAccumulator.configure(deviceContext, 1, true);
+ slotAxisInfo.maxValue = 0;
}
+ mMotionAccumulator.configure(deviceContext, slotAxisInfo.maxValue + 1, true);
mGestureInterpreter->Initialize(GESTURES_DEVCLASS_TOUCHPAD);
mGestureInterpreter->SetHardwareProperties(createHardwareProperties(deviceContext));