blob: ed570e76a3d15b55c1506595b37751678f66dccb [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
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080025import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080026import "frameworks/base/core/proto/android/server/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/telephony/enums.proto";
28import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080029
Yao Chend54f9dd2017-10-17 17:37:48 +000030/**
Stefan Lafonae2df012017-11-14 09:17:21 -080031 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000032 * raw stats log events from the Android system, also known as "atoms."
33 *
34 * This field contains a single oneof with all of the available messages.
35 * The stats-log-api-gen tool runs as part of the Android build and
36 * generates the android.util.StatsLog class, which contains the constants
37 * and methods that Android uses to log.
38 *
Stefan Lafonae2df012017-11-14 09:17:21 -080039 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000040 * Instead, statsd on Android constructs these messages synthetically,
41 * in the format defined here and in stats_log.proto.
42 */
Stefan Lafonae2df012017-11-14 09:17:21 -080043message Atom {
44 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070045 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070046 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
47 BleScanStateChanged ble_scan_state_changed = 2;
48 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
49 BleScanResultReceived ble_scan_result_received = 4;
50 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080051 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070052 SyncStateChanged sync_state_changed = 7;
53 ScheduledJobStateChanged scheduled_job_state_changed = 8;
54 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070055 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080056 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
57 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
58 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
59 // TODO: 14-19 are blank, but need not be
60 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
61 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
62 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070063 AudioStateChanged audio_state_changed = 23;
64 MediaCodecActivityChanged media_codec_activity_changed = 24;
65 CameraStateChanged camera_state_changed = 25;
66 FlashlightStateChanged flashlight_state_changed = 26;
67 UidProcessStateChanged uid_process_state_changed = 27;
68 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
69 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070070 BatteryLevelChanged battery_level_changed = 30;
71 ChargingStateChanged charging_state_changed = 31;
72 PluggedStateChanged plugged_state_changed = 32;
73 DeviceTemperatureReported device_temperature_reported = 33;
74 DeviceOnStatusChanged device_on_status_changed = 34;
75 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
76 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070077 WifiLockStateChanged wifi_lock_state_changed = 37;
78 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
79 WifiScanStateChanged wifi_scan_state_changed = 39;
80 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070081 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070082 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070083 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090084 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080085 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080086 AnomalyDetected anomaly_detected = 46;
87 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000088 AppStartChanged app_start_changed = 48;
89 AppStartCancelChanged app_start_cancel_changed = 49;
90 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080091 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080092 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080093 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080094 LmkStateChanged lmk_state_changed = 54;
95 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080096 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -080097 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -080098 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -080099 OverlayStateChanged overlay_state_changed = 59;
Bookatzc1a050a2017-10-10 15:49:28 -0700100 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000101 }
David Chenc8a43242017-10-17 16:23:28 -0700102
David Chen6e3e6cb2018-01-03 16:14:06 -0800103 // Pulled events will start at field 10000.
Tej Singhbf972d92018-01-10 20:51:13 -0800104 // Next: 10021
David Chenc8a43242017-10-17 16:23:28 -0700105 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800106 WifiBytesTransfer wifi_bytes_transfer = 10000;
107 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
108 MobileBytesTransfer mobile_bytes_transfer = 10002;
109 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800110 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800111 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800112 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800113 CpuTimePerFreq cpu_time_per_freq = 10008;
114 CpuTimePerUid cpu_time_per_uid = 10009;
115 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
116 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
117 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800118 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800119 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800120 SystemElapsedRealtime system_elapsed_realtime = 10014;
121 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800122 CpuActiveTime cpu_active_time = 10016;
123 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800124 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800125 RemainingBatteryCapacity remaining_battery_capacity = 10019;
126 FullBatteryCapacity full_battery_capacity = 10020;
David Chenc8a43242017-10-17 16:23:28 -0700127 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700128}
129
Yao Chend54f9dd2017-10-17 17:37:48 +0000130/**
Yangster-mac20877162017-12-22 17:19:39 -0800131 * This proto represents a node of an attribution chain.
132 * Note: All attribution chains are represented as a repeated field of type
133 * AttributionNode. It is understood that in such arrays, the order is that
134 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000135 */
Yangster-mac20877162017-12-22 17:19:39 -0800136message AttributionNode {
137 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800138 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800139
Yangster-mac20877162017-12-22 17:19:39 -0800140 // The (optional) string tag for an element in the attribution chain. If the
141 // element has no tag, it is encoded as an empty string.
142 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700143}
144
Yao Chend54f9dd2017-10-17 17:37:48 +0000145/*
146 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800147 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000148 *
149 * RULES:
150 * - The field ids for each atom must start at 1, and count upwards by 1.
151 * Skipping field ids is not allowed.
152 * - These form an API, so renaming, renumbering or removing fields is
153 * not allowed between android releases. (This is not currently enforced,
154 * but there will be a tool to enforce this restriction).
155 * - The types must be built-in protocol buffer types, namely, no sub-messages
156 * are allowed (yet). The bytes type is also not allowed.
157 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800158 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000159 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800160 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000161 * - A field that is a uid should be a string field, tagged with the [xxx]
162 * annotation. The generated code on android will be represented by UIDs,
163 * and those UIDs will be translated in xxx to those strings.
164 *
165 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700166 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000167 * - If there is a UID, it goes first. Think in an object-oriented fashion.
168 * *****************************************************************************
169 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700170
Yao Chend54f9dd2017-10-17 17:37:48 +0000171/**
172 * Logs when the screen state changes.
173 *
174 * Logged from:
175 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
176 */
177message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800178 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
179 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700180}
Yao Chend54f9dd2017-10-17 17:37:48 +0000181
182/**
Bookatzc1a050a2017-10-10 15:49:28 -0700183 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 *
185 * Logged from:
186 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
187 */
Bookatzc1a050a2017-10-10 15:49:28 -0700188message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000189 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
190
Bookatzdb026a22018-01-10 19:01:56 -0800191 // The state, from frameworks/base/core/proto/android/app/enums.proto.
192 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000193}
194
195/**
Bookatzc1a050a2017-10-10 15:49:28 -0700196 * Logs that a process started, finished, crashed, or ANRed.
197 *
198 * Logged from:
199 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
200 */
201message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700202 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
203
204 // TODO: What is this?
205 optional string name = 2;
206
Bookatzddccf0a2017-11-28 16:48:14 -0800207 // What lifecycle state the process changed to.
208 // This enum is specific to atoms.proto.
209 enum Event {
210 PROCESS_FINISHED = 0;
211 PROCESS_STARTED = 1;
212 PROCESS_CRASHED = 2;
213 PROCESS_ANRED = 3;
214 }
215 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700216}
217
Bookatzc1a050a2017-10-10 15:49:28 -0700218/**
219 * Logs when the ble scan state changes.
220 *
221 * Logged from:
222 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
223 */
224message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800225 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700226
227 enum State {
228 OFF = 0;
229 ON = 1;
230 }
231 optional State state = 2;
232}
233
234/**
235 * Logs when an unoptimized ble scan state changes.
236 *
237 * Logged from:
238 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
239 */
240// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
241message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800242 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700243
244 enum State {
245 OFF = 0;
246 ON = 1;
247 }
248 optional State state = 2;
249}
250
251/**
252 * Logs reporting of a ble scan finding results.
253 *
254 * Logged from:
255 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
256 */
257// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
258message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800259 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700260
261 // Number of ble scan results returned.
262 optional int32 num_of_results = 2;
263}
264
265/**
266 * Logs when a sensor state changes.
267 *
268 * Logged from:
269 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
270 */
271message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800272 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700273
274 // TODO: Is there a way to get the actual name of the sensor?
275 // The id (int) of the sensor.
276 optional int32 sensor_id = 2;
277
278 enum State {
279 OFF = 0;
280 ON = 1;
281 }
282 optional State state = 3;
283}
284
285
286/**
287 * Logs when GPS state changes.
288 *
289 * Logged from:
290 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
291 */
292message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800293 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700294
295 enum State {
296 OFF = 0;
297 ON = 1;
298 }
299 optional State state = 2;
300}
301
302
303/**
304 * Logs when a sync manager sync state changes.
305 *
306 * Logged from:
307 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
308 */
309message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800310 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700311
312 // Name of the sync (as named in the app)
313 optional string name = 2;
314
315 enum State {
316 OFF = 0;
317 ON = 1;
318 }
319 optional State state = 3;
320}
321
322/**
323 * Logs when a job scheduler job state changes.
324 *
325 * Logged from:
326 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
327 */
328message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800329 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700330
331 // Name of the job (as named in the app)
332 optional string name = 2;
333
334 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800335 FINISHED = 0;
336 STARTED = 1;
337 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700338 }
339 optional State state = 3;
340
341 // TODO: Consider adding the stopReason (int)
342}
343
344/**
345 * Logs when the audio state changes.
346 *
347 * Logged from:
348 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
349 */
350message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800351 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700352
353 enum State {
354 OFF = 0;
355 ON = 1;
356 }
357 optional State state = 2;
358}
359
360/**
361 * Logs when the video codec state changes.
362 *
363 * Logged from:
364 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
365 */
366message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800367 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700368
369 enum State {
370 OFF = 0;
371 ON = 1;
372 }
373 optional State state = 2;
374}
375
376/**
377 * Logs when the flashlight state changes.
378 *
379 * Logged from:
380 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
381 */
382message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800383 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700384
385 enum State {
386 OFF = 0;
387 ON = 1;
388 }
389 optional State state = 2;
390}
391
392/**
393 * Logs when the camera state changes.
394 *
395 * Logged from:
396 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
397 */
398message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800399 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700400
401 enum State {
402 OFF = 0;
403 ON = 1;
404 }
405 optional State state = 2;
406}
407
408/**
409 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000410 *
411 * Logged from:
412 * TODO
413 */
Bookatzd6746242017-10-24 18:39:35 -0700414message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800415 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000416
Bookatz1a1b0462018-01-12 11:47:03 -0800417 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
418 // From frameworks/base/core/proto/android/os/enums.proto.
419 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700420
421 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
422 optional string tag = 3;
423
424 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800425 RELEASE = 0;
426 ACQUIRE = 1;
427 CHANGE_RELEASE = 2;
428 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700429 }
430 optional State state = 4;
431}
432
433/**
Bookatzc1a050a2017-10-10 15:49:28 -0700434 * Logs when a partial wakelock is considered 'long' (over 1 min).
435 *
436 * Logged from:
437 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
438 */
439message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800440 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700441
Yao Chend54f9dd2017-10-17 17:37:48 +0000442 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
443 optional string tag = 2;
444
Bookatzc1a050a2017-10-10 15:49:28 -0700445 // TODO: I have no idea what this is.
446 optional string history_tag = 3;
447
448 enum State {
449 OFF = 0;
450 ON = 1;
451 }
452 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000453}
454
Bookatzc1a050a2017-10-10 15:49:28 -0700455/**
456 * Logs Battery Saver state change.
457 *
458 * Logged from:
459 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
460 */
461message BatterySaverModeStateChanged {
462 enum State {
463 OFF = 0;
464 ON = 1;
465 }
466 optional State state = 1;
467}
468
469/**
470 * Logs Doze mode state change.
471 *
472 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800473 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700474 */
475message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800476 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800477}
478
479
480/**
481 * Logs state change of Doze mode including maintenance windows.
482 *
483 * Logged from:
484 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
485 */
486message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800487 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700488}
489
490/**
491 * Logs screen brightness level.
492 *
493 * Logged from:
494 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
495 */
496message ScreenBrightnessChanged {
497 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
498 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700499}
500
501/**
502 * Logs battery level (percent full, from 0 to 100).
503 *
504 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700505 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700506 */
507message BatteryLevelChanged {
508 // Battery level. Should be in [0, 100].
509 optional int32 battery_level = 1;
510}
511
512/**
513 * Logs change in charging status of the device.
514 *
515 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700516 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700517 */
518message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800519 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
520 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700521}
522
523/**
524 * Logs whether the device is plugged in, and what power source it is using.
525 *
526 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700527 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700528 */
529message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800530 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
531 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700532}
533
534/**
535 * Logs the temperature of the device, in tenths of a degree Celsius.
536 *
537 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700538 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700539 */
540message DeviceTemperatureReported {
541 // Temperature in tenths of a degree C.
542 optional int32 temperature = 1;
543}
544
545// TODO: Define this more precisely.
546// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
547/**
548 * Logs when the device turns off or on.
549 *
550 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700551 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700552 */
553message DeviceOnStatusChanged {
554 enum State {
555 OFF = 0;
556 ON = 1;
557 }
558 optional State state = 1;
559}
560
561/**
562 * Logs when an app's wakeup alarm fires.
563 *
564 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700565 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700566 */
567message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800568 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800569
570 // Name of the wakeup alarm.
571 optional string tag = 2;
572}
573
574/**
575 * Logs when an an app causes the mobile radio to change state.
576 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
577 *
578 * Logged from:
579 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
580 */
581message MobileRadioPowerStateChanged {
582 // TODO: Add attribution instead of uid?
583 optional int32 uid = 1;
584
Bookatz1a1b0462018-01-12 11:47:03 -0800585 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
586 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800587}
588
589/**
590 * Logs when an an app causes the wifi radio to change state.
591 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
592 *
593 * Logged from:
594 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
595 */
596message WifiRadioPowerStateChanged {
597 // TODO: Add attribution instead of uid?
598 optional int32 uid = 1;
599
Bookatz1a1b0462018-01-12 11:47:03 -0800600 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
601 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700602}
603
604/**
605 * Logs kernel wakeup reasons and aborts.
606 *
607 * Logged from:
608 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
609 */
610message KernelWakeupReported {
611 // Name of the kernel wakeup reason (or abort).
612 optional string wakeup_reason_name = 1;
613
614 // Duration (in microseconds) for the wake-up interrupt to be serviced.
615 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700616}
617
618/**
619 * Logs wifi locks held by an app.
620 *
621 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700622 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700623 */
624message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800625 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700626
627 enum State {
628 OFF = 0;
629 ON = 1;
630 }
631 optional State state = 2;
632}
633
634/**
635 * Logs wifi signal strength changes.
636 *
637 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700638 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700639 */
640message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800641 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
642 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700643}
644
645/**
646 * Logs wifi scans performed by an app.
647 *
648 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700649 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700650 */
651message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800652 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700653
654 enum State {
655 OFF = 0;
656 ON = 1;
657 }
658 optional State state = 2;
659}
660
661/**
Tej Singh4503e102018-01-04 14:35:01 -0800662 * Logs wifi multicast locks held by an app
663 *
664 * Logged from:
665 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
666 */
667message WifiMulticastLockStateChanged {
668 repeated AttributionNode attribution_node = 1;
669
670 enum State {
671 OFF = 0;
672 ON = 1;
673 }
674 optional State state = 2;
675}
676
677/**
Tej Singh1ea42892018-01-19 09:27:00 -0800678 * Logs shutdown reason and duration on next boot.
679 *
680 * Logged from:
681 * frameworks/base/core/java/com/android/server/BootReceiver.java
682 */
683message ShutdownSequenceReported {
684 // True if shutdown is for a reboot. Default: false if we do not know.
685 optional bool reboot = 1;
686
687 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
688 optional string reason = 2;
689
690 // Beginning of shutdown time in ms using wall clock time since unix epoch.
691 // Default: 0 if no start time received.
692 optional int64 start_time_ms = 3;
693
694 // Duration of shutdown in ms. Default: 0 if no duration received.
695 optional int64 duration_ms = 4;
696}
697
Tej Singh6483ea42018-01-25 17:45:49 -0800698
699/**
700 * Logs boot reason and duration.
701 *
702 * Logged from:
703 * system/core/bootstat/bootstat.cpp
704 */
705message BootSequenceReported {
706 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
707 // Default: "<EMPTY>" if not available.
708 optional string bootloader_reason = 1;
709
710 // Reason for system boot. Eg. bootloader, reboot,userrequested
711 // Default: "<EMPTY>" if not available.
712 optional string system_reason = 2;
713
714 // End of boot time in ms from unix epoch using system wall clock.
715 optional int64 end_time_ms = 3;
716
717 // Total boot duration in ms.
718 optional int64 total_duration_ms = 4;
719
720 // Bootloader duration in ms.
721 optional int64 bootloader_duration_ms = 5;
722
723 // Time since last boot in ms. Default: 0 if not available.
724 optional int64 time_since_last_boot = 6;
725}
726
Tej Singh1ea42892018-01-19 09:27:00 -0800727/**
Tej Singhbb8554a2018-01-26 11:59:14 -0800728 * Logs the duration of a davey (jank of >=700ms) when it occurs
729 *
730 * Logged from:
731 * frameworks/base/libs/hwui/JankTracker.cpp
732 */
733message DaveyOccurred {
734 // Amount of time it took to render the frame. Should be >=700ms.
735 optional int64 jank_duration_ms = 1;
736}
737
738/**
Bookatze5885242017-10-24 20:10:31 -0700739 * Logs phone signal strength changes.
740 *
741 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700742 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700743 */
744message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800745 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
746 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700747}
748
749/**
750 * Logs that a setting was updated.
751 * Logged from:
752 * frameworks/base/core/java/android/provider/Settings.java
753 * The tag and is_default allow resetting of settings to default values based on the specified
754 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
755 */
756message SettingChanged {
757 // The name of the setting.
758 optional string setting = 1;
759
760 // The change being imposed on this setting. May represent a number, eg "3".
761 optional string value = 2;
762
763 // The new value of this setting. For most settings, this is same as value. For some settings,
764 // value is +X or -X where X represents an element in a set. For example, if the previous value
765 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
766 // The +/- feature is currently only used for location_providers_allowed.
767 optional string new_value = 3;
768
769 // The previous value of this setting.
770 optional string prev_value = 4;
771
772 // The tag used with the is_default for resetting sets of settings. This is generally null.
773 optional string tag = 5;
774
Bookatz90867622018-01-31 15:05:57 -0800775 // True if this setting with tag should be resettable.
776 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -0700777
778 // The user ID associated. Defined in android/os/UserHandle.java
779 optional int32 user = 7;
780}
Chenjie Yub3dda412017-10-24 13:41:59 -0700781
Chenjie Yu05013b32017-11-21 10:21:41 -0800782/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700783 * Logs activity going to foreground or background
784 *
785 * Logged from:
786 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
787 */
788message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800789 optional int32 uid = 1;
790 optional string pkg_name = 2;
791 optional string class_name = 3;
792
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700793 enum Activity {
794 MOVE_TO_BACKGROUND = 0;
795 MOVE_TO_FOREGROUND = 1;
796 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700797 optional Activity activity = 4;
798}
David Chenc8a43242017-10-17 16:23:28 -0700799
800/**
David Chen9e3808c2017-11-20 17:25:34 -0800801 * Logs when an error is written to dropbox.
802 * Logged from:
803 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
804 */
805message DropboxErrorChanged {
806 // The uid if available. -1 means not available.
807 optional int32 uid = 1;
808
809 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
810 optional string tag = 2;
811
812 // The name of the process.
813 optional string process_name = 3;
814
815 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800816 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800817
818 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800819 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800820
821 // The activity name if available.
822 optional string activity_name = 6;
823
David Chen6e3e6cb2018-01-03 16:14:06 -0800824 // The package name if available.
825 optional string package_name = 7;
826
David Chen9e3808c2017-11-20 17:25:34 -0800827 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800828 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800829}
830
David Chen0a368b22017-12-06 16:28:16 -0800831/*
832 * Allows other apps to push events into statsd.
833 * Logged from:
834 * frameworks/base/core/java/android/util/StatsLog.java
835 */
836message AppHook {
837 // The uid of the application that sent this custom atom.
838 optional int32 uid = 1;
839
840 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
841 optional int32 label = 2;
842
843 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
844 // predicates for the metrics).
845 enum State {
846 UNKNOWN = 0;
847 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
848 STOP = 2;
849 START = 3;
850 }
851 optional State state = 3;
852}
853
David Chen9e3808c2017-11-20 17:25:34 -0800854/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800855 * Logs when statsd detects an anomaly.
856 *
857 * Logged from:
858 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
859 */
860message AnomalyDetected {
861 // Uid that owns the config whose anomaly detection alert fired.
862 optional int32 config_uid = 1;
863
Yangster-mac94e197c2018-01-02 16:03:03 -0800864 // Id of the config whose anomaly detection alert fired.
865 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800866
Yangster-mac94e197c2018-01-02 16:03:03 -0800867 // Id of the alert (i.e. name of the anomaly that was detected).
868 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800869}
870
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000871message AppStartChanged {
872 // The uid if available. -1 means not available.
873 optional int32 uid = 1;
874
875 // The app package name.
876 optional string pkg_name = 2;
877
878 enum TransitionType {
879 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
880 WARM = 1;
881 HOT = 2;
882 COLD = 3;
883 }
884 // The transition type.
885 optional TransitionType type = 3;
886
887 // The activity name.
888 optional string activity_name = 4;
889
890 // The name of the calling app. Empty if not set.
891 optional string calling_pkg_name = 5;
892
893 // Whether the app is an instant app.
894 optional bool is_instant_app = 6;
895
896 // Device uptime when activity started.
897 optional int64 activity_start_msec = 7;
898
Bookatz80d11a02018-01-16 10:46:35 -0800899 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000900
901 optional int32 transition_delay_msec = 9;
902 // -1 if not set.
903 optional int32 starting_window_delay_msec = 10;
904 // -1 if not set.
905 optional int32 bind_application_delay_msec = 11;
906 optional int32 windows_drawn_delay_msec = 12;
907
908 // Empty if not set.
909 optional string launch_token = 13;
910
911}
912
913message AppStartCancelChanged {
914 // The uid if available. -1 means not available.
915 optional int32 uid = 1;
916
917 // The app package name.
918 optional string pkg_name = 2;
919
920 enum TransitionType {
921 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
922 WARM = 1;
923 HOT = 2;
924 COLD = 3;
925 }
926 // The transition type.
927 optional TransitionType type = 3;
928
929 // The activity name.
930 optional string activity_name = 4;
931}
932
933message AppStartFullyDrawnChanged {
934 // The uid if available. -1 means not available.
935 optional int32 uid = 1;
936
937 // The app package name.
938 optional string pkg_name = 2;
939
940 enum TransitionType {
941 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
942 WITH_BUNDLE = 1;
943 WITHOUT_BUNDLE = 2;
944 }
945 // The transition type.
946 optional TransitionType type = 3;
947
948 // The activity name.
949 optional string activity_name = 4;
950
951 optional bool transition_process_running = 5;
952
953 // App startup time (until call to Activity#reportFullyDrawn()).
954 optional int64 app_startup_time_ms = 6;
955}
956
Bookatz8fcd09a2017-12-18 13:01:10 -0800957/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800958 * Logs a picture-in-picture action
959 * Logged from:
960 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
961 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
962 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
963 */
964message PictureInPictureStateChanged {
965 optional int32 uid = 1;
966
967 optional string package_name = 2;
968
969 optional string class_name = 3;
970
971 // Picture-in-Picture action occurred, similar to
972 // frameworks/base/proto/src/metrics_constants.proto
973 enum State {
974 ENTERED = 1;
975 EXPANDED_TO_FULL_SCREEN = 2;
976 MINIMIZED = 3;
977 DISMISSED = 4;
978 }
979 optional State state = 4;
980}
981
982/**
Chenjie Yue8904192017-12-08 19:12:57 -0800983 * Logs overlay action
984 * Logged from:
985 * services/core/java/com/android/server/wm/Session.java
986 */
987message OverlayStateChanged {
988 optional int32 uid = 1;
989
990 optional string package_name = 2;
991
992 optional bool using_alert_window = 3;
993
994 enum State {
995 ENTERED = 1;
996 EXITED = 2;
997 }
998 optional State state = 4;
999}
1000
1001/**
David Chenc8a43242017-10-17 16:23:28 -07001002 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1003 *
1004 * Pulled from:
1005 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1006 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001007message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001008 optional int32 uid = 1;
1009
1010 optional int64 rx_bytes = 2;
1011
1012 optional int64 rx_packets = 3;
1013
1014 optional int64 tx_bytes = 4;
1015
1016 optional int64 tx_packets = 5;
1017}
1018
1019/**
1020 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1021 *
1022 * Pulled from:
1023 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1024 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001025message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001026 optional int32 uid = 1;
1027
1028 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1029 optional int32 is_foreground = 2;
1030
1031 optional int64 rx_bytes = 3;
1032
1033 optional int64 rx_packets = 4;
1034
1035 optional int64 tx_bytes = 5;
1036
1037 optional int64 tx_packets = 6;
1038}
1039
1040/**
1041 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1042 *
1043 * Pulled from:
1044 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1045 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001046message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001047 optional int32 uid = 1;
1048
1049 optional int64 rx_bytes = 2;
1050
1051 optional int64 rx_packets = 3;
1052
1053 optional int64 tx_bytes = 4;
1054
1055 optional int64 tx_packets = 5;
1056}
1057
1058/**
1059 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1060 *
1061 * Pulled from:
1062 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1063 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001064message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001065 optional int32 uid = 1;
1066
1067 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1068 optional int32 is_foreground = 2;
1069
1070 optional int64 rx_bytes = 3;
1071
1072 optional int64 rx_packets = 4;
1073
1074 optional int64 tx_bytes = 5;
1075
1076 optional int64 tx_packets = 6;
1077}
1078
1079/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001080 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1081 *
1082 * Pulled from:
1083 * StatsCompanionService
1084 */
1085message BluetoothBytesTransfer {
1086 optional int32 uid = 1;
1087
1088 optional int64 rx_bytes = 2;
1089
1090 optional int64 tx_bytes = 3;
1091}
1092
1093/**
David Chenc8a43242017-10-17 16:23:28 -07001094 * Pulls the kernel wakelock durations. This atom is adapted from
1095 * android/internal/os/KernelWakelockStats.java
1096 *
1097 * Pulled from:
1098 * StatsCompanionService using KernelWakelockReader.
1099 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001100message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001101 optional string name = 1;
1102
1103 optional int32 count = 2;
1104
1105 optional int32 version = 3;
1106
1107 optional int64 time = 4;
1108}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001109
Chenjie Yu05013b32017-11-21 10:21:41 -08001110/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001111 * Pulls low power state information. This includes platform and subsystem sleep state information,
1112 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001113 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001114 * hardware/interfaces/power/1.1/types.hal
1115 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001116message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001117 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1118 // YYY is corresponding voter name.
1119 // If there are no voters, the format should just be XXX (with no dot).
1120 // XXX and YYY should not contain a "." in it.
1121 optional string name = 1;
1122 // The number of times it entered, or voted for entering the sleep state
1123 optional uint64 count = 2;
1124 // The length of time spent in, or spent voting for, the sleep state
1125 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001126}
David Chen21582962017-11-01 17:32:46 -07001127
1128/**
1129 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1130 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1131 * attributed back to the parent (host) uid. One example is Chrome.
1132 *
1133 * Logged from:
1134 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1135 */
1136message IsolatedUidChanged {
1137 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1138 optional int32 parent_uid = 1;
1139
1140 optional int32 isolated_uid = 2;
1141
Bookatz90867622018-01-31 15:05:57 -08001142 // We expect an isolated uid to be removed before if it's used for another parent uid.
1143 enum Event {
1144 REMOVED = 0;
1145 CREATED = 1;
1146 }
1147 optional Event event = 3;
David Chen21582962017-11-01 17:32:46 -07001148}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001149
Chenjie Yu05013b32017-11-21 10:21:41 -08001150/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001151 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001152 * Pulls the time the cpu spend on the frequency index. Frequency index
1153 * starts from highest to lowest. The value should be monotonically
1154 * increasing since boot. However, if there is a cpu
1155 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001156 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001157message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001158 optional uint32 cluster = 1;
1159 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001160 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001161}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001162
Chenjie Yu05013b32017-11-21 10:21:41 -08001163/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001164 * Pulls Cpu Time Per Uid.
1165 * Note that isolated process uid time should be attributed to host uids.
1166 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001167message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001168 optional uint64 uid = 1;
1169 optional uint64 user_time_ms = 2;
1170 optional uint64 sys_time_ms = 3;
1171}
1172
1173/**
1174 * Pulls Cpu Time Per Uid per frequency.
1175 * Note that isolated process uid time should be attributed to host uids.
1176 * For each uid, we order the time by descending frequencies.
1177 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001178message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001179 optional uint64 uid = 1;
1180 optional uint64 freq_idx = 2;
1181 optional uint64 time_ms = 3;
1182}
Hugo Benichi884970e2017-11-14 22:42:46 +09001183
1184/*
1185 * Logs the reception of an incoming network packet causing the main system to wake up for
1186 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1187 * and processed by WakeupController.cpp.
1188 */
1189message PacketWakeupOccurred {
1190 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1191 // delivered nowhere.
1192 optional int32 uid = 1;
1193 // The interface name on which the packet was received.
1194 optional string iface = 2;
1195 // The ethertype value of the packet.
1196 optional int32 ethertype = 3;
1197 // String representation of the destination MAC address of the packet.
1198 optional string destination_hardware_address = 4;
1199 // String representation of the source address of the packet if this was an IP packet.
1200 optional string source_ip = 5;
1201 // String representation of the destination address of the packet if this was an IP packet.
1202 optional string destination_ip = 6;
1203 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1204 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1205 // families.
1206 optional int32 ip_next_header = 7;
1207 // The source port if this was a TCP or UDP packet.
1208 optional int32 source_port = 8;
1209 // The destination port if this was a TCP or UDP packet.
1210 optional int32 destination_port = 9;
1211}
Chenjie Yu05013b32017-11-21 10:21:41 -08001212
1213/**
1214 * Pulls Wifi Controller Activity Energy Info
1215 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001216message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001217 // timestamp(wall clock) of record creation
1218 optional uint64 timestamp_ms = 1;
1219 // stack reported state
1220 // TODO: replace this with proto enum
1221 optional int32 stack_state = 2;
1222 // tx time in ms
1223 optional uint64 controller_tx_time_ms = 3;
1224 // rx time in ms
1225 optional uint64 controller_rx_time_ms = 4;
1226 // idle time in ms
1227 optional uint64 controller_idle_time_ms = 5;
1228 // product of current(mA), voltage(V) and time(ms)
1229 optional uint64 controller_energy_used = 6;
1230}
1231
1232/**
1233 * Pulls Modem Activity Energy Info
1234 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001235message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001236 // timestamp(wall clock) of record creation
1237 optional uint64 timestamp_ms = 1;
1238 // sleep time in ms.
1239 optional uint64 sleep_time_ms = 2;
1240 // idle time in ms
1241 optional uint64 controller_idle_time_ms = 3;
1242 /**
1243 * Tx power index
1244 * index 0 = tx_power < 0dBm
1245 * index 1 = 0dBm < tx_power < 5dBm
1246 * index 2 = 5dBm < tx_power < 15dBm
1247 * index 3 = 15dBm < tx_power < 20dBm
1248 * index 4 = tx_power > 20dBm
1249 */
1250 // tx time in ms at power level 0
1251 optional uint64 controller_tx_time_pl0_ms = 4;
1252 // tx time in ms at power level 1
1253 optional uint64 controller_tx_time_pl1_ms = 5;
1254 // tx time in ms at power level 2
1255 optional uint64 controller_tx_time_pl2_ms = 6;
1256 // tx time in ms at power level 3
1257 optional uint64 controller_tx_time_pl3_ms = 7;
1258 // tx time in ms at power level 4
1259 optional uint64 controller_tx_time_pl4_ms = 8;
1260 // rx time in ms at power level 5
1261 optional uint64 controller_rx_time_ms = 9;
1262 // product of current(mA), voltage(V) and time(ms)
1263 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001264}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001265
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001266/**
1267 * Pulls Bluetooth Activity Energy Info
1268 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1269 */
1270message BluetoothActivityInfo {
1271 // timestamp(wall clock) of record creation
1272 optional uint64 timestamp_ms = 1;
1273 // bluetooth stack state
1274 optional int32 bluetooth_stack_state = 2;
1275 // tx time in ms
1276 optional uint64 controller_tx_time_ms = 3;
1277 // rx time in ms
1278 optional uint64 controller_rx_time_ms = 4;
1279 // idle time in ms
1280 optional uint64 controller_idle_time_ms = 5;
1281 // product of current(mA), voltage(V) and time(ms)
1282 optional uint64 energy_used = 6;
1283}
1284
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001285/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001286 * Logs the memory stats for an app on startup.
1287 * Logged from:
1288 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001289 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001290message AppStartMemoryStateCaptured {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001291 // The uid if available. -1 means not available.
1292 optional int32 uid = 1;
1293
Rajeev Kumar27572b92018-01-23 16:12:51 -08001294 // The process name.
1295 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001296
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001297 // The activity name.
1298 optional string activity_name = 3;
1299
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001300 // # of page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001301 optional int64 pgfault = 4;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001302
1303 // # of major page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001304 optional int64 pgmajfault = 5;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001305
Rajeev Kumar90235992018-01-29 11:06:48 -08001306 // RSS
1307 optional int64 rss_in_bytes = 6;
1308
1309 // CACHE
1310 optional int64 cache_in_bytes = 7;
1311
1312 // SWAP
1313 optional int64 swap_in_bytes = 8;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001314}
1315
1316/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001317 * Logs the memory stats for a process.
1318 */
1319message ProcessMemoryState {
1320 // The uid if available. -1 means not available.
1321 optional int32 uid = 1;
1322
1323 // The process name.
1324 optional string process_name = 2;
1325
1326 // oom adj score.
1327 optional int32 oom_score = 3;
1328
1329 // # of page-faults
1330 optional int64 pgfault = 4;
1331
1332 // # of major page-faults
1333 optional int64 pgmajfault = 5;
1334
Rajeev Kumar90235992018-01-29 11:06:48 -08001335 // RSS
1336 optional int64 rss_in_bytes = 6;
1337
1338 // CACHE
1339 optional int64 cache_in_bytes = 7;
1340
1341 // SWAP
1342 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001343}
1344
1345/*
1346 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1347 * for LMK event.
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001348 * Logged from:
1349 * system/core/lmkd/lmkd.c
1350 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001351message LmkStateChanged {
1352 enum State {
1353 UNKNOWN = 0;
1354 START = 1;
1355 STOP = 2;
1356 }
1357 optional State state = 1;
1358}
1359
1360/*
1361 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1362 * Logged from:
1363 * system/core/lmkd/lmkd.c
1364 */
1365message LmkKillOccurred {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001366 // The uid if available. -1 means not available.
1367 optional int32 uid = 1;
1368
Rajeev Kumar27572b92018-01-23 16:12:51 -08001369 // The process name.
1370 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001371
1372 // oom adj score.
1373 optional int32 oom_score = 3;
1374
Rajeev Kumar27572b92018-01-23 16:12:51 -08001375 // # of page-faults
1376 optional int64 pgfault = 4;
1377
1378 // # of major page-faults
1379 optional int64 pgmajfault = 5;
1380
Rajeev Kumar90235992018-01-29 11:06:48 -08001381 // RSS
1382 optional int64 rss_in_bytes = 6;
1383
1384 // CACHE
1385 optional int64 cache_in_bytes = 7;
1386
1387 // SWAP
1388 optional int64 swap_in_bytes = 8;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001389}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001390
1391/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001392 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001393 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001394message SystemElapsedRealtime {
1395 optional uint64 time_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001396}
1397
1398/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001399 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001400 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001401message SystemUptime {
1402 // Milliseconds since the system was booted.
1403 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1404 // for external input).
1405 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1406 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001407}
1408
1409/*
1410 * Reads from /proc/uid_concurrent_active_time which has the format:
1411 * active: X (X is # cores)
1412 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1413 * [uid1]: [time-0] [time-1] [time-2] ... ...
1414 * ...
1415 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1416 * The file contains a monotonically increasing count of time for a single boot.
1417 */
1418message CpuActiveTime {
1419 optional uint64 uid = 1;
1420 optional uint64 idx = 2;
1421 optional uint64 time_ms = 3;
1422}
1423
1424/**
1425 * Reads from /proc/uid_concurrent_policy_time which has the format:
1426 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1427 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1428 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1429 * ...
1430 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1431 * The file contains a monotonically increasing count of time for a single boot.
1432 */
1433message CpuClusterTime {
1434 optional uint64 uid = 1;
1435 optional uint64 idx = 2;
1436 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001437}
1438
1439/*
1440 * Pulls free disk space, for data, system partition and temporary directory.
1441 */
1442message DiskSpace {
1443 // available bytes in data partition
1444 optional uint64 data_available_bytes = 1;
1445 // available bytes in system partition
1446 optional uint64 system_available_bytes = 2;
1447 // available bytes in download cache or temp directories
1448 optional uint64 temp_available_bytes = 3;
1449}
Tej Singhbf972d92018-01-10 20:51:13 -08001450
1451/**
1452 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
1453 * Logged from: frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
1454 */
1455message RemainingBatteryCapacity {
1456 optional int32 charge_uAh = 1;
1457}
1458
1459/**
1460 * Pulls battery capacity, which is the battery capacity when full in uAh.
1461 * Logged from: frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
1462 */
1463message FullBatteryCapacity {
1464 optional int32 capacity_uAh = 1;
1465}