diff options
-rw-r--r-- | services/inputflinger/dispatcher/LatencyAggregatorWithHistograms.cpp | 3 | ||||
-rw-r--r-- | services/inputflinger/tests/LatencyTracker_test.cpp | 20 |
2 files changed, 19 insertions, 4 deletions
diff --git a/services/inputflinger/dispatcher/LatencyAggregatorWithHistograms.cpp b/services/inputflinger/dispatcher/LatencyAggregatorWithHistograms.cpp index 881a96b28e..4da05c19cf 100644 --- a/services/inputflinger/dispatcher/LatencyAggregatorWithHistograms.cpp +++ b/services/inputflinger/dispatcher/LatencyAggregatorWithHistograms.cpp @@ -133,10 +133,11 @@ void LatencyAggregatorWithHistograms::addSampleToHistogram( } void LatencyAggregatorWithHistograms::processStatistics(const InputEventTimeline& timeline) { - // Only gather data for Down, Move and Up motion events and Key events + // Only gather data for Down, Move, Up and Scroll motion events and Key events if (!(timeline.inputEventActionType == InputEventActionType::MOTION_ACTION_DOWN || timeline.inputEventActionType == InputEventActionType::MOTION_ACTION_MOVE || timeline.inputEventActionType == InputEventActionType::MOTION_ACTION_UP || + timeline.inputEventActionType == InputEventActionType::MOTION_ACTION_SCROLL || timeline.inputEventActionType == InputEventActionType::KEY)) return; diff --git a/services/inputflinger/tests/LatencyTracker_test.cpp b/services/inputflinger/tests/LatencyTracker_test.cpp index ca0f1e8999..1cfaaa8418 100644 --- a/services/inputflinger/tests/LatencyTracker_test.cpp +++ b/services/inputflinger/tests/LatencyTracker_test.cpp @@ -57,6 +57,7 @@ void setDefaultInputDeviceInfo(LatencyTracker& tracker) { } const auto FIRST_TOUCH_POINTER = PointerBuilder(/*id=*/0, ToolType::FINGER).x(100).y(200); +const auto FIRST_MOUSE_POINTER = PointerBuilder(/*id=*/1, ToolType::MOUSE); /** * This is a convenience method for comparing timelines that also prints the difference between @@ -491,8 +492,13 @@ TEST_F(LatencyTrackerTest, TrackListenerCheck_InputEventActionTypeFieldInputEven /*vendorId*/ 0, /*productId*/ 0, {InputDeviceUsageSource::BUTTONS}, InputEventActionType::KEY); - InputEventTimeline unknownTimeline( + InputEventTimeline motionScrollTimeline( /*eventTime*/ 12, /*readTime*/ 13, + /*vendorId*/ 0, /*productId*/ 0, {InputDeviceUsageSource::MOUSE}, + InputEventActionType::MOTION_ACTION_SCROLL); + + InputEventTimeline unknownTimeline( + /*eventTime*/ 14, /*readTime*/ 15, /*vendorId*/ 0, /*productId*/ 0, {InputDeviceUsageSource::TOUCHSCREEN}, InputEventActionType::UNKNOWN_INPUT_EVENT); @@ -529,8 +535,15 @@ TEST_F(LatencyTrackerTest, TrackListenerCheck_InputEventActionTypeFieldInputEven .readTime(keyUpTimeline.readTime) .deviceId(DEVICE_ID) .build()); + mTracker->trackListener( + MotionArgsBuilder(AMOTION_EVENT_ACTION_SCROLL, AINPUT_SOURCE_MOUSE, inputEventId + 5) + .eventTime(motionScrollTimeline.eventTime) + .readTime(motionScrollTimeline.readTime) + .deviceId(DEVICE_ID) + .pointer(FIRST_MOUSE_POINTER) + .build()); mTracker->trackListener(MotionArgsBuilder(AMOTION_EVENT_ACTION_POINTER_DOWN, - AINPUT_SOURCE_TOUCHSCREEN, inputEventId + 5) + AINPUT_SOURCE_TOUCHSCREEN, inputEventId + 6) .eventTime(unknownTimeline.eventTime) .readTime(unknownTimeline.readTime) .deviceId(DEVICE_ID) @@ -541,7 +554,8 @@ TEST_F(LatencyTrackerTest, TrackListenerCheck_InputEventActionTypeFieldInputEven std::vector<InputEventTimeline> expectedTimelines = {motionDownTimeline, motionMoveTimeline, motionUpTimeline, keyDownTimeline, - keyUpTimeline, unknownTimeline}; + keyUpTimeline, motionScrollTimeline, + unknownTimeline}; assertReceivedTimelines(expectedTimelines); } |