1/*
2 * Copyright (C) 2020 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.wm.shell;
20
21option java_multiple_files = true;
22
23/* Represents a file full of transition entries.
24   Encoded, it should start with 0x09 0x57 0x4D 0x53 0x54 0x52 0x41 0x43 0x45 (.WMSTRACE), such
25   that it can be easily identified. */
26message WmShellTransitionTraceProto {
27    /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
28   (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
29    constants into .proto files. */
30    enum MagicNumber {
31        INVALID = 0;
32        MAGIC_NUMBER_L = 0x54534D57;  /* WMST (little-endian ASCII) */
33        MAGIC_NUMBER_H = 0x45434152;  /* RACE (little-endian ASCII) */
34    }
35
36    // Must be the first field, set to value in MagicNumber
37    required fixed64 magic_number = 1;
38    repeated Transition transitions = 2;
39    repeated HandlerMapping handlerMappings = 3;
40    /* offset between real-time clock and elapsed time clock in nanoseconds.
41    Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
42    optional fixed64 real_to_elapsed_time_offset_nanos = 4;
43}
44
45message Transition {
46    required int32 id = 1;
47    optional int64 dispatch_time_ns = 2;
48    optional int32 handler = 3;
49    optional int64 merge_time_ns = 4;
50    optional int64 merge_request_time_ns = 5;
51    optional int32 merge_target = 6;
52    optional int64 abort_time_ns = 7;
53}
54
55message HandlerMapping {
56    required int32 id = 1;
57    required string name = 2;
58}
59