blob: ba4f48008e7a7d522978e94e34b77beeb6ed3690 [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
Yao Chend54f9dd2017-10-17 17:37:48 +000019// TODO: Not the right package and class name
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070021option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080022option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070023
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080025import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080026import "frameworks/base/core/proto/android/server/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/telephony/enums.proto";
28import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080029
Yao Chend54f9dd2017-10-17 17:37:48 +000030/**
Stefan Lafonae2df012017-11-14 09:17:21 -080031 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000032 * raw stats log events from the Android system, also known as "atoms."
33 *
34 * This field contains a single oneof with all of the available messages.
35 * The stats-log-api-gen tool runs as part of the Android build and
36 * generates the android.util.StatsLog class, which contains the constants
37 * and methods that Android uses to log.
38 *
Stefan Lafonae2df012017-11-14 09:17:21 -080039 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000040 * Instead, statsd on Android constructs these messages synthetically,
41 * in the format defined here and in stats_log.proto.
42 */
Stefan Lafonae2df012017-11-14 09:17:21 -080043message Atom {
44 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070045 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070046 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
47 BleScanStateChanged ble_scan_state_changed = 2;
48 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
49 BleScanResultReceived ble_scan_result_received = 4;
50 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080051 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070052 SyncStateChanged sync_state_changed = 7;
53 ScheduledJobStateChanged scheduled_job_state_changed = 8;
54 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070055 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080056 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
57 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
58 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
59 // TODO: 14-19 are blank, but need not be
60 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
61 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
62 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070063 AudioStateChanged audio_state_changed = 23;
64 MediaCodecActivityChanged media_codec_activity_changed = 24;
65 CameraStateChanged camera_state_changed = 25;
66 FlashlightStateChanged flashlight_state_changed = 26;
67 UidProcessStateChanged uid_process_state_changed = 27;
68 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
69 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070070 BatteryLevelChanged battery_level_changed = 30;
71 ChargingStateChanged charging_state_changed = 31;
72 PluggedStateChanged plugged_state_changed = 32;
73 DeviceTemperatureReported device_temperature_reported = 33;
74 DeviceOnStatusChanged device_on_status_changed = 34;
75 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
76 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070077 WifiLockStateChanged wifi_lock_state_changed = 37;
78 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
79 WifiScanStateChanged wifi_scan_state_changed = 39;
80 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070081 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070082 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070083 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090084 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080085 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080086 AnomalyDetected anomaly_detected = 46;
87 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000088 AppStartChanged app_start_changed = 48;
89 AppStartCancelChanged app_start_cancel_changed = 49;
90 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080091 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080092 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080093 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080094 LmkStateChanged lmk_state_changed = 54;
95 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080096 ShutdownSequenceReported shutdown_sequence_reported = 56;
Bookatzc1a050a2017-10-10 15:49:28 -070097 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000098 }
David Chenc8a43242017-10-17 16:23:28 -070099
David Chen6e3e6cb2018-01-03 16:14:06 -0800100 // Pulled events will start at field 10000.
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800101 // Next: 10019
David Chenc8a43242017-10-17 16:23:28 -0700102 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800103 WifiBytesTransfer wifi_bytes_transfer = 10000;
104 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
105 MobileBytesTransfer mobile_bytes_transfer = 10002;
106 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800107 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800108 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800109 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800110 CpuTimePerFreq cpu_time_per_freq = 10008;
111 CpuTimePerUid cpu_time_per_uid = 10009;
112 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
113 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
114 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800115 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800116 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800117 SystemElapsedRealtime system_elapsed_realtime = 10014;
118 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800119 CpuActiveTime cpu_active_time = 10016;
120 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800121 DiskSpace disk_space = 10018;
David Chenc8a43242017-10-17 16:23:28 -0700122 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700123}
124
Yao Chend54f9dd2017-10-17 17:37:48 +0000125/**
Yangster-mac20877162017-12-22 17:19:39 -0800126 * This proto represents a node of an attribution chain.
127 * Note: All attribution chains are represented as a repeated field of type
128 * AttributionNode. It is understood that in such arrays, the order is that
129 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000130 */
Yangster-mac20877162017-12-22 17:19:39 -0800131message AttributionNode {
132 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800133 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800134
Yangster-mac20877162017-12-22 17:19:39 -0800135 // The (optional) string tag for an element in the attribution chain. If the
136 // element has no tag, it is encoded as an empty string.
137 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700138}
139
Yao Chend54f9dd2017-10-17 17:37:48 +0000140/*
141 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800142 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000143 *
144 * RULES:
145 * - The field ids for each atom must start at 1, and count upwards by 1.
146 * Skipping field ids is not allowed.
147 * - These form an API, so renaming, renumbering or removing fields is
148 * not allowed between android releases. (This is not currently enforced,
149 * but there will be a tool to enforce this restriction).
150 * - The types must be built-in protocol buffer types, namely, no sub-messages
151 * are allowed (yet). The bytes type is also not allowed.
152 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800153 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000154 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800155 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000156 * - A field that is a uid should be a string field, tagged with the [xxx]
157 * annotation. The generated code on android will be represented by UIDs,
158 * and those UIDs will be translated in xxx to those strings.
159 *
160 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700161 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000162 * - If there is a UID, it goes first. Think in an object-oriented fashion.
163 * *****************************************************************************
164 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700165
Yao Chend54f9dd2017-10-17 17:37:48 +0000166/**
167 * Logs when the screen state changes.
168 *
169 * Logged from:
170 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
171 */
172message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800173 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
174 optional android.view.DisplayStateEnum state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700175}
Yao Chend54f9dd2017-10-17 17:37:48 +0000176
177/**
Bookatzc1a050a2017-10-10 15:49:28 -0700178 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 *
180 * Logged from:
181 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
182 */
Bookatzc1a050a2017-10-10 15:49:28 -0700183message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
185
Bookatzdb026a22018-01-10 19:01:56 -0800186 // The state, from frameworks/base/core/proto/android/app/enums.proto.
187 optional android.app.ProcessStateEnum state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000188}
189
190/**
Bookatzc1a050a2017-10-10 15:49:28 -0700191 * Logs that a process started, finished, crashed, or ANRed.
192 *
193 * Logged from:
194 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
195 */
196message ProcessLifeCycleStateChanged {
Bookatzc1a050a2017-10-10 15:49:28 -0700197 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
198
199 // TODO: What is this?
200 optional string name = 2;
201
Bookatzddccf0a2017-11-28 16:48:14 -0800202 // What lifecycle state the process changed to.
203 // This enum is specific to atoms.proto.
204 enum Event {
205 PROCESS_FINISHED = 0;
206 PROCESS_STARTED = 1;
207 PROCESS_CRASHED = 2;
208 PROCESS_ANRED = 3;
209 }
210 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700211}
212
Bookatzc1a050a2017-10-10 15:49:28 -0700213/**
214 * Logs when the ble scan state changes.
215 *
216 * Logged from:
217 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
218 */
219message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800220 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700221
222 enum State {
223 OFF = 0;
224 ON = 1;
225 }
226 optional State state = 2;
227}
228
229/**
230 * Logs when an unoptimized ble scan state changes.
231 *
232 * Logged from:
233 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
234 */
235// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
236message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800237 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700238
239 enum State {
240 OFF = 0;
241 ON = 1;
242 }
243 optional State state = 2;
244}
245
246/**
247 * Logs reporting of a ble scan finding results.
248 *
249 * Logged from:
250 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
251 */
252// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
253message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800254 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700255
256 // Number of ble scan results returned.
257 optional int32 num_of_results = 2;
258}
259
260/**
261 * Logs when a sensor state changes.
262 *
263 * Logged from:
264 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
265 */
266message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800267 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700268
269 // TODO: Is there a way to get the actual name of the sensor?
270 // The id (int) of the sensor.
271 optional int32 sensor_id = 2;
272
273 enum State {
274 OFF = 0;
275 ON = 1;
276 }
277 optional State state = 3;
278}
279
280
281/**
282 * Logs when GPS state changes.
283 *
284 * Logged from:
285 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
286 */
287message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800288 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700289
290 enum State {
291 OFF = 0;
292 ON = 1;
293 }
294 optional State state = 2;
295}
296
297
298/**
299 * Logs when a sync manager sync state changes.
300 *
301 * Logged from:
302 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
303 */
304message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800305 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700306
307 // Name of the sync (as named in the app)
308 optional string name = 2;
309
310 enum State {
311 OFF = 0;
312 ON = 1;
313 }
314 optional State state = 3;
315}
316
317/**
318 * Logs when a job scheduler job state changes.
319 *
320 * Logged from:
321 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
322 */
323message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800324 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700325
326 // Name of the job (as named in the app)
327 optional string name = 2;
328
329 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800330 FINISHED = 0;
331 STARTED = 1;
332 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700333 }
334 optional State state = 3;
335
336 // TODO: Consider adding the stopReason (int)
337}
338
339/**
340 * Logs when the audio state changes.
341 *
342 * Logged from:
343 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
344 */
345message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800346 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700347
348 enum State {
349 OFF = 0;
350 ON = 1;
351 }
352 optional State state = 2;
353}
354
355/**
356 * Logs when the video codec state changes.
357 *
358 * Logged from:
359 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
360 */
361message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800362 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700363
364 enum State {
365 OFF = 0;
366 ON = 1;
367 }
368 optional State state = 2;
369}
370
371/**
372 * Logs when the flashlight state changes.
373 *
374 * Logged from:
375 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
376 */
377message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800378 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700379
380 enum State {
381 OFF = 0;
382 ON = 1;
383 }
384 optional State state = 2;
385}
386
387/**
388 * Logs when the camera state changes.
389 *
390 * Logged from:
391 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
392 */
393message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800394 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700395
396 enum State {
397 OFF = 0;
398 ON = 1;
399 }
400 optional State state = 2;
401}
402
403/**
404 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000405 *
406 * Logged from:
407 * TODO
408 */
Bookatzd6746242017-10-24 18:39:35 -0700409message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800410 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000411
Bookatz1a1b0462018-01-12 11:47:03 -0800412 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
413 // From frameworks/base/core/proto/android/os/enums.proto.
414 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700415
416 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
417 optional string tag = 3;
418
419 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800420 RELEASE = 0;
421 ACQUIRE = 1;
422 CHANGE_RELEASE = 2;
423 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700424 }
425 optional State state = 4;
426}
427
428/**
Bookatzc1a050a2017-10-10 15:49:28 -0700429 * Logs when a partial wakelock is considered 'long' (over 1 min).
430 *
431 * Logged from:
432 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
433 */
434message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800435 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700436
Yao Chend54f9dd2017-10-17 17:37:48 +0000437 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
438 optional string tag = 2;
439
Bookatzc1a050a2017-10-10 15:49:28 -0700440 // TODO: I have no idea what this is.
441 optional string history_tag = 3;
442
443 enum State {
444 OFF = 0;
445 ON = 1;
446 }
447 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000448}
449
Bookatzc1a050a2017-10-10 15:49:28 -0700450/**
451 * Logs Battery Saver state change.
452 *
453 * Logged from:
454 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
455 */
456message BatterySaverModeStateChanged {
457 enum State {
458 OFF = 0;
459 ON = 1;
460 }
461 optional State state = 1;
462}
463
464/**
465 * Logs Doze mode state change.
466 *
467 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800468 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700469 */
470message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800471 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800472}
473
474
475/**
476 * Logs state change of Doze mode including maintenance windows.
477 *
478 * Logged from:
479 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
480 */
481message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800482 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700483}
484
485/**
486 * Logs screen brightness level.
487 *
488 * Logged from:
489 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
490 */
491message ScreenBrightnessChanged {
492 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
493 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700494}
495
496/**
497 * Logs battery level (percent full, from 0 to 100).
498 *
499 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700500 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700501 */
502message BatteryLevelChanged {
503 // Battery level. Should be in [0, 100].
504 optional int32 battery_level = 1;
505}
506
507/**
508 * Logs change in charging status of the device.
509 *
510 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700511 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700512 */
513message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800514 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
515 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700516}
517
518/**
519 * Logs whether the device is plugged in, and what power source it is using.
520 *
521 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700522 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700523 */
524message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800525 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
526 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700527}
528
529/**
530 * Logs the temperature of the device, in tenths of a degree Celsius.
531 *
532 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700533 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700534 */
535message DeviceTemperatureReported {
536 // Temperature in tenths of a degree C.
537 optional int32 temperature = 1;
538}
539
540// TODO: Define this more precisely.
541// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
542/**
543 * Logs when the device turns off or on.
544 *
545 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700546 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700547 */
548message DeviceOnStatusChanged {
549 enum State {
550 OFF = 0;
551 ON = 1;
552 }
553 optional State state = 1;
554}
555
556/**
557 * Logs when an app's wakeup alarm fires.
558 *
559 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700560 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700561 */
562message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800563 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800564
565 // Name of the wakeup alarm.
566 optional string tag = 2;
567}
568
569/**
570 * Logs when an an app causes the mobile radio to change state.
571 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
572 *
573 * Logged from:
574 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
575 */
576message MobileRadioPowerStateChanged {
577 // TODO: Add attribution instead of uid?
578 optional int32 uid = 1;
579
Bookatz1a1b0462018-01-12 11:47:03 -0800580 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
581 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800582}
583
584/**
585 * Logs when an an app causes the wifi radio to change state.
586 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
587 *
588 * Logged from:
589 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
590 */
591message WifiRadioPowerStateChanged {
592 // TODO: Add attribution instead of uid?
593 optional int32 uid = 1;
594
Bookatz1a1b0462018-01-12 11:47:03 -0800595 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
596 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700597}
598
599/**
600 * Logs kernel wakeup reasons and aborts.
601 *
602 * Logged from:
603 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
604 */
605message KernelWakeupReported {
606 // Name of the kernel wakeup reason (or abort).
607 optional string wakeup_reason_name = 1;
608
609 // Duration (in microseconds) for the wake-up interrupt to be serviced.
610 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700611}
612
613/**
614 * Logs wifi locks held by an app.
615 *
616 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700617 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700618 */
619message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800620 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700621
622 enum State {
623 OFF = 0;
624 ON = 1;
625 }
626 optional State state = 2;
627}
628
629/**
630 * Logs wifi signal strength changes.
631 *
632 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700633 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700634 */
635message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800636 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
637 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700638}
639
640/**
641 * Logs wifi scans performed by an app.
642 *
643 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700644 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700645 */
646message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800647 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700648
649 enum State {
650 OFF = 0;
651 ON = 1;
652 }
653 optional State state = 2;
654}
655
656/**
Tej Singh4503e102018-01-04 14:35:01 -0800657 * Logs wifi multicast locks held by an app
658 *
659 * Logged from:
660 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
661 */
662message WifiMulticastLockStateChanged {
663 repeated AttributionNode attribution_node = 1;
664
665 enum State {
666 OFF = 0;
667 ON = 1;
668 }
669 optional State state = 2;
670}
671
672/**
Tej Singh1ea42892018-01-19 09:27:00 -0800673 * Logs shutdown reason and duration on next boot.
674 *
675 * Logged from:
676 * frameworks/base/core/java/com/android/server/BootReceiver.java
677 */
678message ShutdownSequenceReported {
679 // True if shutdown is for a reboot. Default: false if we do not know.
680 optional bool reboot = 1;
681
682 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
683 optional string reason = 2;
684
685 // Beginning of shutdown time in ms using wall clock time since unix epoch.
686 // Default: 0 if no start time received.
687 optional int64 start_time_ms = 3;
688
689 // Duration of shutdown in ms. Default: 0 if no duration received.
690 optional int64 duration_ms = 4;
691}
692
693/**
Bookatze5885242017-10-24 20:10:31 -0700694 * Logs phone signal strength changes.
695 *
696 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700697 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700698 */
699message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800700 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
701 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700702}
703
704/**
705 * Logs that a setting was updated.
706 * Logged from:
707 * frameworks/base/core/java/android/provider/Settings.java
708 * The tag and is_default allow resetting of settings to default values based on the specified
709 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
710 */
711message SettingChanged {
712 // The name of the setting.
713 optional string setting = 1;
714
715 // The change being imposed on this setting. May represent a number, eg "3".
716 optional string value = 2;
717
718 // The new value of this setting. For most settings, this is same as value. For some settings,
719 // value is +X or -X where X represents an element in a set. For example, if the previous value
720 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
721 // The +/- feature is currently only used for location_providers_allowed.
722 optional string new_value = 3;
723
724 // The previous value of this setting.
725 optional string prev_value = 4;
726
727 // The tag used with the is_default for resetting sets of settings. This is generally null.
728 optional string tag = 5;
729
730 // 1 indicates that this setting with tag should be resettable.
731 optional int32 is_default = 6;
732
733 // The user ID associated. Defined in android/os/UserHandle.java
734 optional int32 user = 7;
735}
Chenjie Yub3dda412017-10-24 13:41:59 -0700736
Chenjie Yu05013b32017-11-21 10:21:41 -0800737/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700738 * Logs activity going to foreground or background
739 *
740 * Logged from:
741 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
742 */
743message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800744 optional int32 uid = 1;
745 optional string pkg_name = 2;
746 optional string class_name = 3;
747
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700748 enum Activity {
749 MOVE_TO_BACKGROUND = 0;
750 MOVE_TO_FOREGROUND = 1;
751 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700752 optional Activity activity = 4;
753}
David Chenc8a43242017-10-17 16:23:28 -0700754
755/**
David Chen9e3808c2017-11-20 17:25:34 -0800756 * Logs when an error is written to dropbox.
757 * Logged from:
758 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
759 */
760message DropboxErrorChanged {
761 // The uid if available. -1 means not available.
762 optional int32 uid = 1;
763
764 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
765 optional string tag = 2;
766
767 // The name of the process.
768 optional string process_name = 3;
769
770 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800771 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800772
773 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800774 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800775
776 // The activity name if available.
777 optional string activity_name = 6;
778
David Chen6e3e6cb2018-01-03 16:14:06 -0800779 // The package name if available.
780 optional string package_name = 7;
781
David Chen9e3808c2017-11-20 17:25:34 -0800782 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800783 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800784}
785
David Chen0a368b22017-12-06 16:28:16 -0800786/*
787 * Allows other apps to push events into statsd.
788 * Logged from:
789 * frameworks/base/core/java/android/util/StatsLog.java
790 */
791message AppHook {
792 // The uid of the application that sent this custom atom.
793 optional int32 uid = 1;
794
795 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
796 optional int32 label = 2;
797
798 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
799 // predicates for the metrics).
800 enum State {
801 UNKNOWN = 0;
802 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
803 STOP = 2;
804 START = 3;
805 }
806 optional State state = 3;
807}
808
David Chen9e3808c2017-11-20 17:25:34 -0800809/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800810 * Logs when statsd detects an anomaly.
811 *
812 * Logged from:
813 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
814 */
815message AnomalyDetected {
816 // Uid that owns the config whose anomaly detection alert fired.
817 optional int32 config_uid = 1;
818
Yangster-mac94e197c2018-01-02 16:03:03 -0800819 // Id of the config whose anomaly detection alert fired.
820 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800821
Yangster-mac94e197c2018-01-02 16:03:03 -0800822 // Id of the alert (i.e. name of the anomaly that was detected).
823 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800824}
825
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000826message AppStartChanged {
827 // The uid if available. -1 means not available.
828 optional int32 uid = 1;
829
830 // The app package name.
831 optional string pkg_name = 2;
832
833 enum TransitionType {
834 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
835 WARM = 1;
836 HOT = 2;
837 COLD = 3;
838 }
839 // The transition type.
840 optional TransitionType type = 3;
841
842 // The activity name.
843 optional string activity_name = 4;
844
845 // The name of the calling app. Empty if not set.
846 optional string calling_pkg_name = 5;
847
848 // Whether the app is an instant app.
849 optional bool is_instant_app = 6;
850
851 // Device uptime when activity started.
852 optional int64 activity_start_msec = 7;
853
Bookatz80d11a02018-01-16 10:46:35 -0800854 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000855
856 optional int32 transition_delay_msec = 9;
857 // -1 if not set.
858 optional int32 starting_window_delay_msec = 10;
859 // -1 if not set.
860 optional int32 bind_application_delay_msec = 11;
861 optional int32 windows_drawn_delay_msec = 12;
862
863 // Empty if not set.
864 optional string launch_token = 13;
865
866}
867
868message AppStartCancelChanged {
869 // The uid if available. -1 means not available.
870 optional int32 uid = 1;
871
872 // The app package name.
873 optional string pkg_name = 2;
874
875 enum TransitionType {
876 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
877 WARM = 1;
878 HOT = 2;
879 COLD = 3;
880 }
881 // The transition type.
882 optional TransitionType type = 3;
883
884 // The activity name.
885 optional string activity_name = 4;
886}
887
888message AppStartFullyDrawnChanged {
889 // The uid if available. -1 means not available.
890 optional int32 uid = 1;
891
892 // The app package name.
893 optional string pkg_name = 2;
894
895 enum TransitionType {
896 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
897 WITH_BUNDLE = 1;
898 WITHOUT_BUNDLE = 2;
899 }
900 // The transition type.
901 optional TransitionType type = 3;
902
903 // The activity name.
904 optional string activity_name = 4;
905
906 optional bool transition_process_running = 5;
907
908 // App startup time (until call to Activity#reportFullyDrawn()).
909 optional int64 app_startup_time_ms = 6;
910}
911
Bookatz8fcd09a2017-12-18 13:01:10 -0800912/**
Chenjie Yu52cacc62017-12-08 18:11:45 -0800913 * Logs a picture-in-picture action
914 * Logged from:
915 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
916 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
917 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
918 */
919message PictureInPictureStateChanged {
920 optional int32 uid = 1;
921
922 optional string package_name = 2;
923
924 optional string class_name = 3;
925
926 // Picture-in-Picture action occurred, similar to
927 // frameworks/base/proto/src/metrics_constants.proto
928 enum State {
929 ENTERED = 1;
930 EXPANDED_TO_FULL_SCREEN = 2;
931 MINIMIZED = 3;
932 DISMISSED = 4;
933 }
934 optional State state = 4;
935}
936
937/**
David Chenc8a43242017-10-17 16:23:28 -0700938 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
939 *
940 * Pulled from:
941 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
942 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800943message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700944 optional int32 uid = 1;
945
946 optional int64 rx_bytes = 2;
947
948 optional int64 rx_packets = 3;
949
950 optional int64 tx_bytes = 4;
951
952 optional int64 tx_packets = 5;
953}
954
955/**
956 * Pulls bytes transferred via wifi (separated by foreground and background usage).
957 *
958 * Pulled from:
959 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
960 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800961message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700962 optional int32 uid = 1;
963
964 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
965 optional int32 is_foreground = 2;
966
967 optional int64 rx_bytes = 3;
968
969 optional int64 rx_packets = 4;
970
971 optional int64 tx_bytes = 5;
972
973 optional int64 tx_packets = 6;
974}
975
976/**
977 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
978 *
979 * Pulled from:
980 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
981 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800982message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700983 optional int32 uid = 1;
984
985 optional int64 rx_bytes = 2;
986
987 optional int64 rx_packets = 3;
988
989 optional int64 tx_bytes = 4;
990
991 optional int64 tx_packets = 5;
992}
993
994/**
995 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
996 *
997 * Pulled from:
998 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
999 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001000message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001001 optional int32 uid = 1;
1002
1003 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1004 optional int32 is_foreground = 2;
1005
1006 optional int64 rx_bytes = 3;
1007
1008 optional int64 rx_packets = 4;
1009
1010 optional int64 tx_bytes = 5;
1011
1012 optional int64 tx_packets = 6;
1013}
1014
1015/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001016 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1017 *
1018 * Pulled from:
1019 * StatsCompanionService
1020 */
1021message BluetoothBytesTransfer {
1022 optional int32 uid = 1;
1023
1024 optional int64 rx_bytes = 2;
1025
1026 optional int64 tx_bytes = 3;
1027}
1028
1029/**
David Chenc8a43242017-10-17 16:23:28 -07001030 * Pulls the kernel wakelock durations. This atom is adapted from
1031 * android/internal/os/KernelWakelockStats.java
1032 *
1033 * Pulled from:
1034 * StatsCompanionService using KernelWakelockReader.
1035 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001036message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001037 optional string name = 1;
1038
1039 optional int32 count = 2;
1040
1041 optional int32 version = 3;
1042
1043 optional int64 time = 4;
1044}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001045
Chenjie Yu05013b32017-11-21 10:21:41 -08001046/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001047 * Pulls low power state information. This includes platform and subsystem sleep state information,
1048 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001049 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001050 * hardware/interfaces/power/1.1/types.hal
1051 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001052message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001053 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1054 // YYY is corresponding voter name.
1055 // If there are no voters, the format should just be XXX (with no dot).
1056 // XXX and YYY should not contain a "." in it.
1057 optional string name = 1;
1058 // The number of times it entered, or voted for entering the sleep state
1059 optional uint64 count = 2;
1060 // The length of time spent in, or spent voting for, the sleep state
1061 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001062}
David Chen21582962017-11-01 17:32:46 -07001063
1064/**
1065 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1066 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1067 * attributed back to the parent (host) uid. One example is Chrome.
1068 *
1069 * Logged from:
1070 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1071 */
1072message IsolatedUidChanged {
1073 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1074 optional int32 parent_uid = 1;
1075
1076 optional int32 isolated_uid = 2;
1077
1078 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1079 // be removed before if it's used for another parent uid.
1080 optional int32 is_create = 3;
1081}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001082
Chenjie Yu05013b32017-11-21 10:21:41 -08001083/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001084 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001085 * Pulls the time the cpu spend on the frequency index. Frequency index
1086 * starts from highest to lowest. The value should be monotonically
1087 * increasing since boot. However, if there is a cpu
1088 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001089 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001090message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001091 optional uint32 cluster = 1;
1092 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001093 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001094}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001095
Chenjie Yu05013b32017-11-21 10:21:41 -08001096/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001097 * Pulls Cpu Time Per Uid.
1098 * Note that isolated process uid time should be attributed to host uids.
1099 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001100message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001101 optional uint64 uid = 1;
1102 optional uint64 user_time_ms = 2;
1103 optional uint64 sys_time_ms = 3;
1104}
1105
1106/**
1107 * Pulls Cpu Time Per Uid per frequency.
1108 * Note that isolated process uid time should be attributed to host uids.
1109 * For each uid, we order the time by descending frequencies.
1110 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001111message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001112 optional uint64 uid = 1;
1113 optional uint64 freq_idx = 2;
1114 optional uint64 time_ms = 3;
1115}
Hugo Benichi884970e2017-11-14 22:42:46 +09001116
1117/*
1118 * Logs the reception of an incoming network packet causing the main system to wake up for
1119 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1120 * and processed by WakeupController.cpp.
1121 */
1122message PacketWakeupOccurred {
1123 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1124 // delivered nowhere.
1125 optional int32 uid = 1;
1126 // The interface name on which the packet was received.
1127 optional string iface = 2;
1128 // The ethertype value of the packet.
1129 optional int32 ethertype = 3;
1130 // String representation of the destination MAC address of the packet.
1131 optional string destination_hardware_address = 4;
1132 // String representation of the source address of the packet if this was an IP packet.
1133 optional string source_ip = 5;
1134 // String representation of the destination address of the packet if this was an IP packet.
1135 optional string destination_ip = 6;
1136 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1137 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1138 // families.
1139 optional int32 ip_next_header = 7;
1140 // The source port if this was a TCP or UDP packet.
1141 optional int32 source_port = 8;
1142 // The destination port if this was a TCP or UDP packet.
1143 optional int32 destination_port = 9;
1144}
Chenjie Yu05013b32017-11-21 10:21:41 -08001145
1146/**
1147 * Pulls Wifi Controller Activity Energy Info
1148 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001149message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001150 // timestamp(wall clock) of record creation
1151 optional uint64 timestamp_ms = 1;
1152 // stack reported state
1153 // TODO: replace this with proto enum
1154 optional int32 stack_state = 2;
1155 // tx time in ms
1156 optional uint64 controller_tx_time_ms = 3;
1157 // rx time in ms
1158 optional uint64 controller_rx_time_ms = 4;
1159 // idle time in ms
1160 optional uint64 controller_idle_time_ms = 5;
1161 // product of current(mA), voltage(V) and time(ms)
1162 optional uint64 controller_energy_used = 6;
1163}
1164
1165/**
1166 * Pulls Modem Activity Energy Info
1167 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001168message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001169 // timestamp(wall clock) of record creation
1170 optional uint64 timestamp_ms = 1;
1171 // sleep time in ms.
1172 optional uint64 sleep_time_ms = 2;
1173 // idle time in ms
1174 optional uint64 controller_idle_time_ms = 3;
1175 /**
1176 * Tx power index
1177 * index 0 = tx_power < 0dBm
1178 * index 1 = 0dBm < tx_power < 5dBm
1179 * index 2 = 5dBm < tx_power < 15dBm
1180 * index 3 = 15dBm < tx_power < 20dBm
1181 * index 4 = tx_power > 20dBm
1182 */
1183 // tx time in ms at power level 0
1184 optional uint64 controller_tx_time_pl0_ms = 4;
1185 // tx time in ms at power level 1
1186 optional uint64 controller_tx_time_pl1_ms = 5;
1187 // tx time in ms at power level 2
1188 optional uint64 controller_tx_time_pl2_ms = 6;
1189 // tx time in ms at power level 3
1190 optional uint64 controller_tx_time_pl3_ms = 7;
1191 // tx time in ms at power level 4
1192 optional uint64 controller_tx_time_pl4_ms = 8;
1193 // rx time in ms at power level 5
1194 optional uint64 controller_rx_time_ms = 9;
1195 // product of current(mA), voltage(V) and time(ms)
1196 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001197}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001198
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001199/**
1200 * Pulls Bluetooth Activity Energy Info
1201 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1202 */
1203message BluetoothActivityInfo {
1204 // timestamp(wall clock) of record creation
1205 optional uint64 timestamp_ms = 1;
1206 // bluetooth stack state
1207 optional int32 bluetooth_stack_state = 2;
1208 // tx time in ms
1209 optional uint64 controller_tx_time_ms = 3;
1210 // rx time in ms
1211 optional uint64 controller_rx_time_ms = 4;
1212 // idle time in ms
1213 optional uint64 controller_idle_time_ms = 5;
1214 // product of current(mA), voltage(V) and time(ms)
1215 optional uint64 energy_used = 6;
1216}
1217
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001218/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001219 * Logs the memory stats for an app on startup.
1220 * Logged from:
1221 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001222 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001223message AppStartMemoryStateCaptured {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001224 // The uid if available. -1 means not available.
1225 optional int32 uid = 1;
1226
Rajeev Kumar27572b92018-01-23 16:12:51 -08001227 // The process name.
1228 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001229
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001230 // The activity name.
1231 optional string activity_name = 3;
1232
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001233 // # of page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001234 optional int64 pgfault = 4;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001235
1236 // # of major page-faults
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001237 optional int64 pgmajfault = 5;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001238
1239 // RSS+CACHE(+SWAP)
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001240 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001241}
1242
1243/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001244 * Logs the memory stats for a process.
1245 */
1246message ProcessMemoryState {
1247 // The uid if available. -1 means not available.
1248 optional int32 uid = 1;
1249
1250 // The process name.
1251 optional string process_name = 2;
1252
1253 // oom adj score.
1254 optional int32 oom_score = 3;
1255
1256 // # of page-faults
1257 optional int64 pgfault = 4;
1258
1259 // # of major page-faults
1260 optional int64 pgmajfault = 5;
1261
1262 // RSS+CACHE(+SWAP)
1263 optional int64 usage_in_bytes = 6;
1264}
1265
1266/*
1267 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1268 * for LMK event.
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001269 * Logged from:
1270 * system/core/lmkd/lmkd.c
1271 */
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001272message LmkStateChanged {
1273 enum State {
1274 UNKNOWN = 0;
1275 START = 1;
1276 STOP = 2;
1277 }
1278 optional State state = 1;
1279}
1280
1281/*
1282 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1283 * Logged from:
1284 * system/core/lmkd/lmkd.c
1285 */
1286message LmkKillOccurred {
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001287 // The uid if available. -1 means not available.
1288 optional int32 uid = 1;
1289
Rajeev Kumar27572b92018-01-23 16:12:51 -08001290 // The process name.
1291 optional string process_name = 2;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001292
1293 // oom adj score.
1294 optional int32 oom_score = 3;
1295
Rajeev Kumar27572b92018-01-23 16:12:51 -08001296 // # of page-faults
1297 optional int64 pgfault = 4;
1298
1299 // # of major page-faults
1300 optional int64 pgmajfault = 5;
1301
1302 // RSS+CACHE(+SWAP)
1303 optional int64 usage_in_bytes = 6;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001304}
Chenjie Yu9da105b2018-01-13 12:41:08 -08001305
1306/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001307 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001308 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001309message SystemElapsedRealtime {
1310 optional uint64 time_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001311}
1312
1313/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001314 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001315 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001316message SystemUptime {
1317 // Milliseconds since the system was booted.
1318 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1319 // for external input).
1320 // It is not affected by clock scaling, idle, or other power saving mechanisms.
1321 optional uint64 uptime_ms = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001322}
1323
1324/*
1325 * Reads from /proc/uid_concurrent_active_time which has the format:
1326 * active: X (X is # cores)
1327 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1328 * [uid1]: [time-0] [time-1] [time-2] ... ...
1329 * ...
1330 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1331 * The file contains a monotonically increasing count of time for a single boot.
1332 */
1333message CpuActiveTime {
1334 optional uint64 uid = 1;
1335 optional uint64 idx = 2;
1336 optional uint64 time_ms = 3;
1337}
1338
1339/**
1340 * Reads from /proc/uid_concurrent_policy_time which has the format:
1341 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1342 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1343 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1344 * ...
1345 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1346 * The file contains a monotonically increasing count of time for a single boot.
1347 */
1348message CpuClusterTime {
1349 optional uint64 uid = 1;
1350 optional uint64 idx = 2;
1351 optional uint64 time_ms = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001352}
1353
1354/*
1355 * Pulls free disk space, for data, system partition and temporary directory.
1356 */
1357message DiskSpace {
1358 // available bytes in data partition
1359 optional uint64 data_available_bytes = 1;
1360 // available bytes in system partition
1361 optional uint64 system_available_bytes = 2;
1362 // available bytes in download cache or temp directories
1363 optional uint64 temp_available_bytes = 3;
1364}