InputTracer: Adjust sensitivity based on IME connection
Based on the trace rules, we can adjust the trace level depending on
when there was an active IME connection when the event processing was
complete.
Bug: 210460522
Test: manual with perfetto
Change-Id: I90587c3004fa05517cf44c4c0b6b5c5c40fc00d1
diff --git a/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.cpp b/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.cpp
index b413def..9c39743 100644
--- a/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.cpp
+++ b/services/inputflinger/dispatcher/trace/InputTracingPerfettoBackend.cpp
@@ -118,6 +118,12 @@
return false;
}
+ // Match the event if it was processed while there was an active InputMethod connection.
+ if (rule.matchImeConnectionActive.has_value() &&
+ *rule.matchImeConnectionActive != metadata.isImeConnectionActive) {
+ return false;
+ }
+
// Match the event if all of its target packages are explicitly allowed in the "match all" list.
if (!rule.matchAllPackages.empty() &&
!std::all_of(metadata.targets.begin(), metadata.targets.end(), [&](const auto& uid) {