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.statsd;
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  }
34
35  // Pulled events will start at field 10000.
36  oneof pulled {
37    ProcessMemoryState process_memory_state = 10013;
38    ProcessCpuTime process_cpu_time = 10035;
39  }
40}
41
42message AppStartMemoryStateCaptured {
43  // The uid if available. -1 means not available.
44  optional int32 uid = 1;
45  optional string process_name = 2;
46  optional string activity_name = 3;
47  optional int64 page_fault = 4;
48  optional int64 page_major_fault = 5;
49  optional int64 rss_in_bytes = 6;
50  optional int64 cache_in_bytes = 7;
51  optional int64 swap_in_bytes = 8;
52}
53
54message ProcessMemoryState {
55  optional int32 uid = 1;
56  optional string process_name = 2;
57  optional int32 oom_adj_score = 3;
58  optional int64 page_fault = 4;
59  optional int64 page_major_fault = 5;
60  optional int64 rss_in_bytes = 6;
61  optional int64 cache_in_bytes = 7;
62  optional int64 swap_in_bytes = 8;
63}
64
65message ActivityForegroundStateChanged {
66  optional int32 uid = 1;
67  optional string pkg_name = 2;
68  optional string class_name = 3;
69  enum State {
70    BACKGROUND = 0;
71    FOREGROUND = 1;
72  }
73  optional State state = 4;
74}
75
76message ProcessCpuTime {
77  optional int32 uid = 1;
78  optional string process_name = 2;
79  optional int64 user_time_millis = 3;
80  optional int64 system_time_millis = 4;
81}
82
83// Copied from //frameworks/proto_logging/stats/enums/server/enums.proto
84enum ErrorSource {
85  ERROR_SOURCE_UNKNOWN = 0;
86  DATA_APP = 1;
87  SYSTEM_APP = 2;
88  SYSTEM_SERVER = 3;
89}
90
91message AppCrashOccurred {
92  optional int32 uid = 1;
93  optional string event_type = 2;
94  optional string process_name = 3;
95  optional int32 pid = 4;
96  optional string package_name = 5;
97  enum InstantApp {
98    UNAVAILABLE = 0;
99    FALSE = 1;
100    TRUE = 2;
101  }
102  optional InstantApp is_instant_app = 6;
103  enum ForegroundState {
104    UNKNOWN = 0;
105    BACKGROUND = 1;
106    FOREGROUND = 2;
107  }
108  optional ForegroundState foreground_state = 7;
109  optional ErrorSource error_source = 8;
110  optional bool is_incremental = 9;
111  optional float loading_progress = 10;
112  optional int64 millis_since_oldest_pending_read = 11;
113  optional int32 storage_health_code = 12;
114  optional int32 data_loader_status_code = 13;
115  optional bool read_logs_enabled = 14;
116  optional int64 millis_since_last_data_loader_bind = 15;
117  optional int64 data_loader_bind_delay_millis = 16;
118  optional int32 total_delayed_reads = 17;
119  optional int32 total_failed_reads = 18;
120  optional int32 last_read_error_uid = 19;
121  optional int64 last_read_error_millis_since = 20;
122  optional int32 last_read_error_code = 21;
123  optional int64 total_delayed_reads_duration_millis = 22;
124}
125
126message ANROccurred {
127  optional int32 uid = 1;
128  optional string process_name = 2;
129  optional string short_component_name = 3;
130  optional string reason = 4;
131  enum InstantApp {
132    UNAVAILABLE = 0;
133    FALSE = 1;
134    TRUE = 2;
135  }
136  optional InstantApp is_instant_app = 5;
137  enum ForegroundState {
138    UNKNOWN = 0;
139    BACKGROUND = 1;
140    FOREGROUND = 2;
141  }
142  optional ForegroundState foreground_state = 6;
143  optional ErrorSource error_source = 7;
144  optional string package_name = 8;
145  optional bool is_incremental = 9;
146  optional float loading_progress = 10;
147  optional int64 millis_since_oldest_pending_read = 11;
148  optional int32 storage_health_code = 12;
149  optional int32 data_loader_status_code = 13;
150  optional bool read_logs_enabled = 14;
151  optional int64 millis_since_last_data_loader_bind = 15;
152  optional int64 data_loader_bind_delay_millis = 16;
153  optional int32 total_delayed_reads = 17;
154  optional int32 total_failed_reads = 18;
155  optional int32 last_read_error_uid = 19;
156  optional int64 last_read_error_millis_since = 20;
157  optional int32 last_read_error_code = 21;
158  optional int64 total_delayed_reads_duration_millis = 22;
159}
160
161message WTFOccurred {
162  optional int32 uid = 1;
163  optional string tag = 2;
164  optional string process_name = 3;
165  optional int32 pid = 4;
166  optional ErrorSource error_source = 5;
167}
168