Add data source config for Input Tracing on Android
Design doc: go/input-tracing
Bug: 210460522
Test: presubmit, manual using perfetto
Change-Id: I90d14b06f23f584d06fd4050105f55a26309af0c
diff --git a/Android.bp b/Android.bp
index bd2375b..9f3e3e1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1313,6 +1313,7 @@
"protos/perfetto/common/tracing_service_state.proto",
"protos/perfetto/common/track_event_descriptor.proto",
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
@@ -2880,6 +2881,7 @@
name: "perfetto_protos_perfetto_config_android_cpp",
srcs: [
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
@@ -2906,6 +2908,7 @@
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_config_android_cpp)",
out: [
"external/perfetto/protos/perfetto/config/android/android_game_intervention_list_config.gen.cc",
+ "external/perfetto/protos/perfetto/config/android/android_input_event_config.gen.cc",
"external/perfetto/protos/perfetto/config/android/android_log_config.gen.cc",
"external/perfetto/protos/perfetto/config/android/android_polled_state_config.gen.cc",
"external/perfetto/protos/perfetto/config/android/android_sdk_sysprop_guard_config.gen.cc",
@@ -2932,6 +2935,7 @@
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_cppgen_plugin) --plugin_out=wrapper_namespace=gen:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_config_android_cpp)",
out: [
"external/perfetto/protos/perfetto/config/android/android_game_intervention_list_config.gen.h",
+ "external/perfetto/protos/perfetto/config/android/android_input_event_config.gen.h",
"external/perfetto/protos/perfetto/config/android/android_log_config.gen.h",
"external/perfetto/protos/perfetto/config/android/android_polled_state_config.gen.h",
"external/perfetto/protos/perfetto/config/android/android_sdk_sysprop_guard_config.gen.h",
@@ -2953,6 +2957,7 @@
name: "perfetto_protos_perfetto_config_android_lite",
srcs: [
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
@@ -2978,6 +2983,7 @@
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --cpp_out=lite=true:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_config_android_lite)",
out: [
"external/perfetto/protos/perfetto/config/android/android_game_intervention_list_config.pb.cc",
+ "external/perfetto/protos/perfetto/config/android/android_input_event_config.pb.cc",
"external/perfetto/protos/perfetto/config/android/android_log_config.pb.cc",
"external/perfetto/protos/perfetto/config/android/android_polled_state_config.pb.cc",
"external/perfetto/protos/perfetto/config/android/android_sdk_sysprop_guard_config.pb.cc",
@@ -3003,6 +3009,7 @@
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --cpp_out=lite=true:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_config_android_lite)",
out: [
"external/perfetto/protos/perfetto/config/android/android_game_intervention_list_config.pb.h",
+ "external/perfetto/protos/perfetto/config/android/android_input_event_config.pb.h",
"external/perfetto/protos/perfetto/config/android/android_log_config.pb.h",
"external/perfetto/protos/perfetto/config/android/android_polled_state_config.pb.h",
"external/perfetto/protos/perfetto/config/android/android_sdk_sysprop_guard_config.pb.h",
@@ -3024,6 +3031,7 @@
name: "perfetto_protos_perfetto_config_android_zero",
srcs: [
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
@@ -3050,6 +3058,7 @@
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location protozero_plugin) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_config_android_zero)",
out: [
"external/perfetto/protos/perfetto/config/android/android_game_intervention_list_config.pbzero.cc",
+ "external/perfetto/protos/perfetto/config/android/android_input_event_config.pbzero.cc",
"external/perfetto/protos/perfetto/config/android/android_log_config.pbzero.cc",
"external/perfetto/protos/perfetto/config/android/android_polled_state_config.pbzero.cc",
"external/perfetto/protos/perfetto/config/android/android_sdk_sysprop_guard_config.pbzero.cc",
@@ -3076,6 +3085,7 @@
cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location protozero_plugin) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto/ $(locations :perfetto_protos_perfetto_config_android_zero)",
out: [
"external/perfetto/protos/perfetto/config/android/android_game_intervention_list_config.pbzero.h",
+ "external/perfetto/protos/perfetto/config/android/android_input_event_config.pbzero.h",
"external/perfetto/protos/perfetto/config/android/android_log_config.pbzero.h",
"external/perfetto/protos/perfetto/config/android/android_polled_state_config.pbzero.h",
"external/perfetto/protos/perfetto/config/android/android_sdk_sysprop_guard_config.pbzero.h",
@@ -3208,6 +3218,7 @@
"protos/perfetto/common/tracing_service_state.proto",
"protos/perfetto/common/track_event_descriptor.proto",
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
@@ -5851,6 +5862,7 @@
"protos/perfetto/common/tracing_service_state.proto",
"protos/perfetto/common/track_event_descriptor.proto",
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
@@ -13360,6 +13372,7 @@
"protos/perfetto/common/tracing_service_state.proto",
"protos/perfetto/common/track_event_descriptor.proto",
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
diff --git a/BUILD b/BUILD
index 592c1ec..587d4f9 100644
--- a/BUILD
+++ b/BUILD
@@ -3778,6 +3778,7 @@
name = "protos_perfetto_config_android_protos",
srcs = [
"protos/perfetto/config/android/android_game_intervention_list_config.proto",
+ "protos/perfetto/config/android/android_input_event_config.proto",
"protos/perfetto/config/android/android_log_config.proto",
"protos/perfetto/config/android/android_polled_state_config.proto",
"protos/perfetto/config/android/android_sdk_sysprop_guard_config.proto",
diff --git a/protos/perfetto/config/android/BUILD.gn b/protos/perfetto/config/android/BUILD.gn
index 68c9a79..0af8024 100644
--- a/protos/perfetto/config/android/BUILD.gn
+++ b/protos/perfetto/config/android/BUILD.gn
@@ -19,6 +19,7 @@
deps = [ "../../common:@TYPE@" ]
sources = [
"android_game_intervention_list_config.proto",
+ "android_input_event_config.proto",
"android_log_config.proto",
"android_polled_state_config.proto",
"android_sdk_sysprop_guard_config.proto",
diff --git a/protos/perfetto/config/android/android_input_event_config.proto b/protos/perfetto/config/android/android_input_event_config.proto
new file mode 100644
index 0000000..0b4e22c
--- /dev/null
+++ b/protos/perfetto/config/android/android_input_event_config.proto
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package perfetto.protos;
+
+// Custom configuration for the "android.input.inputevent" data source.
+//
+// NOTE: Input traces can only be taken on debuggable (userdebug/eng) builds!
+//
+// Next ID: 5
+message AndroidInputEventConfig {
+
+ // Trace modes are tracing presets that are included in the system.
+ enum TraceMode {
+ // Preset mode for maximal tracing.
+ // WARNING: This will bypass all privacy measures on debuggable builds, and will record all
+ // input events processed by the system, regardless of the context in which they
+ // were processed. It should only be used for tracing on a local device or for
+ // tests. It should NEVER be used for field tracing.
+ TRACE_MODE_TRACE_ALL = 0;
+ // Use the tracing rules defined in this config to specify what events to trace.
+ TRACE_MODE_USE_RULES = 1;
+ }
+
+ // The tracing mode to use. If unspecified, it will default to TRACE_MODE_USE_RULES.
+ optional TraceMode mode = 1;
+
+ // The level of tracing that should be applied to an event.
+ enum TraceLevel {
+ // Do not trace the input event.
+ TRACE_LEVEL_NONE = 0;
+ // Trace the event as a redacted event, where certain sensitive fields are omitted from
+ // the trace, including the coordinates of pointer events and the key/scan codes of key
+ // events.
+ TRACE_LEVEL_REDACTED = 1;
+ // Trace the complete event.
+ TRACE_LEVEL_COMPLETE = 2;
+ }
+
+ // A rule that specifies the TraceLevel for an event based on matching conditions.
+ // All matchers in the rule are optional. To trigger this rule, an event must match all
+ // of its specified matchers (i.e. the matchers function like a series of conditions connected
+ // by a logical 'AND' operator). A rule with no specified matchers will match all events.
+ // Next ID: 6
+ message TraceRule {
+ // The trace level to be used for events that trigger this rule.
+ // If unspecified, TRACE_LEVEL_NONE will be used by default.
+ optional TraceLevel trace_level = 1;
+
+ // --- Optional Matchers ---
+
+ // Package matchers
+ //
+ // Respectively matches if all or any of the target apps for this event are contained in
+ // the specified list of package names.
+ //
+ // Intended usage:
+ // - Use match_all_packages to selectively allow tracing for the listed packages.
+ // - Use match_any_packages to selectively deny tracing for certain packages.
+ //
+ // WARNING: Great care must be taken when designing rules for field tracing!
+ // This is because each event is almost always sent to more than one app.
+ // For example, when allowing tracing for a package that has a spy window
+ // over the display (e.g. SystemUI) using match_any_packages, essentially all
+ // input will be recorded on that display. This is because the events will be sent
+ // to the spy as well as the foreground app, and regardless of what the foreground
+ // app is, the event will end up being traced.
+ // Alternatively, when attempting to block tracing for specific packages using
+ // match_all_packages, no events will likely be blocked. This is because the event
+ // will also be sent to other apps (such as, but not limited to, ones with spy
+ // windows), so the matcher will not match unless all other targets are also
+ // listed under the match_all_packages list.
+ repeated string match_all_packages = 2;
+ repeated string match_any_packages = 3;
+
+ // Matches if the event is secure, which means that at least one of the targets of
+ // this event is using the window flag FLAG_SECURE.
+ optional bool match_secure = 4;
+
+ // Matches if there was an active IME connection while this event was being processed.
+ optional bool match_ime_connection_active = 5;
+ }
+
+ // The list of rules to use to determine the trace level of events.
+ // Each event will be traced using the TraceLevel of the first rule that it triggers
+ // from this list. The rules are evaluated in the order in which they are specified.
+ // If an event does not match any of the rules, TRACE_LEVEL_NONE will be used by default.
+ repeated TraceRule rules = 2;
+
+ // --- Control flags ---
+
+ // Trace input events processed by the system as they are being dispatched
+ // to application windows. All trace rules will apply.
+ // - If this flag is used without enabling trace_dispatcher_window_dispatch, it will
+ // trace InputDispatcher's inbound events (which does not include events synthesized
+ // within InputDispatcher) that match the rules.
+ // - If used with trace_dispatcher_window_dispatch, all inbound and outbound events
+ // matching the rules, including all events synthesized within InputDispatcher,
+ // will be traced.
+ optional bool trace_dispatcher_input_events = 3;
+
+ // Trace details about which windows the system is sending each input event to.
+ // All trace rules will apply.
+ optional bool trace_dispatcher_window_dispatch = 4;
+}
diff --git a/protos/perfetto/config/data_source_config.proto b/protos/perfetto/config/data_source_config.proto
index 05695a0..e9a2594 100644
--- a/protos/perfetto/config/data_source_config.proto
+++ b/protos/perfetto/config/data_source_config.proto
@@ -19,6 +19,7 @@
package perfetto.protos;
import "protos/perfetto/config/android/android_game_intervention_list_config.proto";
+import "protos/perfetto/config/android/android_input_event_config.proto";
import "protos/perfetto/config/android/android_log_config.proto";
import "protos/perfetto/config/android/android_polled_state_config.proto";
import "protos/perfetto/config/android/android_system_property_config.proto";
@@ -48,7 +49,7 @@
import "protos/perfetto/config/system_info/system_info.proto";
// The configuration that is passed to each data source when starting tracing.
-// Next id: 127
+// Next id: 129
message DataSourceConfig {
enum SessionInitiator {
SESSION_INITIATOR_UNSPECIFIED = 0;
@@ -193,6 +194,9 @@
// Data source name: android.protolog
optional ProtoLogConfig protolog_config = 126 [lazy = true];
+ // Data source name: android.input.inputevent
+ optional AndroidInputEventConfig android_input_event_config = 128 [lazy = true];
+
// This is a fallback mechanism to send a free-form text config to the
// producer. In theory this should never be needed. All the code that
// is part of the platform (i.e. traced service) is supposed to *not* truncate
diff --git a/protos/perfetto/config/perfetto_config.proto b/protos/perfetto/config/perfetto_config.proto
index 1a5fffd..881713c 100644
--- a/protos/perfetto/config/perfetto_config.proto
+++ b/protos/perfetto/config/perfetto_config.proto
@@ -362,6 +362,111 @@
// End of protos/perfetto/config/android/android_game_intervention_list_config.proto
+// Begin of protos/perfetto/config/android/android_input_event_config.proto
+
+// Custom configuration for the "android.input.inputevent" data source.
+//
+// NOTE: Input traces can only be taken on debuggable (userdebug/eng) builds!
+//
+// Next ID: 5
+message AndroidInputEventConfig {
+
+ // Trace modes are tracing presets that are included in the system.
+ enum TraceMode {
+ // Preset mode for maximal tracing.
+ // WARNING: This will bypass all privacy measures on debuggable builds, and will record all
+ // input events processed by the system, regardless of the context in which they
+ // were processed. It should only be used for tracing on a local device or for
+ // tests. It should NEVER be used for field tracing.
+ TRACE_MODE_TRACE_ALL = 0;
+ // Use the tracing rules defined in this config to specify what events to trace.
+ TRACE_MODE_USE_RULES = 1;
+ }
+
+ // The tracing mode to use. If unspecified, it will default to TRACE_MODE_USE_RULES.
+ optional TraceMode mode = 1;
+
+ // The level of tracing that should be applied to an event.
+ enum TraceLevel {
+ // Do not trace the input event.
+ TRACE_LEVEL_NONE = 0;
+ // Trace the event as a redacted event, where certain sensitive fields are omitted from
+ // the trace, including the coordinates of pointer events and the key/scan codes of key
+ // events.
+ TRACE_LEVEL_REDACTED = 1;
+ // Trace the complete event.
+ TRACE_LEVEL_COMPLETE = 2;
+ }
+
+ // A rule that specifies the TraceLevel for an event based on matching conditions.
+ // All matchers in the rule are optional. To trigger this rule, an event must match all
+ // of its specified matchers (i.e. the matchers function like a series of conditions connected
+ // by a logical 'AND' operator). A rule with no specified matchers will match all events.
+ // Next ID: 6
+ message TraceRule {
+ // The trace level to be used for events that trigger this rule.
+ // If unspecified, TRACE_LEVEL_NONE will be used by default.
+ optional TraceLevel trace_level = 1;
+
+ // --- Optional Matchers ---
+
+ // Package matchers
+ //
+ // Respectively matches if all or any of the target apps for this event are contained in
+ // the specified list of package names.
+ //
+ // Intended usage:
+ // - Use match_all_packages to selectively allow tracing for the listed packages.
+ // - Use match_any_packages to selectively deny tracing for certain packages.
+ //
+ // WARNING: Great care must be taken when designing rules for field tracing!
+ // This is because each event is almost always sent to more than one app.
+ // For example, when allowing tracing for a package that has a spy window
+ // over the display (e.g. SystemUI) using match_any_packages, essentially all
+ // input will be recorded on that display. This is because the events will be sent
+ // to the spy as well as the foreground app, and regardless of what the foreground
+ // app is, the event will end up being traced.
+ // Alternatively, when attempting to block tracing for specific packages using
+ // match_all_packages, no events will likely be blocked. This is because the event
+ // will also be sent to other apps (such as, but not limited to, ones with spy
+ // windows), so the matcher will not match unless all other targets are also
+ // listed under the match_all_packages list.
+ repeated string match_all_packages = 2;
+ repeated string match_any_packages = 3;
+
+ // Matches if the event is secure, which means that at least one of the targets of
+ // this event is using the window flag FLAG_SECURE.
+ optional bool match_secure = 4;
+
+ // Matches if there was an active IME connection while this event was being processed.
+ optional bool match_ime_connection_active = 5;
+ }
+
+ // The list of rules to use to determine the trace level of events.
+ // Each event will be traced using the TraceLevel of the first rule that it triggers
+ // from this list. The rules are evaluated in the order in which they are specified.
+ // If an event does not match any of the rules, TRACE_LEVEL_NONE will be used by default.
+ repeated TraceRule rules = 2;
+
+ // --- Control flags ---
+
+ // Trace input events processed by the system as they are being dispatched
+ // to application windows. All trace rules will apply.
+ // - If this flag is used without enabling trace_dispatcher_window_dispatch, it will
+ // trace InputDispatcher's inbound events (which does not include events synthesized
+ // within InputDispatcher) that match the rules.
+ // - If used with trace_dispatcher_window_dispatch, all inbound and outbound events
+ // matching the rules, including all events synthesized within InputDispatcher,
+ // will be traced.
+ optional bool trace_dispatcher_input_events = 3;
+
+ // Trace details about which windows the system is sending each input event to.
+ // All trace rules will apply.
+ optional bool trace_dispatcher_window_dispatch = 4;
+}
+
+// End of protos/perfetto/config/android/android_input_event_config.proto
+
// Begin of protos/perfetto/common/android_log_constants.proto
// Values from NDK's android/log.h.
@@ -3123,7 +3228,7 @@
// Begin of protos/perfetto/config/data_source_config.proto
// The configuration that is passed to each data source when starting tracing.
-// Next id: 127
+// Next id: 129
message DataSourceConfig {
enum SessionInitiator {
SESSION_INITIATOR_UNSPECIFIED = 0;
@@ -3268,6 +3373,9 @@
// Data source name: android.protolog
optional ProtoLogConfig protolog_config = 126 [lazy = true];
+ // Data source name: android.input.inputevent
+ optional AndroidInputEventConfig android_input_event_config = 128 [lazy = true];
+
// This is a fallback mechanism to send a free-form text config to the
// producer. In theory this should never be needed. All the code that
// is part of the platform (i.e. traced service) is supposed to *not* truncate
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index dd305ff..a4d34d7 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -362,6 +362,111 @@
// End of protos/perfetto/config/android/android_game_intervention_list_config.proto
+// Begin of protos/perfetto/config/android/android_input_event_config.proto
+
+// Custom configuration for the "android.input.inputevent" data source.
+//
+// NOTE: Input traces can only be taken on debuggable (userdebug/eng) builds!
+//
+// Next ID: 5
+message AndroidInputEventConfig {
+
+ // Trace modes are tracing presets that are included in the system.
+ enum TraceMode {
+ // Preset mode for maximal tracing.
+ // WARNING: This will bypass all privacy measures on debuggable builds, and will record all
+ // input events processed by the system, regardless of the context in which they
+ // were processed. It should only be used for tracing on a local device or for
+ // tests. It should NEVER be used for field tracing.
+ TRACE_MODE_TRACE_ALL = 0;
+ // Use the tracing rules defined in this config to specify what events to trace.
+ TRACE_MODE_USE_RULES = 1;
+ }
+
+ // The tracing mode to use. If unspecified, it will default to TRACE_MODE_USE_RULES.
+ optional TraceMode mode = 1;
+
+ // The level of tracing that should be applied to an event.
+ enum TraceLevel {
+ // Do not trace the input event.
+ TRACE_LEVEL_NONE = 0;
+ // Trace the event as a redacted event, where certain sensitive fields are omitted from
+ // the trace, including the coordinates of pointer events and the key/scan codes of key
+ // events.
+ TRACE_LEVEL_REDACTED = 1;
+ // Trace the complete event.
+ TRACE_LEVEL_COMPLETE = 2;
+ }
+
+ // A rule that specifies the TraceLevel for an event based on matching conditions.
+ // All matchers in the rule are optional. To trigger this rule, an event must match all
+ // of its specified matchers (i.e. the matchers function like a series of conditions connected
+ // by a logical 'AND' operator). A rule with no specified matchers will match all events.
+ // Next ID: 6
+ message TraceRule {
+ // The trace level to be used for events that trigger this rule.
+ // If unspecified, TRACE_LEVEL_NONE will be used by default.
+ optional TraceLevel trace_level = 1;
+
+ // --- Optional Matchers ---
+
+ // Package matchers
+ //
+ // Respectively matches if all or any of the target apps for this event are contained in
+ // the specified list of package names.
+ //
+ // Intended usage:
+ // - Use match_all_packages to selectively allow tracing for the listed packages.
+ // - Use match_any_packages to selectively deny tracing for certain packages.
+ //
+ // WARNING: Great care must be taken when designing rules for field tracing!
+ // This is because each event is almost always sent to more than one app.
+ // For example, when allowing tracing for a package that has a spy window
+ // over the display (e.g. SystemUI) using match_any_packages, essentially all
+ // input will be recorded on that display. This is because the events will be sent
+ // to the spy as well as the foreground app, and regardless of what the foreground
+ // app is, the event will end up being traced.
+ // Alternatively, when attempting to block tracing for specific packages using
+ // match_all_packages, no events will likely be blocked. This is because the event
+ // will also be sent to other apps (such as, but not limited to, ones with spy
+ // windows), so the matcher will not match unless all other targets are also
+ // listed under the match_all_packages list.
+ repeated string match_all_packages = 2;
+ repeated string match_any_packages = 3;
+
+ // Matches if the event is secure, which means that at least one of the targets of
+ // this event is using the window flag FLAG_SECURE.
+ optional bool match_secure = 4;
+
+ // Matches if there was an active IME connection while this event was being processed.
+ optional bool match_ime_connection_active = 5;
+ }
+
+ // The list of rules to use to determine the trace level of events.
+ // Each event will be traced using the TraceLevel of the first rule that it triggers
+ // from this list. The rules are evaluated in the order in which they are specified.
+ // If an event does not match any of the rules, TRACE_LEVEL_NONE will be used by default.
+ repeated TraceRule rules = 2;
+
+ // --- Control flags ---
+
+ // Trace input events processed by the system as they are being dispatched
+ // to application windows. All trace rules will apply.
+ // - If this flag is used without enabling trace_dispatcher_window_dispatch, it will
+ // trace InputDispatcher's inbound events (which does not include events synthesized
+ // within InputDispatcher) that match the rules.
+ // - If used with trace_dispatcher_window_dispatch, all inbound and outbound events
+ // matching the rules, including all events synthesized within InputDispatcher,
+ // will be traced.
+ optional bool trace_dispatcher_input_events = 3;
+
+ // Trace details about which windows the system is sending each input event to.
+ // All trace rules will apply.
+ optional bool trace_dispatcher_window_dispatch = 4;
+}
+
+// End of protos/perfetto/config/android/android_input_event_config.proto
+
// Begin of protos/perfetto/common/android_log_constants.proto
// Values from NDK's android/log.h.
@@ -3123,7 +3228,7 @@
// Begin of protos/perfetto/config/data_source_config.proto
// The configuration that is passed to each data source when starting tracing.
-// Next id: 127
+// Next id: 129
message DataSourceConfig {
enum SessionInitiator {
SESSION_INITIATOR_UNSPECIFIED = 0;
@@ -3268,6 +3373,9 @@
// Data source name: android.protolog
optional ProtoLogConfig protolog_config = 126 [lazy = true];
+ // Data source name: android.input.inputevent
+ optional AndroidInputEventConfig android_input_event_config = 128 [lazy = true];
+
// This is a fallback mechanism to send a free-form text config to the
// producer. In theory this should never be needed. All the code that
// is part of the platform (i.e. traced service) is supposed to *not* truncate