blob: 02c6c14f95aae94b0152655921e404683b9f7f9b [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;
Bookatzc1a050a2017-10-10 15:49:28 -070098 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000099 }
David Chenc8a43242017-10-17 16:23:28 -0700100
David Chen6e3e6cb2018-01-03 16:14:06 -0800101 // Pulled events will start at field 10000.
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800102 // Next: 10019
David Chenc8a43242017-10-17 16:23:28 -0700103 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800104 WifiBytesTransfer wifi_bytes_transfer = 10000;
105 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
106 MobileBytesTransfer mobile_bytes_transfer = 10002;
107 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800108 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800109 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800110 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800111 CpuTimePerFreq cpu_time_per_freq = 10008;
112 CpuTimePerUid cpu_time_per_uid = 10009;
113 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
114 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
115 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800116 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800117 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800118 SystemElapsedRealtime system_elapsed_realtime = 10014;
119 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800120 CpuActiveTime cpu_active_time = 10016;
121 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800122 DiskSpace disk_space = 10018;
David Chenc8a43242017-10-17 16:23:28 -0700123 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700124}
125
Yao Chend54f9dd2017-10-17 17:37:48 +0000126/**
Yangster-mac20877162017-12-22 17:19:39 -0800127 * This proto represents a node of an attribution chain.
128 * Note: All attribution chains are represented as a repeated field of type
129 * AttributionNode. It is understood that in such arrays, the order is that
130 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000131 */
Yangster-mac20877162017-12-22 17:19:39 -0800132message AttributionNode {
133 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800134 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800135
Yangster-mac20877162017-12-22 17:19:39 -0800136 // The (optional) string tag for an element in the attribution chain. If the
137 // element has no tag, it is encoded as an empty string.
138 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700139}
140
Yao Chend54f9dd2017-10-17 17:37:48 +0000141/*
142 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800143 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000144 *
145 * RULES:
146 * - The field ids for each atom must start at 1, and count upwards by 1.
147 * Skipping field ids is not allowed.
148 * - These form an API, so renaming, renumbering or removing fields is
149 * not allowed between android releases. (This is not currently enforced,
150 * but there will be a tool to enforce this restriction).
151 * - The types must be built-in protocol buffer types, namely, no sub-messages
152 * are allowed (yet). The bytes type is also not allowed.
153 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800154 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000155 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800156 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000157 * - A field that is a uid should be a string field, tagged with the [xxx]
158 * annotation. The generated code on android will be represented by UIDs,
159 * and those UIDs will be translated in xxx to those strings.
160 *
161 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700162 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000163 * - If there is a UID, it goes first. Think in an object-oriented fashion.
164 * *****************************************************************************
165 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700166
Yao Chend54f9dd2017-10-17 17:37:48 +0000167/**
168 * Logs when the screen state changes.
169 *
170 * Logged from:
171 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
172 */
173message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800174 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
175 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700176}
Yao Chend54f9dd2017-10-17 17:37:48 +0000177
178/**
Bookatzc1a050a2017-10-10 15:49:28 -0700179 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 *
181 * Logged from:
182 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
183 */
Bookatzc1a050a2017-10-10 15:49:28 -0700184message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000185 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
186
Bookatzdb026a22018-01-10 19:01:56 -0800187 // The state, from frameworks/base/core/proto/android/app/enums.proto.
188 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000189}
190
191/**
Bookatzc1a050a2017-10-10 15:49:28 -0700192 * Logs that a process started, finished, crashed, or ANRed.
193 *
194 * Logged from:
195 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
196 */
197message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700198 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
199
200 // TODO: What is this?
201 optional string name = 2;
202
Bookatzddccf0a2017-11-28 16:48:14 -0800203 // What lifecycle state the process changed to.
204 // This enum is specific to atoms.proto.
205 enum Event {
206 PROCESS_FINISHED = 0;
207 PROCESS_STARTED = 1;
208 PROCESS_CRASHED = 2;
209 PROCESS_ANRED = 3;
210 }
211 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700212}
213
Bookatzc1a050a2017-10-10 15:49:28 -0700214/**
215 * Logs when the ble scan state changes.
216 *
217 * Logged from:
218 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
219 */
220message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800221 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700222
223 enum State {
224 OFF = 0;
225 ON = 1;
226 }
227 optional State state = 2;
228}
229
230/**
231 * Logs when an unoptimized ble scan state changes.
232 *
233 * Logged from:
234 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
235 */
236// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
237message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800238 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700239
240 enum State {
241 OFF = 0;
242 ON = 1;
243 }
244 optional State state = 2;
245}
246
247/**
248 * Logs reporting of a ble scan finding results.
249 *
250 * Logged from:
251 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
252 */
253// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
254message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800255 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700256
257 // Number of ble scan results returned.
258 optional int32 num_of_results = 2;
259}
260
261/**
262 * Logs when a sensor state changes.
263 *
264 * Logged from:
265 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
266 */
267message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800268 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700269
270 // TODO: Is there a way to get the actual name of the sensor?
271 // The id (int) of the sensor.
272 optional int32 sensor_id = 2;
273
274 enum State {
275 OFF = 0;
276 ON = 1;
277 }
278 optional State state = 3;
279}
280
281
282/**
283 * Logs when GPS state changes.
284 *
285 * Logged from:
286 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
287 */
288message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800289 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700290
291 enum State {
292 OFF = 0;
293 ON = 1;
294 }
295 optional State state = 2;
296}
297
298
299/**
300 * Logs when a sync manager sync state changes.
301 *
302 * Logged from:
303 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
304 */
305message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800306 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700307
308 // Name of the sync (as named in the app)
309 optional string name = 2;
310
311 enum State {
312 OFF = 0;
313 ON = 1;
314 }
315 optional State state = 3;
316}
317
318/**
319 * Logs when a job scheduler job state changes.
320 *
321 * Logged from:
322 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
323 */
324message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800325 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700326
327 // Name of the job (as named in the app)
328 optional string name = 2;
329
330 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800331 FINISHED = 0;
332 STARTED = 1;
333 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700334 }
335 optional State state = 3;
336
337 // TODO: Consider adding the stopReason (int)
338}
339
340/**
341 * Logs when the audio state changes.
342 *
343 * Logged from:
344 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
345 */
346message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800347 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700348
349 enum State {
350 OFF = 0;
351 ON = 1;
352 }
353 optional State state = 2;
354}
355
356/**
357 * Logs when the video codec state changes.
358 *
359 * Logged from:
360 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
361 */
362message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800363 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700364
365 enum State {
366 OFF = 0;
367 ON = 1;
368 }
369 optional State state = 2;
370}
371
372/**
373 * Logs when the flashlight state changes.
374 *
375 * Logged from:
376 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
377 */
378message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800379 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700380
381 enum State {
382 OFF = 0;
383 ON = 1;
384 }
385 optional State state = 2;
386}
387
388/**
389 * Logs when the camera state changes.
390 *
391 * Logged from:
392 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
393 */
394message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800395 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700396
397 enum State {
398 OFF = 0;
399 ON = 1;
400 }
401 optional State state = 2;
402}
403
404/**
405 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000406 *
407 * Logged from:
408 * TODO
409 */
Bookatzd6746242017-10-24 18:39:35 -0700410message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800411 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000412
Bookatz1a1b0462018-01-12 11:47:03 -0800413 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
414 // From frameworks/base/core/proto/android/os/enums.proto.
415 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700416
417 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
418 optional string tag = 3;
419
420 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800421 RELEASE = 0;
422 ACQUIRE = 1;
423 CHANGE_RELEASE = 2;
424 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700425 }
426 optional State state = 4;
427}
428
429/**
Bookatzc1a050a2017-10-10 15:49:28 -0700430 * Logs when a partial wakelock is considered 'long' (over 1 min).
431 *
432 * Logged from:
433 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
434 */
435message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800436 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700437
Yao Chend54f9dd2017-10-17 17:37:48 +0000438 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
439 optional string tag = 2;
440
Bookatzc1a050a2017-10-10 15:49:28 -0700441 // TODO: I have no idea what this is.
442 optional string history_tag = 3;
443
444 enum State {
445 OFF = 0;
446 ON = 1;
447 }
448 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000449}
450
Bookatzc1a050a2017-10-10 15:49:28 -0700451/**
452 * Logs Battery Saver state change.
453 *
454 * Logged from:
455 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
456 */
457message BatterySaverModeStateChanged {
458 enum State {
459 OFF = 0;
460 ON = 1;
461 }
462 optional State state = 1;
463}
464
465/**
466 * Logs Doze mode state change.
467 *
468 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800469 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700470 */
471message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800472 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800473}
474
475
476/**
477 * Logs state change of Doze mode including maintenance windows.
478 *
479 * Logged from:
480 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
481 */
482message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800483 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700484}
485
486/**
487 * Logs screen brightness level.
488 *
489 * Logged from:
490 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
491 */
492message ScreenBrightnessChanged {
493 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
494 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700495}
496
497/**
498 * Logs battery level (percent full, from 0 to 100).
499 *
500 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700501 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700502 */
503message BatteryLevelChanged {
504 // Battery level. Should be in [0, 100].
505 optional int32 battery_level = 1;
506}
507
508/**
509 * Logs change in charging status of the device.
510 *
511 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700512 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700513 */
514message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800515 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
516 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700517}
518
519/**
520 * Logs whether the device is plugged in, and what power source it is using.
521 *
522 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700523 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700524 */
525message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800526 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
527 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700528}
529
530/**
531 * Logs the temperature of the device, in tenths of a degree Celsius.
532 *
533 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700534 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700535 */
536message DeviceTemperatureReported {
537 // Temperature in tenths of a degree C.
538 optional int32 temperature = 1;
539}
540
541// TODO: Define this more precisely.
542// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
543/**
544 * Logs when the device turns off or on.
545 *
546 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700547 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700548 */
549message DeviceOnStatusChanged {
550 enum State {
551 OFF = 0;
552 ON = 1;
553 }
554 optional State state = 1;
555}
556
557/**
558 * Logs when an app's wakeup alarm fires.
559 *
560 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700561 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700562 */
563message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800564 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800565
566 // Name of the wakeup alarm.
567 optional string tag = 2;
568}
569
570/**
571 * Logs when an an app causes the mobile radio to change state.
572 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
573 *
574 * Logged from:
575 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
576 */
577message MobileRadioPowerStateChanged {
578 // TODO: Add attribution instead of uid?
579 optional int32 uid = 1;
580
Bookatz1a1b0462018-01-12 11:47:03 -0800581 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
582 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800583}
584
585/**
586 * Logs when an an app causes the wifi radio to change state.
587 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
588 *
589 * Logged from:
590 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
591 */
592message WifiRadioPowerStateChanged {
593 // TODO: Add attribution instead of uid?
594 optional int32 uid = 1;
595
Bookatz1a1b0462018-01-12 11:47:03 -0800596 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
597 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700598}
599
600/**
601 * Logs kernel wakeup reasons and aborts.
602 *
603 * Logged from:
604 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
605 */
606message KernelWakeupReported {
607 // Name of the kernel wakeup reason (or abort).
608 optional string wakeup_reason_name = 1;
609
610 // Duration (in microseconds) for the wake-up interrupt to be serviced.
611 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700612}
613
614/**
615 * Logs wifi locks held by an app.
616 *
617 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700618 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700619 */
620message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800621 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700622
623 enum State {
624 OFF = 0;
625 ON = 1;
626 }
627 optional State state = 2;
628}
629
630/**
631 * Logs wifi signal strength changes.
632 *
633 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700634 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700635 */
636message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800637 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
638 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700639}
640
641/**
642 * Logs wifi scans performed by an app.
643 *
644 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700645 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700646 */
647message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800648 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700649
650 enum State {
651 OFF = 0;
652 ON = 1;
653 }
654 optional State state = 2;
655}
656
657/**
Tej Singh4503e102018-01-04 14:35:01 -0800658 * Logs wifi multicast locks held by an app
659 *
660 * Logged from:
661 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
662 */
663message WifiMulticastLockStateChanged {
664 repeated AttributionNode attribution_node = 1;
665
666 enum State {
667 OFF = 0;
668 ON = 1;
669 }
670 optional State state = 2;
671}
672
673/**
Tej Singh1ea42892018-01-19 09:27:00 -0800674 * Logs shutdown reason and duration on next boot.
675 *
676 * Logged from:
677 * frameworks/base/core/java/com/android/server/BootReceiver.java
678 */
679message ShutdownSequenceReported {
680 // True if shutdown is for a reboot. Default: false if we do not know.
681 optional bool reboot = 1;
682
683 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
684 optional string reason = 2;
685
686 // Beginning of shutdown time in ms using wall clock time since unix epoch.
687 // Default: 0 if no start time received.
688 optional int64 start_time_ms = 3;
689
690 // Duration of shutdown in ms. Default: 0 if no duration received.
691 optional int64 duration_ms = 4;
692}
693
Tej Singh6483ea42018-01-25 17:45:49 -0800694
695/**
696 * Logs boot reason and duration.
697 *
698 * Logged from:
699 * system/core/bootstat/bootstat.cpp
700 */
701message BootSequenceReported {
702 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
703 // Default: "<EMPTY>" if not available.
704 optional string bootloader_reason = 1;
705
706 // Reason for system boot. Eg. bootloader, reboot,userrequested
707 // Default: "<EMPTY>" if not available.
708 optional string system_reason = 2;
709
710 // End of boot time in ms from unix epoch using system wall clock.
711 optional int64 end_time_ms = 3;
712
713 // Total boot duration in ms.
714 optional int64 total_duration_ms = 4;
715
716 // Bootloader duration in ms.
717 optional int64 bootloader_duration_ms = 5;
718
719 // Time since last boot in ms. Default: 0 if not available.
720 optional int64 time_since_last_boot = 6;
721}
722
Tej Singh1ea42892018-01-19 09:27:00 -0800723/**
Bookatze5885242017-10-24 20:10:31 -0700724 * Logs phone signal strength changes.
725 *
726 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700727 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700728 */
729message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800730 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
731 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700732}
733
734/**
735 * Logs that a setting was updated.
736 * Logged from:
737 * frameworks/base/core/java/android/provider/Settings.java
738 * The tag and is_default allow resetting of settings to default values based on the specified
739 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
740 */
741message SettingChanged {
742 // The name of the setting.
743 optional string setting = 1;
744
745 // The change being imposed on this setting. May represent a number, eg "3".
746 optional string value = 2;
747
748 // The new value of this setting. For most settings, this is same as value. For some settings,
749 // value is +X or -X where X represents an element in a set. For example, if the previous value
750 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
751 // The +/- feature is currently only used for location_providers_allowed.
752 optional string new_value = 3;
753
754 // The previous value of this setting.
755 optional string prev_value = 4;
756
757 // The tag used with the is_default for resetting sets of settings. This is generally null.
758 optional string tag = 5;
759
Bookatz90867622018-01-31 15:05:57 -0800760 // True if this setting with tag should be resettable.
761 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -0700762
763 // The user ID associated. Defined in android/os/UserHandle.java
764 optional int32 user = 7;
765}
Chenjie Yub3dda412017-10-24 13:41:59 -0700766
Chenjie Yu05013b32017-11-21 10:21:41 -0800767/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700768 * Logs activity going to foreground or background
769 *
770 * Logged from:
771 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
772 */
773message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800774 optional int32 uid = 1;
775 optional string pkg_name = 2;
776 optional string class_name = 3;
777
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700778 enum Activity {
779 MOVE_TO_BACKGROUND = 0;
780 MOVE_TO_FOREGROUND = 1;
781 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700782 optional Activity activity = 4;
783}
David Chenc8a43242017-10-17 16:23:28 -0700784
785/**
David Chen9e3808c2017-11-20 17:25:34 -0800786 * Logs when an error is written to dropbox.
787 * Logged from:
788 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
789 */
790message DropboxErrorChanged {
791 // The uid if available. -1 means not available.
792 optional int32 uid = 1;
793
794 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
795 optional string tag = 2;
796
797 // The name of the process.
798 optional string process_name = 3;
799
800 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800801 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800802
803 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800804 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800805
806 // The activity name if available.
807 optional string activity_name = 6;
808
David Chen6e3e6cb2018-01-03 16:14:06 -0800809 // The package name if available.
810 optional string package_name = 7;
811
David Chen9e3808c2017-11-20 17:25:34 -0800812 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800813 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800814}
815
David Chen0a368b22017-12-06 16:28:16 -0800816/*
817 * Allows other apps to push events into statsd.
818 * Logged from:
819 * frameworks/base/core/java/android/util/StatsLog.java
820 */
821message AppHook {
822 // The uid of the application that sent this custom atom.
823 optional int32 uid = 1;
824
825 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
826 optional int32 label = 2;
827
828 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
829 // predicates for the metrics).
830 enum State {
831 UNKNOWN = 0;
832 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
833 STOP = 2;
834 START = 3;
835 }
836 optional State state = 3;
837}
838
David Chen9e3808c2017-11-20 17:25:34 -0800839/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800840 * Logs when statsd detects an anomaly.
841 *
842 * Logged from:
843 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
844 */
845message AnomalyDetected {
846 // Uid that owns the config whose anomaly detection alert fired.
847 optional int32 config_uid = 1;
848
Yangster-mac94e197c2018-01-02 16:03:03 -0800849 // Id of the config whose anomaly detection alert fired.
850 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800851
Yangster-mac94e197c2018-01-02 16:03:03 -0800852 // Id of the alert (i.e. name of the anomaly that was detected).
853 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800854}
855
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000856message AppStartChanged {
857 // The uid if available. -1 means not available.
858 optional int32 uid = 1;
859
860 // The app package name.
861 optional string pkg_name = 2;
862
863 enum TransitionType {
864 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
865 WARM = 1;
866 HOT = 2;
867 COLD = 3;
868 }
869 // The transition type.
870 optional TransitionType type = 3;
871
872 // The activity name.
873 optional string activity_name = 4;
874
875 // The name of the calling app. Empty if not set.
876 optional string calling_pkg_name = 5;
877
878 // Whether the app is an instant app.
879 optional bool is_instant_app = 6;
880
881 // Device uptime when activity started.
882 optional int64 activity_start_msec = 7;
883
Bookatz80d11a02018-01-16 10:46:35 -0800884 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000885
886 optional int32 transition_delay_msec = 9;
887 // -1 if not set.
888 optional int32 starting_window_delay_msec = 10;
889 // -1 if not set.
890 optional int32 bind_application_delay_msec = 11;
891 optional int32 windows_drawn_delay_msec = 12;
892
893 // Empty if not set.
894 optional string launch_token = 13;
895
896}
897
898message AppStartCancelChanged {
899 // The uid if available. -1 means not available.
900 optional int32 uid = 1;
901
902 // The app package name.
903 optional string pkg_name = 2;
904
905 enum TransitionType {
906 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
907 WARM = 1;
908 HOT = 2;
909 COLD = 3;
910 }
911 // The transition type.
912 optional TransitionType type = 3;
913
914 // The activity name.
915 optional string activity_name = 4;
916}
917
918message AppStartFullyDrawnChanged {
919 // The uid if available. -1 means not available.
920 optional int32 uid = 1;
921
922 // The app package name.
923 optional string pkg_name = 2;
924
925 enum TransitionType {
926 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
927 WITH_BUNDLE = 1;
928 WITHOUT_BUNDLE = 2;
929 }
930 // The transition type.
931 optional TransitionType type = 3;
932
933 // The activity name.
934 optional string activity_name = 4;
935
936 optional bool transition_process_running = 5;
937
938 // App startup time (until call to Activity#reportFullyDrawn()).
939 optional int64 app_startup_time_ms = 6;
940}
941
Bookatz8fcd09a2017-12-18 13:01:10 -0800942/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800943 * Logs a picture-in-picture action
944 * Logged from:
945 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
946 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
947 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
948 */
949message PictureInPictureStateChanged {
950 optional int32 uid = 1;
951
952 optional string package_name = 2;
953
954 optional string class_name = 3;
955
956 // Picture-in-Picture action occurred, similar to
957 // frameworks/base/proto/src/metrics_constants.proto
958 enum State {
959 ENTERED = 1;
960 EXPANDED_TO_FULL_SCREEN = 2;
961 MINIMIZED = 3;
962 DISMISSED = 4;
963 }
964 optional State state = 4;
965}
966
967/**
David Chenc8a43242017-10-17 16:23:28 -0700968 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
969 *
970 * Pulled from:
971 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
972 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800973message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700974 optional int32 uid = 1;
975
976 optional int64 rx_bytes = 2;
977
978 optional int64 rx_packets = 3;
979
980 optional int64 tx_bytes = 4;
981
982 optional int64 tx_packets = 5;
983}
984
985/**
986 * Pulls bytes transferred via wifi (separated by foreground and background usage).
987 *
988 * Pulled from:
989 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
990 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800991message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700992 optional int32 uid = 1;
993
994 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
995 optional int32 is_foreground = 2;
996
997 optional int64 rx_bytes = 3;
998
999 optional int64 rx_packets = 4;
1000
1001 optional int64 tx_bytes = 5;
1002
1003 optional int64 tx_packets = 6;
1004}
1005
1006/**
1007 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1008 *
1009 * Pulled from:
1010 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1011 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001012message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001013 optional int32 uid = 1;
1014
1015 optional int64 rx_bytes = 2;
1016
1017 optional int64 rx_packets = 3;
1018
1019 optional int64 tx_bytes = 4;
1020
1021 optional int64 tx_packets = 5;
1022}
1023
1024/**
1025 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1026 *
1027 * Pulled from:
1028 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1029 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001030message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001031 optional int32 uid = 1;
1032
1033 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1034 optional int32 is_foreground = 2;
1035
1036 optional int64 rx_bytes = 3;
1037
1038 optional int64 rx_packets = 4;
1039
1040 optional int64 tx_bytes = 5;
1041
1042 optional int64 tx_packets = 6;
1043}
1044
1045/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001046 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1047 *
1048 * Pulled from:
1049 * StatsCompanionService
1050 */
1051message BluetoothBytesTransfer {
1052 optional int32 uid = 1;
1053
1054 optional int64 rx_bytes = 2;
1055
1056 optional int64 tx_bytes = 3;
1057}
1058
1059/**
David Chenc8a43242017-10-17 16:23:28 -07001060 * Pulls the kernel wakelock durations. This atom is adapted from
1061 * android/internal/os/KernelWakelockStats.java
1062 *
1063 * Pulled from:
1064 * StatsCompanionService using KernelWakelockReader.
1065 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001066message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001067 optional string name = 1;
1068
1069 optional int32 count = 2;
1070
1071 optional int32 version = 3;
1072
1073 optional int64 time = 4;
1074}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001075
Chenjie Yu05013b32017-11-21 10:21:41 -08001076/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001077 * Pulls low power state information. This includes platform and subsystem sleep state information,
1078 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001079 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001080 * hardware/interfaces/power/1.1/types.hal
1081 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001082message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001083 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1084 // YYY is corresponding voter name.
1085 // If there are no voters, the format should just be XXX (with no dot).
1086 // XXX and YYY should not contain a "." in it.
1087 optional string name = 1;
1088 // The number of times it entered, or voted for entering the sleep state
1089 optional uint64 count = 2;
1090 // The length of time spent in, or spent voting for, the sleep state
1091 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001092}
David Chen21582962017-11-01 17:32:46 -07001093
1094/**
1095 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1096 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1097 * attributed back to the parent (host) uid. One example is Chrome.
1098 *
1099 * Logged from:
1100 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1101 */
1102message IsolatedUidChanged {
1103 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1104 optional int32 parent_uid = 1;
1105
1106 optional int32 isolated_uid = 2;
1107
Bookatz90867622018-01-31 15:05:57 -08001108 // We expect an isolated uid to be removed before if it's used for another parent uid.
1109 enum Event {
1110 REMOVED = 0;
1111 CREATED = 1;
1112 }
1113 optional Event event = 3;
David Chen21582962017-11-01 17:32:46 -07001114}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001115
Chenjie Yu05013b32017-11-21 10:21:41 -08001116/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001117 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001118 * Pulls the time the cpu spend on the frequency index. Frequency index
1119 * starts from highest to lowest. The value should be monotonically
1120 * increasing since boot. However, if there is a cpu
1121 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001122 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001123message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001124 optional uint32 cluster = 1;
1125 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001126 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001127}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001128
Chenjie Yu05013b32017-11-21 10:21:41 -08001129/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001130 * Pulls Cpu Time Per Uid.
1131 * Note that isolated process uid time should be attributed to host uids.
1132 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001133message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001134 optional uint64 uid = 1;
1135 optional uint64 user_time_ms = 2;
1136 optional uint64 sys_time_ms = 3;
1137}
1138
1139/**
1140 * Pulls Cpu Time Per Uid per frequency.
1141 * Note that isolated process uid time should be attributed to host uids.
1142 * For each uid, we order the time by descending frequencies.
1143 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001144message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001145 optional uint64 uid = 1;
1146 optional uint64 freq_idx = 2;
1147 optional uint64 time_ms = 3;
1148}
Hugo Benichi884970e2017-11-14 22:42:46 +09001149
1150/*
1151 * Logs the reception of an incoming network packet causing the main system to wake up for
1152 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1153 * and processed by WakeupController.cpp.
1154 */
1155message PacketWakeupOccurred {
1156 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1157 // delivered nowhere.
1158 optional int32 uid = 1;
1159 // The interface name on which the packet was received.
1160 optional string iface = 2;
1161 // The ethertype value of the packet.
1162 optional int32 ethertype = 3;
1163 // String representation of the destination MAC address of the packet.
1164 optional string destination_hardware_address = 4;
1165 // String representation of the source address of the packet if this was an IP packet.
1166 optional string source_ip = 5;
1167 // String representation of the destination address of the packet if this was an IP packet.
1168 optional string destination_ip = 6;
1169 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1170 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1171 // families.
1172 optional int32 ip_next_header = 7;
1173 // The source port if this was a TCP or UDP packet.
1174 optional int32 source_port = 8;
1175 // The destination port if this was a TCP or UDP packet.
1176 optional int32 destination_port = 9;
1177}
Chenjie Yu05013b32017-11-21 10:21:41 -08001178
1179/**
1180 * Pulls Wifi Controller Activity Energy Info
1181 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001182message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001183 // timestamp(wall clock) of record creation
1184 optional uint64 timestamp_ms = 1;
1185 // stack reported state
1186 // TODO: replace this with proto enum
1187 optional int32 stack_state = 2;
1188 // tx time in ms
1189 optional uint64 controller_tx_time_ms = 3;
1190 // rx time in ms
1191 optional uint64 controller_rx_time_ms = 4;
1192 // idle time in ms
1193 optional uint64 controller_idle_time_ms = 5;
1194 // product of current(mA), voltage(V) and time(ms)
1195 optional uint64 controller_energy_used = 6;
1196}
1197
1198/**
1199 * Pulls Modem Activity Energy Info
1200 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001201message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001202 // timestamp(wall clock) of record creation
1203 optional uint64 timestamp_ms = 1;
1204 // sleep time in ms.
1205 optional uint64 sleep_time_ms = 2;
1206 // idle time in ms
1207 optional uint64 controller_idle_time_ms = 3;
1208 /**
1209 * Tx power index
1210 * index 0 = tx_power < 0dBm
1211 * index 1 = 0dBm < tx_power < 5dBm
1212 * index 2 = 5dBm < tx_power < 15dBm
1213 * index 3 = 15dBm < tx_power < 20dBm
1214 * index 4 = tx_power > 20dBm
1215 */
1216 // tx time in ms at power level 0
1217 optional uint64 controller_tx_time_pl0_ms = 4;
1218 // tx time in ms at power level 1
1219 optional uint64 controller_tx_time_pl1_ms = 5;
1220 // tx time in ms at power level 2
1221 optional uint64 controller_tx_time_pl2_ms = 6;
1222 // tx time in ms at power level 3
1223 optional uint64 controller_tx_time_pl3_ms = 7;
1224 // tx time in ms at power level 4
1225 optional uint64 controller_tx_time_pl4_ms = 8;
1226 // rx time in ms at power level 5
1227 optional uint64 controller_rx_time_ms = 9;
1228 // product of current(mA), voltage(V) and time(ms)
1229 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001230}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001231
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001232/**
1233 * Pulls Bluetooth Activity Energy Info
1234 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1235 */
1236message BluetoothActivityInfo {
1237 // timestamp(wall clock) of record creation
1238 optional uint64 timestamp_ms = 1;
1239 // bluetooth stack state
1240 optional int32 bluetooth_stack_state = 2;
1241 // tx time in ms
1242 optional uint64 controller_tx_time_ms = 3;
1243 // rx time in ms
1244 optional uint64 controller_rx_time_ms = 4;
1245 // idle time in ms
1246 optional uint64 controller_idle_time_ms = 5;
1247 // product of current(mA), voltage(V) and time(ms)
1248 optional uint64 energy_used = 6;
1249}
1250
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001251/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001252 * Logs the memory stats for an app on startup.
1253 * Logged from:
1254 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001255 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001256message AppStartMemoryStateCaptured {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001257 // The uid if available. -1 means not available.
1258 optional int32 uid = 1;
1259
Rajeev Kumar27572b92018-01-23 16:12:51 -08001260 // The process name.
1261 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001262
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001263 // The activity name.
1264 optional string activity_name = 3;
1265
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001266 // # of page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001267 optional int64 pgfault = 4;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001268
1269 // # of major page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001270 optional int64 pgmajfault = 5;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001271
Rajeev Kumar90235992018-01-29 11:06:48 -08001272 // RSS
1273 optional int64 rss_in_bytes = 6;
1274
1275 // CACHE
1276 optional int64 cache_in_bytes = 7;
1277
1278 // SWAP
1279 optional int64 swap_in_bytes = 8;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001280}
1281
1282/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001283 * Logs the memory stats for a process.
1284 */
1285message ProcessMemoryState {
1286 // The uid if available. -1 means not available.
1287 optional int32 uid = 1;
1288
1289 // The process name.
1290 optional string process_name = 2;
1291
1292 // oom adj score.
1293 optional int32 oom_score = 3;
1294
1295 // # of page-faults
1296 optional int64 pgfault = 4;
1297
1298 // # of major page-faults
1299 optional int64 pgmajfault = 5;
1300
Rajeev Kumar90235992018-01-29 11:06:48 -08001301 // RSS
1302 optional int64 rss_in_bytes = 6;
1303
1304 // CACHE
1305 optional int64 cache_in_bytes = 7;
1306
1307 // SWAP
1308 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001309}
1310
1311/*
1312 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1313 * for LMK event.
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001314 * Logged from:
1315 * system/core/lmkd/lmkd.c
1316 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001317message LmkStateChanged {
1318 enum State {
1319 UNKNOWN = 0;
1320 START = 1;
1321 STOP = 2;
1322 }
1323 optional State state = 1;
1324}
1325
1326/*
1327 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1328 * Logged from:
1329 * system/core/lmkd/lmkd.c
1330 */
1331message LmkKillOccurred {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001332 // The uid if available. -1 means not available.
1333 optional int32 uid = 1;
1334
Rajeev Kumar27572b92018-01-23 16:12:51 -08001335 // The process name.
1336 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001337
1338 // oom adj score.
1339 optional int32 oom_score = 3;
1340
Rajeev Kumar27572b92018-01-23 16:12:51 -08001341 // # of page-faults
1342 optional int64 pgfault = 4;
1343
1344 // # of major page-faults
1345 optional int64 pgmajfault = 5;
1346
Rajeev Kumar90235992018-01-29 11:06:48 -08001347 // RSS
1348 optional int64 rss_in_bytes = 6;
1349
1350 // CACHE
1351 optional int64 cache_in_bytes = 7;
1352
1353 // SWAP
1354 optional int64 swap_in_bytes = 8;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001355}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001356
1357/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001358 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001359 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001360message SystemElapsedRealtime {
1361 optional uint64 time_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001362}
1363
1364/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001365 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001366 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001367message SystemUptime {
1368 // Milliseconds since the system was booted.
1369 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1370 // for external input).
1371 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1372 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001373}
1374
1375/*
1376 * Reads from /proc/uid_concurrent_active_time which has the format:
1377 * active: X (X is # cores)
1378 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1379 * [uid1]: [time-0] [time-1] [time-2] ... ...
1380 * ...
1381 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1382 * The file contains a monotonically increasing count of time for a single boot.
1383 */
1384message CpuActiveTime {
1385 optional uint64 uid = 1;
1386 optional uint64 idx = 2;
1387 optional uint64 time_ms = 3;
1388}
1389
1390/**
1391 * Reads from /proc/uid_concurrent_policy_time which has the format:
1392 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1393 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1394 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1395 * ...
1396 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1397 * The file contains a monotonically increasing count of time for a single boot.
1398 */
1399message CpuClusterTime {
1400 optional uint64 uid = 1;
1401 optional uint64 idx = 2;
1402 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001403}
1404
1405/*
1406 * Pulls free disk space, for data, system partition and temporary directory.
1407 */
1408message DiskSpace {
1409 // available bytes in data partition
1410 optional uint64 data_available_bytes = 1;
1411 // available bytes in system partition
1412 optional uint64 system_available_bytes = 2;
1413 // available bytes in download cache or temp directories
1414 optional uint64 temp_available_bytes = 3;
1415}