From 2b2d1bf66ae1fdc5f2db3d9fadf916ccb22d4a7b Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Tue, 5 Mar 2024 16:27:56 +0000 Subject: InputTracer: Trace injected events with history as separate events If an injected event is batched, it is split into separate events and each historical event is injected individually. When this happens, the historical events were not being traced, which is a bug. Trace them. It is difficult to test batching from InputDispatcher_tests because we are polling for events rather than responding to them, so avoid adding a test for now. Bug: 210460522 Test: atest inputflinger_tests Change-Id: I7062f97181bcde614e43e68e127583690efa70b2 --- services/inputflinger/dispatcher/InputDispatcher.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index 057b996a23..1725e48f7f 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -4815,6 +4815,10 @@ InputEventInjectionResult InputDispatcher::injectInputEvent(const InputEvent* ev pointerCount)); transformMotionEntryForInjectionLocked(*nextInjectedEntry, motionEvent.getTransform()); + if (mTracer) { + nextInjectedEntry->traceTracker = + mTracer->traceInboundEvent(*nextInjectedEntry); + } injectedEntries.push(std::move(nextInjectedEntry)); } break; -- cgit v1.2.3-59-g8ed1b