1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18    This file is a snapshot of
19    frameworks/base/core/proto/android/server/windowmanagertransitiontrace.proto
20    before it got moved to external/perfetto as part of the winscope-to-perfetto migration.
21 */
22syntax = "proto2";
23
24package com.android.server.wm.shell;
25
26option java_multiple_files = true;
27
28/* Represents a file full of transition entries.
29   Encoded, it should start with 0x09 0x54 0x52 0x4E 0x54 0x52 0x41 0x43 0x45 (.TRNTRACE), such
30   that it can be easily identified. */
31message TransitionTraceProto {
32
33  /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
34     (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
35      constants into .proto files. */
36  enum MagicNumber {
37    INVALID = 0;
38    MAGIC_NUMBER_L = 0x544e5254;  /* TRNT (little-endian ASCII) */
39    MAGIC_NUMBER_H = 0x45434152;  /* RACE (little-endian ASCII) */
40  }
41
42  // Must be the first field, set to value in MagicNumber
43  required fixed64 magic_number = 1;
44  repeated Transition transitions = 2;
45
46  /* offset between real-time clock and elapsed time clock in nanoseconds.
47   Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
48  optional fixed64 real_to_elapsed_time_offset_nanos = 3;
49}
50
51message Transition {
52  required int32 id = 1;
53  optional uint64 start_transaction_id = 2;
54  optional uint64 finish_transaction_id = 3;
55  optional int64 create_time_ns = 4;
56  optional int64 send_time_ns = 5;
57  optional int64 finish_time_ns = 6;
58  optional int32 type = 7;
59  repeated Target targets = 8;
60  optional int32 flags = 9;
61  optional int64 abort_time_ns = 10;
62  optional int64 starting_window_remove_time_ns = 11;
63}
64
65message Target {
66  optional int32 mode = 1;
67  optional int32 layer_id = 2;
68  optional int32 window_id = 3;  // Not dumped in always on tracing
69  optional int32 flags = 4;
70}
71