blob: cbea484e92dc8d0c7e7e3dbc0e5857a1ca952b22 [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 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";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070025import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080026import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080028import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080029import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/telephony/enums.proto";
31import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080032
Yao Chend54f9dd2017-10-17 17:37:48 +000033/**
Stefan Lafonae2df012017-11-14 09:17:21 -080034 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000035 * raw stats log events from the Android system, also known as "atoms."
36 *
37 * This field contains a single oneof with all of the available messages.
38 * The stats-log-api-gen tool runs as part of the Android build and
39 * generates the android.util.StatsLog class, which contains the constants
40 * and methods that Android uses to log.
41 *
Stefan Lafonae2df012017-11-14 09:17:21 -080042 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000043 * Instead, statsd on Android constructs these messages synthetically,
44 * in the format defined here and in stats_log.proto.
45 */
Stefan Lafonae2df012017-11-14 09:17:21 -080046message Atom {
47 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070048 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070049 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
50 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070051 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070052 BleScanResultReceived ble_scan_result_received = 4;
53 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080054 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070055 SyncStateChanged sync_state_changed = 7;
56 ScheduledJobStateChanged scheduled_job_state_changed = 8;
57 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070058 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080059 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
60 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
61 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070062 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
63 MemoryFactorStateChanged memory_factor_state_changed = 15;
64 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
65 CachedKillReported cached_kill_reported = 17;
66 ProcessMemoryStatReported process_memory_stat_reported = 18;
67 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080068 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
69 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
70 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070071 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080072 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070073 CameraStateChanged camera_state_changed = 25;
74 FlashlightStateChanged flashlight_state_changed = 26;
75 UidProcessStateChanged uid_process_state_changed = 27;
76 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
77 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070078 BatteryLevelChanged battery_level_changed = 30;
79 ChargingStateChanged charging_state_changed = 31;
80 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080081 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070082 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
83 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070084 WifiLockStateChanged wifi_lock_state_changed = 37;
85 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
86 WifiScanStateChanged wifi_scan_state_changed = 39;
87 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070088 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070089 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070090 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090091 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080092 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080093 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080094 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080095 AppStartOccurred app_start_occurred = 48;
96 AppStartCanceled app_start_canceled = 49;
97 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080098 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080099 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800100 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800101 LmkStateChanged lmk_state_changed = 54;
102 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800103 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800104 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800105 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800106 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800107 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800108 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800109 KeyguardStateChanged keyguard_state_changed = 62;
110 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
111 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800112 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800113 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800114 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
115 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700116 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700117 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800118 SpeakerImpedanceReported speaker_impedance_reported = 71;
119 HardwareFailed hardware_failed = 72;
120 PhysicalDropDetected physical_drop_detected = 73;
121 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800122 MobileConnectionStateChanged mobile_connection_state_changed = 75;
123 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700124 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800125 AppCrashOccurred app_crash_occurred = 78;
126 ANROccurred anr_occurred = 79;
127 WTFOccurred wtf_occurred = 80;
128 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700129 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700130 KeyValuePairsAtom key_value_pairs_atom = 83;
Yao Chend54f9dd2017-10-17 17:37:48 +0000131 }
David Chenc8a43242017-10-17 16:23:28 -0700132
David Chen6e3e6cb2018-01-03 16:14:06 -0800133 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100134 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700135 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800136 WifiBytesTransfer wifi_bytes_transfer = 10000;
137 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
138 MobileBytesTransfer mobile_bytes_transfer = 10002;
139 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800140 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800141 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800142 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800143 CpuTimePerFreq cpu_time_per_freq = 10008;
144 CpuTimePerUid cpu_time_per_uid = 10009;
145 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800146 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800147 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800148 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800149 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800150 SystemElapsedRealtime system_elapsed_realtime = 10014;
151 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800152 CpuActiveTime cpu_active_time = 10016;
153 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh6188aa32018-08-29 00:21:07 +0000154 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800155 RemainingBatteryCapacity remaining_battery_capacity = 10019;
156 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800157 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100158 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100159 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100160 LooperStats looper_stats = 10024;
David Chenc8a43242017-10-17 16:23:28 -0700161 }
yroa1fe77c2018-02-26 14:22:54 -0800162
163 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
164 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700165}
166
Yao Chend54f9dd2017-10-17 17:37:48 +0000167/**
Yangster-mac20877162017-12-22 17:19:39 -0800168 * This proto represents a node of an attribution chain.
169 * Note: All attribution chains are represented as a repeated field of type
170 * AttributionNode. It is understood that in such arrays, the order is that
171 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 */
Yangster-mac20877162017-12-22 17:19:39 -0800173message AttributionNode {
174 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800175 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800176
Yangster-mac20877162017-12-22 17:19:39 -0800177 // The (optional) string tag for an element in the attribution chain. If the
178 // element has no tag, it is encoded as an empty string.
179 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700180}
181
Yangster-mac48b3d622018-08-18 12:38:11 -0700182message KeyValuePair {
183 optional int32 key = 1;
184 oneof value {
185 int64 value_int = 2;
186 string value_str = 3;
187 float value_float = 4;
188 }
189}
190
191message KeyValuePairsAtom {
192 optional int32 uid = 1;
193 repeated KeyValuePair pairs = 2;
194}
195
Yao Chend54f9dd2017-10-17 17:37:48 +0000196/*
197 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800198 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000199 *
200 * RULES:
201 * - The field ids for each atom must start at 1, and count upwards by 1.
202 * Skipping field ids is not allowed.
203 * - These form an API, so renaming, renumbering or removing fields is
204 * not allowed between android releases. (This is not currently enforced,
205 * but there will be a tool to enforce this restriction).
206 * - The types must be built-in protocol buffer types, namely, no sub-messages
207 * are allowed (yet). The bytes type is also not allowed.
208 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800209 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000210 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800211 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000212 * - A field that is a uid should be a string field, tagged with the [xxx]
213 * annotation. The generated code on android will be represented by UIDs,
214 * and those UIDs will be translated in xxx to those strings.
215 *
216 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700217 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000218 * - If there is a UID, it goes first. Think in an object-oriented fashion.
219 * *****************************************************************************
220 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700221
Yao Chend54f9dd2017-10-17 17:37:48 +0000222/**
223 * Logs when the screen state changes.
224 *
225 * Logged from:
226 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
227 */
228message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800229 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800230 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700231}
Yao Chend54f9dd2017-10-17 17:37:48 +0000232
233/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700234 * Logs that the process state of the uid, as determined by ActivityManager
235 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000236 *
237 * Logged from:
238 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
239 */
Bookatzc1a050a2017-10-10 15:49:28 -0700240message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700241 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000242
Bookatzdb026a22018-01-10 19:01:56 -0800243 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800244 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000245}
246
247/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700248 * Logs process state change of a process, as per the activity manager.
249 *
250 * Logged from:
251 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
252 */
253message ProcessStateChanged {
254 optional int32 uid = 1;
255 optional string process_name = 2;
256 optional string package_name = 3;
257 // TODO: remove this when validation is done
258 optional int64 version = 5;
259 // The state, from frameworks/base/core/proto/android/app/enums.proto.
260 optional android.app.ProcessStateEnum state = 4;
261}
262
263/**
264 * Logs when ActivityManagerService sleep state is changed.
265 *
266 * Logged from:
267 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
268 */
269message ActivityManagerSleepStateChanged {
270 // TODO: import frameworks proto
271 enum State {
272 UNKNOWN = 0;
273 ASLEEP = 1;
274 AWAKE = 2;
275 }
276 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
277}
278
279/**
280 * Logs when system memory state changes.
281 *
282 * Logged from:
283 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
284 */
285message MemoryFactorStateChanged {
286 // TODO: import frameworks proto
287 enum State {
288 MEMORY_UNKNOWN = 0;
289 NORMAL = 1; // normal.
290 MODERATE = 2; // moderate memory pressure.
291 LOW = 3; // low memory.
292 CRITICAL = 4; // critical memory.
293
294 }
295 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
296}
297
298/**
299 * Logs when app is using too much cpu, according to ActivityManagerService.
300 *
301 * Logged from:
302 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
303 */
304message ExcessiveCpuUsageReported {
305 optional int32 uid = 1;
306 optional string process_name = 2;
307 optional string package_name = 3;
308 // package version. TODO: remove this when validation is done
309 optional int64 version = 4;
310}
311
312/**
313 * Logs when a cached process is killed, along with its pss.
314 *
315 * Logged from:
316 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
317 */
318message CachedKillReported {
319 optional int32 uid = 1;
320 optional string process_name = 2;
321 optional string package_name = 3;
322 // TODO: remove this when validation is done
323 optional int64 version = 5;
324 optional int64 pss = 4;
325}
326
327/**
328 * Logs when memory stats of a process is reported.
329 *
330 * Logged from:
331 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
332 */
333message ProcessMemoryStatReported {
334 optional int32 uid = 1;
335 optional string process_name = 2;
336 optional string package_name = 3;
337 //TODO: remove this when validation is done
338 optional int64 version = 9;
339 optional int64 pss = 4;
340 optional int64 uss = 5;
341 optional int64 rss = 6;
342 enum Type {
343 ADD_PSS_INTERNAL_SINGLE = 0;
344 ADD_PSS_INTERNAL_ALL_MEM = 1;
345 ADD_PSS_INTERNAL_ALL_POLL = 2;
346 ADD_PSS_EXTERNAL = 3;
347 ADD_PSS_EXTERNAL_SLOW = 4;
348 }
349 optional Type type = 7;
350 optional int64 duration = 8;
351}
352
353/**
Bookatzc1a050a2017-10-10 15:49:28 -0700354 * Logs that a process started, finished, crashed, or ANRed.
355 *
356 * Logged from:
357 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
358 */
359message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700360 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700361
David Chen0b5c90c2018-01-25 16:51:49 -0800362 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800363 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700364
Bookatzddccf0a2017-11-28 16:48:14 -0800365 // What lifecycle state the process changed to.
366 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800367 enum State {
368 FINISHED = 0;
369 STARTED = 1;
370 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800371 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800372 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700373}
374
Bookatzc1a050a2017-10-10 15:49:28 -0700375/**
376 * Logs when the ble scan state changes.
377 *
378 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700379 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700380 */
381message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800382 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700383
384 enum State {
385 OFF = 0;
386 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700387 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
388 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700389 }
390 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700391
Bookatze5ec0b42018-03-26 13:34:56 -0700392 // Does the scan have a filter.
393 optional bool is_filtered = 3;
394 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
395 optional bool is_first_match = 4;
396 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
397 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700398}
399
400/**
401 * Logs reporting of a ble scan finding results.
402 *
403 * Logged from:
404 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
405 */
406// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
407message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800408 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700409
410 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800411 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700412}
413
414/**
415 * Logs when a sensor state changes.
416 *
417 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700418 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700419 */
420message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800421 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700422
Bookatzc1a050a2017-10-10 15:49:28 -0700423 // The id (int) of the sensor.
424 optional int32 sensor_id = 2;
425
426 enum State {
427 OFF = 0;
428 ON = 1;
429 }
430 optional State state = 3;
431}
432
433
434/**
435 * Logs when GPS state changes.
436 *
437 * Logged from:
438 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
439 */
440message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800441 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700442
443 enum State {
444 OFF = 0;
445 ON = 1;
446 }
447 optional State state = 2;
448}
449
450
451/**
452 * Logs when a sync manager sync state changes.
453 *
454 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700455 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700456 */
457message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800458 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700459
David Chen0b5c90c2018-01-25 16:51:49 -0800460 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800461 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700462
463 enum State {
464 OFF = 0;
465 ON = 1;
466 }
467 optional State state = 3;
468}
469
470/**
471 * Logs when a job scheduler job state changes.
472 *
473 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700474 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700475 */
476message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800477 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700478
479 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800480 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700481
482 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800483 FINISHED = 0;
484 STARTED = 1;
485 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700486 }
487 optional State state = 3;
488
Tej Singh33a412b2018-03-16 18:43:59 -0700489 // The reason a job has stopped.
490 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700491 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700492 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700493}
494
495/**
496 * Logs when the audio state changes.
497 *
498 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700499 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700500 */
501message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800502 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700503
504 enum State {
505 OFF = 0;
506 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700507 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
508 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700509 }
510 optional State state = 2;
511}
512
513/**
514 * Logs when the video codec state changes.
515 *
516 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700517 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700518 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800519message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800520 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700521
522 enum State {
523 OFF = 0;
524 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700525 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
526 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700527 }
528 optional State state = 2;
529}
530
531/**
532 * Logs when the flashlight state changes.
533 *
534 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700535 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700536 */
537message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800538 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700539
540 enum State {
541 OFF = 0;
542 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700543 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
544 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700545 }
546 optional State state = 2;
547}
548
549/**
550 * Logs when the camera state changes.
551 *
552 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700553 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700554 */
555message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800556 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700557
558 enum State {
559 OFF = 0;
560 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700561 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
562 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700563 }
564 optional State state = 2;
565}
566
567/**
568 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000569 *
570 * Logged from:
571 * TODO
572 */
Bookatzd6746242017-10-24 18:39:35 -0700573message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800574 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000575
Bookatz1a1b0462018-01-12 11:47:03 -0800576 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
577 // From frameworks/base/core/proto/android/os/enums.proto.
578 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700579
580 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
581 optional string tag = 3;
582
583 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800584 RELEASE = 0;
585 ACQUIRE = 1;
586 CHANGE_RELEASE = 2;
587 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700588 }
589 optional State state = 4;
590}
591
592/**
Bookatzc1a050a2017-10-10 15:49:28 -0700593 * Logs when a partial wakelock is considered 'long' (over 1 min).
594 *
595 * Logged from:
596 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
597 */
598message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800599 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700600
Yao Chend54f9dd2017-10-17 17:37:48 +0000601 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
602 optional string tag = 2;
603
Bookatzc1a050a2017-10-10 15:49:28 -0700604 // TODO: I have no idea what this is.
605 optional string history_tag = 3;
606
607 enum State {
608 OFF = 0;
609 ON = 1;
610 }
611 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000612}
613
Bookatzc1a050a2017-10-10 15:49:28 -0700614/**
615 * Logs Battery Saver state change.
616 *
617 * Logged from:
618 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
619 */
620message BatterySaverModeStateChanged {
621 enum State {
622 OFF = 0;
623 ON = 1;
624 }
625 optional State state = 1;
626}
627
628/**
629 * Logs Doze mode state change.
630 *
631 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800632 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700633 */
634message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800635 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800636}
637
638
639/**
640 * Logs state change of Doze mode including maintenance windows.
641 *
642 * Logged from:
643 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
644 */
645message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800646 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700647}
648
649/**
650 * Logs screen brightness level.
651 *
652 * Logged from:
653 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
654 */
655message ScreenBrightnessChanged {
656 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
657 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700658}
659
660/**
661 * Logs battery level (percent full, from 0 to 100).
662 *
663 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700664 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700665 */
666message BatteryLevelChanged {
667 // Battery level. Should be in [0, 100].
668 optional int32 battery_level = 1;
669}
670
671/**
672 * Logs change in charging status of the device.
673 *
674 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700675 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700676 */
677message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800678 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
679 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700680}
681
682/**
683 * Logs whether the device is plugged in, and what power source it is using.
684 *
685 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700686 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700687 */
688message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800689 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
690 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700691}
692
Bookatz8c6571b2017-10-24 15:04:41 -0700693/**
694 * Logs when an app's wakeup alarm fires.
695 *
696 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700697 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700698 */
699message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800700 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800701
702 // Name of the wakeup alarm.
703 optional string tag = 2;
704}
705
706/**
707 * Logs when an an app causes the mobile radio to change state.
708 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
709 *
710 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700711 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800712 */
713message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800714 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800715
Bookatz1a1b0462018-01-12 11:47:03 -0800716 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
717 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800718}
719
720/**
721 * Logs when an an app causes the wifi radio to change state.
722 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
723 *
724 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700725 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800726 */
727message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800728 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800729
Bookatz1a1b0462018-01-12 11:47:03 -0800730 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
731 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700732}
733
734/**
735 * Logs kernel wakeup reasons and aborts.
736 *
737 * Logged from:
738 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
739 */
740message KernelWakeupReported {
741 // Name of the kernel wakeup reason (or abort).
742 optional string wakeup_reason_name = 1;
743
744 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800745 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700746}
747
748/**
749 * Logs wifi locks held by an app.
750 *
751 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700752 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700753 */
754message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800755 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700756
757 enum State {
758 OFF = 0;
759 ON = 1;
760 }
761 optional State state = 2;
762}
763
764/**
765 * Logs wifi signal strength changes.
766 *
767 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700768 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700769 */
770message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800771 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
772 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700773}
774
775/**
776 * Logs wifi scans performed by an app.
777 *
778 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700779 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700780 */
781message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800782 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700783
784 enum State {
785 OFF = 0;
786 ON = 1;
787 }
788 optional State state = 2;
789}
790
791/**
Tej Singh4503e102018-01-04 14:35:01 -0800792 * Logs wifi multicast locks held by an app
793 *
794 * Logged from:
795 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
796 */
797message WifiMulticastLockStateChanged {
798 repeated AttributionNode attribution_node = 1;
799
800 enum State {
801 OFF = 0;
802 ON = 1;
803 }
804 optional State state = 2;
805}
806
807/**
Tej Singh1ea42892018-01-19 09:27:00 -0800808 * Logs shutdown reason and duration on next boot.
809 *
810 * Logged from:
811 * frameworks/base/core/java/com/android/server/BootReceiver.java
812 */
813message ShutdownSequenceReported {
814 // True if shutdown is for a reboot. Default: false if we do not know.
815 optional bool reboot = 1;
816
817 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
818 optional string reason = 2;
819
820 // Beginning of shutdown time in ms using wall clock time since unix epoch.
821 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800822 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800823
824 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800825 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800826}
827
Tej Singh6483ea42018-01-25 17:45:49 -0800828
829/**
830 * Logs boot reason and duration.
831 *
832 * Logged from:
833 * system/core/bootstat/bootstat.cpp
834 */
835message BootSequenceReported {
836 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
837 // Default: "<EMPTY>" if not available.
838 optional string bootloader_reason = 1;
839
840 // Reason for system boot. Eg. bootloader, reboot,userrequested
841 // Default: "<EMPTY>" if not available.
842 optional string system_reason = 2;
843
844 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800845 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800846
847 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800848 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800849
850 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800851 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800852
853 // Time since last boot in ms. Default: 0 if not available.
854 optional int64 time_since_last_boot = 6;
855}
856
Tej Singhc477d9c2018-02-05 18:31:39 -0800857
858/**
859 * Logs call state and disconnect cause (if applicable).
860 *
861 * Logged from:
862 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
863 */
864message CallStateChanged {
865 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
866 // From frameworks/base/core/proto/android/telecomm/enums.proto.
867 optional android.telecom.CallStateEnum call_state = 1;
868
869 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
870 // This value is only applicable when the call_state is DISCONNECTED, and
871 // should always be UNKNOWN if the call_state is not DISCONNECTED.
872 // From frameworks/base/core/proto/android/telecomm/enums.proto.
873 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
874
875 // True if the call is self-managed, which are apps that use the
876 // telecom infrastructure to make their own calls.
877 optional bool self_managed = 3;
878
879 // True if call is external. External calls are calls on connected Wear
880 // devices but show up in Telecom so the user can pull them onto the device.
881 optional bool external_call = 4;
882}
883
Tej Singh1ea42892018-01-19 09:27:00 -0800884/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800885 * Logs keyguard state. The keyguard is the lock screen.
886 *
887 * Logged from:
888 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
889 */
890message KeyguardStateChanged {
891 enum State {
892 UNKNOWN = 0;
893 // The keyguard is hidden when the phone is unlocked.
894 HIDDEN = 1;
895 // The keyguard is shown when the phone is locked (screen turns off).
896 SHOWN= 2;
897 // The keyguard is occluded when something is overlaying the keyguard.
898 // Eg. Opening the camera while on the lock screen.
899 OCCLUDED = 3;
900 }
901 optional State state = 1;
902}
903
904/**
905 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
906 * prompts the user to enter a password (pattern, pin, etc).
907 *
908 * Logged from:
909 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
910 */
911
912message KeyguardBouncerStateChanged {
913 enum State {
914 UNKNOWN = 0;
915 // Bouncer is hidden, either as a result of successfully entering the
916 // password, screen timing out, or user going back to lock screen.
917 HIDDEN = 1;
918 // This is when the user is being prompted to enter the password.
919 SHOWN = 2;
920 }
921 optional State state = 1;
922}
923
924/**
925 * Logs the result of entering a password into the keyguard bouncer.
926 *
927 * Logged from:
928 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
929 */
930message KeyguardBouncerPasswordEntered {
931 enum BouncerResult {
932 UNKNOWN = 0;
933 // The password entered was incorrect.
934 FAILURE = 1;
935 // The password entered was correct.
936 SUCCESS = 2;
937 }
938 optional BouncerResult result = 1;
939}
940
Tej Singha883b372018-02-15 11:30:01 -0800941/*
942 * Logs changes to the configuration of the device. The configuration is defined
943 * in frameworks/base/core/java/android/content/res/Configuration.java
944 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
945 * Please go there to interpret the possible values each field can be.
946 *
947 * Logged from:
948 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
949 */
950message ResourceConfigurationChanged {
951 // Bit mask of color capabilities of the screen.
952 // Contains information about the color gamut and hdr mode of the screen.
953 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
954 optional int32 colorMode = 1;
955
956 // The target screen density being rendered to.
957 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
958 optional int32 densityDpi = 2;
959
960 // Current user preference for the scaling factor for fonts,
961 // relative to the base density scaling.
962 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
963 optional float fontScale = 3;
964
965 // Flag indicating whether the hard keyboard is hidden.
966 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
967 optional int32 hardKeyboardHidden = 4;
968
969 // The type of keyboard attached to the device.
970 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
971 optional int32 keyboard = 5;
972
973 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
974 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
975 optional int32 keyboardHideen = 6;
976
977 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
978 // 0 if undefined.
979 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
980 optional int32 mcc = 7;
981
982 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
983 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
984 // MNC_ZERO symbol defined in Configuration.java.
985 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
986 optional int32 mnc = 8;
987
988 // The kind of navigation available on the device.
989 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
990 optional int32 navigation = 9;
991
992 // Flag indicating whether the navigation is available.
993 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
994 optional int32 navigationHidden = 10;
995
996 // Overall orientation of the screen.
997 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
998 optional int32 orientation = 11;
999
1000 // The current height of the available screen space, in dp units.
1001 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1002 optional int32 screenHeightDp = 12;
1003
1004 // Bit mask of overall layout of the screen.
1005 // Contains information about screen size, whether the screen is wider/taller
1006 // than normal, whether the screen layout is right-tl-left or left-to-right,
1007 // and whether the screen has a rounded shape.
1008 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1009 optional int32 screenLayout = 13;
1010
1011 // Current width of the available screen space, in dp units.
1012 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1013 optional int32 screenWidthDp = 14;
1014
1015 // The smallest screen size an application will see in normal operation.
1016 // This is the smallest value of both screenWidthDp and screenHeightDp
1017 // in portrait and landscape.
1018 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1019 optional int32 smallestScreenWidthDp = 15;
1020
1021 // The type of touch screen attached to the device.
1022 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1023 optional int32 touchscreen = 16;
1024
1025 // Bit mask of the ui mode.
1026 // Contains information about the overall ui mode of the device.
1027 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1028 // Also contains information about whether the device is in night mode.
1029 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1030 optional int32 uiMode = 17;
1031}
1032
Tej Singheee317b2018-03-07 19:28:05 -08001033
1034/**
1035 * Logs changes in the connection state of the mobile radio.
1036 *
1037 * Logged from:
1038 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1039 */
1040message MobileConnectionStateChanged {
1041 // States are from the state machine DataConnection.java.
1042 enum State {
1043 UNKNOWN = 0;
1044 // The connection is inactive, or disconnected.
1045 INACTIVE = 1;
1046 // The connection is being activated, or connecting.
1047 ACTIVATING = 2;
1048 // The connection is active, or connected.
1049 ACTIVE = 3;
1050 // The connection is disconnecting.
1051 DISCONNECTING = 4;
1052 // The connection is disconnecting after creating a connection.
1053 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1054 }
1055 optional State state = 1;
1056 // For multi-sim phones, this distinguishes between the sim cards.
1057 optional int32 sim_slot_index = 2;
1058 // Used to identify the connection. Starts at 0 and increments by 1 for
1059 // every new network created. Resets whenever the device reboots.
1060 optional int32 data_connection_id = 3;
1061 // A bitmask for the capabilities of this connection.
1062 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1063 // Default value (if we have no information): 0
1064 optional int64 capabilities = 4;
1065 // If this connection has internet.
1066 // This just checks if the DEFAULT bit of capabilities is set.
1067 optional bool has_internet = 5;
1068}
1069
1070/**
1071 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1072 *
1073 * Logged from:
1074 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1075 */
1076message MobileRadioTechnologyChanged {
1077 optional android.telephony.NetworkTypeEnum state = 1;
1078 // For multi-sim phones, this distinguishes between the sim cards.
1079 optional int32 sim_slot_index = 2;
1080}
1081
Andrew Chantb56388b2018-03-22 21:07:33 -07001082/**
1083 * Logs the VID and PID of any connected USB devices.
1084 *
1085 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1086 *
1087 * Logged by Vendor.
1088 */
1089message UsbDeviceAttached {
1090 optional int32 vid = 1;
1091 optional int32 pid = 2;
1092 optional bool has_audio = 3;
1093 optional bool has_hid = 4;
1094 optional bool has_storage = 5;
1095}
1096
Tej Singheee317b2018-03-07 19:28:05 -08001097
Tej Singhdd7bd352018-02-09 19:33:15 -08001098/**
Tej Singh5d991e12018-03-09 19:48:11 -08001099 * Logs when Bluetooth is enabled and disabled.
1100 *
1101 * Logged from:
1102 * services/core/java/com/android/server/BluetoothManagerService.java
1103 */
1104message BluetoothEnabledStateChanged {
1105 repeated AttributionNode attribution_node = 1;
1106 // Whether or not bluetooth is enabled on the device.
1107 enum State {
1108 UNKNOWN = 0;
1109 ENABLED = 1;
1110 DISABLED = 2;
1111 }
1112 optional State state = 2;
1113 // The reason for being enabled/disabled.
1114 // Eg. Airplane mode, crash, application request.
1115 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1116 // If the reason is an application request, this will be the package name.
1117 optional string pkgName = 4;
1118}
1119
1120/**
1121 * Logs when a Bluetooth device connects and disconnects.
1122 *
1123 * Logged from:
1124 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1125 */
1126message BluetoothConnectionStateChanged {
1127 // The state of the connection.
1128 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1129 optional android.bluetooth.ConnectionStateEnum state = 1;
1130 // An identifier that can be used to match connect and disconnect events.
1131 // Currently is last two bytes of a hash of a device level ID and
1132 // the mac address of the bluetooth device that is connected.
1133 optional int32 obfuscated_id = 2;
1134 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1135 // From android.bluetooth.BluetoothAdapter.java
1136 optional int32 bt_profile = 3;
1137}
1138
1139/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001140 * Logs when something is plugged into or removed from the USB-C connector.
1141 *
1142 * Logged from:
1143 * Vendor USB HAL.
1144 */
1145message UsbConnectorStateChanged {
1146 enum State {
1147 DISCONNECTED = 0;
1148 CONNECTED = 1;
1149 }
1150 optional State state = 1;
1151}
1152
1153/**
1154 * Logs the reported speaker impedance.
1155 *
1156 * Logged from:
1157 * Vendor audio implementation.
1158 */
1159message SpeakerImpedanceReported {
1160 optional int32 speaker_location = 1;
1161 optional int32 impedance = 2;
1162}
1163
1164/**
1165 * Logs the report of a failed hardware.
1166 *
1167 * Logged from:
1168 * Vendor HALs.
1169 *
1170 */
1171message HardwareFailed {
1172 enum HardwareType {
1173 HARDWARE_FAILED_UNKNOWN = 0;
1174 HARDWARE_FAILED_MICROPHONE = 1;
1175 HARDWARE_FAILED_CODEC = 2;
1176 HARDWARE_FAILED_SPEAKER = 3;
1177 HARDWARE_FAILED_FINGERPRINT = 4;
1178 }
1179 optional HardwareType hardware_type = 1;
1180
1181 /* hardware_location allows vendors to differentiate between multiple instances of
1182 * the same hardware_type. The specific locations are vendor defined integers,
1183 * referring to board-specific numbering schemes.
1184 */
1185 optional int32 hardware_location = 2;
1186
1187 /* failure_code is specific to the HardwareType of the failed hardware.
1188 * It should use the enum values defined below.
1189 */
1190 enum MicrophoneFailureCode {
1191 MICROPHONE_FAILURE_COMPLETE = 0;
1192 }
1193 enum CodecFailureCode {
1194 CODEC_FAILURE_COMPLETE = 0;
1195 }
1196 enum SpeakerFailureCode {
1197 SPEAKER_FAILURE_COMPLETE = 0;
1198 SPEAKER_FAILURE_HIGH_Z = 1;
1199 SPEAKER_FAILURE_SHORT = 2;
1200 }
1201 enum FingerprintFailureCode {
1202 FINGERPRINT_FAILURE_COMPLETE = 0;
1203 FINGERPRINT_SENSOR_BROKEN = 1;
1204 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1205 }
1206 optional int32 failure_code = 3;
1207}
1208
1209/**
1210 * Log an event when the device has been physically dropped.
1211 * Reported from the /vendor partition.
1212 */
1213message PhysicalDropDetected {
1214 // Confidence that the event was actually a drop, 0 -> 100
1215 optional int32 confidence_pctg = 1;
1216 // Peak acceleration of the drop, in 1/1000s of a g.
1217 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001218 // Duration of freefall in ms
1219 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001220}
1221
1222/**
1223 * Log bucketed battery charge cycles.
1224 *
1225 * Each bucket represents cycles of the battery past
1226 * a given charge point. For example, bucket 1 is the
1227 * lowest 1/8th of the battery, and bucket 8 is 100%.
1228 *
1229 * Logged from:
1230 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1231 */
1232message ChargeCyclesReported {
1233 optional int32 cycle_bucket_1 = 1;
1234 optional int32 cycle_bucket_2 = 2;
1235 optional int32 cycle_bucket_3 = 3;
1236 optional int32 cycle_bucket_4 = 4;
1237 optional int32 cycle_bucket_5 = 5;
1238 optional int32 cycle_bucket_6 = 6;
1239 optional int32 cycle_bucket_7 = 7;
1240 optional int32 cycle_bucket_8 = 8;
1241}
1242
1243/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001244 * Logs the duration of a davey (jank of >=700ms) when it occurs
1245 *
1246 * Logged from:
1247 * frameworks/base/libs/hwui/JankTracker.cpp
1248 */
1249message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001250 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001251 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001252
Tej Singhbb8554a2018-01-26 11:59:14 -08001253 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001254 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001255}
1256
1257/**
Bookatze5885242017-10-24 20:10:31 -07001258 * Logs phone signal strength changes.
1259 *
1260 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001261 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001262 */
1263message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001264 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1265 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001266}
1267
1268/**
1269 * Logs that a setting was updated.
1270 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001271 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001272 * The tag and is_default allow resetting of settings to default values based on the specified
1273 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1274 */
1275message SettingChanged {
1276 // The name of the setting.
1277 optional string setting = 1;
1278
1279 // The change being imposed on this setting. May represent a number, eg "3".
1280 optional string value = 2;
1281
1282 // The new value of this setting. For most settings, this is same as value. For some settings,
1283 // value is +X or -X where X represents an element in a set. For example, if the previous value
1284 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1285 // The +/- feature is currently only used for location_providers_allowed.
1286 optional string new_value = 3;
1287
1288 // The previous value of this setting.
1289 optional string prev_value = 4;
1290
1291 // The tag used with the is_default for resetting sets of settings. This is generally null.
1292 optional string tag = 5;
1293
Bookatz90867622018-01-31 15:05:57 -08001294 // True if this setting with tag should be resettable.
1295 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001296
David Chenbd789912018-03-16 17:19:55 -07001297 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001298 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001299
1300 enum ChangeReason {
1301 UPDATED = 1; // Updated can be an insertion or an update.
1302 DELETED = 2;
1303 }
1304 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001305}
Chenjie Yub3dda412017-10-24 13:41:59 -07001306
Chenjie Yu05013b32017-11-21 10:21:41 -08001307/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001308 * Logs activity going to foreground or background
1309 *
1310 * Logged from:
1311 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1312 */
1313message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001314 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001315 optional string pkg_name = 2;
1316 optional string class_name = 3;
1317
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001318 enum State {
1319 BACKGROUND = 0;
1320 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001321 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001322 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001323}
David Chenc8a43242017-10-17 16:23:28 -07001324
1325/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001326 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001327 * Logged from:
1328 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1329 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001330message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001331 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001332
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001333 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001334
1335 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001336 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001337 optional string process_name = 3;
1338
1339 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001340 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001341
1342 optional string package_name = 5;
1343
1344 enum InstantApp {
1345 UNAVAILABLE = 0;
1346 FALSE = 1;
1347 TRUE = 2;
1348 }
1349 optional InstantApp is_instant_app = 6;
1350
1351 enum ForegroundState {
1352 UNKNOWN = 0;
1353 BACKGROUND = 1;
1354 FOREGROUND = 2;
1355 }
1356 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001357}
David Chen9e3808c2017-11-20 17:25:34 -08001358
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001359/**
1360 * Logs when a WTF (What a Terrible Failure) happened.
1361 * Logged from:
1362 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1363 */
1364message WTFOccurred {
1365 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001366
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001367 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001368
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001369 // The name of the process.
1370 // system_server if it is not by an app
1371 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001372
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001373 // The pid if available. -1 means not available.
1374 optional sint32 pid = 4;
1375}
1376
1377/**
1378 * Logs when system server reports low memory.
1379 * Logged from:
1380 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1381 */
1382message LowMemReported {
1383}
1384
1385/**
1386 * Logs when an app ANR (App Not Responding) occurs.
1387 * Logged from:
1388 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1389 */
1390message ANROccurred {
1391 optional int32 uid = 1 [(is_uid) = true];
1392
1393 optional string process_name = 2;
1394
1395 optional string short_component_name = 3;
1396
1397 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001398
1399 enum InstantApp {
1400 UNAVAILABLE = 0;
1401 FALSE = 1;
1402 TRUE = 2;
1403 }
1404 optional InstantApp is_instant_app = 5;
1405
1406 enum ForegroundState {
1407 UNKNOWN = 0;
1408 BACKGROUND = 1;
1409 FOREGROUND = 2;
1410 }
1411 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001412}
1413
David Chen0a368b22017-12-06 16:28:16 -08001414/*
1415 * Allows other apps to push events into statsd.
1416 * Logged from:
1417 * frameworks/base/core/java/android/util/StatsLog.java
1418 */
David Chen0b5c90c2018-01-25 16:51:49 -08001419message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001420 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001421 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001422
1423 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1424 optional int32 label = 2;
1425
1426 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1427 // predicates for the metrics).
1428 enum State {
1429 UNKNOWN = 0;
1430 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1431 STOP = 2;
1432 START = 3;
1433 }
1434 optional State state = 3;
1435}
1436
David Chen9e3808c2017-11-20 17:25:34 -08001437/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001438 * Logs when statsd detects an anomaly.
1439 *
1440 * Logged from:
1441 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1442 */
1443message AnomalyDetected {
1444 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001445 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001446
Yangster-mac94e197c2018-01-02 16:03:03 -08001447 // Id of the config whose anomaly detection alert fired.
1448 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001449
Yangster-mac94e197c2018-01-02 16:03:03 -08001450 // Id of the alert (i.e. name of the anomaly that was detected).
1451 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001452}
1453
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001454message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001455 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001456 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001457
1458 // The app package name.
1459 optional string pkg_name = 2;
1460
1461 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001462 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001463 WARM = 1;
1464 HOT = 2;
1465 COLD = 3;
1466 }
1467 // The transition type.
1468 optional TransitionType type = 3;
1469
1470 // The activity name.
1471 optional string activity_name = 4;
1472
1473 // The name of the calling app. Empty if not set.
1474 optional string calling_pkg_name = 5;
1475
1476 // Whether the app is an instant app.
1477 optional bool is_instant_app = 6;
1478
1479 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001480 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001481
Bookatz80d11a02018-01-16 10:46:35 -08001482 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001483
David Chen0b5c90c2018-01-25 16:51:49 -08001484 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001485 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001486 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001487 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001488 optional int32 bind_application_delay_millis = 11;
1489 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001490
1491 // Empty if not set.
1492 optional string launch_token = 13;
1493
Calin Juravle759fbda2018-02-20 19:52:30 +00001494 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001495 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001496
1497 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001498 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001499}
1500
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001501message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001502 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001503 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001504
1505 // The app package name.
1506 optional string pkg_name = 2;
1507
1508 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001509 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001510 WARM = 1;
1511 HOT = 2;
1512 COLD = 3;
1513 }
1514 // The transition type.
1515 optional TransitionType type = 3;
1516
1517 // The activity name.
1518 optional string activity_name = 4;
1519}
1520
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001521message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001522 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001523 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001524
1525 // The app package name.
1526 optional string pkg_name = 2;
1527
1528 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001529 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001530 WITH_BUNDLE = 1;
1531 WITHOUT_BUNDLE = 2;
1532 }
1533 // The transition type.
1534 optional TransitionType type = 3;
1535
1536 // The activity name.
1537 optional string activity_name = 4;
1538
1539 optional bool transition_process_running = 5;
1540
1541 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001542 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001543}
1544
Bookatz8fcd09a2017-12-18 13:01:10 -08001545/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001546 * Logs a picture-in-picture action
1547 * Logged from:
1548 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1549 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1550 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1551 */
1552message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001553 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001554 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001555
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001556 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001557
Chenjie Yu52cacc62017-12-08 18:11:45 -08001558 enum State {
1559 ENTERED = 1;
1560 EXPANDED_TO_FULL_SCREEN = 2;
1561 MINIMIZED = 3;
1562 DISMISSED = 4;
1563 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001564 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001565}
1566
1567/**
Chenjie Yue8904192017-12-08 19:12:57 -08001568 * Logs overlay action
1569 * Logged from:
1570 * services/core/java/com/android/server/wm/Session.java
1571 */
1572message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001573 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001574
1575 optional string package_name = 2;
1576
1577 optional bool using_alert_window = 3;
1578
1579 enum State {
1580 ENTERED = 1;
1581 EXITED = 2;
1582 }
1583 optional State state = 4;
1584}
1585
Chenjie Yuccfe6452018-01-30 11:33:21 -08001586/*
1587 * Logs foreground service starts and stops.
1588 * Note that this is not when a service starts or stops, but when it is
1589 * considered foreground.
1590 * Logged from
1591 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1592 */
1593message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001594 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001595 // package_name + "/" + class_name
1596 optional string short_name = 2;
1597
1598 enum State {
1599 ENTER = 1;
1600 EXIT = 2;
1601 }
1602 optional State state = 3;
1603}
1604
Chenjie Yue8904192017-12-08 19:12:57 -08001605/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001606 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1607 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1608 * attributed back to the parent (host) uid. One example is Chrome.
1609 *
1610 * Logged from:
1611 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1612 */
1613message IsolatedUidChanged {
1614 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001615 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001616 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001617 optional int32 parent_uid = 1;
1618
1619 optional int32 isolated_uid = 2;
1620
1621 // We expect an isolated uid to be removed before if it's used for another parent uid.
1622 enum Event {
1623 REMOVED = 0;
1624 CREATED = 1;
1625 }
1626 optional Event event = 3;
1627}
1628
1629/*
1630 * Logs the reception of an incoming network packet causing the main system to wake up for
1631 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1632 * and processed by WakeupController.cpp.
1633 */
1634message PacketWakeupOccurred {
1635 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1636 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001637 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001638 // The interface name on which the packet was received.
1639 optional string iface = 2;
1640 // The ethertype value of the packet.
1641 optional int32 ethertype = 3;
1642 // String representation of the destination MAC address of the packet.
1643 optional string destination_hardware_address = 4;
1644 // String representation of the source address of the packet if this was an IP packet.
1645 optional string source_ip = 5;
1646 // String representation of the destination address of the packet if this was an IP packet.
1647 optional string destination_ip = 6;
1648 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1649 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1650 // families.
1651 optional int32 ip_next_header = 7;
1652 // The source port if this was a TCP or UDP packet.
1653 optional int32 source_port = 8;
1654 // The destination port if this was a TCP or UDP packet.
1655 optional int32 destination_port = 9;
1656}
1657
1658/*
1659 * Logs the memory stats for an app on startup.
1660 * Logged from:
1661 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1662 */
1663message AppStartMemoryStateCaptured {
1664 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001665 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001666
1667 // The process name.
1668 optional string process_name = 2;
1669
1670 // The activity name.
1671 optional string activity_name = 3;
1672
1673 // # of page-faults
1674 optional int64 pgfault = 4;
1675
1676 // # of major page-faults
1677 optional int64 pgmajfault = 5;
1678
1679 // RSS
1680 optional int64 rss_in_bytes = 6;
1681
1682 // CACHE
1683 optional int64 cache_in_bytes = 7;
1684
1685 // SWAP
1686 optional int64 swap_in_bytes = 8;
1687}
1688
1689/*
1690 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1691 * for LMK event.
1692 * Logged from:
1693 * system/core/lmkd/lmkd.c
1694 */
1695message LmkStateChanged {
1696 enum State {
1697 UNKNOWN = 0;
1698 START = 1;
1699 STOP = 2;
1700 }
1701 optional State state = 1;
1702}
1703
1704/*
1705 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1706 * Logged from:
1707 * system/core/lmkd/lmkd.c
1708 */
1709message LmkKillOccurred {
1710 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001711 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001712
1713 // The process name.
1714 optional string process_name = 2;
1715
1716 // oom adj score.
1717 optional int32 oom_score = 3;
1718
1719 // # of page-faults
1720 optional int64 pgfault = 4;
1721
1722 // # of major page-faults
1723 optional int64 pgmajfault = 5;
1724
1725 // RSS
1726 optional int64 rss_in_bytes = 6;
1727
1728 // CACHE
1729 optional int64 cache_in_bytes = 7;
1730
1731 // SWAP
1732 optional int64 swap_in_bytes = 8;
1733}
1734
Rajeev Kumar51b54602018-03-01 12:18:26 -08001735/*
1736 * Logs when the ActivityManagerService detects that an app died.
1737 *
1738 * Logged from:
1739 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1740 */
1741message AppDied {
1742 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001743 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001744}
1745
Howard Ro21a039c2018-08-06 14:55:47 -07001746/**
1747 * An atom for generic metrics logging. Available from Android Q.
1748 */
1749message GenericAtom {
1750 // The uid of the application that sent this custom atom.
1751 optional int32 uid = 1 [(is_uid) = true];
1752
1753 // An event_id indicates the type of event.
1754 optional int32 event_id = 2;
1755}
1756
Chenjie Yubbcbc602018-02-05 16:51:52 -08001757//////////////////////////////////////////////////////////////////////
1758// Pulled atoms below this line //
1759//////////////////////////////////////////////////////////////////////
1760
1761/**
David Chenc8a43242017-10-17 16:23:28 -07001762 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1763 *
1764 * Pulled from:
1765 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1766 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001767message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001768 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001769
1770 optional int64 rx_bytes = 2;
1771
1772 optional int64 rx_packets = 3;
1773
1774 optional int64 tx_bytes = 4;
1775
1776 optional int64 tx_packets = 5;
1777}
1778
1779/**
1780 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1781 *
1782 * Pulled from:
1783 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1784 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001785message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001786 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001787
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001788 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1789 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001790
1791 optional int64 rx_bytes = 3;
1792
1793 optional int64 rx_packets = 4;
1794
1795 optional int64 tx_bytes = 5;
1796
1797 optional int64 tx_packets = 6;
1798}
1799
1800/**
1801 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1802 *
1803 * Pulled from:
1804 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1805 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001806message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001807 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001808
1809 optional int64 rx_bytes = 2;
1810
1811 optional int64 rx_packets = 3;
1812
1813 optional int64 tx_bytes = 4;
1814
1815 optional int64 tx_packets = 5;
1816}
1817
1818/**
1819 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1820 *
1821 * Pulled from:
1822 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1823 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001824message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001825 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001826
Yao Chenc40a19d2018-03-15 16:48:25 -07001827 // 1 denotes foreground and 0 denotes background. This is called Set in
1828 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001829 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001830
1831 optional int64 rx_bytes = 3;
1832
1833 optional int64 rx_packets = 4;
1834
1835 optional int64 tx_bytes = 5;
1836
1837 optional int64 tx_packets = 6;
1838}
1839
1840/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001841 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1842 *
1843 * Pulled from:
1844 * StatsCompanionService
1845 */
1846message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001847 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001848
1849 optional int64 rx_bytes = 2;
1850
1851 optional int64 tx_bytes = 3;
1852}
1853
1854/**
David Chenc8a43242017-10-17 16:23:28 -07001855 * Pulls the kernel wakelock durations. This atom is adapted from
1856 * android/internal/os/KernelWakelockStats.java
1857 *
1858 * Pulled from:
1859 * StatsCompanionService using KernelWakelockReader.
1860 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001861message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001862 optional string name = 1;
1863
1864 optional int32 count = 2;
1865
1866 optional int32 version = 3;
1867
1868 optional int64 time = 4;
1869}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001870
Chenjie Yu05013b32017-11-21 10:21:41 -08001871/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001872 * Pulls low power state information. This includes platform and subsystem sleep state information,
1873 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001874 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001875 * hardware/interfaces/power/1.1/types.hal
1876 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001877message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001878 // Subsystem name
1879 optional string subsystem_name = 1;
1880 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1881 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1882 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001883 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001884 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001885 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001886 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001887}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001888
Chenjie Yu05013b32017-11-21 10:21:41 -08001889/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001890 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001891 * Pulls the time the cpu spend on the frequency index. Frequency index
1892 * starts from highest to lowest. The value should be monotonically
1893 * increasing since boot. However, if there is a cpu
1894 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001895 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001896message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001897 optional uint32 cluster = 1;
1898 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001899 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001900}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001901
Chenjie Yu05013b32017-11-21 10:21:41 -08001902/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001903 * Pulls Cpu Time Per Uid.
1904 * Note that isolated process uid time should be attributed to host uids.
1905 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001906message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001907 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001908 optional uint64 user_time_millis = 2;
1909 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001910}
1911
1912/**
1913 * Pulls Cpu Time Per Uid per frequency.
1914 * Note that isolated process uid time should be attributed to host uids.
1915 * For each uid, we order the time by descending frequencies.
1916 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001917message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001918 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001919 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001920 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001921}
Hugo Benichi884970e2017-11-14 22:42:46 +09001922
Chenjie Yu05013b32017-11-21 10:21:41 -08001923/**
1924 * Pulls Wifi Controller Activity Energy Info
1925 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001926message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001927 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001928 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001929 // stack reported state
1930 // TODO: replace this with proto enum
1931 optional int32 stack_state = 2;
1932 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001933 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001934 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001935 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001936 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001937 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001938 // product of current(mA), voltage(V) and time(ms)
1939 optional uint64 controller_energy_used = 6;
1940}
1941
1942/**
1943 * Pulls Modem Activity Energy Info
1944 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001945message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001946 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001947 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001948 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001949 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001950 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001951 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001952 /**
1953 * Tx power index
1954 * index 0 = tx_power < 0dBm
1955 * index 1 = 0dBm < tx_power < 5dBm
1956 * index 2 = 5dBm < tx_power < 15dBm
1957 * index 3 = 15dBm < tx_power < 20dBm
1958 * index 4 = tx_power > 20dBm
1959 */
1960 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001961 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001962 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001963 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001964 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001965 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001966 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001967 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001968 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001969 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001970 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001971 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001972 // product of current(mA), voltage(V) and time(ms)
1973 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001974}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001975
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001976/**
1977 * Pulls Bluetooth Activity Energy Info
1978 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1979 */
1980message BluetoothActivityInfo {
1981 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001982 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001983 // bluetooth stack state
1984 optional int32 bluetooth_stack_state = 2;
1985 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001986 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001987 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001988 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001989 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001990 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001991 // product of current(mA), voltage(V) and time(ms)
1992 optional uint64 energy_used = 6;
1993}
1994
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001995/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001996 * Logs the memory stats for a process.
1997 */
1998message ProcessMemoryState {
1999 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002000 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002001
2002 // The process name.
2003 optional string process_name = 2;
2004
2005 // oom adj score.
2006 optional int32 oom_score = 3;
2007
2008 // # of page-faults
2009 optional int64 pgfault = 4;
2010
2011 // # of major page-faults
2012 optional int64 pgmajfault = 5;
2013
Rajeev Kumar90235992018-01-29 11:06:48 -08002014 // RSS
2015 optional int64 rss_in_bytes = 6;
2016
2017 // CACHE
2018 optional int64 cache_in_bytes = 7;
2019
2020 // SWAP
2021 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002022}
2023
2024/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002025 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002026 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002027message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002028 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002029}
2030
2031/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002032 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002033 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002034message SystemUptime {
2035 // Milliseconds since the system was booted.
2036 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2037 // for external input).
2038 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002039 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002040}
2041
2042/*
2043 * Reads from /proc/uid_concurrent_active_time which has the format:
2044 * active: X (X is # cores)
2045 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2046 * [uid1]: [time-0] [time-1] [time-2] ... ...
2047 * ...
2048 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2049 * The file contains a monotonically increasing count of time for a single boot.
2050 */
2051message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002052 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002053 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002054}
2055
2056/**
2057 * Reads from /proc/uid_concurrent_policy_time which has the format:
2058 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2059 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2060 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2061 * ...
2062 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2063 * The file contains a monotonically increasing count of time for a single boot.
2064 */
2065message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002066 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002067 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002068 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002069}
2070
2071/*
2072 * Pulls free disk space, for data, system partition and temporary directory.
2073 */
2074message DiskSpace {
2075 // available bytes in data partition
2076 optional uint64 data_available_bytes = 1;
2077 // available bytes in system partition
2078 optional uint64 system_available_bytes = 2;
2079 // available bytes in download cache or temp directories
2080 optional uint64 temp_available_bytes = 3;
2081}
Tej Singhbf972d92018-01-10 20:51:13 -08002082
2083/**
2084 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002085 * Pulled from:
2086 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002087 */
2088message RemainingBatteryCapacity {
2089 optional int32 charge_uAh = 1;
2090}
2091
2092/**
2093 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002094 * Pulled from:
2095 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002096 */
2097message FullBatteryCapacity {
2098 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002099}
2100
2101/**
Tej Singhd89137e2018-03-26 14:51:40 -07002102 * Pulls the temperature of various parts of the device.
2103 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002104 *
2105 * Pulled from:
2106 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2107 */
2108message Temperature {
2109 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2110 optional android.os.TemperatureTypeEnum sensor_location = 1;
2111
2112 // The name of the temperature source. Eg. CPU0
2113 optional string sensor_name = 2;
2114
Tej Singhd89137e2018-03-26 14:51:40 -07002115 // Temperature in tenths of a degree C.
2116 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002117}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002118
2119/**
2120 * Pulls the statistics of calls to Binder.
2121 *
2122 * Binder stats are cumulative from boot unless somebody reset the data using
2123 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002124 *
2125 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002126 */
2127message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002128 optional int32 uid = 1 [(is_uid) = true];
2129 // Fully qualified class name of the API call.
2130 //
2131 // This is a system server class name.
2132 //
2133 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2134 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2135 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2136 // commonly used APIs.
2137 optional string service_class_name = 2;
2138 // Method name of the API call. It can also be a transaction code if we cannot
2139 // resolve it to a name. See Binder#getTransactionName.
2140 //
2141 // This is a system server method name.
2142 optional string service_method_name = 3;
2143 // Total number of API calls.
2144 optional int64 call_count = 4;
2145 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2146 optional bool screen_interactive = 13;
2147 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2148 // call_count will be equal to recorded_call_count.
2149 //
2150 // If recorded_call_count is different than call_count, it means data collection has been
2151 // sampled. All the fields below will be sampled in this case.
2152 optional int64 recorded_call_count = 12;
2153 // Number of exceptions thrown by the API.
2154 optional int64 recorded_exception_count = 5;
2155 // Total latency of all API calls.
2156 // Average can be computed using total_latency_micros / recorded_call_count.
2157 optional int64 recorded_total_latency_micros = 6;
2158 // Maximum latency of one API call.
2159 optional int64 recorded_max_latency_micros = 7;
2160 // Total CPU usage of all API calls.
2161 // Average can be computed using total_cpu_micros / recorded_call_count.
2162 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2163 optional int64 recorded_total_cpu_micros = 8;
2164 // Maximum CPU usage of one API call.
2165 optional int64 recorded_max_cpu_micros = 9;
2166 // Maximum parcel reply size of one API call.
2167 optional int64 recorded_max_reply_size_bytes = 10;
2168 // Maximum parcel request size of one API call.
2169 optional int64 recorded_max_request_size_bytes = 11;
2170}
2171
2172/**
2173 * Pulls the statistics of exceptions during calls to Binder.
2174 *
2175 * Binder stats are cumulative from boot unless somebody reset the data using
2176 * > adb shell dumpsys binder_calls_stats --reset
2177 */
2178message BinderCallsExceptions {
2179 // Exception class name, e.g. java.lang.IllegalArgumentException.
2180 //
2181 // This is an exception class name thrown by the system server.
2182 optional string exception_class_name = 1;
2183 // Total number of exceptions.
2184 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002185}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002186
2187message LooperStats {
2188 // Currently not collected and always set to 0.
2189 optional int32 uid = 1 [(is_uid) = true];
2190
2191 // Fully qualified class name of the handler target class.
2192 //
2193 // This field does not contain PII. This is a system server class name.
2194 optional string handler_class_name = 2;
2195
2196 // The name of the thread that runs the Looper.
2197 //
2198 // This field does not contain PII. This is a system server thread name.
2199 optional string looper_thread_name = 3;
2200
2201 // The name of the dispatched message.
2202 //
2203 // This field does not contain PII. This is a system server constant or class
2204 // name.
2205 optional string message_name = 4;
2206
2207 // Total number of successfully dispatched messages.
2208 optional int64 message_count = 5;
2209
2210 // Total number of messages that failed dispatching.
2211 optional int64 exception_count = 6;
2212
2213 // Total number of processed messages we have data recorded for. If we
2214 // collected data for all the messages, message_count will be equal to
2215 // recorded_message_count.
2216 //
2217 // If recorded_message_count is different than message_count, it means data
2218 // collection has been sampled. All the fields below will be sampled in this
2219 // case.
2220 optional int64 recorded_message_count = 7;
2221
2222 // Total latency of all processed messages.
2223 // Average can be computed using recorded_total_latency_micros /
2224 // recorded_message_count.
2225 optional int64 recorded_total_latency_micros = 8;
2226
2227 // Total CPU usage of all processed message.
2228 // Average can be computed using recorded_total_cpu_micros /
2229 // recorded_message_count. Total can be computed using
2230 // recorded_total_cpu_micros / recorded_message_count * call_count.
2231 optional int64 recorded_total_cpu_micros = 9;
2232}