blob: 8ba35b76435f089402e63b7b22ce2276b425f38e [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
Yao Chen9c1debe2018-02-19 14:39:19 -080024import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080025import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080026import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080028import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080029import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/telephony/enums.proto";
31import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080032
Yao Chend54f9dd2017-10-17 17:37:48 +000033/**
Stefan Lafonae2df012017-11-14 09:17:21 -080034 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000035 * raw stats log events from the Android system, also known as "atoms."
36 *
37 * This field contains a single oneof with all of the available messages.
38 * The stats-log-api-gen tool runs as part of the Android build and
39 * generates the android.util.StatsLog class, which contains the constants
40 * and methods that Android uses to log.
41 *
Stefan Lafonae2df012017-11-14 09:17:21 -080042 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000043 * Instead, statsd on Android constructs these messages synthetically,
44 * in the format defined here and in stats_log.proto.
45 */
Stefan Lafonae2df012017-11-14 09:17:21 -080046message Atom {
47 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070048 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070049 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
50 BleScanStateChanged ble_scan_state_changed = 2;
51 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
52 BleScanResultReceived ble_scan_result_received = 4;
53 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080054 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070055 SyncStateChanged sync_state_changed = 7;
56 ScheduledJobStateChanged scheduled_job_state_changed = 8;
57 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070058 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080059 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
60 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
61 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
62 // TODO: 14-19 are blank, but need not be
63 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
64 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
65 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070066 AudioStateChanged audio_state_changed = 23;
67 MediaCodecActivityChanged media_codec_activity_changed = 24;
68 CameraStateChanged camera_state_changed = 25;
69 FlashlightStateChanged flashlight_state_changed = 26;
70 UidProcessStateChanged uid_process_state_changed = 27;
71 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
72 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070073 BatteryLevelChanged battery_level_changed = 30;
74 ChargingStateChanged charging_state_changed = 31;
75 PluggedStateChanged plugged_state_changed = 32;
Tej Singh40298312018-02-16 00:15:09 -080076 // TODO: 33 is blank, but is available for use.
Bookatz8c6571b2017-10-24 15:04:41 -070077 DeviceOnStatusChanged device_on_status_changed = 34;
78 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
79 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070080 WifiLockStateChanged wifi_lock_state_changed = 37;
81 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
82 WifiScanStateChanged wifi_scan_state_changed = 39;
83 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070084 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070085 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070086 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090087 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080088 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080089 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080090 AppBreadcrumbReported app_breadcrumb_reported = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000091 AppStartChanged app_start_changed = 48;
92 AppStartCancelChanged app_start_cancel_changed = 49;
93 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080094 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080095 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080096 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080097 LmkStateChanged lmk_state_changed = 54;
98 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080099 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800100 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800101 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800102 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800103 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800104 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800105 KeyguardStateChanged keyguard_state_changed = 62;
106 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
107 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Rajeev Kumar51b54602018-03-01 12:18:26 -0800108 AppDied app_died=65;
Tej Singha883b372018-02-15 11:30:01 -0800109 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800110 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
111 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
112 BluetoothA2dpAudioStateChanged bluetooth_a2dp_audio_state_changed = 69;
Bookatzc1a050a2017-10-10 15:49:28 -0700113 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000114 }
David Chenc8a43242017-10-17 16:23:28 -0700115
David Chen6e3e6cb2018-01-03 16:14:06 -0800116 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800117 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700118 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800119 WifiBytesTransfer wifi_bytes_transfer = 10000;
120 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
121 MobileBytesTransfer mobile_bytes_transfer = 10002;
122 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800123 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800124 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800125 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800126 CpuTimePerFreq cpu_time_per_freq = 10008;
127 CpuTimePerUid cpu_time_per_uid = 10009;
128 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
129 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
130 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800131 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800132 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800133 SystemElapsedRealtime system_elapsed_realtime = 10014;
134 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800135 CpuActiveTime cpu_active_time = 10016;
136 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800137 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800138 RemainingBatteryCapacity remaining_battery_capacity = 10019;
139 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800140 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700141 }
yroa1fe77c2018-02-26 14:22:54 -0800142
143 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
144 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700145}
146
Yao Chend54f9dd2017-10-17 17:37:48 +0000147/**
Yangster-mac20877162017-12-22 17:19:39 -0800148 * This proto represents a node of an attribution chain.
149 * Note: All attribution chains are represented as a repeated field of type
150 * AttributionNode. It is understood that in such arrays, the order is that
151 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000152 */
Yangster-mac20877162017-12-22 17:19:39 -0800153message AttributionNode {
154 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800155 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800156
Yangster-mac20877162017-12-22 17:19:39 -0800157 // The (optional) string tag for an element in the attribution chain. If the
158 // element has no tag, it is encoded as an empty string.
159 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700160}
161
Yao Chend54f9dd2017-10-17 17:37:48 +0000162/*
163 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800164 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000165 *
166 * RULES:
167 * - The field ids for each atom must start at 1, and count upwards by 1.
168 * Skipping field ids is not allowed.
169 * - These form an API, so renaming, renumbering or removing fields is
170 * not allowed between android releases. (This is not currently enforced,
171 * but there will be a tool to enforce this restriction).
172 * - The types must be built-in protocol buffer types, namely, no sub-messages
173 * are allowed (yet). The bytes type is also not allowed.
174 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800175 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000176 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800177 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 * - A field that is a uid should be a string field, tagged with the [xxx]
179 * annotation. The generated code on android will be represented by UIDs,
180 * and those UIDs will be translated in xxx to those strings.
181 *
182 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700183 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 * - If there is a UID, it goes first. Think in an object-oriented fashion.
185 * *****************************************************************************
186 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700187
Yao Chend54f9dd2017-10-17 17:37:48 +0000188/**
189 * Logs when the screen state changes.
190 *
191 * Logged from:
192 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
193 */
194message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800195 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800196 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700197}
Yao Chend54f9dd2017-10-17 17:37:48 +0000198
199/**
Bookatzc1a050a2017-10-10 15:49:28 -0700200 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000201 *
202 * Logged from:
203 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
204 */
Bookatzc1a050a2017-10-10 15:49:28 -0700205message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800206 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000207
Bookatzdb026a22018-01-10 19:01:56 -0800208 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800209 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000210}
211
212/**
Bookatzc1a050a2017-10-10 15:49:28 -0700213 * Logs that a process started, finished, crashed, or ANRed.
214 *
215 * Logged from:
216 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
217 */
218message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800219 // TODO: should be a string tagged w/ uid annotation
220 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700221
David Chen0b5c90c2018-01-25 16:51:49 -0800222 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700223 optional string name = 2;
224
Bookatzddccf0a2017-11-28 16:48:14 -0800225 // What lifecycle state the process changed to.
226 // This enum is specific to atoms.proto.
227 enum Event {
228 PROCESS_FINISHED = 0;
229 PROCESS_STARTED = 1;
230 PROCESS_CRASHED = 2;
231 PROCESS_ANRED = 3;
232 }
233 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700234}
235
Bookatzc1a050a2017-10-10 15:49:28 -0700236/**
237 * Logs when the ble scan state changes.
238 *
239 * Logged from:
240 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
241 */
242message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800243 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700244
245 enum State {
246 OFF = 0;
247 ON = 1;
248 }
249 optional State state = 2;
250}
251
252/**
253 * Logs when an unoptimized ble scan state changes.
254 *
255 * Logged from:
256 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
257 */
258// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
259message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800260 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700261
262 enum State {
263 OFF = 0;
264 ON = 1;
265 }
266 optional State state = 2;
267}
268
269/**
270 * Logs reporting of a ble scan finding results.
271 *
272 * Logged from:
273 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
274 */
275// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
276message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800277 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700278
279 // Number of ble scan results returned.
280 optional int32 num_of_results = 2;
281}
282
283/**
284 * Logs when a sensor state changes.
285 *
286 * Logged from:
287 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
288 */
289message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800290 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700291
292 // TODO: Is there a way to get the actual name of the sensor?
293 // The id (int) of the sensor.
294 optional int32 sensor_id = 2;
295
296 enum State {
297 OFF = 0;
298 ON = 1;
299 }
300 optional State state = 3;
301}
302
303
304/**
305 * Logs when GPS state changes.
306 *
307 * Logged from:
308 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
309 */
310message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800311 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700312
313 enum State {
314 OFF = 0;
315 ON = 1;
316 }
317 optional State state = 2;
318}
319
320
321/**
322 * Logs when a sync manager sync state changes.
323 *
324 * Logged from:
325 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
326 */
327message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800328 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700329
David Chen0b5c90c2018-01-25 16:51:49 -0800330 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700331 optional string name = 2;
332
333 enum State {
334 OFF = 0;
335 ON = 1;
336 }
337 optional State state = 3;
338}
339
340/**
341 * Logs when a job scheduler job state changes.
342 *
343 * Logged from:
344 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
345 */
346message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800347 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700348
349 // Name of the job (as named in the app)
350 optional string name = 2;
351
352 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800353 FINISHED = 0;
354 STARTED = 1;
355 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700356 }
357 optional State state = 3;
358
359 // TODO: Consider adding the stopReason (int)
360}
361
362/**
363 * Logs when the audio state changes.
364 *
365 * Logged from:
366 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
367 */
368message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800369 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700370
371 enum State {
372 OFF = 0;
373 ON = 1;
374 }
375 optional State state = 2;
376}
377
378/**
379 * Logs when the video codec state changes.
380 *
381 * Logged from:
382 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
383 */
384message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800385 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700386
387 enum State {
388 OFF = 0;
389 ON = 1;
390 }
391 optional State state = 2;
392}
393
394/**
395 * Logs when the flashlight state changes.
396 *
397 * Logged from:
398 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
399 */
400message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800401 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700402
403 enum State {
404 OFF = 0;
405 ON = 1;
406 }
407 optional State state = 2;
408}
409
410/**
411 * Logs when the camera state changes.
412 *
413 * Logged from:
414 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
415 */
416message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800417 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700418
419 enum State {
420 OFF = 0;
421 ON = 1;
422 }
423 optional State state = 2;
424}
425
426/**
427 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000428 *
429 * Logged from:
430 * TODO
431 */
Bookatzd6746242017-10-24 18:39:35 -0700432message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800433 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000434
Bookatz1a1b0462018-01-12 11:47:03 -0800435 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
436 // From frameworks/base/core/proto/android/os/enums.proto.
437 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700438
439 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
440 optional string tag = 3;
441
442 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800443 RELEASE = 0;
444 ACQUIRE = 1;
445 CHANGE_RELEASE = 2;
446 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700447 }
448 optional State state = 4;
449}
450
451/**
Bookatzc1a050a2017-10-10 15:49:28 -0700452 * Logs when a partial wakelock is considered 'long' (over 1 min).
453 *
454 * Logged from:
455 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
456 */
457message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800458 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700459
Yao Chend54f9dd2017-10-17 17:37:48 +0000460 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
461 optional string tag = 2;
462
Bookatzc1a050a2017-10-10 15:49:28 -0700463 // TODO: I have no idea what this is.
464 optional string history_tag = 3;
465
466 enum State {
467 OFF = 0;
468 ON = 1;
469 }
470 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000471}
472
Bookatzc1a050a2017-10-10 15:49:28 -0700473/**
474 * Logs Battery Saver state change.
475 *
476 * Logged from:
477 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
478 */
479message BatterySaverModeStateChanged {
480 enum State {
481 OFF = 0;
482 ON = 1;
483 }
484 optional State state = 1;
485}
486
487/**
488 * Logs Doze mode state change.
489 *
490 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800491 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700492 */
493message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800494 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800495}
496
497
498/**
499 * Logs state change of Doze mode including maintenance windows.
500 *
501 * Logged from:
502 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
503 */
504message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800505 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700506}
507
508/**
509 * Logs screen brightness level.
510 *
511 * Logged from:
512 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
513 */
514message ScreenBrightnessChanged {
515 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
516 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700517}
518
519/**
520 * Logs battery level (percent full, from 0 to 100).
521 *
522 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700523 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700524 */
525message BatteryLevelChanged {
526 // Battery level. Should be in [0, 100].
527 optional int32 battery_level = 1;
528}
529
530/**
531 * Logs change in charging status of the device.
532 *
533 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700534 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700535 */
536message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800537 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
538 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700539}
540
541/**
542 * Logs whether the device is plugged in, and what power source it is using.
543 *
544 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700545 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700546 */
547message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800548 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
549 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700550}
551
Bookatz8c6571b2017-10-24 15:04:41 -0700552// TODO: Define this more precisely.
553// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
554/**
555 * Logs when the device turns off or on.
556 *
557 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700558 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700559 */
560message DeviceOnStatusChanged {
561 enum State {
562 OFF = 0;
563 ON = 1;
564 }
565 optional State state = 1;
566}
567
568/**
569 * Logs when an app's wakeup alarm fires.
570 *
571 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700572 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700573 */
574message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800575 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800576
577 // Name of the wakeup alarm.
578 optional string tag = 2;
579}
580
581/**
582 * Logs when an an app causes the mobile radio to change state.
583 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
584 *
585 * Logged from:
586 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
587 */
588message MobileRadioPowerStateChanged {
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;
Bookatzddccf0a2017-11-28 16:48:14 -0800594}
595
596/**
597 * Logs when an an app causes the wifi radio to change state.
598 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
599 *
600 * Logged from:
601 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
602 */
603message WifiRadioPowerStateChanged {
604 // TODO: Add attribution instead of uid?
605 optional int32 uid = 1;
606
Bookatz1a1b0462018-01-12 11:47:03 -0800607 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
608 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700609}
610
611/**
612 * Logs kernel wakeup reasons and aborts.
613 *
614 * Logged from:
615 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
616 */
617message KernelWakeupReported {
618 // Name of the kernel wakeup reason (or abort).
619 optional string wakeup_reason_name = 1;
620
621 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800622 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700623}
624
625/**
626 * Logs wifi locks held by an app.
627 *
628 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700629 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700630 */
631message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800632 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700633
634 enum State {
635 OFF = 0;
636 ON = 1;
637 }
638 optional State state = 2;
639}
640
641/**
642 * Logs wifi signal strength changes.
643 *
644 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700645 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700646 */
647message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800648 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
649 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700650}
651
652/**
653 * Logs wifi scans performed by an app.
654 *
655 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700656 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700657 */
658message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800659 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700660
661 enum State {
662 OFF = 0;
663 ON = 1;
664 }
665 optional State state = 2;
666}
667
668/**
Tej Singh4503e102018-01-04 14:35:01 -0800669 * Logs wifi multicast locks held by an app
670 *
671 * Logged from:
672 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
673 */
674message WifiMulticastLockStateChanged {
675 repeated AttributionNode attribution_node = 1;
676
677 enum State {
678 OFF = 0;
679 ON = 1;
680 }
681 optional State state = 2;
682}
683
684/**
Tej Singh1ea42892018-01-19 09:27:00 -0800685 * Logs shutdown reason and duration on next boot.
686 *
687 * Logged from:
688 * frameworks/base/core/java/com/android/server/BootReceiver.java
689 */
690message ShutdownSequenceReported {
691 // True if shutdown is for a reboot. Default: false if we do not know.
692 optional bool reboot = 1;
693
694 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
695 optional string reason = 2;
696
697 // Beginning of shutdown time in ms using wall clock time since unix epoch.
698 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800699 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800700
701 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800702 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800703}
704
Tej Singh6483ea42018-01-25 17:45:49 -0800705
706/**
707 * Logs boot reason and duration.
708 *
709 * Logged from:
710 * system/core/bootstat/bootstat.cpp
711 */
712message BootSequenceReported {
713 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
714 // Default: "<EMPTY>" if not available.
715 optional string bootloader_reason = 1;
716
717 // Reason for system boot. Eg. bootloader, reboot,userrequested
718 // Default: "<EMPTY>" if not available.
719 optional string system_reason = 2;
720
721 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800722 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800723
724 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800725 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800726
727 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800728 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800729
730 // Time since last boot in ms. Default: 0 if not available.
731 optional int64 time_since_last_boot = 6;
732}
733
Tej Singhc477d9c2018-02-05 18:31:39 -0800734
735/**
736 * Logs call state and disconnect cause (if applicable).
737 *
738 * Logged from:
739 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
740 */
741message CallStateChanged {
742 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
743 // From frameworks/base/core/proto/android/telecomm/enums.proto.
744 optional android.telecom.CallStateEnum call_state = 1;
745
746 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
747 // This value is only applicable when the call_state is DISCONNECTED, and
748 // should always be UNKNOWN if the call_state is not DISCONNECTED.
749 // From frameworks/base/core/proto/android/telecomm/enums.proto.
750 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
751
752 // True if the call is self-managed, which are apps that use the
753 // telecom infrastructure to make their own calls.
754 optional bool self_managed = 3;
755
756 // True if call is external. External calls are calls on connected Wear
757 // devices but show up in Telecom so the user can pull them onto the device.
758 optional bool external_call = 4;
759}
760
Tej Singh1ea42892018-01-19 09:27:00 -0800761/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800762 * Logs keyguard state. The keyguard is the lock screen.
763 *
764 * Logged from:
765 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
766 */
767message KeyguardStateChanged {
768 enum State {
769 UNKNOWN = 0;
770 // The keyguard is hidden when the phone is unlocked.
771 HIDDEN = 1;
772 // The keyguard is shown when the phone is locked (screen turns off).
773 SHOWN= 2;
774 // The keyguard is occluded when something is overlaying the keyguard.
775 // Eg. Opening the camera while on the lock screen.
776 OCCLUDED = 3;
777 }
778 optional State state = 1;
779}
780
781/**
782 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
783 * prompts the user to enter a password (pattern, pin, etc).
784 *
785 * Logged from:
786 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
787 */
788
789message KeyguardBouncerStateChanged {
790 enum State {
791 UNKNOWN = 0;
792 // Bouncer is hidden, either as a result of successfully entering the
793 // password, screen timing out, or user going back to lock screen.
794 HIDDEN = 1;
795 // This is when the user is being prompted to enter the password.
796 SHOWN = 2;
797 }
798 optional State state = 1;
799}
800
801/**
802 * Logs the result of entering a password into the keyguard bouncer.
803 *
804 * Logged from:
805 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
806 */
807message KeyguardBouncerPasswordEntered {
808 enum BouncerResult {
809 UNKNOWN = 0;
810 // The password entered was incorrect.
811 FAILURE = 1;
812 // The password entered was correct.
813 SUCCESS = 2;
814 }
815 optional BouncerResult result = 1;
816}
817
Tej Singha883b372018-02-15 11:30:01 -0800818/*
819 * Logs changes to the configuration of the device. The configuration is defined
820 * in frameworks/base/core/java/android/content/res/Configuration.java
821 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
822 * Please go there to interpret the possible values each field can be.
823 *
824 * Logged from:
825 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
826 */
827message ResourceConfigurationChanged {
828 // Bit mask of color capabilities of the screen.
829 // Contains information about the color gamut and hdr mode of the screen.
830 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
831 optional int32 colorMode = 1;
832
833 // The target screen density being rendered to.
834 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
835 optional int32 densityDpi = 2;
836
837 // Current user preference for the scaling factor for fonts,
838 // relative to the base density scaling.
839 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
840 optional float fontScale = 3;
841
842 // Flag indicating whether the hard keyboard is hidden.
843 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
844 optional int32 hardKeyboardHidden = 4;
845
846 // The type of keyboard attached to the device.
847 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
848 optional int32 keyboard = 5;
849
850 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
851 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
852 optional int32 keyboardHideen = 6;
853
854 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
855 // 0 if undefined.
856 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
857 optional int32 mcc = 7;
858
859 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
860 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
861 // MNC_ZERO symbol defined in Configuration.java.
862 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
863 optional int32 mnc = 8;
864
865 // The kind of navigation available on the device.
866 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
867 optional int32 navigation = 9;
868
869 // Flag indicating whether the navigation is available.
870 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
871 optional int32 navigationHidden = 10;
872
873 // Overall orientation of the screen.
874 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
875 optional int32 orientation = 11;
876
877 // The current height of the available screen space, in dp units.
878 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
879 optional int32 screenHeightDp = 12;
880
881 // Bit mask of overall layout of the screen.
882 // Contains information about screen size, whether the screen is wider/taller
883 // than normal, whether the screen layout is right-tl-left or left-to-right,
884 // and whether the screen has a rounded shape.
885 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
886 optional int32 screenLayout = 13;
887
888 // Current width of the available screen space, in dp units.
889 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
890 optional int32 screenWidthDp = 14;
891
892 // The smallest screen size an application will see in normal operation.
893 // This is the smallest value of both screenWidthDp and screenHeightDp
894 // in portrait and landscape.
895 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
896 optional int32 smallestScreenWidthDp = 15;
897
898 // The type of touch screen attached to the device.
899 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
900 optional int32 touchscreen = 16;
901
902 // Bit mask of the ui mode.
903 // Contains information about the overall ui mode of the device.
904 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
905 // Also contains information about whether the device is in night mode.
906 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
907 optional int32 uiMode = 17;
908}
909
Tej Singhdd7bd352018-02-09 19:33:15 -0800910/**
Tej Singh5d991e12018-03-09 19:48:11 -0800911 * Logs when Bluetooth is enabled and disabled.
912 *
913 * Logged from:
914 * services/core/java/com/android/server/BluetoothManagerService.java
915 */
916message BluetoothEnabledStateChanged {
917 repeated AttributionNode attribution_node = 1;
918 // Whether or not bluetooth is enabled on the device.
919 enum State {
920 UNKNOWN = 0;
921 ENABLED = 1;
922 DISABLED = 2;
923 }
924 optional State state = 2;
925 // The reason for being enabled/disabled.
926 // Eg. Airplane mode, crash, application request.
927 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
928 // If the reason is an application request, this will be the package name.
929 optional string pkgName = 4;
930}
931
932/**
933 * Logs when a Bluetooth device connects and disconnects.
934 *
935 * Logged from:
936 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
937 */
938message BluetoothConnectionStateChanged {
939 // The state of the connection.
940 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
941 optional android.bluetooth.ConnectionStateEnum state = 1;
942 // An identifier that can be used to match connect and disconnect events.
943 // Currently is last two bytes of a hash of a device level ID and
944 // the mac address of the bluetooth device that is connected.
945 optional int32 obfuscated_id = 2;
946 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
947 // From android.bluetooth.BluetoothAdapter.java
948 optional int32 bt_profile = 3;
949}
950
951/**
952 * Logs when Bluetooth A2dp audio streaming state changes.
953 *
954 * Logged from:
955 * TODO(b/73971848)
956 */
957message BluetoothA2dpAudioStateChanged {
958 // Whether or not audio is being played using Bluetooth A2dp.
959 enum State {
960 UNKNOWN = 0;
961 PLAY = 1;
962 STOP = 2;
963 }
964 optional State state = 1;
965}
966
967/**
Tej Singhbb8554a2018-01-26 11:59:14 -0800968 * Logs the duration of a davey (jank of >=700ms) when it occurs
969 *
970 * Logged from:
971 * frameworks/base/libs/hwui/JankTracker.cpp
972 */
973message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -0800974 // The UID that logged this atom.
975 optional int32 uid = 1;
976
Tej Singhbb8554a2018-01-26 11:59:14 -0800977 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -0800978 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -0800979}
980
981/**
Bookatze5885242017-10-24 20:10:31 -0700982 * Logs phone signal strength changes.
983 *
984 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700985 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700986 */
987message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800988 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
989 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700990}
991
992/**
993 * Logs that a setting was updated.
994 * Logged from:
995 * frameworks/base/core/java/android/provider/Settings.java
996 * The tag and is_default allow resetting of settings to default values based on the specified
997 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
998 */
999message SettingChanged {
1000 // The name of the setting.
1001 optional string setting = 1;
1002
1003 // The change being imposed on this setting. May represent a number, eg "3".
1004 optional string value = 2;
1005
1006 // The new value of this setting. For most settings, this is same as value. For some settings,
1007 // value is +X or -X where X represents an element in a set. For example, if the previous value
1008 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1009 // The +/- feature is currently only used for location_providers_allowed.
1010 optional string new_value = 3;
1011
1012 // The previous value of this setting.
1013 optional string prev_value = 4;
1014
1015 // The tag used with the is_default for resetting sets of settings. This is generally null.
1016 optional string tag = 5;
1017
Bookatz90867622018-01-31 15:05:57 -08001018 // True if this setting with tag should be resettable.
1019 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001020
1021 // The user ID associated. Defined in android/os/UserHandle.java
1022 optional int32 user = 7;
1023}
Chenjie Yub3dda412017-10-24 13:41:59 -07001024
Chenjie Yu05013b32017-11-21 10:21:41 -08001025/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001026 * Logs activity going to foreground or background
1027 *
1028 * Logged from:
1029 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1030 */
1031message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -08001032 optional int32 uid = 1;
1033 optional string pkg_name = 2;
1034 optional string class_name = 3;
1035
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001036 enum Activity {
1037 MOVE_TO_BACKGROUND = 0;
1038 MOVE_TO_FOREGROUND = 1;
1039 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001040 optional Activity activity = 4;
1041}
David Chenc8a43242017-10-17 16:23:28 -07001042
1043/**
David Chen9e3808c2017-11-20 17:25:34 -08001044 * Logs when an error is written to dropbox.
1045 * Logged from:
1046 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1047 */
1048message DropboxErrorChanged {
1049 // The uid if available. -1 means not available.
1050 optional int32 uid = 1;
1051
1052 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
1053 optional string tag = 2;
1054
1055 // The name of the process.
1056 optional string process_name = 3;
1057
1058 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001059 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -08001060
1061 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -08001062 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -08001063
1064 // The activity name if available.
1065 optional string activity_name = 6;
1066
David Chen6e3e6cb2018-01-03 16:14:06 -08001067 // The package name if available.
1068 optional string package_name = 7;
1069
David Chen9e3808c2017-11-20 17:25:34 -08001070 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001071 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001072}
1073
David Chen0a368b22017-12-06 16:28:16 -08001074/*
1075 * Allows other apps to push events into statsd.
1076 * Logged from:
1077 * frameworks/base/core/java/android/util/StatsLog.java
1078 */
David Chen0b5c90c2018-01-25 16:51:49 -08001079message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001080 // The uid of the application that sent this custom atom.
1081 optional int32 uid = 1;
1082
1083 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1084 optional int32 label = 2;
1085
1086 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1087 // predicates for the metrics).
1088 enum State {
1089 UNKNOWN = 0;
1090 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1091 STOP = 2;
1092 START = 3;
1093 }
1094 optional State state = 3;
1095}
1096
David Chen9e3808c2017-11-20 17:25:34 -08001097/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001098 * Logs when statsd detects an anomaly.
1099 *
1100 * Logged from:
1101 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1102 */
1103message AnomalyDetected {
1104 // Uid that owns the config whose anomaly detection alert fired.
1105 optional int32 config_uid = 1;
1106
Yangster-mac94e197c2018-01-02 16:03:03 -08001107 // Id of the config whose anomaly detection alert fired.
1108 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001109
Yangster-mac94e197c2018-01-02 16:03:03 -08001110 // Id of the alert (i.e. name of the anomaly that was detected).
1111 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001112}
1113
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001114message AppStartChanged {
1115 // The uid if available. -1 means not available.
1116 optional int32 uid = 1;
1117
1118 // The app package name.
1119 optional string pkg_name = 2;
1120
1121 enum TransitionType {
1122 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1123 WARM = 1;
1124 HOT = 2;
1125 COLD = 3;
1126 }
1127 // The transition type.
1128 optional TransitionType type = 3;
1129
1130 // The activity name.
1131 optional string activity_name = 4;
1132
1133 // The name of the calling app. Empty if not set.
1134 optional string calling_pkg_name = 5;
1135
1136 // Whether the app is an instant app.
1137 optional bool is_instant_app = 6;
1138
1139 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001140 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001141
Bookatz80d11a02018-01-16 10:46:35 -08001142 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001143
David Chen0b5c90c2018-01-25 16:51:49 -08001144 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001145 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001146 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001147 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001148 optional int32 bind_application_delay_millis = 11;
1149 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001150
1151 // Empty if not set.
1152 optional string launch_token = 13;
1153
Calin Juravle759fbda2018-02-20 19:52:30 +00001154 // The compiler filter used when when the package was optimized.
1155 optional string package_optimization_compilation_filter = 14;
1156
1157 // The reason why the package was optimized.
1158 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001159}
1160
1161message AppStartCancelChanged {
1162 // The uid if available. -1 means not available.
1163 optional int32 uid = 1;
1164
1165 // The app package name.
1166 optional string pkg_name = 2;
1167
1168 enum TransitionType {
1169 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1170 WARM = 1;
1171 HOT = 2;
1172 COLD = 3;
1173 }
1174 // The transition type.
1175 optional TransitionType type = 3;
1176
1177 // The activity name.
1178 optional string activity_name = 4;
1179}
1180
1181message AppStartFullyDrawnChanged {
1182 // The uid if available. -1 means not available.
1183 optional int32 uid = 1;
1184
1185 // The app package name.
1186 optional string pkg_name = 2;
1187
1188 enum TransitionType {
1189 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1190 WITH_BUNDLE = 1;
1191 WITHOUT_BUNDLE = 2;
1192 }
1193 // The transition type.
1194 optional TransitionType type = 3;
1195
1196 // The activity name.
1197 optional string activity_name = 4;
1198
1199 optional bool transition_process_running = 5;
1200
1201 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001202 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001203}
1204
Bookatz8fcd09a2017-12-18 13:01:10 -08001205/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001206 * Logs a picture-in-picture action
1207 * Logged from:
1208 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1209 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1210 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1211 */
1212message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001213 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001214 optional int32 uid = 1;
1215
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001216 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001217
Chenjie Yu52cacc62017-12-08 18:11:45 -08001218 enum State {
1219 ENTERED = 1;
1220 EXPANDED_TO_FULL_SCREEN = 2;
1221 MINIMIZED = 3;
1222 DISMISSED = 4;
1223 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001224 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001225}
1226
1227/**
Chenjie Yue8904192017-12-08 19:12:57 -08001228 * Logs overlay action
1229 * Logged from:
1230 * services/core/java/com/android/server/wm/Session.java
1231 */
1232message OverlayStateChanged {
1233 optional int32 uid = 1;
1234
1235 optional string package_name = 2;
1236
1237 optional bool using_alert_window = 3;
1238
1239 enum State {
1240 ENTERED = 1;
1241 EXITED = 2;
1242 }
1243 optional State state = 4;
1244}
1245
Chenjie Yuccfe6452018-01-30 11:33:21 -08001246/*
1247 * Logs foreground service starts and stops.
1248 * Note that this is not when a service starts or stops, but when it is
1249 * considered foreground.
1250 * Logged from
1251 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1252 */
1253message ForegroundServiceStateChanged {
1254 optional int32 uid = 1;
1255 // package_name + "/" + class_name
1256 optional string short_name = 2;
1257
1258 enum State {
1259 ENTER = 1;
1260 EXIT = 2;
1261 }
1262 optional State state = 3;
1263}
1264
Chenjie Yue8904192017-12-08 19:12:57 -08001265/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001266 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1267 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1268 * attributed back to the parent (host) uid. One example is Chrome.
1269 *
1270 * Logged from:
1271 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1272 */
1273message IsolatedUidChanged {
1274 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1275 optional int32 parent_uid = 1;
1276
1277 optional int32 isolated_uid = 2;
1278
1279 // We expect an isolated uid to be removed before if it's used for another parent uid.
1280 enum Event {
1281 REMOVED = 0;
1282 CREATED = 1;
1283 }
1284 optional Event event = 3;
1285}
1286
1287/*
1288 * Logs the reception of an incoming network packet causing the main system to wake up for
1289 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1290 * and processed by WakeupController.cpp.
1291 */
1292message PacketWakeupOccurred {
1293 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1294 // delivered nowhere.
1295 optional int32 uid = 1;
1296 // The interface name on which the packet was received.
1297 optional string iface = 2;
1298 // The ethertype value of the packet.
1299 optional int32 ethertype = 3;
1300 // String representation of the destination MAC address of the packet.
1301 optional string destination_hardware_address = 4;
1302 // String representation of the source address of the packet if this was an IP packet.
1303 optional string source_ip = 5;
1304 // String representation of the destination address of the packet if this was an IP packet.
1305 optional string destination_ip = 6;
1306 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1307 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1308 // families.
1309 optional int32 ip_next_header = 7;
1310 // The source port if this was a TCP or UDP packet.
1311 optional int32 source_port = 8;
1312 // The destination port if this was a TCP or UDP packet.
1313 optional int32 destination_port = 9;
1314}
1315
1316/*
1317 * Logs the memory stats for an app on startup.
1318 * Logged from:
1319 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1320 */
1321message AppStartMemoryStateCaptured {
1322 // The uid if available. -1 means not available.
1323 optional int32 uid = 1;
1324
1325 // The process name.
1326 optional string process_name = 2;
1327
1328 // The activity name.
1329 optional string activity_name = 3;
1330
1331 // # of page-faults
1332 optional int64 pgfault = 4;
1333
1334 // # of major page-faults
1335 optional int64 pgmajfault = 5;
1336
1337 // RSS
1338 optional int64 rss_in_bytes = 6;
1339
1340 // CACHE
1341 optional int64 cache_in_bytes = 7;
1342
1343 // SWAP
1344 optional int64 swap_in_bytes = 8;
1345}
1346
1347/*
1348 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1349 * for LMK event.
1350 * Logged from:
1351 * system/core/lmkd/lmkd.c
1352 */
1353message LmkStateChanged {
1354 enum State {
1355 UNKNOWN = 0;
1356 START = 1;
1357 STOP = 2;
1358 }
1359 optional State state = 1;
1360}
1361
1362/*
1363 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1364 * Logged from:
1365 * system/core/lmkd/lmkd.c
1366 */
1367message LmkKillOccurred {
1368 // The uid if available. -1 means not available.
1369 optional int32 uid = 1;
1370
1371 // The process name.
1372 optional string process_name = 2;
1373
1374 // oom adj score.
1375 optional int32 oom_score = 3;
1376
1377 // # of page-faults
1378 optional int64 pgfault = 4;
1379
1380 // # of major page-faults
1381 optional int64 pgmajfault = 5;
1382
1383 // RSS
1384 optional int64 rss_in_bytes = 6;
1385
1386 // CACHE
1387 optional int64 cache_in_bytes = 7;
1388
1389 // SWAP
1390 optional int64 swap_in_bytes = 8;
1391}
1392
Rajeev Kumar51b54602018-03-01 12:18:26 -08001393/*
1394 * Logs when the ActivityManagerService detects that an app died.
1395 *
1396 * Logged from:
1397 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1398 */
1399message AppDied {
1400 // timestamp(elapsedRealtime) of record creation
1401 optional uint64 timestamp_millis = 1;
1402}
1403
Chenjie Yubbcbc602018-02-05 16:51:52 -08001404//////////////////////////////////////////////////////////////////////
1405// Pulled atoms below this line //
1406//////////////////////////////////////////////////////////////////////
1407
1408/**
David Chenc8a43242017-10-17 16:23:28 -07001409 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1410 *
1411 * Pulled from:
1412 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1413 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001414message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001415 optional int32 uid = 1;
1416
1417 optional int64 rx_bytes = 2;
1418
1419 optional int64 rx_packets = 3;
1420
1421 optional int64 tx_bytes = 4;
1422
1423 optional int64 tx_packets = 5;
1424}
1425
1426/**
1427 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1428 *
1429 * Pulled from:
1430 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1431 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001432message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001433 optional int32 uid = 1;
1434
1435 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1436 optional int32 is_foreground = 2;
1437
1438 optional int64 rx_bytes = 3;
1439
1440 optional int64 rx_packets = 4;
1441
1442 optional int64 tx_bytes = 5;
1443
1444 optional int64 tx_packets = 6;
1445}
1446
1447/**
1448 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1449 *
1450 * Pulled from:
1451 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1452 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001453message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001454 optional int32 uid = 1;
1455
1456 optional int64 rx_bytes = 2;
1457
1458 optional int64 rx_packets = 3;
1459
1460 optional int64 tx_bytes = 4;
1461
1462 optional int64 tx_packets = 5;
1463}
1464
1465/**
1466 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1467 *
1468 * Pulled from:
1469 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1470 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001471message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001472 optional int32 uid = 1;
1473
1474 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1475 optional int32 is_foreground = 2;
1476
1477 optional int64 rx_bytes = 3;
1478
1479 optional int64 rx_packets = 4;
1480
1481 optional int64 tx_bytes = 5;
1482
1483 optional int64 tx_packets = 6;
1484}
1485
1486/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001487 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1488 *
1489 * Pulled from:
1490 * StatsCompanionService
1491 */
1492message BluetoothBytesTransfer {
1493 optional int32 uid = 1;
1494
1495 optional int64 rx_bytes = 2;
1496
1497 optional int64 tx_bytes = 3;
1498}
1499
1500/**
David Chenc8a43242017-10-17 16:23:28 -07001501 * Pulls the kernel wakelock durations. This atom is adapted from
1502 * android/internal/os/KernelWakelockStats.java
1503 *
1504 * Pulled from:
1505 * StatsCompanionService using KernelWakelockReader.
1506 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001507message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001508 optional string name = 1;
1509
1510 optional int32 count = 2;
1511
1512 optional int32 version = 3;
1513
1514 optional int64 time = 4;
1515}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001516
Chenjie Yu05013b32017-11-21 10:21:41 -08001517/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001518 * Pulls low power state information. This includes platform and subsystem sleep state information,
1519 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001520 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001521 * hardware/interfaces/power/1.1/types.hal
1522 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001523message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001524 // Subsystem name
1525 optional string subsystem_name = 1;
1526 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1527 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1528 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001529 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001530 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001531 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001532 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001533}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001534
Chenjie Yu05013b32017-11-21 10:21:41 -08001535/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001536 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001537 * Pulls the time the cpu spend on the frequency index. Frequency index
1538 * starts from highest to lowest. The value should be monotonically
1539 * increasing since boot. However, if there is a cpu
1540 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001541 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001542message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001543 optional uint32 cluster = 1;
1544 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001545 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001546}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001547
Chenjie Yu05013b32017-11-21 10:21:41 -08001548/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001549 * Pulls Cpu Time Per Uid.
1550 * Note that isolated process uid time should be attributed to host uids.
1551 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001552message CpuTimePerUid {
Chenjie Yuec676612018-03-07 09:19:17 -08001553 optional int32 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001554 optional uint64 user_time_millis = 2;
1555 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001556}
1557
1558/**
1559 * Pulls Cpu Time Per Uid per frequency.
1560 * Note that isolated process uid time should be attributed to host uids.
1561 * For each uid, we order the time by descending frequencies.
1562 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001563message CpuTimePerUidFreq {
Chenjie Yuec676612018-03-07 09:19:17 -08001564 optional int32 uid = 1;
1565 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001566 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001567}
Hugo Benichi884970e2017-11-14 22:42:46 +09001568
Chenjie Yu05013b32017-11-21 10:21:41 -08001569/**
1570 * Pulls Wifi Controller Activity Energy Info
1571 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001572message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001573 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001574 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001575 // stack reported state
1576 // TODO: replace this with proto enum
1577 optional int32 stack_state = 2;
1578 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001579 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001580 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001581 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001582 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001583 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001584 // product of current(mA), voltage(V) and time(ms)
1585 optional uint64 controller_energy_used = 6;
1586}
1587
1588/**
1589 * Pulls Modem Activity Energy Info
1590 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001591message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001592 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001593 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001594 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001595 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001596 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001597 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001598 /**
1599 * Tx power index
1600 * index 0 = tx_power < 0dBm
1601 * index 1 = 0dBm < tx_power < 5dBm
1602 * index 2 = 5dBm < tx_power < 15dBm
1603 * index 3 = 15dBm < tx_power < 20dBm
1604 * index 4 = tx_power > 20dBm
1605 */
1606 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001607 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001608 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001609 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001610 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001611 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001612 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001613 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001614 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001615 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001616 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001617 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001618 // product of current(mA), voltage(V) and time(ms)
1619 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001620}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001621
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001622/**
1623 * Pulls Bluetooth Activity Energy Info
1624 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1625 */
1626message BluetoothActivityInfo {
1627 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001628 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001629 // bluetooth stack state
1630 optional int32 bluetooth_stack_state = 2;
1631 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001632 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001633 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001634 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001635 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001636 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001637 // product of current(mA), voltage(V) and time(ms)
1638 optional uint64 energy_used = 6;
1639}
1640
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001641/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001642 * Logs the memory stats for a process.
1643 */
1644message ProcessMemoryState {
1645 // The uid if available. -1 means not available.
1646 optional int32 uid = 1;
1647
1648 // The process name.
1649 optional string process_name = 2;
1650
1651 // oom adj score.
1652 optional int32 oom_score = 3;
1653
1654 // # of page-faults
1655 optional int64 pgfault = 4;
1656
1657 // # of major page-faults
1658 optional int64 pgmajfault = 5;
1659
Rajeev Kumar90235992018-01-29 11:06:48 -08001660 // RSS
1661 optional int64 rss_in_bytes = 6;
1662
1663 // CACHE
1664 optional int64 cache_in_bytes = 7;
1665
1666 // SWAP
1667 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001668}
1669
1670/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001671 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001672 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001673message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001674 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001675}
1676
1677/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001678 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001679 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001680message SystemUptime {
1681 // Milliseconds since the system was booted.
1682 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1683 // for external input).
1684 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001685 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001686}
1687
1688/*
1689 * Reads from /proc/uid_concurrent_active_time which has the format:
1690 * active: X (X is # cores)
1691 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1692 * [uid1]: [time-0] [time-1] [time-2] ... ...
1693 * ...
1694 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1695 * The file contains a monotonically increasing count of time for a single boot.
1696 */
1697message CpuActiveTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001698 optional int32 uid = 1;
1699 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001700}
1701
1702/**
1703 * Reads from /proc/uid_concurrent_policy_time which has the format:
1704 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1705 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1706 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1707 * ...
1708 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1709 * The file contains a monotonically increasing count of time for a single boot.
1710 */
1711message CpuClusterTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001712 optional int32 uid = 1;
1713 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001714 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001715}
1716
1717/*
1718 * Pulls free disk space, for data, system partition and temporary directory.
1719 */
1720message DiskSpace {
1721 // available bytes in data partition
1722 optional uint64 data_available_bytes = 1;
1723 // available bytes in system partition
1724 optional uint64 system_available_bytes = 2;
1725 // available bytes in download cache or temp directories
1726 optional uint64 temp_available_bytes = 3;
1727}
Tej Singhbf972d92018-01-10 20:51:13 -08001728
1729/**
1730 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001731 * Pulled from:
1732 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001733 */
1734message RemainingBatteryCapacity {
1735 optional int32 charge_uAh = 1;
1736}
1737
1738/**
1739 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001740 * Pulled from:
1741 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001742 */
1743message FullBatteryCapacity {
1744 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001745}
1746
1747/**
1748 * Pulls the temperature of various parts of the device, in Celsius.
1749 *
1750 * Pulled from:
1751 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1752 */
1753message Temperature {
1754 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1755 optional android.os.TemperatureTypeEnum sensor_location = 1;
1756
1757 // The name of the temperature source. Eg. CPU0
1758 optional string sensor_name = 2;
1759
1760 // Temperature in degrees C.
1761 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001762}