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
17syntax = "proto2";
18
19package com.android.server.wm.shell;
20
21import "frameworks/base/core/proto/android/server/windowmanagerservice.proto";
22
23option java_multiple_files = true;
24
25/* Represents a file full of transition entries.
26   Encoded, it should start with 0x09 0x54 0x52 0x4E 0x54 0x52 0x41 0x43 0x45 (.TRNTRACE), such
27   that it can be easily identified. */
28message TransitionTraceProto {
29
30  /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
31     (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
32      constants into .proto files. */
33  enum MagicNumber {
34    INVALID = 0;
35    MAGIC_NUMBER_L = 0x544e5254;  /* TRNT (little-endian ASCII) */
36    MAGIC_NUMBER_H = 0x45434152;  /* RACE (little-endian ASCII) */
37  }
38
39  // Must be the first field, set to value in MagicNumber
40  required fixed64 magic_number = 1;
41  repeated Transition transitions = 2;
42
43  /* offset between real-time clock and elapsed time clock in nanoseconds.
44   Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
45  optional fixed64 real_to_elapsed_time_offset_nanos = 3;
46}
47
48message Transition {
49  required int32 id = 1;
50  optional uint64 start_transaction_id = 2;
51  optional uint64 finish_transaction_id = 3;
52  optional int64 create_time_ns = 4;
53  optional int64 send_time_ns = 5;
54  optional int64 finish_time_ns = 6;
55  optional int32 type = 7;
56  repeated Target targets = 8;
57  optional int32 flags = 9;
58  optional int64 abort_time_ns = 10;
59  optional int64 starting_window_remove_time_ns = 11;
60}
61
62message Target {
63  required int32 mode = 1;
64  required int32 layer_id = 2;
65  optional int32 window_id = 3;  // Not dumped in always on tracing
66  optional int32 flags = 4;
67}
68