InputTracer: Add tests for perfetto backend
Add a new InputTraceSession class that encapsulates the logic to take
and decode a perfetto input trace for testing.
Then, use it to add new tests to verify the behavior of entire tracing
framework, using InputDispatcher as the interface.
Bug: 210460522
Test: atest inputflinger_tests
Change-Id: I5a9b47e831c5c30e5d7f2b60c9b8075b7d330e9e
diff --git a/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.h b/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.h
index e945066..fdfe495 100644
--- a/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.h
+++ b/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.h
@@ -51,6 +51,8 @@
public:
using GetPackageUid = std::function<gui::Uid(std::string)>;
+ static bool sUseInProcessBackendForTest;
+
explicit PerfettoBackend(GetPackageUid);
~PerfettoBackend() override = default;
@@ -61,6 +63,7 @@
private:
// Implementation of the perfetto data source.
// Each instance of the InputEventDataSource represents a different tracing session.
+ // Its lifecycle is controlled by perfetto.
class InputEventDataSource : public perfetto::DataSource<InputEventDataSource> {
public:
explicit InputEventDataSource();