Revert "Send mapper events via context"
This reverts commit cec3f6a94b1cd510d6c2f7ef9935db95fa115297.
As we discussed with Chris and Michael, it is more natural to keep the
flow of inputreader -> inputdevice -> inputmapper -> inputlistener
rather than having to come back to inputreader.
This also reduces the redundancy of having to mimic the inputlistener
interface inside the inputreader context.
Bug: 169866723
Test: atest inputflinger_tests
Change-Id: I4244947810d99ff40cfffaa34f6374aa18a238c6
diff --git a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
index 3f8a364..594ff42 100644
--- a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
@@ -121,12 +121,13 @@
int32_t metaState = getContext()->getGlobalMetaState();
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_SCROLL, scroll * mScalingFactor);
- getContext()->notifyMotion(when, getDeviceId(), mSource, displayId, policyFlags,
- AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState,
- /* buttonState */ 0, MotionClassification::NONE,
- AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
- &pointerCoords, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
- AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, /* videoFrames */ {});
+ NotifyMotionArgs scrollArgs(getContext()->getNextId(), when, getDeviceId(), mSource,
+ displayId, policyFlags, AMOTION_EVENT_ACTION_SCROLL, 0, 0,
+ metaState, /* buttonState */ 0, MotionClassification::NONE,
+ AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
+ &pointerCoords, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
+ AMOTION_EVENT_INVALID_CURSOR_POSITION, 0, /* videoFrames */ {});
+ getListener()->notifyMotion(&scrollArgs);
}
mRotaryEncoderScrollAccumulator.finishSync();