blob: 1224504c67034045f97081e29bc7d0bb6ebdc704 [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";
Tej Singhc477d9c2018-02-05 18:31:39 -080027import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080028import "frameworks/base/core/proto/android/telephony/enums.proto";
29import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080030
Yao Chend54f9dd2017-10-17 17:37:48 +000031/**
Stefan Lafonae2df012017-11-14 09:17:21 -080032 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000033 * raw stats log events from the Android system, also known as "atoms."
34 *
35 * This field contains a single oneof with all of the available messages.
36 * The stats-log-api-gen tool runs as part of the Android build and
37 * generates the android.util.StatsLog class, which contains the constants
38 * and methods that Android uses to log.
39 *
Stefan Lafonae2df012017-11-14 09:17:21 -080040 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000041 * Instead, statsd on Android constructs these messages synthetically,
42 * in the format defined here and in stats_log.proto.
43 */
Stefan Lafonae2df012017-11-14 09:17:21 -080044message Atom {
45 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070046 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070047 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
48 BleScanStateChanged ble_scan_state_changed = 2;
49 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
50 BleScanResultReceived ble_scan_result_received = 4;
51 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080052 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070053 SyncStateChanged sync_state_changed = 7;
54 ScheduledJobStateChanged scheduled_job_state_changed = 8;
55 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070056 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080057 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
58 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
59 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
60 // TODO: 14-19 are blank, but need not be
61 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
62 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
63 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070064 AudioStateChanged audio_state_changed = 23;
65 MediaCodecActivityChanged media_codec_activity_changed = 24;
66 CameraStateChanged camera_state_changed = 25;
67 FlashlightStateChanged flashlight_state_changed = 26;
68 UidProcessStateChanged uid_process_state_changed = 27;
69 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
70 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070071 BatteryLevelChanged battery_level_changed = 30;
72 ChargingStateChanged charging_state_changed = 31;
73 PluggedStateChanged plugged_state_changed = 32;
74 DeviceTemperatureReported device_temperature_reported = 33;
75 DeviceOnStatusChanged device_on_status_changed = 34;
76 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
77 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070078 WifiLockStateChanged wifi_lock_state_changed = 37;
79 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
80 WifiScanStateChanged wifi_scan_state_changed = 39;
81 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070082 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070083 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070084 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090085 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080086 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080087 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080088 AppBreadcrumbReported app_breadcrumb_reported = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000089 AppStartChanged app_start_changed = 48;
90 AppStartCancelChanged app_start_cancel_changed = 49;
91 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080092 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080093 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080094 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080095 LmkStateChanged lmk_state_changed = 54;
96 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080097 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -080098 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -080099 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800100 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800101 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800102 CallStateChanged call_state_changed = 61;
Bookatzc1a050a2017-10-10 15:49:28 -0700103 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000104 }
David Chenc8a43242017-10-17 16:23:28 -0700105
David Chen6e3e6cb2018-01-03 16:14:06 -0800106 // Pulled events will start at field 10000.
Tej Singhbf972d92018-01-10 20:51:13 -0800107 // Next: 10021
David Chenc8a43242017-10-17 16:23:28 -0700108 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800109 WifiBytesTransfer wifi_bytes_transfer = 10000;
110 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
111 MobileBytesTransfer mobile_bytes_transfer = 10002;
112 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800113 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800114 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800115 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800116 CpuTimePerFreq cpu_time_per_freq = 10008;
117 CpuTimePerUid cpu_time_per_uid = 10009;
118 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
119 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
120 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800121 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800122 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800123 SystemElapsedRealtime system_elapsed_realtime = 10014;
124 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800125 CpuActiveTime cpu_active_time = 10016;
126 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800127 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800128 RemainingBatteryCapacity remaining_battery_capacity = 10019;
129 FullBatteryCapacity full_battery_capacity = 10020;
David Chenc8a43242017-10-17 16:23:28 -0700130 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700131}
132
Yao Chend54f9dd2017-10-17 17:37:48 +0000133/**
Yangster-mac20877162017-12-22 17:19:39 -0800134 * This proto represents a node of an attribution chain.
135 * Note: All attribution chains are represented as a repeated field of type
136 * AttributionNode. It is understood that in such arrays, the order is that
137 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000138 */
Yangster-mac20877162017-12-22 17:19:39 -0800139message AttributionNode {
140 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800141 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800142
Yangster-mac20877162017-12-22 17:19:39 -0800143 // The (optional) string tag for an element in the attribution chain. If the
144 // element has no tag, it is encoded as an empty string.
145 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700146}
147
Yao Chend54f9dd2017-10-17 17:37:48 +0000148/*
149 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800150 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000151 *
152 * RULES:
153 * - The field ids for each atom must start at 1, and count upwards by 1.
154 * Skipping field ids is not allowed.
155 * - These form an API, so renaming, renumbering or removing fields is
156 * not allowed between android releases. (This is not currently enforced,
157 * but there will be a tool to enforce this restriction).
158 * - The types must be built-in protocol buffer types, namely, no sub-messages
159 * are allowed (yet). The bytes type is also not allowed.
160 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800161 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000162 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800163 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000164 * - A field that is a uid should be a string field, tagged with the [xxx]
165 * annotation. The generated code on android will be represented by UIDs,
166 * and those UIDs will be translated in xxx to those strings.
167 *
168 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700169 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000170 * - If there is a UID, it goes first. Think in an object-oriented fashion.
171 * *****************************************************************************
172 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700173
Yao Chend54f9dd2017-10-17 17:37:48 +0000174/**
175 * Logs when the screen state changes.
176 *
177 * Logged from:
178 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
179 */
180message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800181 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
182 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700183}
Yao Chend54f9dd2017-10-17 17:37:48 +0000184
185/**
Bookatzc1a050a2017-10-10 15:49:28 -0700186 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000187 *
188 * Logged from:
189 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
190 */
Bookatzc1a050a2017-10-10 15:49:28 -0700191message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000192 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
193
Bookatzdb026a22018-01-10 19:01:56 -0800194 // The state, from frameworks/base/core/proto/android/app/enums.proto.
195 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000196}
197
198/**
Bookatzc1a050a2017-10-10 15:49:28 -0700199 * Logs that a process started, finished, crashed, or ANRed.
200 *
201 * Logged from:
202 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
203 */
204message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800205 // TODO: should be a string tagged w/ uid annotation
206 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700207
David Chen0b5c90c2018-01-25 16:51:49 -0800208 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700209 optional string name = 2;
210
Bookatzddccf0a2017-11-28 16:48:14 -0800211 // What lifecycle state the process changed to.
212 // This enum is specific to atoms.proto.
213 enum Event {
214 PROCESS_FINISHED = 0;
215 PROCESS_STARTED = 1;
216 PROCESS_CRASHED = 2;
217 PROCESS_ANRED = 3;
218 }
219 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700220}
221
Bookatzc1a050a2017-10-10 15:49:28 -0700222/**
223 * Logs when the ble scan state changes.
224 *
225 * Logged from:
226 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
227 */
228message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800229 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700230
231 enum State {
232 OFF = 0;
233 ON = 1;
234 }
235 optional State state = 2;
236}
237
238/**
239 * Logs when an unoptimized ble scan state changes.
240 *
241 * Logged from:
242 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
243 */
244// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
245message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800246 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700247
248 enum State {
249 OFF = 0;
250 ON = 1;
251 }
252 optional State state = 2;
253}
254
255/**
256 * Logs reporting of a ble scan finding results.
257 *
258 * Logged from:
259 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
260 */
261// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
262message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800263 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700264
265 // Number of ble scan results returned.
266 optional int32 num_of_results = 2;
267}
268
269/**
270 * Logs when a sensor state changes.
271 *
272 * Logged from:
273 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
274 */
275message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800276 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700277
278 // TODO: Is there a way to get the actual name of the sensor?
279 // The id (int) of the sensor.
280 optional int32 sensor_id = 2;
281
282 enum State {
283 OFF = 0;
284 ON = 1;
285 }
286 optional State state = 3;
287}
288
289
290/**
291 * Logs when GPS state changes.
292 *
293 * Logged from:
294 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
295 */
296message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800297 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700298
299 enum State {
300 OFF = 0;
301 ON = 1;
302 }
303 optional State state = 2;
304}
305
306
307/**
308 * Logs when a sync manager sync state changes.
309 *
310 * Logged from:
311 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
312 */
313message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800314 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700315
David Chen0b5c90c2018-01-25 16:51:49 -0800316 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700317 optional string name = 2;
318
319 enum State {
320 OFF = 0;
321 ON = 1;
322 }
323 optional State state = 3;
324}
325
326/**
327 * Logs when a job scheduler job state changes.
328 *
329 * Logged from:
330 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
331 */
332message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800333 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700334
335 // Name of the job (as named in the app)
336 optional string name = 2;
337
338 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800339 FINISHED = 0;
340 STARTED = 1;
341 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700342 }
343 optional State state = 3;
344
345 // TODO: Consider adding the stopReason (int)
346}
347
348/**
349 * Logs when the audio state changes.
350 *
351 * Logged from:
352 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
353 */
354message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800355 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700356
357 enum State {
358 OFF = 0;
359 ON = 1;
360 }
361 optional State state = 2;
362}
363
364/**
365 * Logs when the video codec state changes.
366 *
367 * Logged from:
368 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
369 */
370message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800371 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700372
373 enum State {
374 OFF = 0;
375 ON = 1;
376 }
377 optional State state = 2;
378}
379
380/**
381 * Logs when the flashlight state changes.
382 *
383 * Logged from:
384 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
385 */
386message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800387 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700388
389 enum State {
390 OFF = 0;
391 ON = 1;
392 }
393 optional State state = 2;
394}
395
396/**
397 * Logs when the camera state changes.
398 *
399 * Logged from:
400 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
401 */
402message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800403 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700404
405 enum State {
406 OFF = 0;
407 ON = 1;
408 }
409 optional State state = 2;
410}
411
412/**
413 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000414 *
415 * Logged from:
416 * TODO
417 */
Bookatzd6746242017-10-24 18:39:35 -0700418message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800419 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000420
Bookatz1a1b0462018-01-12 11:47:03 -0800421 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
422 // From frameworks/base/core/proto/android/os/enums.proto.
423 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700424
425 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
426 optional string tag = 3;
427
428 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800429 RELEASE = 0;
430 ACQUIRE = 1;
431 CHANGE_RELEASE = 2;
432 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700433 }
434 optional State state = 4;
435}
436
437/**
Bookatzc1a050a2017-10-10 15:49:28 -0700438 * Logs when a partial wakelock is considered 'long' (over 1 min).
439 *
440 * Logged from:
441 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
442 */
443message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800444 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700445
Yao Chend54f9dd2017-10-17 17:37:48 +0000446 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
447 optional string tag = 2;
448
Bookatzc1a050a2017-10-10 15:49:28 -0700449 // TODO: I have no idea what this is.
450 optional string history_tag = 3;
451
452 enum State {
453 OFF = 0;
454 ON = 1;
455 }
456 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000457}
458
Bookatzc1a050a2017-10-10 15:49:28 -0700459/**
460 * Logs Battery Saver state change.
461 *
462 * Logged from:
463 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
464 */
465message BatterySaverModeStateChanged {
466 enum State {
467 OFF = 0;
468 ON = 1;
469 }
470 optional State state = 1;
471}
472
473/**
474 * Logs Doze mode state change.
475 *
476 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800477 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700478 */
479message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800480 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800481}
482
483
484/**
485 * Logs state change of Doze mode including maintenance windows.
486 *
487 * Logged from:
488 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
489 */
490message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800491 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700492}
493
494/**
495 * Logs screen brightness level.
496 *
497 * Logged from:
498 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
499 */
500message ScreenBrightnessChanged {
501 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
502 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700503}
504
505/**
506 * Logs battery level (percent full, from 0 to 100).
507 *
508 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700509 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700510 */
511message BatteryLevelChanged {
512 // Battery level. Should be in [0, 100].
513 optional int32 battery_level = 1;
514}
515
516/**
517 * Logs change in charging status of the device.
518 *
519 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700520 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700521 */
522message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800523 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
524 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700525}
526
527/**
528 * Logs whether the device is plugged in, and what power source it is using.
529 *
530 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700531 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700532 */
533message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800534 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
535 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700536}
537
538/**
539 * Logs the temperature of the device, in tenths of a degree Celsius.
540 *
541 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700542 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700543 */
544message DeviceTemperatureReported {
545 // Temperature in tenths of a degree C.
546 optional int32 temperature = 1;
547}
548
549// TODO: Define this more precisely.
550// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
551/**
552 * Logs when the device turns off or on.
553 *
554 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700555 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700556 */
557message DeviceOnStatusChanged {
558 enum State {
559 OFF = 0;
560 ON = 1;
561 }
562 optional State state = 1;
563}
564
565/**
566 * Logs when an app's wakeup alarm fires.
567 *
568 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700569 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700570 */
571message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800572 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800573
574 // Name of the wakeup alarm.
575 optional string tag = 2;
576}
577
578/**
579 * Logs when an an app causes the mobile radio to change state.
580 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
581 *
582 * Logged from:
583 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
584 */
585message MobileRadioPowerStateChanged {
586 // TODO: Add attribution instead of uid?
587 optional int32 uid = 1;
588
Bookatz1a1b0462018-01-12 11:47:03 -0800589 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
590 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800591}
592
593/**
594 * Logs when an an app causes the wifi radio to change state.
595 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
596 *
597 * Logged from:
598 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
599 */
600message WifiRadioPowerStateChanged {
601 // TODO: Add attribution instead of uid?
602 optional int32 uid = 1;
603
Bookatz1a1b0462018-01-12 11:47:03 -0800604 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
605 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700606}
607
608/**
609 * Logs kernel wakeup reasons and aborts.
610 *
611 * Logged from:
612 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
613 */
614message KernelWakeupReported {
615 // Name of the kernel wakeup reason (or abort).
616 optional string wakeup_reason_name = 1;
617
618 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800619 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700620}
621
622/**
623 * Logs wifi locks held by an app.
624 *
625 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700626 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700627 */
628message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800629 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700630
631 enum State {
632 OFF = 0;
633 ON = 1;
634 }
635 optional State state = 2;
636}
637
638/**
639 * Logs wifi signal strength changes.
640 *
641 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700642 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700643 */
644message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800645 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
646 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700647}
648
649/**
650 * Logs wifi scans performed by an app.
651 *
652 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700653 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700654 */
655message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800656 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700657
658 enum State {
659 OFF = 0;
660 ON = 1;
661 }
662 optional State state = 2;
663}
664
665/**
Tej Singh4503e102018-01-04 14:35:01 -0800666 * Logs wifi multicast locks held by an app
667 *
668 * Logged from:
669 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
670 */
671message WifiMulticastLockStateChanged {
672 repeated AttributionNode attribution_node = 1;
673
674 enum State {
675 OFF = 0;
676 ON = 1;
677 }
678 optional State state = 2;
679}
680
681/**
Tej Singh1ea42892018-01-19 09:27:00 -0800682 * Logs shutdown reason and duration on next boot.
683 *
684 * Logged from:
685 * frameworks/base/core/java/com/android/server/BootReceiver.java
686 */
687message ShutdownSequenceReported {
688 // True if shutdown is for a reboot. Default: false if we do not know.
689 optional bool reboot = 1;
690
691 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
692 optional string reason = 2;
693
694 // Beginning of shutdown time in ms using wall clock time since unix epoch.
695 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800696 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800697
698 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800699 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800700}
701
Tej Singh6483ea42018-01-25 17:45:49 -0800702
703/**
704 * Logs boot reason and duration.
705 *
706 * Logged from:
707 * system/core/bootstat/bootstat.cpp
708 */
709message BootSequenceReported {
710 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
711 // Default: "<EMPTY>" if not available.
712 optional string bootloader_reason = 1;
713
714 // Reason for system boot. Eg. bootloader, reboot,userrequested
715 // Default: "<EMPTY>" if not available.
716 optional string system_reason = 2;
717
718 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800719 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800720
721 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800722 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800723
724 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800725 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800726
727 // Time since last boot in ms. Default: 0 if not available.
728 optional int64 time_since_last_boot = 6;
729}
730
Tej Singhc477d9c2018-02-05 18:31:39 -0800731
732/**
733 * Logs call state and disconnect cause (if applicable).
734 *
735 * Logged from:
736 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
737 */
738message CallStateChanged {
739 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
740 // From frameworks/base/core/proto/android/telecomm/enums.proto.
741 optional android.telecom.CallStateEnum call_state = 1;
742
743 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
744 // This value is only applicable when the call_state is DISCONNECTED, and
745 // should always be UNKNOWN if the call_state is not DISCONNECTED.
746 // From frameworks/base/core/proto/android/telecomm/enums.proto.
747 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
748
749 // True if the call is self-managed, which are apps that use the
750 // telecom infrastructure to make their own calls.
751 optional bool self_managed = 3;
752
753 // True if call is external. External calls are calls on connected Wear
754 // devices but show up in Telecom so the user can pull them onto the device.
755 optional bool external_call = 4;
756}
757
Tej Singh1ea42892018-01-19 09:27:00 -0800758/**
Tej Singhbb8554a2018-01-26 11:59:14 -0800759 * Logs the duration of a davey (jank of >=700ms) when it occurs
760 *
761 * Logged from:
762 * frameworks/base/libs/hwui/JankTracker.cpp
763 */
764message DaveyOccurred {
765 // Amount of time it took to render the frame. Should be >=700ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800766 optional int64 jank_duration_millis = 1;
Tej Singhbb8554a2018-01-26 11:59:14 -0800767}
768
769/**
Bookatze5885242017-10-24 20:10:31 -0700770 * Logs phone signal strength changes.
771 *
772 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700773 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700774 */
775message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800776 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
777 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700778}
779
780/**
781 * Logs that a setting was updated.
782 * Logged from:
783 * frameworks/base/core/java/android/provider/Settings.java
784 * The tag and is_default allow resetting of settings to default values based on the specified
785 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
786 */
787message SettingChanged {
788 // The name of the setting.
789 optional string setting = 1;
790
791 // The change being imposed on this setting. May represent a number, eg "3".
792 optional string value = 2;
793
794 // The new value of this setting. For most settings, this is same as value. For some settings,
795 // value is +X or -X where X represents an element in a set. For example, if the previous value
796 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
797 // The +/- feature is currently only used for location_providers_allowed.
798 optional string new_value = 3;
799
800 // The previous value of this setting.
801 optional string prev_value = 4;
802
803 // The tag used with the is_default for resetting sets of settings. This is generally null.
804 optional string tag = 5;
805
Bookatz90867622018-01-31 15:05:57 -0800806 // True if this setting with tag should be resettable.
807 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -0700808
809 // The user ID associated. Defined in android/os/UserHandle.java
810 optional int32 user = 7;
811}
Chenjie Yub3dda412017-10-24 13:41:59 -0700812
Chenjie Yu05013b32017-11-21 10:21:41 -0800813/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700814 * Logs activity going to foreground or background
815 *
816 * Logged from:
817 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
818 */
819message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800820 optional int32 uid = 1;
821 optional string pkg_name = 2;
822 optional string class_name = 3;
823
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700824 enum Activity {
825 MOVE_TO_BACKGROUND = 0;
826 MOVE_TO_FOREGROUND = 1;
827 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700828 optional Activity activity = 4;
829}
David Chenc8a43242017-10-17 16:23:28 -0700830
831/**
David Chen9e3808c2017-11-20 17:25:34 -0800832 * Logs when an error is written to dropbox.
833 * Logged from:
834 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
835 */
836message DropboxErrorChanged {
837 // The uid if available. -1 means not available.
838 optional int32 uid = 1;
839
840 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
841 optional string tag = 2;
842
843 // The name of the process.
844 optional string process_name = 3;
845
846 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800847 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800848
849 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800850 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800851
852 // The activity name if available.
853 optional string activity_name = 6;
854
David Chen6e3e6cb2018-01-03 16:14:06 -0800855 // The package name if available.
856 optional string package_name = 7;
857
David Chen9e3808c2017-11-20 17:25:34 -0800858 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800859 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800860}
861
David Chen0a368b22017-12-06 16:28:16 -0800862/*
863 * Allows other apps to push events into statsd.
864 * Logged from:
865 * frameworks/base/core/java/android/util/StatsLog.java
866 */
David Chen0b5c90c2018-01-25 16:51:49 -0800867message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -0800868 // The uid of the application that sent this custom atom.
869 optional int32 uid = 1;
870
871 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
872 optional int32 label = 2;
873
874 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
875 // predicates for the metrics).
876 enum State {
877 UNKNOWN = 0;
878 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
879 STOP = 2;
880 START = 3;
881 }
882 optional State state = 3;
883}
884
David Chen9e3808c2017-11-20 17:25:34 -0800885/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800886 * Logs when statsd detects an anomaly.
887 *
888 * Logged from:
889 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
890 */
891message AnomalyDetected {
892 // Uid that owns the config whose anomaly detection alert fired.
893 optional int32 config_uid = 1;
894
Yangster-mac94e197c2018-01-02 16:03:03 -0800895 // Id of the config whose anomaly detection alert fired.
896 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800897
Yangster-mac94e197c2018-01-02 16:03:03 -0800898 // Id of the alert (i.e. name of the anomaly that was detected).
899 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800900}
901
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000902message AppStartChanged {
903 // The uid if available. -1 means not available.
904 optional int32 uid = 1;
905
906 // The app package name.
907 optional string pkg_name = 2;
908
909 enum TransitionType {
910 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
911 WARM = 1;
912 HOT = 2;
913 COLD = 3;
914 }
915 // The transition type.
916 optional TransitionType type = 3;
917
918 // The activity name.
919 optional string activity_name = 4;
920
921 // The name of the calling app. Empty if not set.
922 optional string calling_pkg_name = 5;
923
924 // Whether the app is an instant app.
925 optional bool is_instant_app = 6;
926
927 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -0800928 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000929
Bookatz80d11a02018-01-16 10:46:35 -0800930 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000931
David Chen0b5c90c2018-01-25 16:51:49 -0800932 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000933 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800934 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000935 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800936 optional int32 bind_application_delay_millis = 11;
937 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000938
939 // Empty if not set.
940 optional string launch_token = 13;
941
942}
943
944message AppStartCancelChanged {
945 // The uid if available. -1 means not available.
946 optional int32 uid = 1;
947
948 // The app package name.
949 optional string pkg_name = 2;
950
951 enum TransitionType {
952 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
953 WARM = 1;
954 HOT = 2;
955 COLD = 3;
956 }
957 // The transition type.
958 optional TransitionType type = 3;
959
960 // The activity name.
961 optional string activity_name = 4;
962}
963
964message AppStartFullyDrawnChanged {
965 // The uid if available. -1 means not available.
966 optional int32 uid = 1;
967
968 // The app package name.
969 optional string pkg_name = 2;
970
971 enum TransitionType {
972 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
973 WITH_BUNDLE = 1;
974 WITHOUT_BUNDLE = 2;
975 }
976 // The transition type.
977 optional TransitionType type = 3;
978
979 // The activity name.
980 optional string activity_name = 4;
981
982 optional bool transition_process_running = 5;
983
984 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -0800985 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000986}
987
Bookatz8fcd09a2017-12-18 13:01:10 -0800988/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800989 * Logs a picture-in-picture action
990 * Logged from:
991 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
992 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
993 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
994 */
995message PictureInPictureStateChanged {
996 optional int32 uid = 1;
997
998 optional string package_name = 2;
999
1000 optional string class_name = 3;
1001
1002 // Picture-in-Picture action occurred, similar to
1003 // frameworks/base/proto/src/metrics_constants.proto
1004 enum State {
1005 ENTERED = 1;
1006 EXPANDED_TO_FULL_SCREEN = 2;
1007 MINIMIZED = 3;
1008 DISMISSED = 4;
1009 }
1010 optional State state = 4;
1011}
1012
1013/**
Chenjie Yue8904192017-12-08 19:12:57 -08001014 * Logs overlay action
1015 * Logged from:
1016 * services/core/java/com/android/server/wm/Session.java
1017 */
1018message OverlayStateChanged {
1019 optional int32 uid = 1;
1020
1021 optional string package_name = 2;
1022
1023 optional bool using_alert_window = 3;
1024
1025 enum State {
1026 ENTERED = 1;
1027 EXITED = 2;
1028 }
1029 optional State state = 4;
1030}
1031
Chenjie Yuccfe6452018-01-30 11:33:21 -08001032/*
1033 * Logs foreground service starts and stops.
1034 * Note that this is not when a service starts or stops, but when it is
1035 * considered foreground.
1036 * Logged from
1037 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1038 */
1039message ForegroundServiceStateChanged {
1040 optional int32 uid = 1;
1041 // package_name + "/" + class_name
1042 optional string short_name = 2;
1043
1044 enum State {
1045 ENTER = 1;
1046 EXIT = 2;
1047 }
1048 optional State state = 3;
1049}
1050
Chenjie Yue8904192017-12-08 19:12:57 -08001051/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001052 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1053 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1054 * attributed back to the parent (host) uid. One example is Chrome.
1055 *
1056 * Logged from:
1057 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1058 */
1059message IsolatedUidChanged {
1060 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1061 optional int32 parent_uid = 1;
1062
1063 optional int32 isolated_uid = 2;
1064
1065 // We expect an isolated uid to be removed before if it's used for another parent uid.
1066 enum Event {
1067 REMOVED = 0;
1068 CREATED = 1;
1069 }
1070 optional Event event = 3;
1071}
1072
1073/*
1074 * Logs the reception of an incoming network packet causing the main system to wake up for
1075 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1076 * and processed by WakeupController.cpp.
1077 */
1078message PacketWakeupOccurred {
1079 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1080 // delivered nowhere.
1081 optional int32 uid = 1;
1082 // The interface name on which the packet was received.
1083 optional string iface = 2;
1084 // The ethertype value of the packet.
1085 optional int32 ethertype = 3;
1086 // String representation of the destination MAC address of the packet.
1087 optional string destination_hardware_address = 4;
1088 // String representation of the source address of the packet if this was an IP packet.
1089 optional string source_ip = 5;
1090 // String representation of the destination address of the packet if this was an IP packet.
1091 optional string destination_ip = 6;
1092 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1093 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1094 // families.
1095 optional int32 ip_next_header = 7;
1096 // The source port if this was a TCP or UDP packet.
1097 optional int32 source_port = 8;
1098 // The destination port if this was a TCP or UDP packet.
1099 optional int32 destination_port = 9;
1100}
1101
1102/*
1103 * Logs the memory stats for an app on startup.
1104 * Logged from:
1105 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1106 */
1107message AppStartMemoryStateCaptured {
1108 // The uid if available. -1 means not available.
1109 optional int32 uid = 1;
1110
1111 // The process name.
1112 optional string process_name = 2;
1113
1114 // The activity name.
1115 optional string activity_name = 3;
1116
1117 // # of page-faults
1118 optional int64 pgfault = 4;
1119
1120 // # of major page-faults
1121 optional int64 pgmajfault = 5;
1122
1123 // RSS
1124 optional int64 rss_in_bytes = 6;
1125
1126 // CACHE
1127 optional int64 cache_in_bytes = 7;
1128
1129 // SWAP
1130 optional int64 swap_in_bytes = 8;
1131}
1132
1133/*
1134 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1135 * for LMK event.
1136 * Logged from:
1137 * system/core/lmkd/lmkd.c
1138 */
1139message LmkStateChanged {
1140 enum State {
1141 UNKNOWN = 0;
1142 START = 1;
1143 STOP = 2;
1144 }
1145 optional State state = 1;
1146}
1147
1148/*
1149 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1150 * Logged from:
1151 * system/core/lmkd/lmkd.c
1152 */
1153message LmkKillOccurred {
1154 // The uid if available. -1 means not available.
1155 optional int32 uid = 1;
1156
1157 // The process name.
1158 optional string process_name = 2;
1159
1160 // oom adj score.
1161 optional int32 oom_score = 3;
1162
1163 // # of page-faults
1164 optional int64 pgfault = 4;
1165
1166 // # of major page-faults
1167 optional int64 pgmajfault = 5;
1168
1169 // RSS
1170 optional int64 rss_in_bytes = 6;
1171
1172 // CACHE
1173 optional int64 cache_in_bytes = 7;
1174
1175 // SWAP
1176 optional int64 swap_in_bytes = 8;
1177}
1178
1179//////////////////////////////////////////////////////////////////////
1180// Pulled atoms below this line //
1181//////////////////////////////////////////////////////////////////////
1182
1183/**
David Chenc8a43242017-10-17 16:23:28 -07001184 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1185 *
1186 * Pulled from:
1187 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1188 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001189message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001190 optional int32 uid = 1;
1191
1192 optional int64 rx_bytes = 2;
1193
1194 optional int64 rx_packets = 3;
1195
1196 optional int64 tx_bytes = 4;
1197
1198 optional int64 tx_packets = 5;
1199}
1200
1201/**
1202 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1203 *
1204 * Pulled from:
1205 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1206 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001207message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001208 optional int32 uid = 1;
1209
1210 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1211 optional int32 is_foreground = 2;
1212
1213 optional int64 rx_bytes = 3;
1214
1215 optional int64 rx_packets = 4;
1216
1217 optional int64 tx_bytes = 5;
1218
1219 optional int64 tx_packets = 6;
1220}
1221
1222/**
1223 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1224 *
1225 * Pulled from:
1226 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1227 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001228message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001229 optional int32 uid = 1;
1230
1231 optional int64 rx_bytes = 2;
1232
1233 optional int64 rx_packets = 3;
1234
1235 optional int64 tx_bytes = 4;
1236
1237 optional int64 tx_packets = 5;
1238}
1239
1240/**
1241 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1242 *
1243 * Pulled from:
1244 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1245 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001246message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001247 optional int32 uid = 1;
1248
1249 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1250 optional int32 is_foreground = 2;
1251
1252 optional int64 rx_bytes = 3;
1253
1254 optional int64 rx_packets = 4;
1255
1256 optional int64 tx_bytes = 5;
1257
1258 optional int64 tx_packets = 6;
1259}
1260
1261/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001262 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1263 *
1264 * Pulled from:
1265 * StatsCompanionService
1266 */
1267message BluetoothBytesTransfer {
1268 optional int32 uid = 1;
1269
1270 optional int64 rx_bytes = 2;
1271
1272 optional int64 tx_bytes = 3;
1273}
1274
1275/**
David Chenc8a43242017-10-17 16:23:28 -07001276 * Pulls the kernel wakelock durations. This atom is adapted from
1277 * android/internal/os/KernelWakelockStats.java
1278 *
1279 * Pulled from:
1280 * StatsCompanionService using KernelWakelockReader.
1281 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001282message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001283 optional string name = 1;
1284
1285 optional int32 count = 2;
1286
1287 optional int32 version = 3;
1288
1289 optional int64 time = 4;
1290}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001291
Chenjie Yu05013b32017-11-21 10:21:41 -08001292/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001293 * Pulls low power state information. This includes platform and subsystem sleep state information,
1294 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001295 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001296 * hardware/interfaces/power/1.1/types.hal
1297 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001298message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001299 // Subsystem name
1300 optional string subsystem_name = 1;
1301 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1302 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1303 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001304 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001305 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001306 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001307 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001308}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001309
Chenjie Yu05013b32017-11-21 10:21:41 -08001310/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001311 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001312 * Pulls the time the cpu spend on the frequency index. Frequency index
1313 * starts from highest to lowest. The value should be monotonically
1314 * increasing since boot. However, if there is a cpu
1315 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001316 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001317message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001318 optional uint32 cluster = 1;
1319 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001320 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001321}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001322
Chenjie Yu05013b32017-11-21 10:21:41 -08001323/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001324 * Pulls Cpu Time Per Uid.
1325 * Note that isolated process uid time should be attributed to host uids.
1326 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001327message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001328 optional uint64 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001329 optional uint64 user_time_millis = 2;
1330 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001331}
1332
1333/**
1334 * Pulls Cpu Time Per Uid per frequency.
1335 * Note that isolated process uid time should be attributed to host uids.
1336 * For each uid, we order the time by descending frequencies.
1337 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001338message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001339 optional uint64 uid = 1;
1340 optional uint64 freq_idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001341 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001342}
Hugo Benichi884970e2017-11-14 22:42:46 +09001343
Chenjie Yu05013b32017-11-21 10:21:41 -08001344/**
1345 * Pulls Wifi Controller Activity Energy Info
1346 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001347message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001348 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001349 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001350 // stack reported state
1351 // TODO: replace this with proto enum
1352 optional int32 stack_state = 2;
1353 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001354 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001355 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001356 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001357 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001358 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001359 // product of current(mA), voltage(V) and time(ms)
1360 optional uint64 controller_energy_used = 6;
1361}
1362
1363/**
1364 * Pulls Modem Activity Energy Info
1365 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001366message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001367 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001368 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001369 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001370 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001371 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001372 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001373 /**
1374 * Tx power index
1375 * index 0 = tx_power < 0dBm
1376 * index 1 = 0dBm < tx_power < 5dBm
1377 * index 2 = 5dBm < tx_power < 15dBm
1378 * index 3 = 15dBm < tx_power < 20dBm
1379 * index 4 = tx_power > 20dBm
1380 */
1381 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001382 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001383 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001384 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001385 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001386 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001387 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001388 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001389 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001390 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001391 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001392 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001393 // product of current(mA), voltage(V) and time(ms)
1394 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001395}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001396
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001397/**
1398 * Pulls Bluetooth Activity Energy Info
1399 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1400 */
1401message BluetoothActivityInfo {
1402 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001403 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001404 // bluetooth stack state
1405 optional int32 bluetooth_stack_state = 2;
1406 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001407 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001408 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001409 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001410 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001411 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001412 // product of current(mA), voltage(V) and time(ms)
1413 optional uint64 energy_used = 6;
1414}
1415
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001416/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001417 * Logs the memory stats for a process.
1418 */
1419message ProcessMemoryState {
1420 // The uid if available. -1 means not available.
1421 optional int32 uid = 1;
1422
1423 // The process name.
1424 optional string process_name = 2;
1425
1426 // oom adj score.
1427 optional int32 oom_score = 3;
1428
1429 // # of page-faults
1430 optional int64 pgfault = 4;
1431
1432 // # of major page-faults
1433 optional int64 pgmajfault = 5;
1434
Rajeev Kumar90235992018-01-29 11:06:48 -08001435 // RSS
1436 optional int64 rss_in_bytes = 6;
1437
1438 // CACHE
1439 optional int64 cache_in_bytes = 7;
1440
1441 // SWAP
1442 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001443}
1444
1445/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001446 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001447 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001448message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001449 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001450}
1451
1452/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001453 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001454 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001455message SystemUptime {
1456 // Milliseconds since the system was booted.
1457 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1458 // for external input).
1459 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001460 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001461}
1462
1463/*
1464 * Reads from /proc/uid_concurrent_active_time which has the format:
1465 * active: X (X is # cores)
1466 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1467 * [uid1]: [time-0] [time-1] [time-2] ... ...
1468 * ...
1469 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1470 * The file contains a monotonically increasing count of time for a single boot.
1471 */
1472message CpuActiveTime {
1473 optional uint64 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001474 optional uint32 cluster_number =2;
1475 optional uint64 idx = 3;
1476 optional uint64 time_millis = 4;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001477}
1478
1479/**
1480 * Reads from /proc/uid_concurrent_policy_time which has the format:
1481 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1482 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1483 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1484 * ...
1485 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1486 * The file contains a monotonically increasing count of time for a single boot.
1487 */
1488message CpuClusterTime {
1489 optional uint64 uid = 1;
1490 optional uint64 idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001491 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001492}
1493
1494/*
1495 * Pulls free disk space, for data, system partition and temporary directory.
1496 */
1497message DiskSpace {
1498 // available bytes in data partition
1499 optional uint64 data_available_bytes = 1;
1500 // available bytes in system partition
1501 optional uint64 system_available_bytes = 2;
1502 // available bytes in download cache or temp directories
1503 optional uint64 temp_available_bytes = 3;
1504}
Tej Singhbf972d92018-01-10 20:51:13 -08001505
1506/**
1507 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
1508 * Logged from: frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
1509 */
1510message RemainingBatteryCapacity {
1511 optional int32 charge_uAh = 1;
1512}
1513
1514/**
1515 * Pulls battery capacity, which is the battery capacity when full in uAh.
1516 * Logged from: frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
1517 */
1518message FullBatteryCapacity {
1519 optional int32 capacity_uAh = 1;
1520}
Chenjie Yuccfe6452018-01-30 11:33:21 -08001521