Pass ProductId+VendorId+Source info to LatencyTracker
Currently InputEventLatencySketch captures the aggregated latency over
all devices, and it doesn't capture per-device latency.
In order to capture latency metrics per device, we track the timeline
for latency information for each Product Id, Vendor Id and Source
individually.
Bug: 270049345
Test: atest inputflinger_tests:LatencyTrackerTest
Change-Id: Ic3265e25ff95266e8cfe8542d4f4afb7b6ac16b1
diff --git a/services/inputflinger/dispatcher/InputEventTimeline.cpp b/services/inputflinger/dispatcher/InputEventTimeline.cpp
index 3edb638..a7c6d16 100644
--- a/services/inputflinger/dispatcher/InputEventTimeline.cpp
+++ b/services/inputflinger/dispatcher/InputEventTimeline.cpp
@@ -16,6 +16,8 @@
#include "InputEventTimeline.h"
+#include "../InputDeviceMetricsSource.h"
+
namespace android::inputdispatcher {
ConnectionTimeline::ConnectionTimeline(nsecs_t deliveryTime, nsecs_t consumeTime,
@@ -64,8 +66,15 @@
return !operator==(rhs);
}
-InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime)
- : isDown(isDown), eventTime(eventTime), readTime(readTime) {}
+InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime,
+ uint16_t vendorId, uint16_t productId,
+ std::set<InputDeviceUsageSource> sources)
+ : isDown(isDown),
+ eventTime(eventTime),
+ readTime(readTime),
+ vendorId(vendorId),
+ productId(productId),
+ sources(sources) {}
bool InputEventTimeline::operator==(const InputEventTimeline& rhs) const {
if (connectionTimelines.size() != rhs.connectionTimelines.size()) {
@@ -80,7 +89,8 @@
return false;
}
}
- return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime;
+ return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime &&
+ vendorId == rhs.vendorId && productId == rhs.productId && sources == rhs.sources;
}
} // namespace android::inputdispatcher