blob: a98ad593f5af8fbb890930548d5f4720ec507484 [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
Yao Chend54f9dd2017-10-17 17:37:48 +000019// TODO: Not the right package and class name
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070021option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080022option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070023
Yao Chen9c1debe2018-02-19 14:39:19 -080024import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080025import "frameworks/base/core/proto/android/app/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080026import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080027import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080028import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080029import "frameworks/base/core/proto/android/telephony/enums.proto";
30import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080031
Yao Chend54f9dd2017-10-17 17:37:48 +000032/**
Stefan Lafonae2df012017-11-14 09:17:21 -080033 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000034 * raw stats log events from the Android system, also known as "atoms."
35 *
36 * This field contains a single oneof with all of the available messages.
37 * The stats-log-api-gen tool runs as part of the Android build and
38 * generates the android.util.StatsLog class, which contains the constants
39 * and methods that Android uses to log.
40 *
Stefan Lafonae2df012017-11-14 09:17:21 -080041 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000042 * Instead, statsd on Android constructs these messages synthetically,
43 * in the format defined here and in stats_log.proto.
44 */
Stefan Lafonae2df012017-11-14 09:17:21 -080045message Atom {
46 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070047 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070048 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
49 BleScanStateChanged ble_scan_state_changed = 2;
50 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
51 BleScanResultReceived ble_scan_result_received = 4;
52 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080053 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070054 SyncStateChanged sync_state_changed = 7;
55 ScheduledJobStateChanged scheduled_job_state_changed = 8;
56 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070057 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080058 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
59 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
60 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
61 // TODO: 14-19 are blank, but need not be
62 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
63 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
64 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070065 AudioStateChanged audio_state_changed = 23;
66 MediaCodecActivityChanged media_codec_activity_changed = 24;
67 CameraStateChanged camera_state_changed = 25;
68 FlashlightStateChanged flashlight_state_changed = 26;
69 UidProcessStateChanged uid_process_state_changed = 27;
70 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
71 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070072 BatteryLevelChanged battery_level_changed = 30;
73 ChargingStateChanged charging_state_changed = 31;
74 PluggedStateChanged plugged_state_changed = 32;
Tej Singh40298312018-02-16 00:15:09 -080075 // TODO: 33 is blank, but is available for use.
Bookatz8c6571b2017-10-24 15:04:41 -070076 DeviceOnStatusChanged device_on_status_changed = 34;
77 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
78 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070079 WifiLockStateChanged wifi_lock_state_changed = 37;
80 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
81 WifiScanStateChanged wifi_scan_state_changed = 39;
82 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070083 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070084 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070085 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090086 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080087 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080088 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080089 AppBreadcrumbReported app_breadcrumb_reported = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000090 AppStartChanged app_start_changed = 48;
91 AppStartCancelChanged app_start_cancel_changed = 49;
92 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080093 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080094 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080095 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080096 LmkStateChanged lmk_state_changed = 54;
97 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080098 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -080099 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800100 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800101 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800102 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800103 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800104 KeyguardStateChanged keyguard_state_changed = 62;
105 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
106 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Bookatzc1a050a2017-10-10 15:49:28 -0700107 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000108 }
David Chenc8a43242017-10-17 16:23:28 -0700109
David Chen6e3e6cb2018-01-03 16:14:06 -0800110 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800111 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700112 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800113 WifiBytesTransfer wifi_bytes_transfer = 10000;
114 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
115 MobileBytesTransfer mobile_bytes_transfer = 10002;
116 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800117 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800118 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800119 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800120 CpuTimePerFreq cpu_time_per_freq = 10008;
121 CpuTimePerUid cpu_time_per_uid = 10009;
122 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
123 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
124 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800125 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800126 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800127 SystemElapsedRealtime system_elapsed_realtime = 10014;
128 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800129 CpuActiveTime cpu_active_time = 10016;
130 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800131 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800132 RemainingBatteryCapacity remaining_battery_capacity = 10019;
133 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800134 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700135 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700136}
137
Yao Chend54f9dd2017-10-17 17:37:48 +0000138/**
Yangster-mac20877162017-12-22 17:19:39 -0800139 * This proto represents a node of an attribution chain.
140 * Note: All attribution chains are represented as a repeated field of type
141 * AttributionNode. It is understood that in such arrays, the order is that
142 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000143 */
Yangster-mac20877162017-12-22 17:19:39 -0800144message AttributionNode {
145 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800146 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800147
Yangster-mac20877162017-12-22 17:19:39 -0800148 // The (optional) string tag for an element in the attribution chain. If the
149 // element has no tag, it is encoded as an empty string.
150 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700151}
152
Yao Chend54f9dd2017-10-17 17:37:48 +0000153/*
154 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800155 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000156 *
157 * RULES:
158 * - The field ids for each atom must start at 1, and count upwards by 1.
159 * Skipping field ids is not allowed.
160 * - These form an API, so renaming, renumbering or removing fields is
161 * not allowed between android releases. (This is not currently enforced,
162 * but there will be a tool to enforce this restriction).
163 * - The types must be built-in protocol buffer types, namely, no sub-messages
164 * are allowed (yet). The bytes type is also not allowed.
165 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800166 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000167 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800168 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000169 * - A field that is a uid should be a string field, tagged with the [xxx]
170 * annotation. The generated code on android will be represented by UIDs,
171 * and those UIDs will be translated in xxx to those strings.
172 *
173 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700174 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000175 * - If there is a UID, it goes first. Think in an object-oriented fashion.
176 * *****************************************************************************
177 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700178
Yao Chend54f9dd2017-10-17 17:37:48 +0000179/**
180 * Logs when the screen state changes.
181 *
182 * Logged from:
183 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
184 */
185message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800186 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800187 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700188}
Yao Chend54f9dd2017-10-17 17:37:48 +0000189
190/**
Bookatzc1a050a2017-10-10 15:49:28 -0700191 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000192 *
193 * Logged from:
194 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
195 */
Bookatzc1a050a2017-10-10 15:49:28 -0700196message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800197 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000198
Bookatzdb026a22018-01-10 19:01:56 -0800199 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800200 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000201}
202
203/**
Bookatzc1a050a2017-10-10 15:49:28 -0700204 * Logs that a process started, finished, crashed, or ANRed.
205 *
206 * Logged from:
207 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
208 */
209message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800210 // TODO: should be a string tagged w/ uid annotation
211 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700212
David Chen0b5c90c2018-01-25 16:51:49 -0800213 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700214 optional string name = 2;
215
Bookatzddccf0a2017-11-28 16:48:14 -0800216 // What lifecycle state the process changed to.
217 // This enum is specific to atoms.proto.
218 enum Event {
219 PROCESS_FINISHED = 0;
220 PROCESS_STARTED = 1;
221 PROCESS_CRASHED = 2;
222 PROCESS_ANRED = 3;
223 }
224 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700225}
226
Bookatzc1a050a2017-10-10 15:49:28 -0700227/**
228 * Logs when the ble scan state changes.
229 *
230 * Logged from:
231 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
232 */
233message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800234 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700235
236 enum State {
237 OFF = 0;
238 ON = 1;
239 }
240 optional State state = 2;
241}
242
243/**
244 * Logs when an unoptimized ble scan state changes.
245 *
246 * Logged from:
247 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
248 */
249// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
250message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800251 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700252
253 enum State {
254 OFF = 0;
255 ON = 1;
256 }
257 optional State state = 2;
258}
259
260/**
261 * Logs reporting of a ble scan finding results.
262 *
263 * Logged from:
264 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
265 */
266// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
267message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800268 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700269
270 // Number of ble scan results returned.
271 optional int32 num_of_results = 2;
272}
273
274/**
275 * Logs when a sensor state changes.
276 *
277 * Logged from:
278 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
279 */
280message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800281 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700282
283 // TODO: Is there a way to get the actual name of the sensor?
284 // The id (int) of the sensor.
285 optional int32 sensor_id = 2;
286
287 enum State {
288 OFF = 0;
289 ON = 1;
290 }
291 optional State state = 3;
292}
293
294
295/**
296 * Logs when GPS state changes.
297 *
298 * Logged from:
299 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
300 */
301message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800302 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700303
304 enum State {
305 OFF = 0;
306 ON = 1;
307 }
308 optional State state = 2;
309}
310
311
312/**
313 * Logs when a sync manager sync state changes.
314 *
315 * Logged from:
316 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
317 */
318message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800319 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700320
David Chen0b5c90c2018-01-25 16:51:49 -0800321 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700322 optional string name = 2;
323
324 enum State {
325 OFF = 0;
326 ON = 1;
327 }
328 optional State state = 3;
329}
330
331/**
332 * Logs when a job scheduler job state changes.
333 *
334 * Logged from:
335 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
336 */
337message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800338 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700339
340 // Name of the job (as named in the app)
341 optional string name = 2;
342
343 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800344 FINISHED = 0;
345 STARTED = 1;
346 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700347 }
348 optional State state = 3;
349
350 // TODO: Consider adding the stopReason (int)
351}
352
353/**
354 * Logs when the audio state changes.
355 *
356 * Logged from:
357 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
358 */
359message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800360 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700361
362 enum State {
363 OFF = 0;
364 ON = 1;
365 }
366 optional State state = 2;
367}
368
369/**
370 * Logs when the video codec state changes.
371 *
372 * Logged from:
373 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
374 */
375message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800376 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700377
378 enum State {
379 OFF = 0;
380 ON = 1;
381 }
382 optional State state = 2;
383}
384
385/**
386 * Logs when the flashlight state changes.
387 *
388 * Logged from:
389 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
390 */
391message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800392 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700393
394 enum State {
395 OFF = 0;
396 ON = 1;
397 }
398 optional State state = 2;
399}
400
401/**
402 * Logs when the camera state changes.
403 *
404 * Logged from:
405 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
406 */
407message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800408 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700409
410 enum State {
411 OFF = 0;
412 ON = 1;
413 }
414 optional State state = 2;
415}
416
417/**
418 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000419 *
420 * Logged from:
421 * TODO
422 */
Bookatzd6746242017-10-24 18:39:35 -0700423message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800424 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000425
Bookatz1a1b0462018-01-12 11:47:03 -0800426 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
427 // From frameworks/base/core/proto/android/os/enums.proto.
428 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700429
430 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
431 optional string tag = 3;
432
433 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800434 RELEASE = 0;
435 ACQUIRE = 1;
436 CHANGE_RELEASE = 2;
437 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700438 }
439 optional State state = 4;
440}
441
442/**
Bookatzc1a050a2017-10-10 15:49:28 -0700443 * Logs when a partial wakelock is considered 'long' (over 1 min).
444 *
445 * Logged from:
446 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
447 */
448message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800449 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700450
Yao Chend54f9dd2017-10-17 17:37:48 +0000451 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
452 optional string tag = 2;
453
Bookatzc1a050a2017-10-10 15:49:28 -0700454 // TODO: I have no idea what this is.
455 optional string history_tag = 3;
456
457 enum State {
458 OFF = 0;
459 ON = 1;
460 }
461 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000462}
463
Bookatzc1a050a2017-10-10 15:49:28 -0700464/**
465 * Logs Battery Saver state change.
466 *
467 * Logged from:
468 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
469 */
470message BatterySaverModeStateChanged {
471 enum State {
472 OFF = 0;
473 ON = 1;
474 }
475 optional State state = 1;
476}
477
478/**
479 * Logs Doze mode state change.
480 *
481 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800482 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700483 */
484message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800485 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800486}
487
488
489/**
490 * Logs state change of Doze mode including maintenance windows.
491 *
492 * Logged from:
493 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
494 */
495message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800496 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700497}
498
499/**
500 * Logs screen brightness level.
501 *
502 * Logged from:
503 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
504 */
505message ScreenBrightnessChanged {
506 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
507 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700508}
509
510/**
511 * Logs battery level (percent full, from 0 to 100).
512 *
513 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700514 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700515 */
516message BatteryLevelChanged {
517 // Battery level. Should be in [0, 100].
518 optional int32 battery_level = 1;
519}
520
521/**
522 * Logs change in charging status of the device.
523 *
524 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700525 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700526 */
527message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800528 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
529 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700530}
531
532/**
533 * Logs whether the device is plugged in, and what power source it is using.
534 *
535 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700536 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700537 */
538message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800539 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
540 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700541}
542
Bookatz8c6571b2017-10-24 15:04:41 -0700543// TODO: Define this more precisely.
544// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
545/**
546 * Logs when the device turns off or on.
547 *
548 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700549 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700550 */
551message DeviceOnStatusChanged {
552 enum State {
553 OFF = 0;
554 ON = 1;
555 }
556 optional State state = 1;
557}
558
559/**
560 * Logs when an app's wakeup alarm fires.
561 *
562 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700563 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700564 */
565message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800566 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800567
568 // Name of the wakeup alarm.
569 optional string tag = 2;
570}
571
572/**
573 * Logs when an an app causes the mobile radio to change state.
574 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
575 *
576 * Logged from:
577 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
578 */
579message MobileRadioPowerStateChanged {
580 // TODO: Add attribution instead of uid?
581 optional int32 uid = 1;
582
Bookatz1a1b0462018-01-12 11:47:03 -0800583 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
584 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800585}
586
587/**
588 * Logs when an an app causes the wifi radio to change state.
589 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
590 *
591 * Logged from:
592 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
593 */
594message WifiRadioPowerStateChanged {
595 // TODO: Add attribution instead of uid?
596 optional int32 uid = 1;
597
Bookatz1a1b0462018-01-12 11:47:03 -0800598 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
599 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700600}
601
602/**
603 * Logs kernel wakeup reasons and aborts.
604 *
605 * Logged from:
606 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
607 */
608message KernelWakeupReported {
609 // Name of the kernel wakeup reason (or abort).
610 optional string wakeup_reason_name = 1;
611
612 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800613 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700614}
615
616/**
617 * Logs wifi locks held by an app.
618 *
619 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700620 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700621 */
622message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800623 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700624
625 enum State {
626 OFF = 0;
627 ON = 1;
628 }
629 optional State state = 2;
630}
631
632/**
633 * Logs wifi signal strength changes.
634 *
635 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700636 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700637 */
638message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800639 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
640 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700641}
642
643/**
644 * Logs wifi scans performed by an app.
645 *
646 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700647 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700648 */
649message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800650 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700651
652 enum State {
653 OFF = 0;
654 ON = 1;
655 }
656 optional State state = 2;
657}
658
659/**
Tej Singh4503e102018-01-04 14:35:01 -0800660 * Logs wifi multicast locks held by an app
661 *
662 * Logged from:
663 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
664 */
665message WifiMulticastLockStateChanged {
666 repeated AttributionNode attribution_node = 1;
667
668 enum State {
669 OFF = 0;
670 ON = 1;
671 }
672 optional State state = 2;
673}
674
675/**
Tej Singh1ea42892018-01-19 09:27:00 -0800676 * Logs shutdown reason and duration on next boot.
677 *
678 * Logged from:
679 * frameworks/base/core/java/com/android/server/BootReceiver.java
680 */
681message ShutdownSequenceReported {
682 // True if shutdown is for a reboot. Default: false if we do not know.
683 optional bool reboot = 1;
684
685 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
686 optional string reason = 2;
687
688 // Beginning of shutdown time in ms using wall clock time since unix epoch.
689 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800690 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800691
692 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800693 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800694}
695
Tej Singh6483ea42018-01-25 17:45:49 -0800696
697/**
698 * Logs boot reason and duration.
699 *
700 * Logged from:
701 * system/core/bootstat/bootstat.cpp
702 */
703message BootSequenceReported {
704 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
705 // Default: "<EMPTY>" if not available.
706 optional string bootloader_reason = 1;
707
708 // Reason for system boot. Eg. bootloader, reboot,userrequested
709 // Default: "<EMPTY>" if not available.
710 optional string system_reason = 2;
711
712 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800713 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800714
715 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800716 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800717
718 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800719 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800720
721 // Time since last boot in ms. Default: 0 if not available.
722 optional int64 time_since_last_boot = 6;
723}
724
Tej Singhc477d9c2018-02-05 18:31:39 -0800725
726/**
727 * Logs call state and disconnect cause (if applicable).
728 *
729 * Logged from:
730 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
731 */
732message CallStateChanged {
733 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
734 // From frameworks/base/core/proto/android/telecomm/enums.proto.
735 optional android.telecom.CallStateEnum call_state = 1;
736
737 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
738 // This value is only applicable when the call_state is DISCONNECTED, and
739 // should always be UNKNOWN if the call_state is not DISCONNECTED.
740 // From frameworks/base/core/proto/android/telecomm/enums.proto.
741 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
742
743 // True if the call is self-managed, which are apps that use the
744 // telecom infrastructure to make their own calls.
745 optional bool self_managed = 3;
746
747 // True if call is external. External calls are calls on connected Wear
748 // devices but show up in Telecom so the user can pull them onto the device.
749 optional bool external_call = 4;
750}
751
Tej Singh1ea42892018-01-19 09:27:00 -0800752/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800753 * Logs keyguard state. The keyguard is the lock screen.
754 *
755 * Logged from:
756 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
757 */
758message KeyguardStateChanged {
759 enum State {
760 UNKNOWN = 0;
761 // The keyguard is hidden when the phone is unlocked.
762 HIDDEN = 1;
763 // The keyguard is shown when the phone is locked (screen turns off).
764 SHOWN= 2;
765 // The keyguard is occluded when something is overlaying the keyguard.
766 // Eg. Opening the camera while on the lock screen.
767 OCCLUDED = 3;
768 }
769 optional State state = 1;
770}
771
772/**
773 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
774 * prompts the user to enter a password (pattern, pin, etc).
775 *
776 * Logged from:
777 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
778 */
779
780message KeyguardBouncerStateChanged {
781 enum State {
782 UNKNOWN = 0;
783 // Bouncer is hidden, either as a result of successfully entering the
784 // password, screen timing out, or user going back to lock screen.
785 HIDDEN = 1;
786 // This is when the user is being prompted to enter the password.
787 SHOWN = 2;
788 }
789 optional State state = 1;
790}
791
792/**
793 * Logs the result of entering a password into the keyguard bouncer.
794 *
795 * Logged from:
796 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
797 */
798message KeyguardBouncerPasswordEntered {
799 enum BouncerResult {
800 UNKNOWN = 0;
801 // The password entered was incorrect.
802 FAILURE = 1;
803 // The password entered was correct.
804 SUCCESS = 2;
805 }
806 optional BouncerResult result = 1;
807}
808
809/**
Tej Singhbb8554a2018-01-26 11:59:14 -0800810 * Logs the duration of a davey (jank of >=700ms) when it occurs
811 *
812 * Logged from:
813 * frameworks/base/libs/hwui/JankTracker.cpp
814 */
815message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -0800816 // The UID that logged this atom.
817 optional int32 uid = 1;
818
Tej Singhbb8554a2018-01-26 11:59:14 -0800819 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -0800820 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -0800821}
822
823/**
Bookatze5885242017-10-24 20:10:31 -0700824 * Logs phone signal strength changes.
825 *
826 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700827 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700828 */
829message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800830 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
831 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700832}
833
834/**
835 * Logs that a setting was updated.
836 * Logged from:
837 * frameworks/base/core/java/android/provider/Settings.java
838 * The tag and is_default allow resetting of settings to default values based on the specified
839 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
840 */
841message SettingChanged {
842 // The name of the setting.
843 optional string setting = 1;
844
845 // The change being imposed on this setting. May represent a number, eg "3".
846 optional string value = 2;
847
848 // The new value of this setting. For most settings, this is same as value. For some settings,
849 // value is +X or -X where X represents an element in a set. For example, if the previous value
850 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
851 // The +/- feature is currently only used for location_providers_allowed.
852 optional string new_value = 3;
853
854 // The previous value of this setting.
855 optional string prev_value = 4;
856
857 // The tag used with the is_default for resetting sets of settings. This is generally null.
858 optional string tag = 5;
859
Bookatz90867622018-01-31 15:05:57 -0800860 // True if this setting with tag should be resettable.
861 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -0700862
863 // The user ID associated. Defined in android/os/UserHandle.java
864 optional int32 user = 7;
865}
Chenjie Yub3dda412017-10-24 13:41:59 -0700866
Chenjie Yu05013b32017-11-21 10:21:41 -0800867/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700868 * Logs activity going to foreground or background
869 *
870 * Logged from:
871 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
872 */
873message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800874 optional int32 uid = 1;
875 optional string pkg_name = 2;
876 optional string class_name = 3;
877
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700878 enum Activity {
879 MOVE_TO_BACKGROUND = 0;
880 MOVE_TO_FOREGROUND = 1;
881 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700882 optional Activity activity = 4;
883}
David Chenc8a43242017-10-17 16:23:28 -0700884
885/**
David Chen9e3808c2017-11-20 17:25:34 -0800886 * Logs when an error is written to dropbox.
887 * Logged from:
888 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
889 */
890message DropboxErrorChanged {
891 // The uid if available. -1 means not available.
892 optional int32 uid = 1;
893
894 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
895 optional string tag = 2;
896
897 // The name of the process.
898 optional string process_name = 3;
899
900 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800901 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800902
903 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800904 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800905
906 // The activity name if available.
907 optional string activity_name = 6;
908
David Chen6e3e6cb2018-01-03 16:14:06 -0800909 // The package name if available.
910 optional string package_name = 7;
911
David Chen9e3808c2017-11-20 17:25:34 -0800912 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800913 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800914}
915
David Chen0a368b22017-12-06 16:28:16 -0800916/*
917 * Allows other apps to push events into statsd.
918 * Logged from:
919 * frameworks/base/core/java/android/util/StatsLog.java
920 */
David Chen0b5c90c2018-01-25 16:51:49 -0800921message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -0800922 // The uid of the application that sent this custom atom.
923 optional int32 uid = 1;
924
925 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
926 optional int32 label = 2;
927
928 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
929 // predicates for the metrics).
930 enum State {
931 UNKNOWN = 0;
932 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
933 STOP = 2;
934 START = 3;
935 }
936 optional State state = 3;
937}
938
David Chen9e3808c2017-11-20 17:25:34 -0800939/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800940 * Logs when statsd detects an anomaly.
941 *
942 * Logged from:
943 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
944 */
945message AnomalyDetected {
946 // Uid that owns the config whose anomaly detection alert fired.
947 optional int32 config_uid = 1;
948
Yangster-mac94e197c2018-01-02 16:03:03 -0800949 // Id of the config whose anomaly detection alert fired.
950 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800951
Yangster-mac94e197c2018-01-02 16:03:03 -0800952 // Id of the alert (i.e. name of the anomaly that was detected).
953 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800954}
955
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000956message AppStartChanged {
957 // The uid if available. -1 means not available.
958 optional int32 uid = 1;
959
960 // The app package name.
961 optional string pkg_name = 2;
962
963 enum TransitionType {
964 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
965 WARM = 1;
966 HOT = 2;
967 COLD = 3;
968 }
969 // The transition type.
970 optional TransitionType type = 3;
971
972 // The activity name.
973 optional string activity_name = 4;
974
975 // The name of the calling app. Empty if not set.
976 optional string calling_pkg_name = 5;
977
978 // Whether the app is an instant app.
979 optional bool is_instant_app = 6;
980
981 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -0800982 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000983
Bookatz80d11a02018-01-16 10:46:35 -0800984 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000985
David Chen0b5c90c2018-01-25 16:51:49 -0800986 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000987 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800988 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000989 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800990 optional int32 bind_application_delay_millis = 11;
991 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000992
993 // Empty if not set.
994 optional string launch_token = 13;
995
Calin Juravle759fbda2018-02-20 19:52:30 +0000996 // The compiler filter used when when the package was optimized.
997 optional string package_optimization_compilation_filter = 14;
998
999 // The reason why the package was optimized.
1000 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001001}
1002
1003message AppStartCancelChanged {
1004 // The uid if available. -1 means not available.
1005 optional int32 uid = 1;
1006
1007 // The app package name.
1008 optional string pkg_name = 2;
1009
1010 enum TransitionType {
1011 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1012 WARM = 1;
1013 HOT = 2;
1014 COLD = 3;
1015 }
1016 // The transition type.
1017 optional TransitionType type = 3;
1018
1019 // The activity name.
1020 optional string activity_name = 4;
1021}
1022
1023message AppStartFullyDrawnChanged {
1024 // The uid if available. -1 means not available.
1025 optional int32 uid = 1;
1026
1027 // The app package name.
1028 optional string pkg_name = 2;
1029
1030 enum TransitionType {
1031 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1032 WITH_BUNDLE = 1;
1033 WITHOUT_BUNDLE = 2;
1034 }
1035 // The transition type.
1036 optional TransitionType type = 3;
1037
1038 // The activity name.
1039 optional string activity_name = 4;
1040
1041 optional bool transition_process_running = 5;
1042
1043 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001044 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001045}
1046
Bookatz8fcd09a2017-12-18 13:01:10 -08001047/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001048 * Logs a picture-in-picture action
1049 * Logged from:
1050 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1051 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1052 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1053 */
1054message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001055 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001056 optional int32 uid = 1;
1057
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001058 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001059
Chenjie Yu52cacc62017-12-08 18:11:45 -08001060 enum State {
1061 ENTERED = 1;
1062 EXPANDED_TO_FULL_SCREEN = 2;
1063 MINIMIZED = 3;
1064 DISMISSED = 4;
1065 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001066 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001067}
1068
1069/**
Chenjie Yue8904192017-12-08 19:12:57 -08001070 * Logs overlay action
1071 * Logged from:
1072 * services/core/java/com/android/server/wm/Session.java
1073 */
1074message OverlayStateChanged {
1075 optional int32 uid = 1;
1076
1077 optional string package_name = 2;
1078
1079 optional bool using_alert_window = 3;
1080
1081 enum State {
1082 ENTERED = 1;
1083 EXITED = 2;
1084 }
1085 optional State state = 4;
1086}
1087
Chenjie Yuccfe6452018-01-30 11:33:21 -08001088/*
1089 * Logs foreground service starts and stops.
1090 * Note that this is not when a service starts or stops, but when it is
1091 * considered foreground.
1092 * Logged from
1093 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1094 */
1095message ForegroundServiceStateChanged {
1096 optional int32 uid = 1;
1097 // package_name + "/" + class_name
1098 optional string short_name = 2;
1099
1100 enum State {
1101 ENTER = 1;
1102 EXIT = 2;
1103 }
1104 optional State state = 3;
1105}
1106
Chenjie Yue8904192017-12-08 19:12:57 -08001107/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001108 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1109 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1110 * attributed back to the parent (host) uid. One example is Chrome.
1111 *
1112 * Logged from:
1113 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1114 */
1115message IsolatedUidChanged {
1116 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1117 optional int32 parent_uid = 1;
1118
1119 optional int32 isolated_uid = 2;
1120
1121 // We expect an isolated uid to be removed before if it's used for another parent uid.
1122 enum Event {
1123 REMOVED = 0;
1124 CREATED = 1;
1125 }
1126 optional Event event = 3;
1127}
1128
1129/*
1130 * Logs the reception of an incoming network packet causing the main system to wake up for
1131 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1132 * and processed by WakeupController.cpp.
1133 */
1134message PacketWakeupOccurred {
1135 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1136 // delivered nowhere.
1137 optional int32 uid = 1;
1138 // The interface name on which the packet was received.
1139 optional string iface = 2;
1140 // The ethertype value of the packet.
1141 optional int32 ethertype = 3;
1142 // String representation of the destination MAC address of the packet.
1143 optional string destination_hardware_address = 4;
1144 // String representation of the source address of the packet if this was an IP packet.
1145 optional string source_ip = 5;
1146 // String representation of the destination address of the packet if this was an IP packet.
1147 optional string destination_ip = 6;
1148 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1149 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1150 // families.
1151 optional int32 ip_next_header = 7;
1152 // The source port if this was a TCP or UDP packet.
1153 optional int32 source_port = 8;
1154 // The destination port if this was a TCP or UDP packet.
1155 optional int32 destination_port = 9;
1156}
1157
1158/*
1159 * Logs the memory stats for an app on startup.
1160 * Logged from:
1161 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1162 */
1163message AppStartMemoryStateCaptured {
1164 // The uid if available. -1 means not available.
1165 optional int32 uid = 1;
1166
1167 // The process name.
1168 optional string process_name = 2;
1169
1170 // The activity name.
1171 optional string activity_name = 3;
1172
1173 // # of page-faults
1174 optional int64 pgfault = 4;
1175
1176 // # of major page-faults
1177 optional int64 pgmajfault = 5;
1178
1179 // RSS
1180 optional int64 rss_in_bytes = 6;
1181
1182 // CACHE
1183 optional int64 cache_in_bytes = 7;
1184
1185 // SWAP
1186 optional int64 swap_in_bytes = 8;
1187}
1188
1189/*
1190 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1191 * for LMK event.
1192 * Logged from:
1193 * system/core/lmkd/lmkd.c
1194 */
1195message LmkStateChanged {
1196 enum State {
1197 UNKNOWN = 0;
1198 START = 1;
1199 STOP = 2;
1200 }
1201 optional State state = 1;
1202}
1203
1204/*
1205 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1206 * Logged from:
1207 * system/core/lmkd/lmkd.c
1208 */
1209message LmkKillOccurred {
1210 // The uid if available. -1 means not available.
1211 optional int32 uid = 1;
1212
1213 // The process name.
1214 optional string process_name = 2;
1215
1216 // oom adj score.
1217 optional int32 oom_score = 3;
1218
1219 // # of page-faults
1220 optional int64 pgfault = 4;
1221
1222 // # of major page-faults
1223 optional int64 pgmajfault = 5;
1224
1225 // RSS
1226 optional int64 rss_in_bytes = 6;
1227
1228 // CACHE
1229 optional int64 cache_in_bytes = 7;
1230
1231 // SWAP
1232 optional int64 swap_in_bytes = 8;
1233}
1234
1235//////////////////////////////////////////////////////////////////////
1236// Pulled atoms below this line //
1237//////////////////////////////////////////////////////////////////////
1238
1239/**
David Chenc8a43242017-10-17 16:23:28 -07001240 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1241 *
1242 * Pulled from:
1243 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1244 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001245message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001246 optional int32 uid = 1;
1247
1248 optional int64 rx_bytes = 2;
1249
1250 optional int64 rx_packets = 3;
1251
1252 optional int64 tx_bytes = 4;
1253
1254 optional int64 tx_packets = 5;
1255}
1256
1257/**
1258 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1259 *
1260 * Pulled from:
1261 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1262 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001263message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001264 optional int32 uid = 1;
1265
1266 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1267 optional int32 is_foreground = 2;
1268
1269 optional int64 rx_bytes = 3;
1270
1271 optional int64 rx_packets = 4;
1272
1273 optional int64 tx_bytes = 5;
1274
1275 optional int64 tx_packets = 6;
1276}
1277
1278/**
1279 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1280 *
1281 * Pulled from:
1282 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1283 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001284message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001285 optional int32 uid = 1;
1286
1287 optional int64 rx_bytes = 2;
1288
1289 optional int64 rx_packets = 3;
1290
1291 optional int64 tx_bytes = 4;
1292
1293 optional int64 tx_packets = 5;
1294}
1295
1296/**
1297 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1298 *
1299 * Pulled from:
1300 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1301 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001302message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001303 optional int32 uid = 1;
1304
1305 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1306 optional int32 is_foreground = 2;
1307
1308 optional int64 rx_bytes = 3;
1309
1310 optional int64 rx_packets = 4;
1311
1312 optional int64 tx_bytes = 5;
1313
1314 optional int64 tx_packets = 6;
1315}
1316
1317/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001318 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1319 *
1320 * Pulled from:
1321 * StatsCompanionService
1322 */
1323message BluetoothBytesTransfer {
1324 optional int32 uid = 1;
1325
1326 optional int64 rx_bytes = 2;
1327
1328 optional int64 tx_bytes = 3;
1329}
1330
1331/**
David Chenc8a43242017-10-17 16:23:28 -07001332 * Pulls the kernel wakelock durations. This atom is adapted from
1333 * android/internal/os/KernelWakelockStats.java
1334 *
1335 * Pulled from:
1336 * StatsCompanionService using KernelWakelockReader.
1337 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001338message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001339 optional string name = 1;
1340
1341 optional int32 count = 2;
1342
1343 optional int32 version = 3;
1344
1345 optional int64 time = 4;
1346}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001347
Chenjie Yu05013b32017-11-21 10:21:41 -08001348/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001349 * Pulls low power state information. This includes platform and subsystem sleep state information,
1350 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001351 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001352 * hardware/interfaces/power/1.1/types.hal
1353 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001354message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001355 // Subsystem name
1356 optional string subsystem_name = 1;
1357 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1358 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1359 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001360 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001361 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001362 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001363 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001364}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001365
Chenjie Yu05013b32017-11-21 10:21:41 -08001366/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001367 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001368 * Pulls the time the cpu spend on the frequency index. Frequency index
1369 * starts from highest to lowest. The value should be monotonically
1370 * increasing since boot. However, if there is a cpu
1371 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001372 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001373message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001374 optional uint32 cluster = 1;
1375 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001376 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001377}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001378
Chenjie Yu05013b32017-11-21 10:21:41 -08001379/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001380 * Pulls Cpu Time Per Uid.
1381 * Note that isolated process uid time should be attributed to host uids.
1382 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001383message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001384 optional uint64 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001385 optional uint64 user_time_millis = 2;
1386 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001387}
1388
1389/**
1390 * Pulls Cpu Time Per Uid per frequency.
1391 * Note that isolated process uid time should be attributed to host uids.
1392 * For each uid, we order the time by descending frequencies.
1393 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001394message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001395 optional uint64 uid = 1;
1396 optional uint64 freq_idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001397 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001398}
Hugo Benichi884970e2017-11-14 22:42:46 +09001399
Chenjie Yu05013b32017-11-21 10:21:41 -08001400/**
1401 * Pulls Wifi Controller Activity Energy Info
1402 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001403message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001404 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001405 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001406 // stack reported state
1407 // TODO: replace this with proto enum
1408 optional int32 stack_state = 2;
1409 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001410 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001411 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001412 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001413 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001414 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001415 // product of current(mA), voltage(V) and time(ms)
1416 optional uint64 controller_energy_used = 6;
1417}
1418
1419/**
1420 * Pulls Modem Activity Energy Info
1421 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001422message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001423 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001424 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001425 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001426 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001427 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001428 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001429 /**
1430 * Tx power index
1431 * index 0 = tx_power < 0dBm
1432 * index 1 = 0dBm < tx_power < 5dBm
1433 * index 2 = 5dBm < tx_power < 15dBm
1434 * index 3 = 15dBm < tx_power < 20dBm
1435 * index 4 = tx_power > 20dBm
1436 */
1437 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001438 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001439 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001440 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001441 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001442 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001443 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001444 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001445 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001446 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001447 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001448 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001449 // product of current(mA), voltage(V) and time(ms)
1450 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001451}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001452
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001453/**
1454 * Pulls Bluetooth Activity Energy Info
1455 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1456 */
1457message BluetoothActivityInfo {
1458 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001459 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001460 // bluetooth stack state
1461 optional int32 bluetooth_stack_state = 2;
1462 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001463 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001464 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001465 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001466 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001467 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001468 // product of current(mA), voltage(V) and time(ms)
1469 optional uint64 energy_used = 6;
1470}
1471
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001472/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001473 * Logs the memory stats for a process.
1474 */
1475message ProcessMemoryState {
1476 // The uid if available. -1 means not available.
1477 optional int32 uid = 1;
1478
1479 // The process name.
1480 optional string process_name = 2;
1481
1482 // oom adj score.
1483 optional int32 oom_score = 3;
1484
1485 // # of page-faults
1486 optional int64 pgfault = 4;
1487
1488 // # of major page-faults
1489 optional int64 pgmajfault = 5;
1490
Rajeev Kumar90235992018-01-29 11:06:48 -08001491 // RSS
1492 optional int64 rss_in_bytes = 6;
1493
1494 // CACHE
1495 optional int64 cache_in_bytes = 7;
1496
1497 // SWAP
1498 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001499}
1500
1501/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001502 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001503 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001504message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001505 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001506}
1507
1508/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001509 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001510 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001511message SystemUptime {
1512 // Milliseconds since the system was booted.
1513 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1514 // for external input).
1515 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001516 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001517}
1518
1519/*
1520 * Reads from /proc/uid_concurrent_active_time which has the format:
1521 * active: X (X is # cores)
1522 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1523 * [uid1]: [time-0] [time-1] [time-2] ... ...
1524 * ...
1525 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1526 * The file contains a monotonically increasing count of time for a single boot.
1527 */
1528message CpuActiveTime {
1529 optional uint64 uid = 1;
David Chenb639d142018-02-14 17:29:54 -08001530 optional uint32 cluster_number = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001531 optional uint64 idx = 3;
1532 optional uint64 time_millis = 4;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001533}
1534
1535/**
1536 * Reads from /proc/uid_concurrent_policy_time which has the format:
1537 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1538 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1539 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1540 * ...
1541 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1542 * The file contains a monotonically increasing count of time for a single boot.
1543 */
1544message CpuClusterTime {
1545 optional uint64 uid = 1;
1546 optional uint64 idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001547 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001548}
1549
1550/*
1551 * Pulls free disk space, for data, system partition and temporary directory.
1552 */
1553message DiskSpace {
1554 // available bytes in data partition
1555 optional uint64 data_available_bytes = 1;
1556 // available bytes in system partition
1557 optional uint64 system_available_bytes = 2;
1558 // available bytes in download cache or temp directories
1559 optional uint64 temp_available_bytes = 3;
1560}
Tej Singhbf972d92018-01-10 20:51:13 -08001561
1562/**
1563 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001564 * Pulled from:
1565 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001566 */
1567message RemainingBatteryCapacity {
1568 optional int32 charge_uAh = 1;
1569}
1570
1571/**
1572 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001573 * Pulled from:
1574 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001575 */
1576message FullBatteryCapacity {
1577 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001578}
1579
1580/**
1581 * Pulls the temperature of various parts of the device, in Celsius.
1582 *
1583 * Pulled from:
1584 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1585 */
1586message Temperature {
1587 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1588 optional android.os.TemperatureTypeEnum sensor_location = 1;
1589
1590 // The name of the temperature source. Eg. CPU0
1591 optional string sensor_name = 2;
1592
1593 // Temperature in degrees C.
1594 optional float temperature_C = 3;
Yao Chen9c1debe2018-02-19 14:39:19 -08001595}