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";
18option java_outer_classname = "InputMethodEditorTraceProto";
19
20package android.view.inputmethod;
21
22import "frameworks/base/core/proto/android/view/inputmethod/inputmethodmanager.proto";
23import "frameworks/base/core/proto/android/view/viewrootimpl.proto";
24import "frameworks/base/core/proto/android/view/insetscontroller.proto";
25import "frameworks/base/core/proto/android/view/imeinsetssourceconsumer.proto";
26import "frameworks/base/core/proto/android/view/inputmethod/editorinfo.proto";
27import "frameworks/base/core/proto/android/view/inputmethod/inputconnection.proto";
28import "frameworks/base/core/proto/android/view/imefocuscontroller.proto";
29
30import "frameworks/base/core/proto/android/server/inputmethod/inputmethodmanagerservice.proto";
31import "frameworks/base/core/proto/android/inputmethodservice/inputmethodservice.proto";
32
33/**
34 * Represents a file full of trace entries for clients that use InputMethod.
35 * Encoded, it should start with 0x9 0x49 0x4d 0x43 0x54 0x52 0x41 0x43 0x45 (.IMCTRACE), such
36 * that they can be easily identified.
37 */
38message InputMethodClientsTraceFileProto {
39
40    /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
41       (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
42        constants into .proto files.) */
43    enum MagicNumber {
44        INVALID = 0;
45        MAGIC_NUMBER_L = 0x54434d49;  /* IMCT (little-endian ASCII) */
46        MAGIC_NUMBER_H = 0x45434152;  /* RACE (little-endian ASCII) */
47    }
48
49    /* Must be the first field to allow winscope to auto-detect the dump type. Set to value
50        in MagicNumber */
51    optional fixed64 magic_number = 1;
52    repeated InputMethodClientsTraceProto entry = 2;
53
54    /* offset between real-time clock and elapsed time clock in nanoseconds.
55       Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
56    optional fixed64 real_to_elapsed_time_offset_nanos = 3;
57}
58
59/* One dump entry for clients that use InputMethod. */
60message InputMethodClientsTraceProto {
61    /* required: elapsed realtime in nanos since boot of when this entry was logged */
62    optional fixed64 elapsed_realtime_nanos = 1;
63
64    /* where the trace originated */
65    optional string where = 2;
66
67    optional ClientSideProto client = 3;
68
69    /* groups together the dump from ime related client side classes */
70    message ClientSideProto {
71        optional int32 display_id = 1;
72        optional InputMethodManagerProto input_method_manager = 2;
73        optional ViewRootImplProto view_root_impl = 3;
74        optional InsetsControllerProto insets_controller = 4;
75        optional ImeInsetsSourceConsumerProto ime_insets_source_consumer = 5;
76        optional EditorInfoProto editor_info = 6;
77        optional ImeFocusControllerProto ime_focus_controller = 7;
78        optional InputConnectionProto input_connection = 8;
79        optional InputConnectionCallProto input_connection_call = 9;
80    }
81}
82
83/**
84 * Represents a file full of InputMethodService trace entries.
85 * Encoded, it should start with 0x9 0x49 0x4d 0x53 0x54 0x52 0x41 0x43 0x45 (.IMSTRACE), such
86 * that they can be easily identified.
87 */
88message InputMethodServiceTraceFileProto {
89
90    /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
91       (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
92        constants into .proto files.) */
93    enum MagicNumber {
94        INVALID = 0;
95        MAGIC_NUMBER_L = 0x54534d49;  /* IMST (little-endian ASCII) */
96        MAGIC_NUMBER_H = 0x45434152;  /* RACE (little-endian ASCII) */
97    }
98
99    /* Must be the first field to allow winscope to auto-detect the dump type. Set to value
100        in MagicNumber */
101    optional fixed64 magic_number = 1;
102    repeated InputMethodServiceTraceProto entry = 2;
103
104    /* offset between real-time clock and elapsed time clock in nanoseconds.
105       Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
106    optional fixed64 real_to_elapsed_time_offset_nanos = 3;
107}
108
109/* One dump entry for InputMethodService. */
110message InputMethodServiceTraceProto {
111    /* required: elapsed realtime in nanos since boot of when this entry was logged */
112    optional fixed64 elapsed_realtime_nanos = 1;
113
114    /* where the trace originated */
115    optional string where = 2;
116
117    optional .android.inputmethodservice.InputMethodServiceProto input_method_service = 3;
118}
119
120/**
121 * Represents a file full of InputMethodManagerService trace entries.
122 * Encoded, it should start with 0x9 0x49 0x4d 0x4d 0x54 0x52 0x41 0x43 0x45 (.IMMTRACE), such
123 * that they can be easily identified.
124 */
125message InputMethodManagerServiceTraceFileProto {
126
127    /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
128       (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
129        constants into .proto files.) */
130    enum MagicNumber {
131        INVALID = 0;
132        MAGIC_NUMBER_L = 0x544d4d49;  /* IMMT (little-endian ASCII) */
133        MAGIC_NUMBER_H = 0x45434152;  /* RACE (little-endian ASCII) */
134    }
135
136    /* Must be the first field to allow winscope to auto-detect the dump type. Set to value
137        in MagicNumber */
138    optional fixed64 magic_number = 1;
139    repeated InputMethodManagerServiceTraceProto entry = 2;
140
141    /* offset between real-time clock and elapsed time clock in nanoseconds.
142       Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
143    optional fixed64 real_to_elapsed_time_offset_nanos = 3;
144}
145
146/* One dump entry for InputMethodManagerService. */
147message InputMethodManagerServiceTraceProto {
148    /* required: elapsed realtime in nanos since boot of when this entry was logged */
149    optional fixed64 elapsed_realtime_nanos = 1;
150
151    /* where the trace originated */
152    optional string where = 2;
153
154    optional .android.server.inputmethod.InputMethodManagerServiceProto input_method_manager_service = 3;
155}