InputEventTimeline field fixes
Small fixes and removed isDown field from InputEventTimeline.
Modified LatencyAggregator to use inputEventActionType instead of isDown to distinguish between down and other types of motion events.
Bug: 270049345
Test: atest inputflinger_tests
Flag: EXEMPT bugfix
Change-Id: I3d0fd64baf7b3b5df412cfbd0525818667135b1c
diff --git a/services/inputflinger/dispatcher/LatencyTracker.cpp b/services/inputflinger/dispatcher/LatencyTracker.cpp
index 721d009..69024b3 100644
--- a/services/inputflinger/dispatcher/LatencyTracker.cpp
+++ b/services/inputflinger/dispatcher/LatencyTracker.cpp
@@ -70,7 +70,7 @@
void LatencyTracker::trackListener(int32_t inputEventId, nsecs_t eventTime, nsecs_t readTime,
DeviceId deviceId,
const std::set<InputDeviceUsageSource>& sources,
- int inputEventAction, InputEventType inputEventType) {
+ int32_t inputEventAction, InputEventType inputEventType) {
reportAndPruneMatureRecords(eventTime);
const auto it = mTimelines.find(inputEventId);
if (it != mTimelines.end()) {
@@ -105,7 +105,7 @@
const InputEventActionType inputEventActionType = [&]() {
switch (inputEventType) {
case InputEventType::MOTION: {
- switch (inputEventAction) {
+ switch (MotionEvent::getActionMasked(inputEventAction)) {
case AMOTION_EVENT_ACTION_DOWN:
return InputEventActionType::MOTION_ACTION_DOWN;
case AMOTION_EVENT_ACTION_MOVE:
@@ -134,10 +134,8 @@
}
}();
- bool isDown = inputEventType == InputEventType::MOTION &&
- inputEventAction == AMOTION_EVENT_ACTION_DOWN;
mTimelines.emplace(inputEventId,
- InputEventTimeline(isDown, eventTime, readTime, identifier->vendor,
+ InputEventTimeline(eventTime, readTime, identifier->vendor,
identifier->product, sources, inputEventActionType));
mEventTimes.emplace(eventTime, inputEventId);
}