InputTracer: Create tracker for tracing synthetic events
Allow the creation of a trace tracker for a synthetic event that does
not stem from an inbound input event. This is used for any dispatching
cycle that has a non-input event root, such as ANR timers, window
removals, API interactions (e.g. pilfer pointers), etc.
Any key or motion events generated for this synthetic event should be
traced as a derived event. We achieve this by passing the trace tracker
through the dispatching pipeline, and tracing all of the synthesized
events for that root using the same tracker.
Since all synthetic events can now be traced, we can now enforce that
all dispatched events have been previously traced as either an inbound
or derived event. This makes the event cookie non-nullable.
Bug: 210460522
Test: atest inputflinger_tests
Change-Id: I3417aee300edc251e2f7cb76c1f719502a5f5b8b
diff --git a/services/inputflinger/dispatcher/trace/InputTracer.h b/services/inputflinger/dispatcher/trace/InputTracer.h
index 25a5651..529c0fa 100644
--- a/services/inputflinger/dispatcher/trace/InputTracer.h
+++ b/services/inputflinger/dispatcher/trace/InputTracer.h
@@ -42,11 +42,12 @@
InputTracer& operator=(const InputTracer&) = delete;
std::unique_ptr<EventTrackerInterface> traceInboundEvent(const EventEntry&) override;
+ std::unique_ptr<EventTrackerInterface> createTrackerForSyntheticEvent() override;
void dispatchToTargetHint(const EventTrackerInterface&, const InputTarget&) override;
void eventProcessingComplete(const EventTrackerInterface&) override;
std::unique_ptr<EventTrackerInterface> traceDerivedEvent(const EventEntry&,
const EventTrackerInterface&) override;
- void traceEventDispatch(const DispatchEntry&, const EventTrackerInterface*) override;
+ void traceEventDispatch(const DispatchEntry&, const EventTrackerInterface&) override;
private:
std::unique_ptr<InputTracingBackendInterface> mBackend;