blob: 8e06504c41d885e9697818b34712ef4db7cefb92 [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;
Rajeev Kumar51b54602018-03-01 12:18:26 -0800107 AppDied app_died=65;
Bookatzc1a050a2017-10-10 15:49:28 -0700108 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000109 }
David Chenc8a43242017-10-17 16:23:28 -0700110
David Chen6e3e6cb2018-01-03 16:14:06 -0800111 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800112 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700113 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800114 WifiBytesTransfer wifi_bytes_transfer = 10000;
115 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
116 MobileBytesTransfer mobile_bytes_transfer = 10002;
117 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800118 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800119 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800120 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800121 CpuTimePerFreq cpu_time_per_freq = 10008;
122 CpuTimePerUid cpu_time_per_uid = 10009;
123 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
124 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
125 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800126 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800127 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800128 SystemElapsedRealtime system_elapsed_realtime = 10014;
129 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800130 CpuActiveTime cpu_active_time = 10016;
131 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800132 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800133 RemainingBatteryCapacity remaining_battery_capacity = 10019;
134 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800135 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700136 }
yroa1fe77c2018-02-26 14:22:54 -0800137
138 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
139 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700140}
141
Yao Chend54f9dd2017-10-17 17:37:48 +0000142/**
Yangster-mac20877162017-12-22 17:19:39 -0800143 * This proto represents a node of an attribution chain.
144 * Note: All attribution chains are represented as a repeated field of type
145 * AttributionNode. It is understood that in such arrays, the order is that
146 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000147 */
Yangster-mac20877162017-12-22 17:19:39 -0800148message AttributionNode {
149 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800150 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800151
Yangster-mac20877162017-12-22 17:19:39 -0800152 // The (optional) string tag for an element in the attribution chain. If the
153 // element has no tag, it is encoded as an empty string.
154 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700155}
156
Yao Chend54f9dd2017-10-17 17:37:48 +0000157/*
158 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800159 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000160 *
161 * RULES:
162 * - The field ids for each atom must start at 1, and count upwards by 1.
163 * Skipping field ids is not allowed.
164 * - These form an API, so renaming, renumbering or removing fields is
165 * not allowed between android releases. (This is not currently enforced,
166 * but there will be a tool to enforce this restriction).
167 * - The types must be built-in protocol buffer types, namely, no sub-messages
168 * are allowed (yet). The bytes type is also not allowed.
169 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800170 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000171 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800172 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000173 * - A field that is a uid should be a string field, tagged with the [xxx]
174 * annotation. The generated code on android will be represented by UIDs,
175 * and those UIDs will be translated in xxx to those strings.
176 *
177 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700178 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 * - If there is a UID, it goes first. Think in an object-oriented fashion.
180 * *****************************************************************************
181 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700182
Yao Chend54f9dd2017-10-17 17:37:48 +0000183/**
184 * Logs when the screen state changes.
185 *
186 * Logged from:
187 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
188 */
189message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800190 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800191 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700192}
Yao Chend54f9dd2017-10-17 17:37:48 +0000193
194/**
Bookatzc1a050a2017-10-10 15:49:28 -0700195 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000196 *
197 * Logged from:
198 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
199 */
Bookatzc1a050a2017-10-10 15:49:28 -0700200message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800201 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000202
Bookatzdb026a22018-01-10 19:01:56 -0800203 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800204 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000205}
206
207/**
Bookatzc1a050a2017-10-10 15:49:28 -0700208 * Logs that a process started, finished, crashed, or ANRed.
209 *
210 * Logged from:
211 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
212 */
213message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800214 // TODO: should be a string tagged w/ uid annotation
215 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700216
David Chen0b5c90c2018-01-25 16:51:49 -0800217 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700218 optional string name = 2;
219
Bookatzddccf0a2017-11-28 16:48:14 -0800220 // What lifecycle state the process changed to.
221 // This enum is specific to atoms.proto.
222 enum Event {
223 PROCESS_FINISHED = 0;
224 PROCESS_STARTED = 1;
225 PROCESS_CRASHED = 2;
226 PROCESS_ANRED = 3;
227 }
228 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700229}
230
Bookatzc1a050a2017-10-10 15:49:28 -0700231/**
232 * Logs when the ble scan state changes.
233 *
234 * Logged from:
235 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
236 */
237message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800238 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700239
240 enum State {
241 OFF = 0;
242 ON = 1;
243 }
244 optional State state = 2;
245}
246
247/**
248 * Logs when an unoptimized ble scan state changes.
249 *
250 * Logged from:
251 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
252 */
253// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
254message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800255 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700256
257 enum State {
258 OFF = 0;
259 ON = 1;
260 }
261 optional State state = 2;
262}
263
264/**
265 * Logs reporting of a ble scan finding results.
266 *
267 * Logged from:
268 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
269 */
270// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
271message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800272 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700273
274 // Number of ble scan results returned.
275 optional int32 num_of_results = 2;
276}
277
278/**
279 * Logs when a sensor state changes.
280 *
281 * Logged from:
282 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
283 */
284message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800285 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700286
287 // TODO: Is there a way to get the actual name of the sensor?
288 // The id (int) of the sensor.
289 optional int32 sensor_id = 2;
290
291 enum State {
292 OFF = 0;
293 ON = 1;
294 }
295 optional State state = 3;
296}
297
298
299/**
300 * Logs when GPS state changes.
301 *
302 * Logged from:
303 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
304 */
305message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800306 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700307
308 enum State {
309 OFF = 0;
310 ON = 1;
311 }
312 optional State state = 2;
313}
314
315
316/**
317 * Logs when a sync manager sync state changes.
318 *
319 * Logged from:
320 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
321 */
322message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800323 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700324
David Chen0b5c90c2018-01-25 16:51:49 -0800325 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700326 optional string name = 2;
327
328 enum State {
329 OFF = 0;
330 ON = 1;
331 }
332 optional State state = 3;
333}
334
335/**
336 * Logs when a job scheduler job state changes.
337 *
338 * Logged from:
339 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
340 */
341message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800342 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700343
344 // Name of the job (as named in the app)
345 optional string name = 2;
346
347 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800348 FINISHED = 0;
349 STARTED = 1;
350 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700351 }
352 optional State state = 3;
353
354 // TODO: Consider adding the stopReason (int)
355}
356
357/**
358 * Logs when the audio state changes.
359 *
360 * Logged from:
361 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
362 */
363message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800364 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700365
366 enum State {
367 OFF = 0;
368 ON = 1;
369 }
370 optional State state = 2;
371}
372
373/**
374 * Logs when the video codec state changes.
375 *
376 * Logged from:
377 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
378 */
379message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800380 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700381
382 enum State {
383 OFF = 0;
384 ON = 1;
385 }
386 optional State state = 2;
387}
388
389/**
390 * Logs when the flashlight state changes.
391 *
392 * Logged from:
393 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
394 */
395message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800396 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700397
398 enum State {
399 OFF = 0;
400 ON = 1;
401 }
402 optional State state = 2;
403}
404
405/**
406 * Logs when the camera state changes.
407 *
408 * Logged from:
409 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
410 */
411message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800412 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700413
414 enum State {
415 OFF = 0;
416 ON = 1;
417 }
418 optional State state = 2;
419}
420
421/**
422 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000423 *
424 * Logged from:
425 * TODO
426 */
Bookatzd6746242017-10-24 18:39:35 -0700427message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800428 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000429
Bookatz1a1b0462018-01-12 11:47:03 -0800430 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
431 // From frameworks/base/core/proto/android/os/enums.proto.
432 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700433
434 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
435 optional string tag = 3;
436
437 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800438 RELEASE = 0;
439 ACQUIRE = 1;
440 CHANGE_RELEASE = 2;
441 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700442 }
443 optional State state = 4;
444}
445
446/**
Bookatzc1a050a2017-10-10 15:49:28 -0700447 * Logs when a partial wakelock is considered 'long' (over 1 min).
448 *
449 * Logged from:
450 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
451 */
452message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800453 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700454
Yao Chend54f9dd2017-10-17 17:37:48 +0000455 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
456 optional string tag = 2;
457
Bookatzc1a050a2017-10-10 15:49:28 -0700458 // TODO: I have no idea what this is.
459 optional string history_tag = 3;
460
461 enum State {
462 OFF = 0;
463 ON = 1;
464 }
465 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000466}
467
Bookatzc1a050a2017-10-10 15:49:28 -0700468/**
469 * Logs Battery Saver state change.
470 *
471 * Logged from:
472 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
473 */
474message BatterySaverModeStateChanged {
475 enum State {
476 OFF = 0;
477 ON = 1;
478 }
479 optional State state = 1;
480}
481
482/**
483 * Logs Doze mode state change.
484 *
485 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800486 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700487 */
488message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800489 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800490}
491
492
493/**
494 * Logs state change of Doze mode including maintenance windows.
495 *
496 * Logged from:
497 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
498 */
499message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800500 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700501}
502
503/**
504 * Logs screen brightness level.
505 *
506 * Logged from:
507 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
508 */
509message ScreenBrightnessChanged {
510 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
511 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700512}
513
514/**
515 * Logs battery level (percent full, from 0 to 100).
516 *
517 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700518 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700519 */
520message BatteryLevelChanged {
521 // Battery level. Should be in [0, 100].
522 optional int32 battery_level = 1;
523}
524
525/**
526 * Logs change in charging status of the device.
527 *
528 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700529 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700530 */
531message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800532 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
533 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700534}
535
536/**
537 * Logs whether the device is plugged in, and what power source it is using.
538 *
539 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700540 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700541 */
542message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800543 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
544 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700545}
546
Bookatz8c6571b2017-10-24 15:04:41 -0700547// TODO: Define this more precisely.
548// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
549/**
550 * Logs when the device turns off or on.
551 *
552 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700553 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700554 */
555message DeviceOnStatusChanged {
556 enum State {
557 OFF = 0;
558 ON = 1;
559 }
560 optional State state = 1;
561}
562
563/**
564 * Logs when an app's wakeup alarm fires.
565 *
566 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700567 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700568 */
569message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800570 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800571
572 // Name of the wakeup alarm.
573 optional string tag = 2;
574}
575
576/**
577 * Logs when an an app causes the mobile radio to change state.
578 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
579 *
580 * Logged from:
581 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
582 */
583message MobileRadioPowerStateChanged {
584 // TODO: Add attribution instead of uid?
585 optional int32 uid = 1;
586
Bookatz1a1b0462018-01-12 11:47:03 -0800587 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
588 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800589}
590
591/**
592 * Logs when an an app causes the wifi radio to change state.
593 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
594 *
595 * Logged from:
596 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
597 */
598message WifiRadioPowerStateChanged {
599 // TODO: Add attribution instead of uid?
600 optional int32 uid = 1;
601
Bookatz1a1b0462018-01-12 11:47:03 -0800602 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
603 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700604}
605
606/**
607 * Logs kernel wakeup reasons and aborts.
608 *
609 * Logged from:
610 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
611 */
612message KernelWakeupReported {
613 // Name of the kernel wakeup reason (or abort).
614 optional string wakeup_reason_name = 1;
615
616 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800617 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700618}
619
620/**
621 * Logs wifi locks held by an app.
622 *
623 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700624 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700625 */
626message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800627 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700628
629 enum State {
630 OFF = 0;
631 ON = 1;
632 }
633 optional State state = 2;
634}
635
636/**
637 * Logs wifi signal strength changes.
638 *
639 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700640 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700641 */
642message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800643 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
644 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700645}
646
647/**
648 * Logs wifi scans performed by an app.
649 *
650 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700651 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700652 */
653message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800654 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700655
656 enum State {
657 OFF = 0;
658 ON = 1;
659 }
660 optional State state = 2;
661}
662
663/**
Tej Singh4503e102018-01-04 14:35:01 -0800664 * Logs wifi multicast locks held by an app
665 *
666 * Logged from:
667 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
668 */
669message WifiMulticastLockStateChanged {
670 repeated AttributionNode attribution_node = 1;
671
672 enum State {
673 OFF = 0;
674 ON = 1;
675 }
676 optional State state = 2;
677}
678
679/**
Tej Singh1ea42892018-01-19 09:27:00 -0800680 * Logs shutdown reason and duration on next boot.
681 *
682 * Logged from:
683 * frameworks/base/core/java/com/android/server/BootReceiver.java
684 */
685message ShutdownSequenceReported {
686 // True if shutdown is for a reboot. Default: false if we do not know.
687 optional bool reboot = 1;
688
689 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
690 optional string reason = 2;
691
692 // Beginning of shutdown time in ms using wall clock time since unix epoch.
693 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800694 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800695
696 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800697 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800698}
699
Tej Singh6483ea42018-01-25 17:45:49 -0800700
701/**
702 * Logs boot reason and duration.
703 *
704 * Logged from:
705 * system/core/bootstat/bootstat.cpp
706 */
707message BootSequenceReported {
708 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
709 // Default: "<EMPTY>" if not available.
710 optional string bootloader_reason = 1;
711
712 // Reason for system boot. Eg. bootloader, reboot,userrequested
713 // Default: "<EMPTY>" if not available.
714 optional string system_reason = 2;
715
716 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800717 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800718
719 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800720 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800721
722 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800723 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800724
725 // Time since last boot in ms. Default: 0 if not available.
726 optional int64 time_since_last_boot = 6;
727}
728
Tej Singhc477d9c2018-02-05 18:31:39 -0800729
730/**
731 * Logs call state and disconnect cause (if applicable).
732 *
733 * Logged from:
734 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
735 */
736message CallStateChanged {
737 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
738 // From frameworks/base/core/proto/android/telecomm/enums.proto.
739 optional android.telecom.CallStateEnum call_state = 1;
740
741 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
742 // This value is only applicable when the call_state is DISCONNECTED, and
743 // should always be UNKNOWN if the call_state is not DISCONNECTED.
744 // From frameworks/base/core/proto/android/telecomm/enums.proto.
745 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
746
747 // True if the call is self-managed, which are apps that use the
748 // telecom infrastructure to make their own calls.
749 optional bool self_managed = 3;
750
751 // True if call is external. External calls are calls on connected Wear
752 // devices but show up in Telecom so the user can pull them onto the device.
753 optional bool external_call = 4;
754}
755
Tej Singh1ea42892018-01-19 09:27:00 -0800756/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800757 * Logs keyguard state. The keyguard is the lock screen.
758 *
759 * Logged from:
760 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
761 */
762message KeyguardStateChanged {
763 enum State {
764 UNKNOWN = 0;
765 // The keyguard is hidden when the phone is unlocked.
766 HIDDEN = 1;
767 // The keyguard is shown when the phone is locked (screen turns off).
768 SHOWN= 2;
769 // The keyguard is occluded when something is overlaying the keyguard.
770 // Eg. Opening the camera while on the lock screen.
771 OCCLUDED = 3;
772 }
773 optional State state = 1;
774}
775
776/**
777 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
778 * prompts the user to enter a password (pattern, pin, etc).
779 *
780 * Logged from:
781 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
782 */
783
784message KeyguardBouncerStateChanged {
785 enum State {
786 UNKNOWN = 0;
787 // Bouncer is hidden, either as a result of successfully entering the
788 // password, screen timing out, or user going back to lock screen.
789 HIDDEN = 1;
790 // This is when the user is being prompted to enter the password.
791 SHOWN = 2;
792 }
793 optional State state = 1;
794}
795
796/**
797 * Logs the result of entering a password into the keyguard bouncer.
798 *
799 * Logged from:
800 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
801 */
802message KeyguardBouncerPasswordEntered {
803 enum BouncerResult {
804 UNKNOWN = 0;
805 // The password entered was incorrect.
806 FAILURE = 1;
807 // The password entered was correct.
808 SUCCESS = 2;
809 }
810 optional BouncerResult result = 1;
811}
812
813/**
Tej Singhbb8554a2018-01-26 11:59:14 -0800814 * Logs the duration of a davey (jank of >=700ms) when it occurs
815 *
816 * Logged from:
817 * frameworks/base/libs/hwui/JankTracker.cpp
818 */
819message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -0800820 // The UID that logged this atom.
821 optional int32 uid = 1;
822
Tej Singhbb8554a2018-01-26 11:59:14 -0800823 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -0800824 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -0800825}
826
827/**
Bookatze5885242017-10-24 20:10:31 -0700828 * Logs phone signal strength changes.
829 *
830 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700831 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700832 */
833message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800834 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
835 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700836}
837
838/**
839 * Logs that a setting was updated.
840 * Logged from:
841 * frameworks/base/core/java/android/provider/Settings.java
842 * The tag and is_default allow resetting of settings to default values based on the specified
843 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
844 */
845message SettingChanged {
846 // The name of the setting.
847 optional string setting = 1;
848
849 // The change being imposed on this setting. May represent a number, eg "3".
850 optional string value = 2;
851
852 // The new value of this setting. For most settings, this is same as value. For some settings,
853 // value is +X or -X where X represents an element in a set. For example, if the previous value
854 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
855 // The +/- feature is currently only used for location_providers_allowed.
856 optional string new_value = 3;
857
858 // The previous value of this setting.
859 optional string prev_value = 4;
860
861 // The tag used with the is_default for resetting sets of settings. This is generally null.
862 optional string tag = 5;
863
Bookatz90867622018-01-31 15:05:57 -0800864 // True if this setting with tag should be resettable.
865 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -0700866
867 // The user ID associated. Defined in android/os/UserHandle.java
868 optional int32 user = 7;
869}
Chenjie Yub3dda412017-10-24 13:41:59 -0700870
Chenjie Yu05013b32017-11-21 10:21:41 -0800871/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700872 * Logs activity going to foreground or background
873 *
874 * Logged from:
875 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
876 */
877message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800878 optional int32 uid = 1;
879 optional string pkg_name = 2;
880 optional string class_name = 3;
881
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700882 enum Activity {
883 MOVE_TO_BACKGROUND = 0;
884 MOVE_TO_FOREGROUND = 1;
885 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700886 optional Activity activity = 4;
887}
David Chenc8a43242017-10-17 16:23:28 -0700888
889/**
David Chen9e3808c2017-11-20 17:25:34 -0800890 * Logs when an error is written to dropbox.
891 * Logged from:
892 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
893 */
894message DropboxErrorChanged {
895 // The uid if available. -1 means not available.
896 optional int32 uid = 1;
897
898 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
899 optional string tag = 2;
900
901 // The name of the process.
902 optional string process_name = 3;
903
904 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800905 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800906
907 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800908 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800909
910 // The activity name if available.
911 optional string activity_name = 6;
912
David Chen6e3e6cb2018-01-03 16:14:06 -0800913 // The package name if available.
914 optional string package_name = 7;
915
David Chen9e3808c2017-11-20 17:25:34 -0800916 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800917 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800918}
919
David Chen0a368b22017-12-06 16:28:16 -0800920/*
921 * Allows other apps to push events into statsd.
922 * Logged from:
923 * frameworks/base/core/java/android/util/StatsLog.java
924 */
David Chen0b5c90c2018-01-25 16:51:49 -0800925message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -0800926 // The uid of the application that sent this custom atom.
927 optional int32 uid = 1;
928
929 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
930 optional int32 label = 2;
931
932 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
933 // predicates for the metrics).
934 enum State {
935 UNKNOWN = 0;
936 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
937 STOP = 2;
938 START = 3;
939 }
940 optional State state = 3;
941}
942
David Chen9e3808c2017-11-20 17:25:34 -0800943/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800944 * Logs when statsd detects an anomaly.
945 *
946 * Logged from:
947 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
948 */
949message AnomalyDetected {
950 // Uid that owns the config whose anomaly detection alert fired.
951 optional int32 config_uid = 1;
952
Yangster-mac94e197c2018-01-02 16:03:03 -0800953 // Id of the config whose anomaly detection alert fired.
954 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800955
Yangster-mac94e197c2018-01-02 16:03:03 -0800956 // Id of the alert (i.e. name of the anomaly that was detected).
957 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800958}
959
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000960message AppStartChanged {
961 // The uid if available. -1 means not available.
962 optional int32 uid = 1;
963
964 // The app package name.
965 optional string pkg_name = 2;
966
967 enum TransitionType {
968 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
969 WARM = 1;
970 HOT = 2;
971 COLD = 3;
972 }
973 // The transition type.
974 optional TransitionType type = 3;
975
976 // The activity name.
977 optional string activity_name = 4;
978
979 // The name of the calling app. Empty if not set.
980 optional string calling_pkg_name = 5;
981
982 // Whether the app is an instant app.
983 optional bool is_instant_app = 6;
984
985 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -0800986 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000987
Bookatz80d11a02018-01-16 10:46:35 -0800988 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000989
David Chen0b5c90c2018-01-25 16:51:49 -0800990 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000991 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800992 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000993 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800994 optional int32 bind_application_delay_millis = 11;
995 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000996
997 // Empty if not set.
998 optional string launch_token = 13;
999
Calin Juravle759fbda2018-02-20 19:52:30 +00001000 // The compiler filter used when when the package was optimized.
1001 optional string package_optimization_compilation_filter = 14;
1002
1003 // The reason why the package was optimized.
1004 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001005}
1006
1007message AppStartCancelChanged {
1008 // The uid if available. -1 means not available.
1009 optional int32 uid = 1;
1010
1011 // The app package name.
1012 optional string pkg_name = 2;
1013
1014 enum TransitionType {
1015 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1016 WARM = 1;
1017 HOT = 2;
1018 COLD = 3;
1019 }
1020 // The transition type.
1021 optional TransitionType type = 3;
1022
1023 // The activity name.
1024 optional string activity_name = 4;
1025}
1026
1027message AppStartFullyDrawnChanged {
1028 // The uid if available. -1 means not available.
1029 optional int32 uid = 1;
1030
1031 // The app package name.
1032 optional string pkg_name = 2;
1033
1034 enum TransitionType {
1035 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1036 WITH_BUNDLE = 1;
1037 WITHOUT_BUNDLE = 2;
1038 }
1039 // The transition type.
1040 optional TransitionType type = 3;
1041
1042 // The activity name.
1043 optional string activity_name = 4;
1044
1045 optional bool transition_process_running = 5;
1046
1047 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001048 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001049}
1050
Bookatz8fcd09a2017-12-18 13:01:10 -08001051/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001052 * Logs a picture-in-picture action
1053 * Logged from:
1054 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1055 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1056 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1057 */
1058message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001059 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001060 optional int32 uid = 1;
1061
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001062 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001063
Chenjie Yu52cacc62017-12-08 18:11:45 -08001064 enum State {
1065 ENTERED = 1;
1066 EXPANDED_TO_FULL_SCREEN = 2;
1067 MINIMIZED = 3;
1068 DISMISSED = 4;
1069 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001070 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001071}
1072
1073/**
Chenjie Yue8904192017-12-08 19:12:57 -08001074 * Logs overlay action
1075 * Logged from:
1076 * services/core/java/com/android/server/wm/Session.java
1077 */
1078message OverlayStateChanged {
1079 optional int32 uid = 1;
1080
1081 optional string package_name = 2;
1082
1083 optional bool using_alert_window = 3;
1084
1085 enum State {
1086 ENTERED = 1;
1087 EXITED = 2;
1088 }
1089 optional State state = 4;
1090}
1091
Chenjie Yuccfe6452018-01-30 11:33:21 -08001092/*
1093 * Logs foreground service starts and stops.
1094 * Note that this is not when a service starts or stops, but when it is
1095 * considered foreground.
1096 * Logged from
1097 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1098 */
1099message ForegroundServiceStateChanged {
1100 optional int32 uid = 1;
1101 // package_name + "/" + class_name
1102 optional string short_name = 2;
1103
1104 enum State {
1105 ENTER = 1;
1106 EXIT = 2;
1107 }
1108 optional State state = 3;
1109}
1110
Chenjie Yue8904192017-12-08 19:12:57 -08001111/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001112 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1113 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1114 * attributed back to the parent (host) uid. One example is Chrome.
1115 *
1116 * Logged from:
1117 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1118 */
1119message IsolatedUidChanged {
1120 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1121 optional int32 parent_uid = 1;
1122
1123 optional int32 isolated_uid = 2;
1124
1125 // We expect an isolated uid to be removed before if it's used for another parent uid.
1126 enum Event {
1127 REMOVED = 0;
1128 CREATED = 1;
1129 }
1130 optional Event event = 3;
1131}
1132
1133/*
1134 * Logs the reception of an incoming network packet causing the main system to wake up for
1135 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1136 * and processed by WakeupController.cpp.
1137 */
1138message PacketWakeupOccurred {
1139 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1140 // delivered nowhere.
1141 optional int32 uid = 1;
1142 // The interface name on which the packet was received.
1143 optional string iface = 2;
1144 // The ethertype value of the packet.
1145 optional int32 ethertype = 3;
1146 // String representation of the destination MAC address of the packet.
1147 optional string destination_hardware_address = 4;
1148 // String representation of the source address of the packet if this was an IP packet.
1149 optional string source_ip = 5;
1150 // String representation of the destination address of the packet if this was an IP packet.
1151 optional string destination_ip = 6;
1152 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1153 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1154 // families.
1155 optional int32 ip_next_header = 7;
1156 // The source port if this was a TCP or UDP packet.
1157 optional int32 source_port = 8;
1158 // The destination port if this was a TCP or UDP packet.
1159 optional int32 destination_port = 9;
1160}
1161
1162/*
1163 * Logs the memory stats for an app on startup.
1164 * Logged from:
1165 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1166 */
1167message AppStartMemoryStateCaptured {
1168 // The uid if available. -1 means not available.
1169 optional int32 uid = 1;
1170
1171 // The process name.
1172 optional string process_name = 2;
1173
1174 // The activity name.
1175 optional string activity_name = 3;
1176
1177 // # of page-faults
1178 optional int64 pgfault = 4;
1179
1180 // # of major page-faults
1181 optional int64 pgmajfault = 5;
1182
1183 // RSS
1184 optional int64 rss_in_bytes = 6;
1185
1186 // CACHE
1187 optional int64 cache_in_bytes = 7;
1188
1189 // SWAP
1190 optional int64 swap_in_bytes = 8;
1191}
1192
1193/*
1194 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1195 * for LMK event.
1196 * Logged from:
1197 * system/core/lmkd/lmkd.c
1198 */
1199message LmkStateChanged {
1200 enum State {
1201 UNKNOWN = 0;
1202 START = 1;
1203 STOP = 2;
1204 }
1205 optional State state = 1;
1206}
1207
1208/*
1209 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1210 * Logged from:
1211 * system/core/lmkd/lmkd.c
1212 */
1213message LmkKillOccurred {
1214 // The uid if available. -1 means not available.
1215 optional int32 uid = 1;
1216
1217 // The process name.
1218 optional string process_name = 2;
1219
1220 // oom adj score.
1221 optional int32 oom_score = 3;
1222
1223 // # of page-faults
1224 optional int64 pgfault = 4;
1225
1226 // # of major page-faults
1227 optional int64 pgmajfault = 5;
1228
1229 // RSS
1230 optional int64 rss_in_bytes = 6;
1231
1232 // CACHE
1233 optional int64 cache_in_bytes = 7;
1234
1235 // SWAP
1236 optional int64 swap_in_bytes = 8;
1237}
1238
Rajeev Kumar51b54602018-03-01 12:18:26 -08001239/*
1240 * Logs when the ActivityManagerService detects that an app died.
1241 *
1242 * Logged from:
1243 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1244 */
1245message AppDied {
1246 // timestamp(elapsedRealtime) of record creation
1247 optional uint64 timestamp_millis = 1;
1248}
1249
Chenjie Yubbcbc602018-02-05 16:51:52 -08001250//////////////////////////////////////////////////////////////////////
1251// Pulled atoms below this line //
1252//////////////////////////////////////////////////////////////////////
1253
1254/**
David Chenc8a43242017-10-17 16:23:28 -07001255 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1256 *
1257 * Pulled from:
1258 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1259 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001260message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001261 optional int32 uid = 1;
1262
1263 optional int64 rx_bytes = 2;
1264
1265 optional int64 rx_packets = 3;
1266
1267 optional int64 tx_bytes = 4;
1268
1269 optional int64 tx_packets = 5;
1270}
1271
1272/**
1273 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1274 *
1275 * Pulled from:
1276 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1277 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001278message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001279 optional int32 uid = 1;
1280
1281 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1282 optional int32 is_foreground = 2;
1283
1284 optional int64 rx_bytes = 3;
1285
1286 optional int64 rx_packets = 4;
1287
1288 optional int64 tx_bytes = 5;
1289
1290 optional int64 tx_packets = 6;
1291}
1292
1293/**
1294 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1295 *
1296 * Pulled from:
1297 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1298 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001299message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001300 optional int32 uid = 1;
1301
1302 optional int64 rx_bytes = 2;
1303
1304 optional int64 rx_packets = 3;
1305
1306 optional int64 tx_bytes = 4;
1307
1308 optional int64 tx_packets = 5;
1309}
1310
1311/**
1312 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1313 *
1314 * Pulled from:
1315 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1316 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001317message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001318 optional int32 uid = 1;
1319
1320 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1321 optional int32 is_foreground = 2;
1322
1323 optional int64 rx_bytes = 3;
1324
1325 optional int64 rx_packets = 4;
1326
1327 optional int64 tx_bytes = 5;
1328
1329 optional int64 tx_packets = 6;
1330}
1331
1332/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001333 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1334 *
1335 * Pulled from:
1336 * StatsCompanionService
1337 */
1338message BluetoothBytesTransfer {
1339 optional int32 uid = 1;
1340
1341 optional int64 rx_bytes = 2;
1342
1343 optional int64 tx_bytes = 3;
1344}
1345
1346/**
David Chenc8a43242017-10-17 16:23:28 -07001347 * Pulls the kernel wakelock durations. This atom is adapted from
1348 * android/internal/os/KernelWakelockStats.java
1349 *
1350 * Pulled from:
1351 * StatsCompanionService using KernelWakelockReader.
1352 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001353message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001354 optional string name = 1;
1355
1356 optional int32 count = 2;
1357
1358 optional int32 version = 3;
1359
1360 optional int64 time = 4;
1361}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001362
Chenjie Yu05013b32017-11-21 10:21:41 -08001363/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001364 * Pulls low power state information. This includes platform and subsystem sleep state information,
1365 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001366 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001367 * hardware/interfaces/power/1.1/types.hal
1368 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001369message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001370 // Subsystem name
1371 optional string subsystem_name = 1;
1372 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1373 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1374 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001375 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001376 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001377 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001378 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001379}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001380
Chenjie Yu05013b32017-11-21 10:21:41 -08001381/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001382 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001383 * Pulls the time the cpu spend on the frequency index. Frequency index
1384 * starts from highest to lowest. The value should be monotonically
1385 * increasing since boot. However, if there is a cpu
1386 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001387 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001388message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001389 optional uint32 cluster = 1;
1390 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001391 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001392}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001393
Chenjie Yu05013b32017-11-21 10:21:41 -08001394/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001395 * Pulls Cpu Time Per Uid.
1396 * Note that isolated process uid time should be attributed to host uids.
1397 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001398message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001399 optional uint64 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001400 optional uint64 user_time_millis = 2;
1401 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001402}
1403
1404/**
1405 * Pulls Cpu Time Per Uid per frequency.
1406 * Note that isolated process uid time should be attributed to host uids.
1407 * For each uid, we order the time by descending frequencies.
1408 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001409message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001410 optional uint64 uid = 1;
1411 optional uint64 freq_idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001412 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001413}
Hugo Benichi884970e2017-11-14 22:42:46 +09001414
Chenjie Yu05013b32017-11-21 10:21:41 -08001415/**
1416 * Pulls Wifi Controller Activity Energy Info
1417 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001418message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001419 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001420 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001421 // stack reported state
1422 // TODO: replace this with proto enum
1423 optional int32 stack_state = 2;
1424 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001425 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001426 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001427 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001428 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001429 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001430 // product of current(mA), voltage(V) and time(ms)
1431 optional uint64 controller_energy_used = 6;
1432}
1433
1434/**
1435 * Pulls Modem Activity Energy Info
1436 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001437message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001438 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001439 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001440 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001441 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001442 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001443 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001444 /**
1445 * Tx power index
1446 * index 0 = tx_power < 0dBm
1447 * index 1 = 0dBm < tx_power < 5dBm
1448 * index 2 = 5dBm < tx_power < 15dBm
1449 * index 3 = 15dBm < tx_power < 20dBm
1450 * index 4 = tx_power > 20dBm
1451 */
1452 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001453 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001454 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001455 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001456 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001457 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001458 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001459 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001460 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001461 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001462 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001463 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001464 // product of current(mA), voltage(V) and time(ms)
1465 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001466}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001467
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001468/**
1469 * Pulls Bluetooth Activity Energy Info
1470 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1471 */
1472message BluetoothActivityInfo {
1473 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001474 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001475 // bluetooth stack state
1476 optional int32 bluetooth_stack_state = 2;
1477 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001478 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001479 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001480 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001481 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001482 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001483 // product of current(mA), voltage(V) and time(ms)
1484 optional uint64 energy_used = 6;
1485}
1486
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001487/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001488 * Logs the memory stats for a process.
1489 */
1490message ProcessMemoryState {
1491 // The uid if available. -1 means not available.
1492 optional int32 uid = 1;
1493
1494 // The process name.
1495 optional string process_name = 2;
1496
1497 // oom adj score.
1498 optional int32 oom_score = 3;
1499
1500 // # of page-faults
1501 optional int64 pgfault = 4;
1502
1503 // # of major page-faults
1504 optional int64 pgmajfault = 5;
1505
Rajeev Kumar90235992018-01-29 11:06:48 -08001506 // RSS
1507 optional int64 rss_in_bytes = 6;
1508
1509 // CACHE
1510 optional int64 cache_in_bytes = 7;
1511
1512 // SWAP
1513 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001514}
1515
1516/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001517 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001518 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001519message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001520 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001521}
1522
1523/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001524 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001525 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001526message SystemUptime {
1527 // Milliseconds since the system was booted.
1528 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1529 // for external input).
1530 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001531 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001532}
1533
1534/*
1535 * Reads from /proc/uid_concurrent_active_time which has the format:
1536 * active: X (X is # cores)
1537 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1538 * [uid1]: [time-0] [time-1] [time-2] ... ...
1539 * ...
1540 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1541 * The file contains a monotonically increasing count of time for a single boot.
1542 */
1543message CpuActiveTime {
1544 optional uint64 uid = 1;
David Chenb639d142018-02-14 17:29:54 -08001545 optional uint32 cluster_number = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001546 optional uint64 idx = 3;
1547 optional uint64 time_millis = 4;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001548}
1549
1550/**
1551 * Reads from /proc/uid_concurrent_policy_time which has the format:
1552 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1553 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1554 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1555 * ...
1556 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1557 * The file contains a monotonically increasing count of time for a single boot.
1558 */
1559message CpuClusterTime {
1560 optional uint64 uid = 1;
1561 optional uint64 idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001562 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001563}
1564
1565/*
1566 * Pulls free disk space, for data, system partition and temporary directory.
1567 */
1568message DiskSpace {
1569 // available bytes in data partition
1570 optional uint64 data_available_bytes = 1;
1571 // available bytes in system partition
1572 optional uint64 system_available_bytes = 2;
1573 // available bytes in download cache or temp directories
1574 optional uint64 temp_available_bytes = 3;
1575}
Tej Singhbf972d92018-01-10 20:51:13 -08001576
1577/**
1578 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001579 * Pulled from:
1580 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001581 */
1582message RemainingBatteryCapacity {
1583 optional int32 charge_uAh = 1;
1584}
1585
1586/**
1587 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001588 * Pulled from:
1589 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001590 */
1591message FullBatteryCapacity {
1592 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001593}
1594
1595/**
1596 * Pulls the temperature of various parts of the device, in Celsius.
1597 *
1598 * Pulled from:
1599 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1600 */
1601message Temperature {
1602 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1603 optional android.os.TemperatureTypeEnum sensor_location = 1;
1604
1605 // The name of the temperature source. Eg. CPU0
1606 optional string sensor_name = 2;
1607
1608 // Temperature in degrees C.
1609 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001610}