blob: 838c1679753bcf7fa1c8e01f5002c8c9999eab49 [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 Kumar508a9bf2018-01-18 15:49:11 -080091 LmkEventOccurred lmk_event_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;
Bookatzc1a050a2017-10-10 15:49:28 -070094 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000095 }
David Chenc8a43242017-10-17 16:23:28 -070096
David Chen6e3e6cb2018-01-03 16:14:06 -080097 // Pulled events will start at field 10000.
Chenjie Yu9d7720b2018-01-24 10:34:48 -080098 // Next: 10019
David Chenc8a43242017-10-17 16:23:28 -070099 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800100 WifiBytesTransfer wifi_bytes_transfer = 10000;
101 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
102 MobileBytesTransfer mobile_bytes_transfer = 10002;
103 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800104 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800105 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800106 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800107 CpuTimePerFreq cpu_time_per_freq = 10008;
108 CpuTimePerUid cpu_time_per_uid = 10009;
109 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
110 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
111 ModemActivityInfo modem_activity_info = 10012;
Rajeev Kumar27572b9a2018-01-23 16:12:51 -0800112 ProcessMemoryStat process_memory_stat = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800113 BluetoothActivityInfo bluetooth_activity_info = 10007;
114 SystemElapsedRealtime system_elapsed_realtime = 10014;
115 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800116 CpuActiveTime cpu_active_time = 10016;
117 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800118 DiskSpace disk_space = 10018;
David Chenc8a43242017-10-17 16:23:28 -0700119 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700120}
121
Yao Chend54f9dd2017-10-17 17:37:48 +0000122/**
Yangster-mac20877162017-12-22 17:19:39 -0800123 * This proto represents a node of an attribution chain.
124 * Note: All attribution chains are represented as a repeated field of type
125 * AttributionNode. It is understood that in such arrays, the order is that
126 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000127 */
Yangster-mac20877162017-12-22 17:19:39 -0800128message AttributionNode {
129 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800130 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800131
Yangster-mac20877162017-12-22 17:19:39 -0800132 // The (optional) string tag for an element in the attribution chain. If the
133 // element has no tag, it is encoded as an empty string.
134 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700135}
136
Yao Chend54f9dd2017-10-17 17:37:48 +0000137/*
138 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800139 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000140 *
141 * RULES:
142 * - The field ids for each atom must start at 1, and count upwards by 1.
143 * Skipping field ids is not allowed.
144 * - These form an API, so renaming, renumbering or removing fields is
145 * not allowed between android releases. (This is not currently enforced,
146 * but there will be a tool to enforce this restriction).
147 * - The types must be built-in protocol buffer types, namely, no sub-messages
148 * are allowed (yet). The bytes type is also not allowed.
149 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800150 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000151 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800152 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000153 * - A field that is a uid should be a string field, tagged with the [xxx]
154 * annotation. The generated code on android will be represented by UIDs,
155 * and those UIDs will be translated in xxx to those strings.
156 *
157 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700158 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000159 * - If there is a UID, it goes first. Think in an object-oriented fashion.
160 * *****************************************************************************
161 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700162
Yao Chend54f9dd2017-10-17 17:37:48 +0000163/**
164 * Logs when the screen state changes.
165 *
166 * Logged from:
167 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
168 */
169message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800170 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
171 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700172}
Yao Chend54f9dd2017-10-17 17:37:48 +0000173
174/**
Bookatzc1a050a2017-10-10 15:49:28 -0700175 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000176 *
177 * Logged from:
178 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
179 */
Bookatzc1a050a2017-10-10 15:49:28 -0700180message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000181 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
182
Bookatzdb026a22018-01-10 19:01:56 -0800183 // The state, from frameworks/base/core/proto/android/app/enums.proto.
184 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000185}
186
187/**
Bookatzc1a050a2017-10-10 15:49:28 -0700188 * Logs that a process started, finished, crashed, or ANRed.
189 *
190 * Logged from:
191 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
192 */
193message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700194 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
195
196 // TODO: What is this?
197 optional string name = 2;
198
Bookatzddccf0a2017-11-28 16:48:14 -0800199 // What lifecycle state the process changed to.
200 // This enum is specific to atoms.proto.
201 enum Event {
202 PROCESS_FINISHED = 0;
203 PROCESS_STARTED = 1;
204 PROCESS_CRASHED = 2;
205 PROCESS_ANRED = 3;
206 }
207 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700208}
209
Bookatzc1a050a2017-10-10 15:49:28 -0700210/**
211 * Logs when the ble scan state changes.
212 *
213 * Logged from:
214 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
215 */
216message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800217 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700218
219 enum State {
220 OFF = 0;
221 ON = 1;
222 }
223 optional State state = 2;
224}
225
226/**
227 * Logs when an unoptimized ble scan state changes.
228 *
229 * Logged from:
230 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
231 */
232// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
233message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800234 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700235
236 enum State {
237 OFF = 0;
238 ON = 1;
239 }
240 optional State state = 2;
241}
242
243/**
244 * Logs reporting of a ble scan finding results.
245 *
246 * Logged from:
247 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
248 */
249// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
250message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800251 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700252
253 // Number of ble scan results returned.
254 optional int32 num_of_results = 2;
255}
256
257/**
258 * Logs when a sensor state changes.
259 *
260 * Logged from:
261 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
262 */
263message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800264 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700265
266 // TODO: Is there a way to get the actual name of the sensor?
267 // The id (int) of the sensor.
268 optional int32 sensor_id = 2;
269
270 enum State {
271 OFF = 0;
272 ON = 1;
273 }
274 optional State state = 3;
275}
276
277
278/**
279 * Logs when GPS state changes.
280 *
281 * Logged from:
282 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
283 */
284message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800285 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700286
287 enum State {
288 OFF = 0;
289 ON = 1;
290 }
291 optional State state = 2;
292}
293
294
295/**
296 * Logs when a sync manager sync state changes.
297 *
298 * Logged from:
299 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
300 */
301message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800302 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700303
304 // Name of the sync (as named in the app)
305 optional string name = 2;
306
307 enum State {
308 OFF = 0;
309 ON = 1;
310 }
311 optional State state = 3;
312}
313
314/**
315 * Logs when a job scheduler job state changes.
316 *
317 * Logged from:
318 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
319 */
320message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800321 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700322
323 // Name of the job (as named in the app)
324 optional string name = 2;
325
326 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800327 FINISHED = 0;
328 STARTED = 1;
329 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700330 }
331 optional State state = 3;
332
333 // TODO: Consider adding the stopReason (int)
334}
335
336/**
337 * Logs when the audio state changes.
338 *
339 * Logged from:
340 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
341 */
342message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800343 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700344
345 enum State {
346 OFF = 0;
347 ON = 1;
348 }
349 optional State state = 2;
350}
351
352/**
353 * Logs when the video codec state changes.
354 *
355 * Logged from:
356 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
357 */
358message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800359 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700360
361 enum State {
362 OFF = 0;
363 ON = 1;
364 }
365 optional State state = 2;
366}
367
368/**
369 * Logs when the flashlight state changes.
370 *
371 * Logged from:
372 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
373 */
374message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800375 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700376
377 enum State {
378 OFF = 0;
379 ON = 1;
380 }
381 optional State state = 2;
382}
383
384/**
385 * Logs when the camera state changes.
386 *
387 * Logged from:
388 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
389 */
390message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800391 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700392
393 enum State {
394 OFF = 0;
395 ON = 1;
396 }
397 optional State state = 2;
398}
399
400/**
401 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000402 *
403 * Logged from:
404 * TODO
405 */
Bookatzd6746242017-10-24 18:39:35 -0700406message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800407 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000408
Bookatz1a1b0462018-01-12 11:47:03 -0800409 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
410 // From frameworks/base/core/proto/android/os/enums.proto.
411 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700412
413 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
414 optional string tag = 3;
415
416 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800417 RELEASE = 0;
418 ACQUIRE = 1;
419 CHANGE_RELEASE = 2;
420 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700421 }
422 optional State state = 4;
423}
424
425/**
Bookatzc1a050a2017-10-10 15:49:28 -0700426 * Logs when a partial wakelock is considered 'long' (over 1 min).
427 *
428 * Logged from:
429 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
430 */
431message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800432 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700433
Yao Chend54f9dd2017-10-17 17:37:48 +0000434 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
435 optional string tag = 2;
436
Bookatzc1a050a2017-10-10 15:49:28 -0700437 // TODO: I have no idea what this is.
438 optional string history_tag = 3;
439
440 enum State {
441 OFF = 0;
442 ON = 1;
443 }
444 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000445}
446
Bookatzc1a050a2017-10-10 15:49:28 -0700447/**
448 * Logs Battery Saver state change.
449 *
450 * Logged from:
451 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
452 */
453message BatterySaverModeStateChanged {
454 enum State {
455 OFF = 0;
456 ON = 1;
457 }
458 optional State state = 1;
459}
460
461/**
462 * Logs Doze mode state change.
463 *
464 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800465 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700466 */
467message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800468 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800469}
470
471
472/**
473 * Logs state change of Doze mode including maintenance windows.
474 *
475 * Logged from:
476 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
477 */
478message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800479 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700480}
481
482/**
483 * Logs screen brightness level.
484 *
485 * Logged from:
486 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
487 */
488message ScreenBrightnessChanged {
489 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
490 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700491}
492
493/**
494 * Logs battery level (percent full, from 0 to 100).
495 *
496 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700497 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700498 */
499message BatteryLevelChanged {
500 // Battery level. Should be in [0, 100].
501 optional int32 battery_level = 1;
502}
503
504/**
505 * Logs change in charging status of the device.
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 ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800511 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
512 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700513}
514
515/**
516 * Logs whether the device is plugged in, and what power source it is using.
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 PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800522 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
523 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700524}
525
526/**
527 * Logs the temperature of the device, in tenths of a degree Celsius.
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 DeviceTemperatureReported {
533 // Temperature in tenths of a degree C.
534 optional int32 temperature = 1;
535}
536
537// TODO: Define this more precisely.
538// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
539/**
540 * Logs when the device turns off or on.
541 *
542 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700543 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700544 */
545message DeviceOnStatusChanged {
546 enum State {
547 OFF = 0;
548 ON = 1;
549 }
550 optional State state = 1;
551}
552
553/**
554 * Logs when an app's wakeup alarm fires.
555 *
556 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700557 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700558 */
559message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800560 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800561
562 // Name of the wakeup alarm.
563 optional string tag = 2;
564}
565
566/**
567 * Logs when an an app causes the mobile radio to change state.
568 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
569 *
570 * Logged from:
571 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
572 */
573message MobileRadioPowerStateChanged {
574 // TODO: Add attribution instead of uid?
575 optional int32 uid = 1;
576
Bookatz1a1b0462018-01-12 11:47:03 -0800577 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
578 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800579}
580
581/**
582 * Logs when an an app causes the wifi radio to change state.
583 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
584 *
585 * Logged from:
586 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
587 */
588message WifiRadioPowerStateChanged {
589 // TODO: Add attribution instead of uid?
590 optional int32 uid = 1;
591
Bookatz1a1b0462018-01-12 11:47:03 -0800592 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
593 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700594}
595
596/**
597 * Logs kernel wakeup reasons and aborts.
598 *
599 * Logged from:
600 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
601 */
602message KernelWakeupReported {
603 // Name of the kernel wakeup reason (or abort).
604 optional string wakeup_reason_name = 1;
605
606 // Duration (in microseconds) for the wake-up interrupt to be serviced.
607 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700608}
609
610/**
611 * Logs wifi locks held by an app.
612 *
613 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700614 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700615 */
616message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800617 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700618
619 enum State {
620 OFF = 0;
621 ON = 1;
622 }
623 optional State state = 2;
624}
625
626/**
627 * Logs wifi signal strength changes.
628 *
629 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700630 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700631 */
632message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800633 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
634 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700635}
636
637/**
638 * Logs wifi scans performed by an app.
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 WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800644 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700645
646 enum State {
647 OFF = 0;
648 ON = 1;
649 }
650 optional State state = 2;
651}
652
653/**
Tej Singh4503e102018-01-04 14:35:01 -0800654 * Logs wifi multicast locks held by an app
655 *
656 * Logged from:
657 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
658 */
659message WifiMulticastLockStateChanged {
660 repeated AttributionNode attribution_node = 1;
661
662 enum State {
663 OFF = 0;
664 ON = 1;
665 }
666 optional State state = 2;
667}
668
669/**
Bookatze5885242017-10-24 20:10:31 -0700670 * Logs phone signal strength changes.
671 *
672 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700673 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700674 */
675message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800676 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
677 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700678}
679
680/**
681 * Logs that a setting was updated.
682 * Logged from:
683 * frameworks/base/core/java/android/provider/Settings.java
684 * The tag and is_default allow resetting of settings to default values based on the specified
685 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
686 */
687message SettingChanged {
688 // The name of the setting.
689 optional string setting = 1;
690
691 // The change being imposed on this setting. May represent a number, eg "3".
692 optional string value = 2;
693
694 // The new value of this setting. For most settings, this is same as value. For some settings,
695 // value is +X or -X where X represents an element in a set. For example, if the previous value
696 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
697 // The +/- feature is currently only used for location_providers_allowed.
698 optional string new_value = 3;
699
700 // The previous value of this setting.
701 optional string prev_value = 4;
702
703 // The tag used with the is_default for resetting sets of settings. This is generally null.
704 optional string tag = 5;
705
706 // 1 indicates that this setting with tag should be resettable.
707 optional int32 is_default = 6;
708
709 // The user ID associated. Defined in android/os/UserHandle.java
710 optional int32 user = 7;
711}
Chenjie Yub3dda412017-10-24 13:41:59 -0700712
Chenjie Yu05013b32017-11-21 10:21:41 -0800713/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700714 * Logs activity going to foreground or background
715 *
716 * Logged from:
717 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
718 */
719message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800720 optional int32 uid = 1;
721 optional string pkg_name = 2;
722 optional string class_name = 3;
723
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700724 enum Activity {
725 MOVE_TO_BACKGROUND = 0;
726 MOVE_TO_FOREGROUND = 1;
727 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700728 optional Activity activity = 4;
729}
David Chenc8a43242017-10-17 16:23:28 -0700730
731/**
David Chen9e3808c2017-11-20 17:25:34 -0800732 * Logs when an error is written to dropbox.
733 * Logged from:
734 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
735 */
736message DropboxErrorChanged {
737 // The uid if available. -1 means not available.
738 optional int32 uid = 1;
739
740 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
741 optional string tag = 2;
742
743 // The name of the process.
744 optional string process_name = 3;
745
746 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800747 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800748
749 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800750 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800751
752 // The activity name if available.
753 optional string activity_name = 6;
754
David Chen6e3e6cb2018-01-03 16:14:06 -0800755 // The package name if available.
756 optional string package_name = 7;
757
David Chen9e3808c2017-11-20 17:25:34 -0800758 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800759 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800760}
761
David Chen0a368b22017-12-06 16:28:16 -0800762/*
763 * Allows other apps to push events into statsd.
764 * Logged from:
765 * frameworks/base/core/java/android/util/StatsLog.java
766 */
767message AppHook {
768 // The uid of the application that sent this custom atom.
769 optional int32 uid = 1;
770
771 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
772 optional int32 label = 2;
773
774 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
775 // predicates for the metrics).
776 enum State {
777 UNKNOWN = 0;
778 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
779 STOP = 2;
780 START = 3;
781 }
782 optional State state = 3;
783}
784
David Chen9e3808c2017-11-20 17:25:34 -0800785/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800786 * Logs when statsd detects an anomaly.
787 *
788 * Logged from:
789 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
790 */
791message AnomalyDetected {
792 // Uid that owns the config whose anomaly detection alert fired.
793 optional int32 config_uid = 1;
794
Yangster-mac94e197c2018-01-02 16:03:03 -0800795 // Id of the config whose anomaly detection alert fired.
796 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800797
Yangster-mac94e197c2018-01-02 16:03:03 -0800798 // Id of the alert (i.e. name of the anomaly that was detected).
799 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800800}
801
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000802message AppStartChanged {
803 // The uid if available. -1 means not available.
804 optional int32 uid = 1;
805
806 // The app package name.
807 optional string pkg_name = 2;
808
809 enum TransitionType {
810 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
811 WARM = 1;
812 HOT = 2;
813 COLD = 3;
814 }
815 // The transition type.
816 optional TransitionType type = 3;
817
818 // The activity name.
819 optional string activity_name = 4;
820
821 // The name of the calling app. Empty if not set.
822 optional string calling_pkg_name = 5;
823
824 // Whether the app is an instant app.
825 optional bool is_instant_app = 6;
826
827 // Device uptime when activity started.
828 optional int64 activity_start_msec = 7;
829
Bookatz80d11a02018-01-16 10:46:35 -0800830 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000831
832 optional int32 transition_delay_msec = 9;
833 // -1 if not set.
834 optional int32 starting_window_delay_msec = 10;
835 // -1 if not set.
836 optional int32 bind_application_delay_msec = 11;
837 optional int32 windows_drawn_delay_msec = 12;
838
839 // Empty if not set.
840 optional string launch_token = 13;
841
842}
843
844message AppStartCancelChanged {
845 // The uid if available. -1 means not available.
846 optional int32 uid = 1;
847
848 // The app package name.
849 optional string pkg_name = 2;
850
851 enum TransitionType {
852 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
853 WARM = 1;
854 HOT = 2;
855 COLD = 3;
856 }
857 // The transition type.
858 optional TransitionType type = 3;
859
860 // The activity name.
861 optional string activity_name = 4;
862}
863
864message AppStartFullyDrawnChanged {
865 // The uid if available. -1 means not available.
866 optional int32 uid = 1;
867
868 // The app package name.
869 optional string pkg_name = 2;
870
871 enum TransitionType {
872 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
873 WITH_BUNDLE = 1;
874 WITHOUT_BUNDLE = 2;
875 }
876 // The transition type.
877 optional TransitionType type = 3;
878
879 // The activity name.
880 optional string activity_name = 4;
881
882 optional bool transition_process_running = 5;
883
884 // App startup time (until call to Activity#reportFullyDrawn()).
885 optional int64 app_startup_time_ms = 6;
886}
887
Bookatz8fcd09a2017-12-18 13:01:10 -0800888/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800889 * Logs a picture-in-picture action
890 * Logged from:
891 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
892 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
893 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
894 */
895message PictureInPictureStateChanged {
896 optional int32 uid = 1;
897
898 optional string package_name = 2;
899
900 optional string class_name = 3;
901
902 // Picture-in-Picture action occurred, similar to
903 // frameworks/base/proto/src/metrics_constants.proto
904 enum State {
905 ENTERED = 1;
906 EXPANDED_TO_FULL_SCREEN = 2;
907 MINIMIZED = 3;
908 DISMISSED = 4;
909 }
910 optional State state = 4;
911}
912
913/**
David Chenc8a43242017-10-17 16:23:28 -0700914 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
915 *
916 * Pulled from:
917 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
918 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800919message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700920 optional int32 uid = 1;
921
922 optional int64 rx_bytes = 2;
923
924 optional int64 rx_packets = 3;
925
926 optional int64 tx_bytes = 4;
927
928 optional int64 tx_packets = 5;
929}
930
931/**
932 * Pulls bytes transferred via wifi (separated by foreground and background usage).
933 *
934 * Pulled from:
935 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
936 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800937message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700938 optional int32 uid = 1;
939
940 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
941 optional int32 is_foreground = 2;
942
943 optional int64 rx_bytes = 3;
944
945 optional int64 rx_packets = 4;
946
947 optional int64 tx_bytes = 5;
948
949 optional int64 tx_packets = 6;
950}
951
952/**
953 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
954 *
955 * Pulled from:
956 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
957 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800958message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700959 optional int32 uid = 1;
960
961 optional int64 rx_bytes = 2;
962
963 optional int64 rx_packets = 3;
964
965 optional int64 tx_bytes = 4;
966
967 optional int64 tx_packets = 5;
968}
969
970/**
971 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
972 *
973 * Pulled from:
974 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
975 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800976message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700977 optional int32 uid = 1;
978
979 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
980 optional int32 is_foreground = 2;
981
982 optional int64 rx_bytes = 3;
983
984 optional int64 rx_packets = 4;
985
986 optional int64 tx_bytes = 5;
987
988 optional int64 tx_packets = 6;
989}
990
991/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800992 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
993 *
994 * Pulled from:
995 * StatsCompanionService
996 */
997message BluetoothBytesTransfer {
998 optional int32 uid = 1;
999
1000 optional int64 rx_bytes = 2;
1001
1002 optional int64 tx_bytes = 3;
1003}
1004
1005/**
David Chenc8a43242017-10-17 16:23:28 -07001006 * Pulls the kernel wakelock durations. This atom is adapted from
1007 * android/internal/os/KernelWakelockStats.java
1008 *
1009 * Pulled from:
1010 * StatsCompanionService using KernelWakelockReader.
1011 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001012message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001013 optional string name = 1;
1014
1015 optional int32 count = 2;
1016
1017 optional int32 version = 3;
1018
1019 optional int64 time = 4;
1020}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001021
Chenjie Yu05013b32017-11-21 10:21:41 -08001022/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001023 * Pulls low power state information. This includes platform and subsystem sleep state information,
1024 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001025 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001026 * hardware/interfaces/power/1.1/types.hal
1027 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001028message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001029 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1030 // YYY is corresponding voter name.
1031 // If there are no voters, the format should just be XXX (with no dot).
1032 // XXX and YYY should not contain a "." in it.
1033 optional string name = 1;
1034 // The number of times it entered, or voted for entering the sleep state
1035 optional uint64 count = 2;
1036 // The length of time spent in, or spent voting for, the sleep state
1037 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001038}
David Chen21582962017-11-01 17:32:46 -07001039
1040/**
1041 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1042 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1043 * attributed back to the parent (host) uid. One example is Chrome.
1044 *
1045 * Logged from:
1046 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1047 */
1048message IsolatedUidChanged {
1049 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1050 optional int32 parent_uid = 1;
1051
1052 optional int32 isolated_uid = 2;
1053
1054 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1055 // be removed before if it's used for another parent uid.
1056 optional int32 is_create = 3;
1057}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001058
Chenjie Yu05013b32017-11-21 10:21:41 -08001059/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001060 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001061 * Pulls the time the cpu spend on the frequency index. Frequency index
1062 * starts from highest to lowest. The value should be monotonically
1063 * increasing since boot. However, if there is a cpu
1064 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001065 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001066message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001067 optional uint32 cluster = 1;
1068 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001069 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001070}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001071
Chenjie Yu05013b32017-11-21 10:21:41 -08001072/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001073 * Pulls Cpu Time Per Uid.
1074 * Note that isolated process uid time should be attributed to host uids.
1075 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001076message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001077 optional uint64 uid = 1;
1078 optional uint64 user_time_ms = 2;
1079 optional uint64 sys_time_ms = 3;
1080}
1081
1082/**
1083 * Pulls Cpu Time Per Uid per frequency.
1084 * Note that isolated process uid time should be attributed to host uids.
1085 * For each uid, we order the time by descending frequencies.
1086 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001087message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001088 optional uint64 uid = 1;
1089 optional uint64 freq_idx = 2;
1090 optional uint64 time_ms = 3;
1091}
Hugo Benichi884970e2017-11-14 22:42:46 +09001092
1093/*
1094 * Logs the reception of an incoming network packet causing the main system to wake up for
1095 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1096 * and processed by WakeupController.cpp.
1097 */
1098message PacketWakeupOccurred {
1099 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1100 // delivered nowhere.
1101 optional int32 uid = 1;
1102 // The interface name on which the packet was received.
1103 optional string iface = 2;
1104 // The ethertype value of the packet.
1105 optional int32 ethertype = 3;
1106 // String representation of the destination MAC address of the packet.
1107 optional string destination_hardware_address = 4;
1108 // String representation of the source address of the packet if this was an IP packet.
1109 optional string source_ip = 5;
1110 // String representation of the destination address of the packet if this was an IP packet.
1111 optional string destination_ip = 6;
1112 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1113 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1114 // families.
1115 optional int32 ip_next_header = 7;
1116 // The source port if this was a TCP or UDP packet.
1117 optional int32 source_port = 8;
1118 // The destination port if this was a TCP or UDP packet.
1119 optional int32 destination_port = 9;
1120}
Chenjie Yu05013b32017-11-21 10:21:41 -08001121
1122/**
1123 * Pulls Wifi Controller Activity Energy Info
1124 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001125message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001126 // timestamp(wall clock) of record creation
1127 optional uint64 timestamp_ms = 1;
1128 // stack reported state
1129 // TODO: replace this with proto enum
1130 optional int32 stack_state = 2;
1131 // tx time in ms
1132 optional uint64 controller_tx_time_ms = 3;
1133 // rx time in ms
1134 optional uint64 controller_rx_time_ms = 4;
1135 // idle time in ms
1136 optional uint64 controller_idle_time_ms = 5;
1137 // product of current(mA), voltage(V) and time(ms)
1138 optional uint64 controller_energy_used = 6;
1139}
1140
1141/**
1142 * Pulls Modem Activity Energy Info
1143 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001144message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001145 // timestamp(wall clock) of record creation
1146 optional uint64 timestamp_ms = 1;
1147 // sleep time in ms.
1148 optional uint64 sleep_time_ms = 2;
1149 // idle time in ms
1150 optional uint64 controller_idle_time_ms = 3;
1151 /**
1152 * Tx power index
1153 * index 0 = tx_power < 0dBm
1154 * index 1 = 0dBm < tx_power < 5dBm
1155 * index 2 = 5dBm < tx_power < 15dBm
1156 * index 3 = 15dBm < tx_power < 20dBm
1157 * index 4 = tx_power > 20dBm
1158 */
1159 // tx time in ms at power level 0
1160 optional uint64 controller_tx_time_pl0_ms = 4;
1161 // tx time in ms at power level 1
1162 optional uint64 controller_tx_time_pl1_ms = 5;
1163 // tx time in ms at power level 2
1164 optional uint64 controller_tx_time_pl2_ms = 6;
1165 // tx time in ms at power level 3
1166 optional uint64 controller_tx_time_pl3_ms = 7;
1167 // tx time in ms at power level 4
1168 optional uint64 controller_tx_time_pl4_ms = 8;
1169 // rx time in ms at power level 5
1170 optional uint64 controller_rx_time_ms = 9;
1171 // product of current(mA), voltage(V) and time(ms)
1172 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001173}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001174
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001175/**
1176 * Pulls Bluetooth Activity Energy Info
1177 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1178 */
1179message BluetoothActivityInfo {
1180 // timestamp(wall clock) of record creation
1181 optional uint64 timestamp_ms = 1;
1182 // bluetooth stack state
1183 optional int32 bluetooth_stack_state = 2;
1184 // tx time in ms
1185 optional uint64 controller_tx_time_ms = 3;
1186 // rx time in ms
1187 optional uint64 controller_rx_time_ms = 4;
1188 // idle time in ms
1189 optional uint64 controller_idle_time_ms = 5;
1190 // product of current(mA), voltage(V) and time(ms)
1191 optional uint64 energy_used = 6;
1192}
1193
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001194/*
1195 * Logs the memory stats for a process
1196 */
Rajeev Kumar27572b9a2018-01-23 16:12:51 -08001197message ProcessMemoryStat {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001198 // The uid if available. -1 means not available.
1199 optional int32 uid = 1;
1200
Rajeev Kumar27572b9a2018-01-23 16:12:51 -08001201 // The process name.
1202 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001203
1204 // # of page-faults
1205 optional int64 pgfault = 3;
1206
1207 // # of major page-faults
1208 optional int64 pgmajfault = 4;
1209
1210 // RSS+CACHE(+SWAP)
1211 optional int64 usage_in_bytes = 5;
1212}
1213
1214/*
1215 * Logs the event when LMKD kills a process to reduce memory pressure
1216 * Logged from:
1217 * system/core/lmkd/lmkd.c
1218 */
1219message LmkEventOccurred {
1220 // The uid if available. -1 means not available.
1221 optional int32 uid = 1;
1222
Rajeev Kumar27572b9a2018-01-23 16:12:51 -08001223 // The process name.
1224 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001225
1226 // oom adj score.
1227 optional int32 oom_score = 3;
1228
Rajeev Kumar27572b9a2018-01-23 16:12:51 -08001229 // # of page-faults
1230 optional int64 pgfault = 4;
1231
1232 // # of major page-faults
1233 optional int64 pgmajfault = 5;
1234
1235 // RSS+CACHE(+SWAP)
1236 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001237}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001238
1239/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001240 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001241 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001242message SystemElapsedRealtime {
1243 optional uint64 time_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001244}
1245
1246/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001247 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001248 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001249message SystemUptime {
1250 // Milliseconds since the system was booted.
1251 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1252 // for external input).
1253 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1254 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001255}
1256
1257/*
1258 * Reads from /proc/uid_concurrent_active_time which has the format:
1259 * active: X (X is # cores)
1260 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1261 * [uid1]: [time-0] [time-1] [time-2] ... ...
1262 * ...
1263 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1264 * The file contains a monotonically increasing count of time for a single boot.
1265 */
1266message CpuActiveTime {
1267 optional uint64 uid = 1;
1268 optional uint64 idx = 2;
1269 optional uint64 time_ms = 3;
1270}
1271
1272/**
1273 * Reads from /proc/uid_concurrent_policy_time which has the format:
1274 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1275 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1276 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1277 * ...
1278 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1279 * The file contains a monotonically increasing count of time for a single boot.
1280 */
1281message CpuClusterTime {
1282 optional uint64 uid = 1;
1283 optional uint64 idx = 2;
1284 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001285}
1286
1287/*
1288 * Pulls free disk space, for data, system partition and temporary directory.
1289 */
1290message DiskSpace {
1291 // available bytes in data partition
1292 optional uint64 data_available_bytes = 1;
1293 // available bytes in system partition
1294 optional uint64 system_available_bytes = 2;
1295 // available bytes in download cache or temp directories
1296 optional uint64 temp_available_bytes = 3;
1297}