1/*
2 * Copyright (C) 2021 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// Partial clone of frameworks/proto_logging/stats/atoms.proto. CarTelemetryService only uses
18// small number of atoms.
19
20syntax = "proto2";
21
22package android.car.telemetry;
23option java_package = "com.android.car.telemetry";
24option java_outer_classname = "AtomsProto";
25
26message Atom {
27  oneof pushed {
28    ActivityForegroundStateChanged activity_foreground_state_changed = 42;
29    AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
30    AppCrashOccurred app_crash_occurred = 78;
31    ANROccurred anr_occurred = 79;
32    WTFOccurred wtf_occurred = 80;
33    ProcessStartTime process_start_time = 169;
34    CarPowerStateChanged car_power_state_changed = 203;
35  }
36
37  // Pulled events will start at field 10000.
38  oneof pulled {
39    ProcessMemoryState process_memory_state = 10013;
40    ProcessCpuTime process_cpu_time = 10035;
41    ProcessMemorySnapshot process_memory_snapshot = 10064;
42  }
43}
44
45message AppStartMemoryStateCaptured {
46  // The uid if available. -1 means not available.
47  optional int32 uid = 1;
48  optional string process_name = 2;
49  optional string activity_name = 3;
50  optional int64 page_fault = 4;
51  optional int64 page_major_fault = 5;
52  optional int64 rss_in_bytes = 6;
53  optional int64 cache_in_bytes = 7;
54  optional int64 swap_in_bytes = 8;
55}
56
57message ProcessMemoryState {
58  optional int32 uid = 1;
59  optional string process_name = 2;
60  optional int32 oom_adj_score = 3;
61  optional int64 page_fault = 4;
62  optional int64 page_major_fault = 5;
63  optional int64 rss_in_bytes = 6;
64  optional int64 cache_in_bytes = 7;
65  optional int64 swap_in_bytes = 8;
66}
67
68message ActivityForegroundStateChanged {
69  optional int32 uid = 1;
70  optional string pkg_name = 2;
71  optional string class_name = 3;
72  enum State {
73    BACKGROUND = 0;
74    FOREGROUND = 1;
75  }
76  optional State state = 4;
77}
78
79message ProcessCpuTime {
80  optional int32 uid = 1;
81  optional string process_name = 2;
82  optional int64 user_time_millis = 3;
83  optional int64 system_time_millis = 4;
84}
85
86// copied from frameworks/proto_logging/stats/atoms.proto
87message ProcessStartTime {
88  optional int32 uid = 1;
89  optional int32 pid = 2;
90
91  optional string process_name = 3;
92
93  enum StartType {
94    UNKNOWN = 0;
95    WARM = 1;
96    HOT = 2;
97    COLD = 3;
98  }
99
100  optional StartType type = 4;
101  optional int64 process_start_time_millis = 5;
102  optional int32 bind_application_delay_millis = 6;
103  optional int32 process_start_delay_millis = 7;
104
105  optional string hosting_type = 8 [deprecated = true];
106  optional string hosting_name = 9;
107  optional string broadcast_action_name = 10;
108
109  enum HostingTypeId {
110    HOSTING_TYPE_UNKNOWN = 0;
111    HOSTING_TYPE_ACTIVITY = 1;
112    HOSTING_TYPE_ADDED_APPLICATION = 2;
113    HOSTING_TYPE_BACKUP = 3;
114    HOSTING_TYPE_BROADCAST = 4;
115    HOSTING_TYPE_CONTENT_PROVIDER = 5;
116    HOSTING_TYPE_LINK_FAIL = 6;
117    HOSTING_TYPE_ON_HOLD = 7;
118    HOSTING_TYPE_NEXT_ACTIVITY = 8;
119    HOSTING_TYPE_NEXT_TOP_ACTIVITY = 9;
120    HOSTING_TYPE_RESTART = 10;
121    HOSTING_TYPE_SERVICE = 11;
122    HOSTING_TYPE_SYSTEM = 12;
123    HOSTING_TYPE_TOP_ACTIVITY = 13;
124    HOSTING_TYPE_EMPTY = 14;
125  }
126
127  optional HostingTypeId hosting_type_id = 11;
128
129  enum TriggerType {
130    TRIGGER_TYPE_UNKNOWN = 0;
131    TRIGGER_TYPE_ALARM = 1;
132    TRIGGER_TYPE_PUSH_MESSAGE = 2;
133    TRIGGER_TYPE_PUSH_MESSAGE_OVER_QUOTA = 3;
134    TRIGGER_TYPE_JOB = 4;
135  }
136
137  optional TriggerType trigger_type = 12;
138}
139
140// Copied from //frameworks/proto_logging/stats/enums/server/enums.proto
141enum ErrorSource {
142  ERROR_SOURCE_UNKNOWN = 0;
143  DATA_APP = 1;
144  SYSTEM_APP = 2;
145  SYSTEM_SERVER = 3;
146}
147
148message AppCrashOccurred {
149  optional int32 uid = 1;
150  optional string event_type = 2;
151  optional string process_name = 3;
152  optional int32 pid = 4;
153  optional string package_name = 5;
154  enum InstantApp {
155    UNAVAILABLE = 0;
156    FALSE = 1;
157    TRUE = 2;
158  }
159  optional InstantApp is_instant_app = 6;
160  enum ForegroundState {
161    UNKNOWN = 0;
162    BACKGROUND = 1;
163    FOREGROUND = 2;
164  }
165  optional ForegroundState foreground_state = 7;
166  optional ErrorSource error_source = 8;
167  optional bool is_incremental = 9;
168  optional float loading_progress = 10;
169  optional int64 millis_since_oldest_pending_read = 11;
170  optional int32 storage_health_code = 12;
171  optional int32 data_loader_status_code = 13;
172  optional bool read_logs_enabled = 14;
173  optional int64 millis_since_last_data_loader_bind = 15;
174  optional int64 data_loader_bind_delay_millis = 16;
175  optional int32 total_delayed_reads = 17;
176  optional int32 total_failed_reads = 18;
177  optional int32 last_read_error_uid = 19;
178  optional int64 last_read_error_millis_since = 20;
179  optional int32 last_read_error_code = 21;
180  optional int64 total_delayed_reads_duration_millis = 22;
181}
182
183message ANROccurred {
184  optional int32 uid = 1;
185  optional string process_name = 2;
186  optional string short_component_name = 3;
187  optional string reason = 4;
188  enum InstantApp {
189    UNAVAILABLE = 0;
190    FALSE = 1;
191    TRUE = 2;
192  }
193  optional InstantApp is_instant_app = 5;
194  enum ForegroundState {
195    UNKNOWN = 0;
196    BACKGROUND = 1;
197    FOREGROUND = 2;
198  }
199  optional ForegroundState foreground_state = 6;
200  optional ErrorSource error_source = 7;
201  optional string package_name = 8;
202  optional bool is_incremental = 9;
203  optional float loading_progress = 10;
204  optional int64 millis_since_oldest_pending_read = 11;
205  optional int32 storage_health_code = 12;
206  optional int32 data_loader_status_code = 13;
207  optional bool read_logs_enabled = 14;
208  optional int64 millis_since_last_data_loader_bind = 15;
209  optional int64 data_loader_bind_delay_millis = 16;
210  optional int32 total_delayed_reads = 17;
211  optional int32 total_failed_reads = 18;
212  optional int32 last_read_error_uid = 19;
213  optional int64 last_read_error_millis_since = 20;
214  optional int32 last_read_error_code = 21;
215  optional int64 total_delayed_reads_duration_millis = 22;
216}
217
218message WTFOccurred {
219  optional int32 uid = 1;
220  optional string tag = 2;
221  optional string process_name = 3;
222  optional int32 pid = 4;
223  optional ErrorSource error_source = 5;
224}
225
226message ProcessMemorySnapshot {
227  optional int32 uid = 1;
228  optional string process_name = 2;
229  optional int32 pid = 3;
230  optional int32 oom_score_adj = 4;
231  optional int32 rss_in_kilobytes = 5;
232  optional int32 anon_rss_in_kilobytes = 6;
233  optional int32 swap_in_kilobytes = 7;
234  optional int32 anon_rss_and_swap_in_kilobytes = 8;
235  optional int32 gpu_memory_kb = 9;
236  optional bool has_foreground_services = 10;
237}
238
239message CarPowerStateChanged {
240  enum State {
241    WAIT_FOR_VHAL = 0;
242    ON = 1;
243    SHUTDOWN_PREPARE = 2;
244    WAIT_FOR_FINISH = 3;
245    SUSPEND = 4;
246    SIMULATE_SLEEP = 5;
247  }
248  optional State state = 1;
249}
250