Add shell transition proto to Perfetto
Test: tools/ninja -C out/linux_clang_release && tools/diff_test_trace_processor.py ./out/linux_clang_release/trace_processor_shell --name-filter "ShellTransitions"
Bug: 309630341
Change-Id: I55bbc479363fc00035e4660177dbfc6a530c7e3e
diff --git a/Android.bp b/Android.bp
index a356ed1..144e1e1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -5230,6 +5230,7 @@
"protos/perfetto/trace/android/initial_display_state.proto",
"protos/perfetto/trace/android/network_trace.proto",
"protos/perfetto/trace/android/packages_list.proto",
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
@@ -5259,6 +5260,7 @@
"external/perfetto/protos/perfetto/trace/android/initial_display_state.gen.cc",
"external/perfetto/protos/perfetto/trace/android/network_trace.gen.cc",
"external/perfetto/protos/perfetto/trace/android/packages_list.gen.cc",
+ "external/perfetto/protos/perfetto/trace/android/shell_transition.gen.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_common.gen.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_layers.gen.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_transactions.gen.cc",
@@ -5288,6 +5290,7 @@
"external/perfetto/protos/perfetto/trace/android/initial_display_state.gen.h",
"external/perfetto/protos/perfetto/trace/android/network_trace.gen.h",
"external/perfetto/protos/perfetto/trace/android/packages_list.gen.h",
+ "external/perfetto/protos/perfetto/trace/android/shell_transition.gen.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_common.gen.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_layers.gen.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_transactions.gen.h",
@@ -5312,6 +5315,7 @@
"protos/perfetto/trace/android/initial_display_state.proto",
"protos/perfetto/trace/android/network_trace.proto",
"protos/perfetto/trace/android/packages_list.proto",
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
@@ -5340,6 +5344,7 @@
"external/perfetto/protos/perfetto/trace/android/initial_display_state.pb.cc",
"external/perfetto/protos/perfetto/trace/android/network_trace.pb.cc",
"external/perfetto/protos/perfetto/trace/android/packages_list.pb.cc",
+ "external/perfetto/protos/perfetto/trace/android/shell_transition.pb.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_common.pb.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_layers.pb.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_transactions.pb.cc",
@@ -5368,6 +5373,7 @@
"external/perfetto/protos/perfetto/trace/android/initial_display_state.pb.h",
"external/perfetto/protos/perfetto/trace/android/network_trace.pb.h",
"external/perfetto/protos/perfetto/trace/android/packages_list.pb.h",
+ "external/perfetto/protos/perfetto/trace/android/shell_transition.pb.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_common.pb.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_layers.pb.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_transactions.pb.h",
@@ -5382,6 +5388,7 @@
genrule {
name: "perfetto_protos_perfetto_trace_android_winscope_descriptor",
srcs: [
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
@@ -5410,6 +5417,7 @@
"protos/perfetto/trace/android/initial_display_state.proto",
"protos/perfetto/trace/android/network_trace.proto",
"protos/perfetto/trace/android/packages_list.proto",
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
@@ -5439,6 +5447,7 @@
"external/perfetto/protos/perfetto/trace/android/initial_display_state.pbzero.cc",
"external/perfetto/protos/perfetto/trace/android/network_trace.pbzero.cc",
"external/perfetto/protos/perfetto/trace/android/packages_list.pbzero.cc",
+ "external/perfetto/protos/perfetto/trace/android/shell_transition.pbzero.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_common.pbzero.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_layers.pbzero.cc",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_transactions.pbzero.cc",
@@ -5468,6 +5477,7 @@
"external/perfetto/protos/perfetto/trace/android/initial_display_state.pbzero.h",
"external/perfetto/protos/perfetto/trace/android/network_trace.pbzero.h",
"external/perfetto/protos/perfetto/trace/android/packages_list.pbzero.h",
+ "external/perfetto/protos/perfetto/trace/android/shell_transition.pbzero.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_common.pbzero.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_layers.pbzero.h",
"external/perfetto/protos/perfetto/trace/android/surfaceflinger_transactions.pbzero.h",
@@ -5687,6 +5697,7 @@
"protos/perfetto/trace/android/initial_display_state.proto",
"protos/perfetto/trace/android/network_trace.proto",
"protos/perfetto/trace/android/packages_list.proto",
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
@@ -13106,6 +13117,7 @@
"protos/perfetto/trace/android/initial_display_state.proto",
"protos/perfetto/trace/android/network_trace.proto",
"protos/perfetto/trace/android/packages_list.proto",
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
diff --git a/BUILD b/BUILD
index 91da2de..c1d990d 100644
--- a/BUILD
+++ b/BUILD
@@ -4243,6 +4243,7 @@
"protos/perfetto/trace/android/initial_display_state.proto",
"protos/perfetto/trace/android/network_trace.proto",
"protos/perfetto/trace/android/packages_list.proto",
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
@@ -4259,6 +4260,7 @@
perfetto_proto_library(
name = "protos_perfetto_trace_android_winscope_deps_protos",
srcs = [
+ "protos/perfetto/trace/android/shell_transition.proto",
"protos/perfetto/trace/android/surfaceflinger_common.proto",
"protos/perfetto/trace/android/surfaceflinger_layers.proto",
"protos/perfetto/trace/android/surfaceflinger_transactions.proto",
diff --git a/protos/perfetto/trace/android/BUILD.gn b/protos/perfetto/trace/android/BUILD.gn
index c5e842f..509c448 100644
--- a/protos/perfetto/trace/android/BUILD.gn
+++ b/protos/perfetto/trace/android/BUILD.gn
@@ -28,6 +28,7 @@
"initial_display_state.proto",
"network_trace.proto",
"packages_list.proto",
+ "shell_transition.proto",
"surfaceflinger_common.proto",
"surfaceflinger_layers.proto",
"surfaceflinger_transactions.proto",
@@ -37,6 +38,7 @@
perfetto_proto_library("winscope_deps") {
proto_generators = [ "source_set" ]
sources = [
+ "shell_transition.proto",
"surfaceflinger_common.proto",
"surfaceflinger_layers.proto",
"surfaceflinger_transactions.proto",
diff --git a/protos/perfetto/trace/android/shell_transition.proto b/protos/perfetto/trace/android/shell_transition.proto
new file mode 100644
index 0000000..9a34d3a
--- /dev/null
+++ b/protos/perfetto/trace/android/shell_transition.proto
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2023 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;
+
+// ShellTransition messages record information about the shell transitions in
+// the system. This is used to track the animations that are created and execute
+// through the shell transition system.
+message ShellTransition {
+ // The unique identifier of the transition.
+ optional int32 id = 1;
+
+ // The time the transition was created on the WM side
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 create_time_ns = 2;
+ // The time the transition was sent from the WM side to shell
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 send_time_ns = 3;
+ // The time the transition was dispatched by shell to execute
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 dispatch_time_ns = 4;
+ // If the transition merge was accepted by the transition handler, this
+ // contains the time the transition was merged into transition with id
+ // `merge_target`.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 merge_time_ns = 5;
+ // The time shell proposed the transition should be merged to the transition
+ // handler into transition with id `merge_target`.
+ // (using SystemClock.elapsedRealtimeNanos()).
+ optional int64 merge_request_time_ns = 6;
+ // If the transition was aborted on the shell side, this is the time that
+ // occured.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 shell_abort_time_ns = 7;
+ // If the transition was aborted on the wm side, this is the time that
+ // occured.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 wm_abort_time_ns = 8;
+ // The time WM considers the transition to be complete.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 finish_time_ns = 9;
+
+ // The id of the transaction that WM proposed to use as the starting
+ // transaction. It contains all the layer changes required to setup the
+ // transition and should be executed right at the start of the transition
+ // by the transition handler.
+ optional uint64 start_transaction_id = 10;
+ // The if of the transaction that WM proposed to use as the finish
+ // transaction. It contains all the layer changes required to set the final
+ // state of the transition.
+ optional uint64 finish_transaction_id = 11;
+
+ // The id of the handler that executed the transition. A HandlerMappings
+ // message in the trace will contain the mapping of id to a string
+ // representation of the handler.
+ optional int32 handler = 12;
+ // The transition type of this transition (e.g. TO_FRONT, OPEN, CLOSE).
+ optional int32 type = 13;
+
+ // The list of targets that are part of this transition.
+ repeated Target targets = 14;
+ // The id of the transition we have requested to merge or have merged this
+ // transition into.
+ optional int32 merge_target = 15;
+
+ // The flags set on this transition.
+ optional int32 flags = 16;
+ // The time the starting window was removed. Tracked because this can
+ // happen after the transition finishes, but the app may not yet be visible
+ // until the starting window is removed. So in a sense the transition is not
+ // finished until the starting window is removed. (b/284302118)
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 starting_window_remove_time_ns = 17;
+
+ // Contains the information about the windows targeted in a transition.
+ message Target {
+ // The transition mode of this target (e.g. TO_FRONT, CLOSE...)
+ optional int32 mode = 1;
+ // The layer id of this target.
+ optional int32 layer_id = 2;
+ // The window id of this target.
+ optional int32 window_id = 3;
+ // The flags set on this target.
+ optional int32 flags = 4;
+ }
+}
+
+// Contains mappings from handler ids to string representation of the handlers.
+message ShellHandlerMappings {
+ repeated ShellHandlerMapping mapping = 1;
+}
+
+message ShellHandlerMapping {
+ // The id of the handler used in the ShellTransition message.
+ optional int32 id = 1;
+ // A human readable and meaningful string representation of the handler.
+ optional string name = 2;
+}
diff --git a/protos/perfetto/trace/android/winscope.proto b/protos/perfetto/trace/android/winscope.proto
index 78fbdcc..296e3ee 100644
--- a/protos/perfetto/trace/android/winscope.proto
+++ b/protos/perfetto/trace/android/winscope.proto
@@ -18,6 +18,7 @@
package perfetto.protos;
+import "protos/perfetto/trace/android/shell_transition.proto";
import "protos/perfetto/trace/android/surfaceflinger_layers.proto";
import "protos/perfetto/trace/android/surfaceflinger_transactions.proto";
@@ -26,4 +27,5 @@
message WinscopeTraceData {
optional LayersSnapshotProto layers_snapshot = 1;
optional TransactionTraceEntry transactions = 2;
+ optional ShellTransition shell_transition = 3;
}
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index f6b6cdc..05306cd 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -4281,6 +4281,104 @@
// End of protos/perfetto/trace/android/packages_list.proto
+// Begin of protos/perfetto/trace/android/shell_transition.proto
+
+// ShellTransition messages record information about the shell transitions in
+// the system. This is used to track the animations that are created and execute
+// through the shell transition system.
+message ShellTransition {
+ // The unique identifier of the transition.
+ optional int32 id = 1;
+
+ // The time the transition was created on the WM side
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 create_time_ns = 2;
+ // The time the transition was sent from the WM side to shell
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 send_time_ns = 3;
+ // The time the transition was dispatched by shell to execute
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 dispatch_time_ns = 4;
+ // If the transition merge was accepted by the transition handler, this
+ // contains the time the transition was merged into transition with id
+ // `merge_target`.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 merge_time_ns = 5;
+ // The time shell proposed the transition should be merged to the transition
+ // handler into transition with id `merge_target`.
+ // (using SystemClock.elapsedRealtimeNanos()).
+ optional int64 merge_request_time_ns = 6;
+ // If the transition was aborted on the shell side, this is the time that
+ // occured.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 shell_abort_time_ns = 7;
+ // If the transition was aborted on the wm side, this is the time that
+ // occured.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 wm_abort_time_ns = 8;
+ // The time WM considers the transition to be complete.
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 finish_time_ns = 9;
+
+ // The id of the transaction that WM proposed to use as the starting
+ // transaction. It contains all the layer changes required to setup the
+ // transition and should be executed right at the start of the transition
+ // by the transition handler.
+ optional uint64 start_transaction_id = 10;
+ // The if of the transaction that WM proposed to use as the finish
+ // transaction. It contains all the layer changes required to set the final
+ // state of the transition.
+ optional uint64 finish_transaction_id = 11;
+
+ // The id of the handler that executed the transition. A HandlerMappings
+ // message in the trace will contain the mapping of id to a string
+ // representation of the handler.
+ optional int32 handler = 12;
+ // The transition type of this transition (e.g. TO_FRONT, OPEN, CLOSE).
+ optional int32 type = 13;
+
+ // The list of targets that are part of this transition.
+ repeated Target targets = 14;
+ // The id of the transition we have requested to merge or have merged this
+ // transition into.
+ optional int32 merge_target = 15;
+
+ // The flags set on this transition.
+ optional int32 flags = 16;
+ // The time the starting window was removed. Tracked because this can
+ // happen after the transition finishes, but the app may not yet be visible
+ // until the starting window is removed. So in a sense the transition is not
+ // finished until the starting window is removed. (b/284302118)
+ // (using SystemClock.elapsedRealtimeNanos())
+ optional int64 starting_window_remove_time_ns = 17;
+
+ // Contains the information about the windows targeted in a transition.
+ message Target {
+ // The transition mode of this target (e.g. TO_FRONT, CLOSE...)
+ optional int32 mode = 1;
+ // The layer id of this target.
+ optional int32 layer_id = 2;
+ // The window id of this target.
+ optional int32 window_id = 3;
+ // The flags set on this target.
+ optional int32 flags = 4;
+ }
+}
+
+// Contains mappings from handler ids to string representation of the handlers.
+message ShellHandlerMappings {
+ repeated ShellHandlerMapping mapping = 1;
+}
+
+message ShellHandlerMapping {
+ // The id of the handler used in the ShellTransition message.
+ optional int32 id = 1;
+ // A human readable and meaningful string representation of the handler.
+ optional string name = 2;
+}
+
+// End of protos/perfetto/trace/android/shell_transition.proto
+
// Begin of protos/perfetto/trace/android/surfaceflinger_common.proto
message RegionProto {
@@ -13373,6 +13471,8 @@
// Winscope traces
LayersSnapshotProto surfaceflinger_layers_snapshot = 93;
TransactionTraceEntry surfaceflinger_transactions = 94;
+ ShellTransition shell_transition = 96;
+ ShellHandlerMappings shell_handler_mappings = 97;
// Events from the Windows etw infrastructure.
EtwTraceEventBundle etw_events = 95;
diff --git a/protos/perfetto/trace/trace_packet.proto b/protos/perfetto/trace/trace_packet.proto
index 9966894..86a90fe 100644
--- a/protos/perfetto/trace/trace_packet.proto
+++ b/protos/perfetto/trace/trace_packet.proto
@@ -29,6 +29,7 @@
import "protos/perfetto/trace/android/initial_display_state.proto";
import "protos/perfetto/trace/android/network_trace.proto";
import "protos/perfetto/trace/android/packages_list.proto";
+import "protos/perfetto/trace/android/shell_transition.proto";
import "protos/perfetto/trace/android/surfaceflinger_layers.proto";
import "protos/perfetto/trace/android/surfaceflinger_transactions.proto";
import "protos/perfetto/trace/chrome/chrome_benchmark_metadata.proto";
@@ -216,6 +217,8 @@
// Winscope traces
LayersSnapshotProto surfaceflinger_layers_snapshot = 93;
TransactionTraceEntry surfaceflinger_transactions = 94;
+ ShellTransition shell_transition = 96;
+ ShellHandlerMappings shell_handler_mappings = 97;
// Events from the Windows etw infrastructure.
EtwTraceEventBundle etw_events = 95;