blob: b8ff0bddcefa0b2c719dc3ddda7bbf612507549e [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";
26import "frameworks/base/core/proto/android/telephony/enums.proto";
27import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080028
Yao Chend54f9dd2017-10-17 17:37:48 +000029/**
Stefan Lafonae2df012017-11-14 09:17:21 -080030 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000031 * raw stats log events from the Android system, also known as "atoms."
32 *
33 * This field contains a single oneof with all of the available messages.
34 * The stats-log-api-gen tool runs as part of the Android build and
35 * generates the android.util.StatsLog class, which contains the constants
36 * and methods that Android uses to log.
37 *
Stefan Lafonae2df012017-11-14 09:17:21 -080038 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000039 * Instead, statsd on Android constructs these messages synthetically,
40 * in the format defined here and in stats_log.proto.
41 */
Stefan Lafonae2df012017-11-14 09:17:21 -080042message Atom {
43 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070044 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070045 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
46 BleScanStateChanged ble_scan_state_changed = 2;
47 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
48 BleScanResultReceived ble_scan_result_received = 4;
49 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080050 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070051 SyncStateChanged sync_state_changed = 7;
52 ScheduledJobStateChanged scheduled_job_state_changed = 8;
53 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070054 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080055 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
56 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
57 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
58 // TODO: 14-19 are blank, but need not be
59 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
60 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
61 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070062 AudioStateChanged audio_state_changed = 23;
63 MediaCodecActivityChanged media_codec_activity_changed = 24;
64 CameraStateChanged camera_state_changed = 25;
65 FlashlightStateChanged flashlight_state_changed = 26;
66 UidProcessStateChanged uid_process_state_changed = 27;
67 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
68 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070069 BatteryLevelChanged battery_level_changed = 30;
70 ChargingStateChanged charging_state_changed = 31;
71 PluggedStateChanged plugged_state_changed = 32;
72 DeviceTemperatureReported device_temperature_reported = 33;
73 DeviceOnStatusChanged device_on_status_changed = 34;
74 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
75 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070076 WifiLockStateChanged wifi_lock_state_changed = 37;
77 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
78 WifiScanStateChanged wifi_scan_state_changed = 39;
79 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070080 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070081 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070082 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090083 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080084 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080085 AnomalyDetected anomaly_detected = 46;
86 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000087 AppStartChanged app_start_changed = 48;
88 AppStartCancelChanged app_start_cancel_changed = 49;
89 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -080090 LmkEventOccurred lmk_event_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080091 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080092 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Bookatzc1a050a2017-10-10 15:49:28 -070093 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000094 }
David Chenc8a43242017-10-17 16:23:28 -070095
David Chen6e3e6cb2018-01-03 16:14:06 -080096 // Pulled events will start at field 10000.
Chenjie Yu9d7720b2018-01-24 10:34:48 -080097 // Next: 10019
David Chenc8a43242017-10-17 16:23:28 -070098 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080099 WifiBytesTransfer wifi_bytes_transfer = 10000;
100 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
101 MobileBytesTransfer mobile_bytes_transfer = 10002;
102 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800103 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800104 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800105 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800106 CpuTimePerFreq cpu_time_per_freq = 10008;
107 CpuTimePerUid cpu_time_per_uid = 10009;
108 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
109 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
110 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar27572b92018-01-23 16:12:51 -0800111 ProcessMemoryStat process_memory_stat = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800112 BluetoothActivityInfo bluetooth_activity_info = 10007;
113 SystemElapsedRealtime system_elapsed_realtime = 10014;
114 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800115 CpuActiveTime cpu_active_time = 10016;
116 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800117 DiskSpace disk_space = 10018;
David Chenc8a43242017-10-17 16:23:28 -0700118 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700119}
120
Yao Chend54f9dd2017-10-17 17:37:48 +0000121/**
Yangster-mac20877162017-12-22 17:19:39 -0800122 * This proto represents a node of an attribution chain.
123 * Note: All attribution chains are represented as a repeated field of type
124 * AttributionNode. It is understood that in such arrays, the order is that
125 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000126 */
Yangster-mac20877162017-12-22 17:19:39 -0800127message AttributionNode {
128 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800129 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800130
Yangster-mac20877162017-12-22 17:19:39 -0800131 // The (optional) string tag for an element in the attribution chain. If the
132 // element has no tag, it is encoded as an empty string.
133 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700134}
135
Yao Chend54f9dd2017-10-17 17:37:48 +0000136/*
137 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800138 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000139 *
140 * RULES:
141 * - The field ids for each atom must start at 1, and count upwards by 1.
142 * Skipping field ids is not allowed.
143 * - These form an API, so renaming, renumbering or removing fields is
144 * not allowed between android releases. (This is not currently enforced,
145 * but there will be a tool to enforce this restriction).
146 * - The types must be built-in protocol buffer types, namely, no sub-messages
147 * are allowed (yet). The bytes type is also not allowed.
148 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800149 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000150 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800151 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000152 * - A field that is a uid should be a string field, tagged with the [xxx]
153 * annotation. The generated code on android will be represented by UIDs,
154 * and those UIDs will be translated in xxx to those strings.
155 *
156 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700157 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000158 * - If there is a UID, it goes first. Think in an object-oriented fashion.
159 * *****************************************************************************
160 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700161
Yao Chend54f9dd2017-10-17 17:37:48 +0000162/**
163 * Logs when the screen state changes.
164 *
165 * Logged from:
166 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
167 */
168message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800169 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
170 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700171}
Yao Chend54f9dd2017-10-17 17:37:48 +0000172
173/**
Bookatzc1a050a2017-10-10 15:49:28 -0700174 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000175 *
176 * Logged from:
177 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
178 */
Bookatzc1a050a2017-10-10 15:49:28 -0700179message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
181
Bookatzdb026a22018-01-10 19:01:56 -0800182 // The state, from frameworks/base/core/proto/android/app/enums.proto.
183 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000184}
185
186/**
Bookatzc1a050a2017-10-10 15:49:28 -0700187 * Logs that a process started, finished, crashed, or ANRed.
188 *
189 * Logged from:
190 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
191 */
192message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700193 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
194
195 // TODO: What is this?
196 optional string name = 2;
197
Bookatzddccf0a2017-11-28 16:48:14 -0800198 // What lifecycle state the process changed to.
199 // This enum is specific to atoms.proto.
200 enum Event {
201 PROCESS_FINISHED = 0;
202 PROCESS_STARTED = 1;
203 PROCESS_CRASHED = 2;
204 PROCESS_ANRED = 3;
205 }
206 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700207}
208
Bookatzc1a050a2017-10-10 15:49:28 -0700209/**
210 * Logs when the ble scan state changes.
211 *
212 * Logged from:
213 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
214 */
215message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800216 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700217
218 enum State {
219 OFF = 0;
220 ON = 1;
221 }
222 optional State state = 2;
223}
224
225/**
226 * Logs when an unoptimized ble scan state changes.
227 *
228 * Logged from:
229 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
230 */
231// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
232message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800233 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700234
235 enum State {
236 OFF = 0;
237 ON = 1;
238 }
239 optional State state = 2;
240}
241
242/**
243 * Logs reporting of a ble scan finding results.
244 *
245 * Logged from:
246 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
247 */
248// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
249message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800250 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700251
252 // Number of ble scan results returned.
253 optional int32 num_of_results = 2;
254}
255
256/**
257 * Logs when a sensor state changes.
258 *
259 * Logged from:
260 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
261 */
262message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800263 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700264
265 // TODO: Is there a way to get the actual name of the sensor?
266 // The id (int) of the sensor.
267 optional int32 sensor_id = 2;
268
269 enum State {
270 OFF = 0;
271 ON = 1;
272 }
273 optional State state = 3;
274}
275
276
277/**
278 * Logs when GPS state changes.
279 *
280 * Logged from:
281 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
282 */
283message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800284 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700285
286 enum State {
287 OFF = 0;
288 ON = 1;
289 }
290 optional State state = 2;
291}
292
293
294/**
295 * Logs when a sync manager sync state changes.
296 *
297 * Logged from:
298 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
299 */
300message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800301 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700302
303 // Name of the sync (as named in the app)
304 optional string name = 2;
305
306 enum State {
307 OFF = 0;
308 ON = 1;
309 }
310 optional State state = 3;
311}
312
313/**
314 * Logs when a job scheduler job state changes.
315 *
316 * Logged from:
317 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
318 */
319message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800320 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700321
322 // Name of the job (as named in the app)
323 optional string name = 2;
324
325 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800326 FINISHED = 0;
327 STARTED = 1;
328 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700329 }
330 optional State state = 3;
331
332 // TODO: Consider adding the stopReason (int)
333}
334
335/**
336 * Logs when the audio state changes.
337 *
338 * Logged from:
339 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
340 */
341message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800342 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700343
344 enum State {
345 OFF = 0;
346 ON = 1;
347 }
348 optional State state = 2;
349}
350
351/**
352 * Logs when the video codec state changes.
353 *
354 * Logged from:
355 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
356 */
357message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800358 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700359
360 enum State {
361 OFF = 0;
362 ON = 1;
363 }
364 optional State state = 2;
365}
366
367/**
368 * Logs when the flashlight state changes.
369 *
370 * Logged from:
371 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
372 */
373message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800374 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700375
376 enum State {
377 OFF = 0;
378 ON = 1;
379 }
380 optional State state = 2;
381}
382
383/**
384 * Logs when the camera state changes.
385 *
386 * Logged from:
387 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
388 */
389message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800390 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700391
392 enum State {
393 OFF = 0;
394 ON = 1;
395 }
396 optional State state = 2;
397}
398
399/**
400 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000401 *
402 * Logged from:
403 * TODO
404 */
Bookatzd6746242017-10-24 18:39:35 -0700405message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800406 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000407
Bookatz1a1b0462018-01-12 11:47:03 -0800408 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
409 // From frameworks/base/core/proto/android/os/enums.proto.
410 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700411
412 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
413 optional string tag = 3;
414
415 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800416 RELEASE = 0;
417 ACQUIRE = 1;
418 CHANGE_RELEASE = 2;
419 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700420 }
421 optional State state = 4;
422}
423
424/**
Bookatzc1a050a2017-10-10 15:49:28 -0700425 * Logs when a partial wakelock is considered 'long' (over 1 min).
426 *
427 * Logged from:
428 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
429 */
430message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800431 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700432
Yao Chend54f9dd2017-10-17 17:37:48 +0000433 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
434 optional string tag = 2;
435
Bookatzc1a050a2017-10-10 15:49:28 -0700436 // TODO: I have no idea what this is.
437 optional string history_tag = 3;
438
439 enum State {
440 OFF = 0;
441 ON = 1;
442 }
443 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000444}
445
Bookatzc1a050a2017-10-10 15:49:28 -0700446/**
447 * Logs Battery Saver state change.
448 *
449 * Logged from:
450 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
451 */
452message BatterySaverModeStateChanged {
453 enum State {
454 OFF = 0;
455 ON = 1;
456 }
457 optional State state = 1;
458}
459
460/**
461 * Logs Doze mode state change.
462 *
463 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800464 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700465 */
466message DeviceIdleModeStateChanged {
467 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800468 enum State {
469 DEVICE_IDLE_MODE_OFF = 0;
470 DEVICE_IDLE_MODE_LIGHT = 1;
471 DEVICE_IDLE_MODE_DEEP = 2;
472 }
473 optional State state = 1;
474}
475
476
477/**
478 * Logs state change of Doze mode including maintenance windows.
479 *
480 * Logged from:
481 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
482 */
483message DeviceIdlingModeStateChanged {
484 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
485 enum State {
486 DEVICE_IDLE_MODE_OFF = 0;
487 DEVICE_IDLE_MODE_LIGHT = 1;
488 DEVICE_IDLE_MODE_DEEP = 2;
489 }
490 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700491}
492
493/**
494 * Logs screen brightness level.
495 *
496 * Logged from:
497 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
498 */
499message ScreenBrightnessChanged {
500 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
501 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700502}
503
504/**
505 * Logs battery level (percent full, from 0 to 100).
506 *
507 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700508 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700509 */
510message BatteryLevelChanged {
511 // Battery level. Should be in [0, 100].
512 optional int32 battery_level = 1;
513}
514
515/**
516 * Logs change in charging status of the device.
517 *
518 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700519 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700520 */
521message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800522 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
523 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700524}
525
526/**
527 * Logs whether the device is plugged in, and what power source it is using.
528 *
529 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700530 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700531 */
532message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800533 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
534 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700535}
536
537/**
538 * Logs the temperature of the device, in tenths of a degree Celsius.
539 *
540 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700541 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700542 */
543message DeviceTemperatureReported {
544 // Temperature in tenths of a degree C.
545 optional int32 temperature = 1;
546}
547
548// TODO: Define this more precisely.
549// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
550/**
551 * Logs when the device turns off or on.
552 *
553 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700554 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700555 */
556message DeviceOnStatusChanged {
557 enum State {
558 OFF = 0;
559 ON = 1;
560 }
561 optional State state = 1;
562}
563
564/**
565 * Logs when an app's wakeup alarm fires.
566 *
567 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700568 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700569 */
570message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800571 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800572
573 // Name of the wakeup alarm.
574 optional string tag = 2;
575}
576
577/**
578 * Logs when an an app causes the mobile radio to change state.
579 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
580 *
581 * Logged from:
582 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
583 */
584message MobileRadioPowerStateChanged {
585 // TODO: Add attribution instead of uid?
586 optional int32 uid = 1;
587
Bookatz1a1b0462018-01-12 11:47:03 -0800588 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
589 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800590}
591
592/**
593 * Logs when an an app causes the wifi radio to change state.
594 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
595 *
596 * Logged from:
597 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
598 */
599message WifiRadioPowerStateChanged {
600 // TODO: Add attribution instead of uid?
601 optional int32 uid = 1;
602
Bookatz1a1b0462018-01-12 11:47:03 -0800603 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
604 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700605}
606
607/**
608 * Logs kernel wakeup reasons and aborts.
609 *
610 * Logged from:
611 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
612 */
613message KernelWakeupReported {
614 // Name of the kernel wakeup reason (or abort).
615 optional string wakeup_reason_name = 1;
616
617 // Duration (in microseconds) for the wake-up interrupt to be serviced.
618 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700619}
620
621/**
622 * Logs wifi locks held by an app.
623 *
624 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700625 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700626 */
627message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800628 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700629
630 enum State {
631 OFF = 0;
632 ON = 1;
633 }
634 optional State state = 2;
635}
636
637/**
638 * Logs wifi signal strength changes.
639 *
640 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700641 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700642 */
643message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800644 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
645 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700646}
647
648/**
649 * Logs wifi scans performed by an app.
650 *
651 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700652 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700653 */
654message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800655 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700656
657 enum State {
658 OFF = 0;
659 ON = 1;
660 }
661 optional State state = 2;
662}
663
664/**
Tej Singh4503e102018-01-04 14:35:01 -0800665 * Logs wifi multicast locks held by an app
666 *
667 * Logged from:
668 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
669 */
670message WifiMulticastLockStateChanged {
671 repeated AttributionNode attribution_node = 1;
672
673 enum State {
674 OFF = 0;
675 ON = 1;
676 }
677 optional State state = 2;
678}
679
680/**
Bookatze5885242017-10-24 20:10:31 -0700681 * Logs phone signal strength changes.
682 *
683 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700684 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700685 */
686message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800687 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
688 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700689}
690
691/**
692 * Logs that a setting was updated.
693 * Logged from:
694 * frameworks/base/core/java/android/provider/Settings.java
695 * The tag and is_default allow resetting of settings to default values based on the specified
696 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
697 */
698message SettingChanged {
699 // The name of the setting.
700 optional string setting = 1;
701
702 // The change being imposed on this setting. May represent a number, eg "3".
703 optional string value = 2;
704
705 // The new value of this setting. For most settings, this is same as value. For some settings,
706 // value is +X or -X where X represents an element in a set. For example, if the previous value
707 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
708 // The +/- feature is currently only used for location_providers_allowed.
709 optional string new_value = 3;
710
711 // The previous value of this setting.
712 optional string prev_value = 4;
713
714 // The tag used with the is_default for resetting sets of settings. This is generally null.
715 optional string tag = 5;
716
717 // 1 indicates that this setting with tag should be resettable.
718 optional int32 is_default = 6;
719
720 // The user ID associated. Defined in android/os/UserHandle.java
721 optional int32 user = 7;
722}
Chenjie Yub3dda412017-10-24 13:41:59 -0700723
Chenjie Yu05013b32017-11-21 10:21:41 -0800724/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700725 * Logs activity going to foreground or background
726 *
727 * Logged from:
728 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
729 */
730message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800731 optional int32 uid = 1;
732 optional string pkg_name = 2;
733 optional string class_name = 3;
734
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700735 enum Activity {
736 MOVE_TO_BACKGROUND = 0;
737 MOVE_TO_FOREGROUND = 1;
738 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700739 optional Activity activity = 4;
740}
David Chenc8a43242017-10-17 16:23:28 -0700741
742/**
David Chen9e3808c2017-11-20 17:25:34 -0800743 * Logs when an error is written to dropbox.
744 * Logged from:
745 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
746 */
747message DropboxErrorChanged {
748 // The uid if available. -1 means not available.
749 optional int32 uid = 1;
750
751 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
752 optional string tag = 2;
753
754 // The name of the process.
755 optional string process_name = 3;
756
757 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800758 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800759
760 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800761 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800762
763 // The activity name if available.
764 optional string activity_name = 6;
765
David Chen6e3e6cb2018-01-03 16:14:06 -0800766 // The package name if available.
767 optional string package_name = 7;
768
David Chen9e3808c2017-11-20 17:25:34 -0800769 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800770 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800771}
772
David Chen0a368b22017-12-06 16:28:16 -0800773/*
774 * Allows other apps to push events into statsd.
775 * Logged from:
776 * frameworks/base/core/java/android/util/StatsLog.java
777 */
778message AppHook {
779 // The uid of the application that sent this custom atom.
780 optional int32 uid = 1;
781
782 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
783 optional int32 label = 2;
784
785 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
786 // predicates for the metrics).
787 enum State {
788 UNKNOWN = 0;
789 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
790 STOP = 2;
791 START = 3;
792 }
793 optional State state = 3;
794}
795
David Chen9e3808c2017-11-20 17:25:34 -0800796/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800797 * Logs when statsd detects an anomaly.
798 *
799 * Logged from:
800 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
801 */
802message AnomalyDetected {
803 // Uid that owns the config whose anomaly detection alert fired.
804 optional int32 config_uid = 1;
805
Yangster-mac94e197c2018-01-02 16:03:03 -0800806 // Id of the config whose anomaly detection alert fired.
807 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800808
Yangster-mac94e197c2018-01-02 16:03:03 -0800809 // Id of the alert (i.e. name of the anomaly that was detected).
810 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800811}
812
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000813message AppStartChanged {
814 // The uid if available. -1 means not available.
815 optional int32 uid = 1;
816
817 // The app package name.
818 optional string pkg_name = 2;
819
820 enum TransitionType {
821 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
822 WARM = 1;
823 HOT = 2;
824 COLD = 3;
825 }
826 // The transition type.
827 optional TransitionType type = 3;
828
829 // The activity name.
830 optional string activity_name = 4;
831
832 // The name of the calling app. Empty if not set.
833 optional string calling_pkg_name = 5;
834
835 // Whether the app is an instant app.
836 optional bool is_instant_app = 6;
837
838 // Device uptime when activity started.
839 optional int64 activity_start_msec = 7;
840
Bookatz80d11a02018-01-16 10:46:35 -0800841 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000842
843 optional int32 transition_delay_msec = 9;
844 // -1 if not set.
845 optional int32 starting_window_delay_msec = 10;
846 // -1 if not set.
847 optional int32 bind_application_delay_msec = 11;
848 optional int32 windows_drawn_delay_msec = 12;
849
850 // Empty if not set.
851 optional string launch_token = 13;
852
853}
854
855message AppStartCancelChanged {
856 // The uid if available. -1 means not available.
857 optional int32 uid = 1;
858
859 // The app package name.
860 optional string pkg_name = 2;
861
862 enum TransitionType {
863 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
864 WARM = 1;
865 HOT = 2;
866 COLD = 3;
867 }
868 // The transition type.
869 optional TransitionType type = 3;
870
871 // The activity name.
872 optional string activity_name = 4;
873}
874
875message AppStartFullyDrawnChanged {
876 // The uid if available. -1 means not available.
877 optional int32 uid = 1;
878
879 // The app package name.
880 optional string pkg_name = 2;
881
882 enum TransitionType {
883 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
884 WITH_BUNDLE = 1;
885 WITHOUT_BUNDLE = 2;
886 }
887 // The transition type.
888 optional TransitionType type = 3;
889
890 // The activity name.
891 optional string activity_name = 4;
892
893 optional bool transition_process_running = 5;
894
895 // App startup time (until call to Activity#reportFullyDrawn()).
896 optional int64 app_startup_time_ms = 6;
897}
898
Bookatz8fcd09a2017-12-18 13:01:10 -0800899/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800900 * Logs a picture-in-picture action
901 * Logged from:
902 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
903 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
904 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
905 */
906message PictureInPictureStateChanged {
907 optional int32 uid = 1;
908
909 optional string package_name = 2;
910
911 optional string class_name = 3;
912
913 // Picture-in-Picture action occurred, similar to
914 // frameworks/base/proto/src/metrics_constants.proto
915 enum State {
916 ENTERED = 1;
917 EXPANDED_TO_FULL_SCREEN = 2;
918 MINIMIZED = 3;
919 DISMISSED = 4;
920 }
921 optional State state = 4;
922}
923
924/**
David Chenc8a43242017-10-17 16:23:28 -0700925 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
926 *
927 * Pulled from:
928 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
929 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800930message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700931 optional int32 uid = 1;
932
933 optional int64 rx_bytes = 2;
934
935 optional int64 rx_packets = 3;
936
937 optional int64 tx_bytes = 4;
938
939 optional int64 tx_packets = 5;
940}
941
942/**
943 * Pulls bytes transferred via wifi (separated by foreground and background usage).
944 *
945 * Pulled from:
946 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
947 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800948message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700949 optional int32 uid = 1;
950
951 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
952 optional int32 is_foreground = 2;
953
954 optional int64 rx_bytes = 3;
955
956 optional int64 rx_packets = 4;
957
958 optional int64 tx_bytes = 5;
959
960 optional int64 tx_packets = 6;
961}
962
963/**
964 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
965 *
966 * Pulled from:
967 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
968 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800969message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700970 optional int32 uid = 1;
971
972 optional int64 rx_bytes = 2;
973
974 optional int64 rx_packets = 3;
975
976 optional int64 tx_bytes = 4;
977
978 optional int64 tx_packets = 5;
979}
980
981/**
982 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
983 *
984 * Pulled from:
985 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
986 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800987message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700988 optional int32 uid = 1;
989
990 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
991 optional int32 is_foreground = 2;
992
993 optional int64 rx_bytes = 3;
994
995 optional int64 rx_packets = 4;
996
997 optional int64 tx_bytes = 5;
998
999 optional int64 tx_packets = 6;
1000}
1001
1002/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001003 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1004 *
1005 * Pulled from:
1006 * StatsCompanionService
1007 */
1008message BluetoothBytesTransfer {
1009 optional int32 uid = 1;
1010
1011 optional int64 rx_bytes = 2;
1012
1013 optional int64 tx_bytes = 3;
1014}
1015
1016/**
David Chenc8a43242017-10-17 16:23:28 -07001017 * Pulls the kernel wakelock durations. This atom is adapted from
1018 * android/internal/os/KernelWakelockStats.java
1019 *
1020 * Pulled from:
1021 * StatsCompanionService using KernelWakelockReader.
1022 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001023message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001024 optional string name = 1;
1025
1026 optional int32 count = 2;
1027
1028 optional int32 version = 3;
1029
1030 optional int64 time = 4;
1031}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001032
Chenjie Yu05013b32017-11-21 10:21:41 -08001033/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001034 * Pulls low power state information. This includes platform and subsystem sleep state information,
1035 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001036 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001037 * hardware/interfaces/power/1.1/types.hal
1038 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001039message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001040 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1041 // YYY is corresponding voter name.
1042 // If there are no voters, the format should just be XXX (with no dot).
1043 // XXX and YYY should not contain a "." in it.
1044 optional string name = 1;
1045 // The number of times it entered, or voted for entering the sleep state
1046 optional uint64 count = 2;
1047 // The length of time spent in, or spent voting for, the sleep state
1048 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001049}
David Chen21582962017-11-01 17:32:46 -07001050
1051/**
1052 * 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 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1066 // be removed before if it's used for another parent uid.
1067 optional int32 is_create = 3;
1068}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001069
Chenjie Yu05013b32017-11-21 10:21:41 -08001070/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001071 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001072 * Pulls the time the cpu spend on the frequency index. Frequency index
1073 * starts from highest to lowest. The value should be monotonically
1074 * increasing since boot. However, if there is a cpu
1075 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001076 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001077message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001078 optional uint32 cluster = 1;
1079 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001080 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001081}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001082
Chenjie Yu05013b32017-11-21 10:21:41 -08001083/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001084 * Pulls Cpu Time Per Uid.
1085 * Note that isolated process uid time should be attributed to host uids.
1086 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001087message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001088 optional uint64 uid = 1;
1089 optional uint64 user_time_ms = 2;
1090 optional uint64 sys_time_ms = 3;
1091}
1092
1093/**
1094 * Pulls Cpu Time Per Uid per frequency.
1095 * Note that isolated process uid time should be attributed to host uids.
1096 * For each uid, we order the time by descending frequencies.
1097 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001098message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001099 optional uint64 uid = 1;
1100 optional uint64 freq_idx = 2;
1101 optional uint64 time_ms = 3;
1102}
Hugo Benichi884970e2017-11-14 22:42:46 +09001103
1104/*
1105 * Logs the reception of an incoming network packet causing the main system to wake up for
1106 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1107 * and processed by WakeupController.cpp.
1108 */
1109message PacketWakeupOccurred {
1110 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1111 // delivered nowhere.
1112 optional int32 uid = 1;
1113 // The interface name on which the packet was received.
1114 optional string iface = 2;
1115 // The ethertype value of the packet.
1116 optional int32 ethertype = 3;
1117 // String representation of the destination MAC address of the packet.
1118 optional string destination_hardware_address = 4;
1119 // String representation of the source address of the packet if this was an IP packet.
1120 optional string source_ip = 5;
1121 // String representation of the destination address of the packet if this was an IP packet.
1122 optional string destination_ip = 6;
1123 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1124 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1125 // families.
1126 optional int32 ip_next_header = 7;
1127 // The source port if this was a TCP or UDP packet.
1128 optional int32 source_port = 8;
1129 // The destination port if this was a TCP or UDP packet.
1130 optional int32 destination_port = 9;
1131}
Chenjie Yu05013b32017-11-21 10:21:41 -08001132
1133/**
1134 * Pulls Wifi Controller Activity Energy Info
1135 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001136message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001137 // timestamp(wall clock) of record creation
1138 optional uint64 timestamp_ms = 1;
1139 // stack reported state
1140 // TODO: replace this with proto enum
1141 optional int32 stack_state = 2;
1142 // tx time in ms
1143 optional uint64 controller_tx_time_ms = 3;
1144 // rx time in ms
1145 optional uint64 controller_rx_time_ms = 4;
1146 // idle time in ms
1147 optional uint64 controller_idle_time_ms = 5;
1148 // product of current(mA), voltage(V) and time(ms)
1149 optional uint64 controller_energy_used = 6;
1150}
1151
1152/**
1153 * Pulls Modem Activity Energy Info
1154 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001155message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001156 // timestamp(wall clock) of record creation
1157 optional uint64 timestamp_ms = 1;
1158 // sleep time in ms.
1159 optional uint64 sleep_time_ms = 2;
1160 // idle time in ms
1161 optional uint64 controller_idle_time_ms = 3;
1162 /**
1163 * Tx power index
1164 * index 0 = tx_power < 0dBm
1165 * index 1 = 0dBm < tx_power < 5dBm
1166 * index 2 = 5dBm < tx_power < 15dBm
1167 * index 3 = 15dBm < tx_power < 20dBm
1168 * index 4 = tx_power > 20dBm
1169 */
1170 // tx time in ms at power level 0
1171 optional uint64 controller_tx_time_pl0_ms = 4;
1172 // tx time in ms at power level 1
1173 optional uint64 controller_tx_time_pl1_ms = 5;
1174 // tx time in ms at power level 2
1175 optional uint64 controller_tx_time_pl2_ms = 6;
1176 // tx time in ms at power level 3
1177 optional uint64 controller_tx_time_pl3_ms = 7;
1178 // tx time in ms at power level 4
1179 optional uint64 controller_tx_time_pl4_ms = 8;
1180 // rx time in ms at power level 5
1181 optional uint64 controller_rx_time_ms = 9;
1182 // product of current(mA), voltage(V) and time(ms)
1183 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001184}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001185
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001186/**
1187 * Pulls Bluetooth Activity Energy Info
1188 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1189 */
1190message BluetoothActivityInfo {
1191 // timestamp(wall clock) of record creation
1192 optional uint64 timestamp_ms = 1;
1193 // bluetooth stack state
1194 optional int32 bluetooth_stack_state = 2;
1195 // tx time in ms
1196 optional uint64 controller_tx_time_ms = 3;
1197 // rx time in ms
1198 optional uint64 controller_rx_time_ms = 4;
1199 // idle time in ms
1200 optional uint64 controller_idle_time_ms = 5;
1201 // product of current(mA), voltage(V) and time(ms)
1202 optional uint64 energy_used = 6;
1203}
1204
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001205/*
1206 * Logs the memory stats for a process
1207 */
Rajeev Kumar27572b92018-01-23 16:12:51 -08001208message ProcessMemoryStat {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001209 // The uid if available. -1 means not available.
1210 optional int32 uid = 1;
1211
Rajeev Kumar27572b92018-01-23 16:12:51 -08001212 // The process name.
1213 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001214
1215 // # of page-faults
1216 optional int64 pgfault = 3;
1217
1218 // # of major page-faults
1219 optional int64 pgmajfault = 4;
1220
1221 // RSS+CACHE(+SWAP)
1222 optional int64 usage_in_bytes = 5;
1223}
1224
1225/*
1226 * Logs the event when LMKD kills a process to reduce memory pressure
1227 * Logged from:
1228 * system/core/lmkd/lmkd.c
1229 */
1230message LmkEventOccurred {
1231 // The uid if available. -1 means not available.
1232 optional int32 uid = 1;
1233
Rajeev Kumar27572b92018-01-23 16:12:51 -08001234 // The process name.
1235 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001236
1237 // oom adj score.
1238 optional int32 oom_score = 3;
1239
Rajeev Kumar27572b92018-01-23 16:12:51 -08001240 // # of page-faults
1241 optional int64 pgfault = 4;
1242
1243 // # of major page-faults
1244 optional int64 pgmajfault = 5;
1245
1246 // RSS+CACHE(+SWAP)
1247 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001248}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001249
1250/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001251 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001252 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001253message SystemElapsedRealtime {
1254 optional uint64 time_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001255}
1256
1257/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001258 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001259 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001260message SystemUptime {
1261 // Milliseconds since the system was booted.
1262 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1263 // for external input).
1264 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1265 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001266}
1267
1268/*
1269 * Reads from /proc/uid_concurrent_active_time which has the format:
1270 * active: X (X is # cores)
1271 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1272 * [uid1]: [time-0] [time-1] [time-2] ... ...
1273 * ...
1274 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1275 * The file contains a monotonically increasing count of time for a single boot.
1276 */
1277message CpuActiveTime {
1278 optional uint64 uid = 1;
1279 optional uint64 idx = 2;
1280 optional uint64 time_ms = 3;
1281}
1282
1283/**
1284 * Reads from /proc/uid_concurrent_policy_time which has the format:
1285 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1286 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1287 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1288 * ...
1289 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1290 * The file contains a monotonically increasing count of time for a single boot.
1291 */
1292message CpuClusterTime {
1293 optional uint64 uid = 1;
1294 optional uint64 idx = 2;
1295 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001296}
1297
1298/*
1299 * Pulls free disk space, for data, system partition and temporary directory.
1300 */
1301message DiskSpace {
1302 // available bytes in data partition
1303 optional uint64 data_available_bytes = 1;
1304 // available bytes in system partition
1305 optional uint64 system_available_bytes = 2;
1306 // available bytes in download cache or temp directories
1307 optional uint64 temp_available_bytes = 3;
1308}