Gather latency metrics for key events
Currently, we are not gathering any latency data for key events. We want
to record latencies and report them using the new
InputEventLatencyReported atom.
In InputDispatcher, call LatencyTracker::trackListener from notifyKey to
gather latency statistics for key events. This will be done only if the
per device input latency metrics flag is enabled because We want to
gather these latency values using the new LatencyAggregator that uses
histograms.
Moved the sources resolution for motion events from InputDispatcher to
LatencyTracker.
Bug: 270049345
Test: atest inputflinger_tests
Flag: com.android.input.flags.enable_per_device_input_latency_metrics
Change-Id: Iadf7b7aecbb14db6f13e4c53ecc11d3ccccd646f
diff --git a/services/inputflinger/dispatcher/LatencyTracker.h b/services/inputflinger/dispatcher/LatencyTracker.h
index b4053ba..2c8c028 100644
--- a/services/inputflinger/dispatcher/LatencyTracker.h
+++ b/services/inputflinger/dispatcher/LatencyTracker.h
@@ -59,6 +59,13 @@
nsecs_t deliveryTime, nsecs_t consumeTime, nsecs_t finishTime);
void trackGraphicsLatency(int32_t inputEventId, const sp<IBinder>& connectionToken,
std::array<nsecs_t, GraphicsTimeline::SIZE> timeline);
+ /**
+ * trackNotifyMotion and trackNotifyKeys are intermediates between InputDispatcher and
+ * trackListener. They compute the InputDeviceUsageSource set and call trackListener with
+ * the relevant parameters for latency computation.
+ */
+ void trackNotifyMotion(const NotifyMotionArgs& args);
+ void trackNotifyKey(const NotifyKeyArgs& args);
std::string dump(const char* prefix) const;
void setInputDevices(const std::vector<InputDeviceInfo>& inputDevices);