blob: 8d3693633631f96f6720205bd4c8d4ce73d75bc5 [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;
Andrew Chant28d627e2018-02-22 15:17:05 -0800113 UsbConnectorStateChanged usb_connector_changed = 70;
114 SpeakerImpedanceReported speaker_impedance_reported = 71;
115 HardwareFailed hardware_failed = 72;
116 PhysicalDropDetected physical_drop_detected = 73;
117 ChargeCyclesReported charge_cycles_reported = 74;
Yao Chend54f9dd2017-10-17 17:37:48 +0000118 }
David Chenc8a43242017-10-17 16:23:28 -0700119
David Chen6e3e6cb2018-01-03 16:14:06 -0800120 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800121 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700122 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800123 WifiBytesTransfer wifi_bytes_transfer = 10000;
124 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
125 MobileBytesTransfer mobile_bytes_transfer = 10002;
126 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800127 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800128 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800129 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800130 CpuTimePerFreq cpu_time_per_freq = 10008;
131 CpuTimePerUid cpu_time_per_uid = 10009;
132 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
133 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
134 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800135 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800136 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800137 SystemElapsedRealtime system_elapsed_realtime = 10014;
138 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800139 CpuActiveTime cpu_active_time = 10016;
140 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800141 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800142 RemainingBatteryCapacity remaining_battery_capacity = 10019;
143 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800144 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700145 }
yroa1fe77c2018-02-26 14:22:54 -0800146
147 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
148 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700149}
150
Yao Chend54f9dd2017-10-17 17:37:48 +0000151/**
Yangster-mac20877162017-12-22 17:19:39 -0800152 * This proto represents a node of an attribution chain.
153 * Note: All attribution chains are represented as a repeated field of type
154 * AttributionNode. It is understood that in such arrays, the order is that
155 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000156 */
Yangster-mac20877162017-12-22 17:19:39 -0800157message AttributionNode {
158 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800159 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800160
Yangster-mac20877162017-12-22 17:19:39 -0800161 // The (optional) string tag for an element in the attribution chain. If the
162 // element has no tag, it is encoded as an empty string.
163 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700164}
165
Yao Chend54f9dd2017-10-17 17:37:48 +0000166/*
167 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800168 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000169 *
170 * RULES:
171 * - The field ids for each atom must start at 1, and count upwards by 1.
172 * Skipping field ids is not allowed.
173 * - These form an API, so renaming, renumbering or removing fields is
174 * not allowed between android releases. (This is not currently enforced,
175 * but there will be a tool to enforce this restriction).
176 * - The types must be built-in protocol buffer types, namely, no sub-messages
177 * are allowed (yet). The bytes type is also not allowed.
178 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800179 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800181 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000182 * - A field that is a uid should be a string field, tagged with the [xxx]
183 * annotation. The generated code on android will be represented by UIDs,
184 * and those UIDs will be translated in xxx to those strings.
185 *
186 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700187 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000188 * - If there is a UID, it goes first. Think in an object-oriented fashion.
189 * *****************************************************************************
190 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700191
Yao Chend54f9dd2017-10-17 17:37:48 +0000192/**
193 * Logs when the screen state changes.
194 *
195 * Logged from:
196 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
197 */
198message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800199 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800200 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700201}
Yao Chend54f9dd2017-10-17 17:37:48 +0000202
203/**
Bookatzc1a050a2017-10-10 15:49:28 -0700204 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000205 *
206 * Logged from:
207 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
208 */
Bookatzc1a050a2017-10-10 15:49:28 -0700209message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800210 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000211
Bookatzdb026a22018-01-10 19:01:56 -0800212 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800213 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000214}
215
216/**
Bookatzc1a050a2017-10-10 15:49:28 -0700217 * Logs that a process started, finished, crashed, or ANRed.
218 *
219 * Logged from:
220 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
221 */
222message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800223 // TODO: should be a string tagged w/ uid annotation
224 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700225
David Chen0b5c90c2018-01-25 16:51:49 -0800226 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700227 optional string name = 2;
228
Bookatzddccf0a2017-11-28 16:48:14 -0800229 // What lifecycle state the process changed to.
230 // This enum is specific to atoms.proto.
231 enum Event {
232 PROCESS_FINISHED = 0;
233 PROCESS_STARTED = 1;
234 PROCESS_CRASHED = 2;
235 PROCESS_ANRED = 3;
236 }
237 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700238}
239
Bookatzc1a050a2017-10-10 15:49:28 -0700240/**
241 * Logs when the ble scan state changes.
242 *
243 * Logged from:
244 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
245 */
246message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800247 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700248
249 enum State {
250 OFF = 0;
251 ON = 1;
252 }
253 optional State state = 2;
254}
255
256/**
257 * Logs when an unoptimized ble scan state changes.
258 *
259 * Logged from:
260 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
261 */
262// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
263message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800264 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700265
266 enum State {
267 OFF = 0;
268 ON = 1;
269 }
270 optional State state = 2;
271}
272
273/**
274 * Logs reporting of a ble scan finding results.
275 *
276 * Logged from:
277 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
278 */
279// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
280message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800281 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700282
283 // Number of ble scan results returned.
284 optional int32 num_of_results = 2;
285}
286
287/**
288 * Logs when a sensor state changes.
289 *
290 * Logged from:
291 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
292 */
293message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800294 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700295
296 // TODO: Is there a way to get the actual name of the sensor?
297 // The id (int) of the sensor.
298 optional int32 sensor_id = 2;
299
300 enum State {
301 OFF = 0;
302 ON = 1;
303 }
304 optional State state = 3;
305}
306
307
308/**
309 * Logs when GPS state changes.
310 *
311 * Logged from:
312 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
313 */
314message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800315 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700316
317 enum State {
318 OFF = 0;
319 ON = 1;
320 }
321 optional State state = 2;
322}
323
324
325/**
326 * Logs when a sync manager sync state changes.
327 *
328 * Logged from:
329 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
330 */
331message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800332 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700333
David Chen0b5c90c2018-01-25 16:51:49 -0800334 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700335 optional string name = 2;
336
337 enum State {
338 OFF = 0;
339 ON = 1;
340 }
341 optional State state = 3;
342}
343
344/**
345 * Logs when a job scheduler job state changes.
346 *
347 * Logged from:
348 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
349 */
350message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800351 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700352
353 // Name of the job (as named in the app)
354 optional string name = 2;
355
356 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800357 FINISHED = 0;
358 STARTED = 1;
359 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700360 }
361 optional State state = 3;
362
363 // TODO: Consider adding the stopReason (int)
364}
365
366/**
367 * Logs when the audio state changes.
368 *
369 * Logged from:
370 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
371 */
372message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800373 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700374
375 enum State {
376 OFF = 0;
377 ON = 1;
378 }
379 optional State state = 2;
380}
381
382/**
383 * Logs when the video codec state changes.
384 *
385 * Logged from:
386 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
387 */
388message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800389 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700390
391 enum State {
392 OFF = 0;
393 ON = 1;
394 }
395 optional State state = 2;
396}
397
398/**
399 * Logs when the flashlight state changes.
400 *
401 * Logged from:
402 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
403 */
404message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800405 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700406
407 enum State {
408 OFF = 0;
409 ON = 1;
410 }
411 optional State state = 2;
412}
413
414/**
415 * Logs when the camera state changes.
416 *
417 * Logged from:
418 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
419 */
420message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800421 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700422
423 enum State {
424 OFF = 0;
425 ON = 1;
426 }
427 optional State state = 2;
428}
429
430/**
431 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000432 *
433 * Logged from:
434 * TODO
435 */
Bookatzd6746242017-10-24 18:39:35 -0700436message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800437 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000438
Bookatz1a1b0462018-01-12 11:47:03 -0800439 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
440 // From frameworks/base/core/proto/android/os/enums.proto.
441 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700442
443 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
444 optional string tag = 3;
445
446 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800447 RELEASE = 0;
448 ACQUIRE = 1;
449 CHANGE_RELEASE = 2;
450 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700451 }
452 optional State state = 4;
453}
454
455/**
Bookatzc1a050a2017-10-10 15:49:28 -0700456 * Logs when a partial wakelock is considered 'long' (over 1 min).
457 *
458 * Logged from:
459 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
460 */
461message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800462 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700463
Yao Chend54f9dd2017-10-17 17:37:48 +0000464 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
465 optional string tag = 2;
466
Bookatzc1a050a2017-10-10 15:49:28 -0700467 // TODO: I have no idea what this is.
468 optional string history_tag = 3;
469
470 enum State {
471 OFF = 0;
472 ON = 1;
473 }
474 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000475}
476
Bookatzc1a050a2017-10-10 15:49:28 -0700477/**
478 * Logs Battery Saver state change.
479 *
480 * Logged from:
481 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
482 */
483message BatterySaverModeStateChanged {
484 enum State {
485 OFF = 0;
486 ON = 1;
487 }
488 optional State state = 1;
489}
490
491/**
492 * Logs Doze mode state change.
493 *
494 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800495 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700496 */
497message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800498 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800499}
500
501
502/**
503 * Logs state change of Doze mode including maintenance windows.
504 *
505 * Logged from:
506 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
507 */
508message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800509 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700510}
511
512/**
513 * Logs screen brightness level.
514 *
515 * Logged from:
516 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
517 */
518message ScreenBrightnessChanged {
519 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
520 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700521}
522
523/**
524 * Logs battery level (percent full, from 0 to 100).
525 *
526 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700527 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700528 */
529message BatteryLevelChanged {
530 // Battery level. Should be in [0, 100].
531 optional int32 battery_level = 1;
532}
533
534/**
535 * Logs change in charging status of the device.
536 *
537 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700538 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700539 */
540message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800541 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
542 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700543}
544
545/**
546 * Logs whether the device is plugged in, and what power source it is using.
547 *
548 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700549 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700550 */
551message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800552 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
553 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700554}
555
Bookatz8c6571b2017-10-24 15:04:41 -0700556// TODO: Define this more precisely.
557// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
558/**
559 * Logs when the device turns off or on.
560 *
561 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700562 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700563 */
564message DeviceOnStatusChanged {
565 enum State {
566 OFF = 0;
567 ON = 1;
568 }
569 optional State state = 1;
570}
571
572/**
573 * Logs when an app's wakeup alarm fires.
574 *
575 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700576 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700577 */
578message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800579 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800580
581 // Name of the wakeup alarm.
582 optional string tag = 2;
583}
584
585/**
586 * Logs when an an app causes the mobile radio to change state.
587 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
588 *
589 * Logged from:
590 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
591 */
592message MobileRadioPowerStateChanged {
593 // TODO: Add attribution instead of uid?
594 optional int32 uid = 1;
595
Bookatz1a1b0462018-01-12 11:47:03 -0800596 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
597 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800598}
599
600/**
601 * Logs when an an app causes the wifi radio to change state.
602 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
603 *
604 * Logged from:
605 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
606 */
607message WifiRadioPowerStateChanged {
608 // TODO: Add attribution instead of uid?
609 optional int32 uid = 1;
610
Bookatz1a1b0462018-01-12 11:47:03 -0800611 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
612 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700613}
614
615/**
616 * Logs kernel wakeup reasons and aborts.
617 *
618 * Logged from:
619 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
620 */
621message KernelWakeupReported {
622 // Name of the kernel wakeup reason (or abort).
623 optional string wakeup_reason_name = 1;
624
625 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800626 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700627}
628
629/**
630 * Logs wifi locks held by an app.
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 WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800636 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700637
638 enum State {
639 OFF = 0;
640 ON = 1;
641 }
642 optional State state = 2;
643}
644
645/**
646 * Logs wifi signal strength changes.
647 *
648 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700649 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700650 */
651message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800652 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
653 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700654}
655
656/**
657 * Logs wifi scans performed by an app.
658 *
659 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700660 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700661 */
662message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800663 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700664
665 enum State {
666 OFF = 0;
667 ON = 1;
668 }
669 optional State state = 2;
670}
671
672/**
Tej Singh4503e102018-01-04 14:35:01 -0800673 * Logs wifi multicast locks held by an app
674 *
675 * Logged from:
676 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
677 */
678message WifiMulticastLockStateChanged {
679 repeated AttributionNode attribution_node = 1;
680
681 enum State {
682 OFF = 0;
683 ON = 1;
684 }
685 optional State state = 2;
686}
687
688/**
Tej Singh1ea42892018-01-19 09:27:00 -0800689 * Logs shutdown reason and duration on next boot.
690 *
691 * Logged from:
692 * frameworks/base/core/java/com/android/server/BootReceiver.java
693 */
694message ShutdownSequenceReported {
695 // True if shutdown is for a reboot. Default: false if we do not know.
696 optional bool reboot = 1;
697
698 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
699 optional string reason = 2;
700
701 // Beginning of shutdown time in ms using wall clock time since unix epoch.
702 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800703 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800704
705 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800706 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800707}
708
Tej Singh6483ea42018-01-25 17:45:49 -0800709
710/**
711 * Logs boot reason and duration.
712 *
713 * Logged from:
714 * system/core/bootstat/bootstat.cpp
715 */
716message BootSequenceReported {
717 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
718 // Default: "<EMPTY>" if not available.
719 optional string bootloader_reason = 1;
720
721 // Reason for system boot. Eg. bootloader, reboot,userrequested
722 // Default: "<EMPTY>" if not available.
723 optional string system_reason = 2;
724
725 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800726 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800727
728 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800729 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800730
731 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800732 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800733
734 // Time since last boot in ms. Default: 0 if not available.
735 optional int64 time_since_last_boot = 6;
736}
737
Tej Singhc477d9c2018-02-05 18:31:39 -0800738
739/**
740 * Logs call state and disconnect cause (if applicable).
741 *
742 * Logged from:
743 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
744 */
745message CallStateChanged {
746 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
747 // From frameworks/base/core/proto/android/telecomm/enums.proto.
748 optional android.telecom.CallStateEnum call_state = 1;
749
750 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
751 // This value is only applicable when the call_state is DISCONNECTED, and
752 // should always be UNKNOWN if the call_state is not DISCONNECTED.
753 // From frameworks/base/core/proto/android/telecomm/enums.proto.
754 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
755
756 // True if the call is self-managed, which are apps that use the
757 // telecom infrastructure to make their own calls.
758 optional bool self_managed = 3;
759
760 // True if call is external. External calls are calls on connected Wear
761 // devices but show up in Telecom so the user can pull them onto the device.
762 optional bool external_call = 4;
763}
764
Tej Singh1ea42892018-01-19 09:27:00 -0800765/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800766 * Logs keyguard state. The keyguard is the lock screen.
767 *
768 * Logged from:
769 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
770 */
771message KeyguardStateChanged {
772 enum State {
773 UNKNOWN = 0;
774 // The keyguard is hidden when the phone is unlocked.
775 HIDDEN = 1;
776 // The keyguard is shown when the phone is locked (screen turns off).
777 SHOWN= 2;
778 // The keyguard is occluded when something is overlaying the keyguard.
779 // Eg. Opening the camera while on the lock screen.
780 OCCLUDED = 3;
781 }
782 optional State state = 1;
783}
784
785/**
786 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
787 * prompts the user to enter a password (pattern, pin, etc).
788 *
789 * Logged from:
790 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
791 */
792
793message KeyguardBouncerStateChanged {
794 enum State {
795 UNKNOWN = 0;
796 // Bouncer is hidden, either as a result of successfully entering the
797 // password, screen timing out, or user going back to lock screen.
798 HIDDEN = 1;
799 // This is when the user is being prompted to enter the password.
800 SHOWN = 2;
801 }
802 optional State state = 1;
803}
804
805/**
806 * Logs the result of entering a password into the keyguard bouncer.
807 *
808 * Logged from:
809 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
810 */
811message KeyguardBouncerPasswordEntered {
812 enum BouncerResult {
813 UNKNOWN = 0;
814 // The password entered was incorrect.
815 FAILURE = 1;
816 // The password entered was correct.
817 SUCCESS = 2;
818 }
819 optional BouncerResult result = 1;
820}
821
Tej Singha883b372018-02-15 11:30:01 -0800822/*
823 * Logs changes to the configuration of the device. The configuration is defined
824 * in frameworks/base/core/java/android/content/res/Configuration.java
825 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
826 * Please go there to interpret the possible values each field can be.
827 *
828 * Logged from:
829 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
830 */
831message ResourceConfigurationChanged {
832 // Bit mask of color capabilities of the screen.
833 // Contains information about the color gamut and hdr mode of the screen.
834 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
835 optional int32 colorMode = 1;
836
837 // The target screen density being rendered to.
838 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
839 optional int32 densityDpi = 2;
840
841 // Current user preference for the scaling factor for fonts,
842 // relative to the base density scaling.
843 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
844 optional float fontScale = 3;
845
846 // Flag indicating whether the hard keyboard is hidden.
847 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
848 optional int32 hardKeyboardHidden = 4;
849
850 // The type of keyboard attached to the device.
851 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
852 optional int32 keyboard = 5;
853
854 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
855 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
856 optional int32 keyboardHideen = 6;
857
858 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
859 // 0 if undefined.
860 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
861 optional int32 mcc = 7;
862
863 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
864 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
865 // MNC_ZERO symbol defined in Configuration.java.
866 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
867 optional int32 mnc = 8;
868
869 // The kind of navigation available on the device.
870 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
871 optional int32 navigation = 9;
872
873 // Flag indicating whether the navigation is available.
874 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
875 optional int32 navigationHidden = 10;
876
877 // Overall orientation of the screen.
878 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
879 optional int32 orientation = 11;
880
881 // The current height of the available screen space, in dp units.
882 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
883 optional int32 screenHeightDp = 12;
884
885 // Bit mask of overall layout of the screen.
886 // Contains information about screen size, whether the screen is wider/taller
887 // than normal, whether the screen layout is right-tl-left or left-to-right,
888 // and whether the screen has a rounded shape.
889 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
890 optional int32 screenLayout = 13;
891
892 // Current width of the available screen space, in dp units.
893 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
894 optional int32 screenWidthDp = 14;
895
896 // The smallest screen size an application will see in normal operation.
897 // This is the smallest value of both screenWidthDp and screenHeightDp
898 // in portrait and landscape.
899 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
900 optional int32 smallestScreenWidthDp = 15;
901
902 // The type of touch screen attached to the device.
903 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
904 optional int32 touchscreen = 16;
905
906 // Bit mask of the ui mode.
907 // Contains information about the overall ui mode of the device.
908 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
909 // Also contains information about whether the device is in night mode.
910 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
911 optional int32 uiMode = 17;
912}
913
Tej Singhdd7bd352018-02-09 19:33:15 -0800914/**
Tej Singh5d991e12018-03-09 19:48:11 -0800915 * Logs when Bluetooth is enabled and disabled.
916 *
917 * Logged from:
918 * services/core/java/com/android/server/BluetoothManagerService.java
919 */
920message BluetoothEnabledStateChanged {
921 repeated AttributionNode attribution_node = 1;
922 // Whether or not bluetooth is enabled on the device.
923 enum State {
924 UNKNOWN = 0;
925 ENABLED = 1;
926 DISABLED = 2;
927 }
928 optional State state = 2;
929 // The reason for being enabled/disabled.
930 // Eg. Airplane mode, crash, application request.
931 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
932 // If the reason is an application request, this will be the package name.
933 optional string pkgName = 4;
934}
935
936/**
937 * Logs when a Bluetooth device connects and disconnects.
938 *
939 * Logged from:
940 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
941 */
942message BluetoothConnectionStateChanged {
943 // The state of the connection.
944 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
945 optional android.bluetooth.ConnectionStateEnum state = 1;
946 // An identifier that can be used to match connect and disconnect events.
947 // Currently is last two bytes of a hash of a device level ID and
948 // the mac address of the bluetooth device that is connected.
949 optional int32 obfuscated_id = 2;
950 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
951 // From android.bluetooth.BluetoothAdapter.java
952 optional int32 bt_profile = 3;
953}
954
955/**
956 * Logs when Bluetooth A2dp audio streaming state changes.
957 *
958 * Logged from:
959 * TODO(b/73971848)
960 */
961message BluetoothA2dpAudioStateChanged {
962 // Whether or not audio is being played using Bluetooth A2dp.
963 enum State {
964 UNKNOWN = 0;
965 PLAY = 1;
966 STOP = 2;
967 }
968 optional State state = 1;
969}
970
971/**
Andrew Chant28d627e2018-02-22 15:17:05 -0800972 * Logs when something is plugged into or removed from the USB-C connector.
973 *
974 * Logged from:
975 * Vendor USB HAL.
976 */
977message UsbConnectorStateChanged {
978 enum State {
979 DISCONNECTED = 0;
980 CONNECTED = 1;
981 }
982 optional State state = 1;
983}
984
985/**
986 * Logs the reported speaker impedance.
987 *
988 * Logged from:
989 * Vendor audio implementation.
990 */
991message SpeakerImpedanceReported {
992 optional int32 speaker_location = 1;
993 optional int32 impedance = 2;
994}
995
996/**
997 * Logs the report of a failed hardware.
998 *
999 * Logged from:
1000 * Vendor HALs.
1001 *
1002 */
1003message HardwareFailed {
1004 enum HardwareType {
1005 HARDWARE_FAILED_UNKNOWN = 0;
1006 HARDWARE_FAILED_MICROPHONE = 1;
1007 HARDWARE_FAILED_CODEC = 2;
1008 HARDWARE_FAILED_SPEAKER = 3;
1009 HARDWARE_FAILED_FINGERPRINT = 4;
1010 }
1011 optional HardwareType hardware_type = 1;
1012
1013 /* hardware_location allows vendors to differentiate between multiple instances of
1014 * the same hardware_type. The specific locations are vendor defined integers,
1015 * referring to board-specific numbering schemes.
1016 */
1017 optional int32 hardware_location = 2;
1018
1019 /* failure_code is specific to the HardwareType of the failed hardware.
1020 * It should use the enum values defined below.
1021 */
1022 enum MicrophoneFailureCode {
1023 MICROPHONE_FAILURE_COMPLETE = 0;
1024 }
1025 enum CodecFailureCode {
1026 CODEC_FAILURE_COMPLETE = 0;
1027 }
1028 enum SpeakerFailureCode {
1029 SPEAKER_FAILURE_COMPLETE = 0;
1030 SPEAKER_FAILURE_HIGH_Z = 1;
1031 SPEAKER_FAILURE_SHORT = 2;
1032 }
1033 enum FingerprintFailureCode {
1034 FINGERPRINT_FAILURE_COMPLETE = 0;
1035 FINGERPRINT_SENSOR_BROKEN = 1;
1036 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1037 }
1038 optional int32 failure_code = 3;
1039}
1040
1041/**
1042 * Log an event when the device has been physically dropped.
1043 * Reported from the /vendor partition.
1044 */
1045message PhysicalDropDetected {
1046 // Confidence that the event was actually a drop, 0 -> 100
1047 optional int32 confidence_pctg = 1;
1048 // Peak acceleration of the drop, in 1/1000s of a g.
1049 optional int32 accel_peak_thousandths_g = 2;
1050}
1051
1052/**
1053 * Log bucketed battery charge cycles.
1054 *
1055 * Each bucket represents cycles of the battery past
1056 * a given charge point. For example, bucket 1 is the
1057 * lowest 1/8th of the battery, and bucket 8 is 100%.
1058 *
1059 * Logged from:
1060 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1061 */
1062message ChargeCyclesReported {
1063 optional int32 cycle_bucket_1 = 1;
1064 optional int32 cycle_bucket_2 = 2;
1065 optional int32 cycle_bucket_3 = 3;
1066 optional int32 cycle_bucket_4 = 4;
1067 optional int32 cycle_bucket_5 = 5;
1068 optional int32 cycle_bucket_6 = 6;
1069 optional int32 cycle_bucket_7 = 7;
1070 optional int32 cycle_bucket_8 = 8;
1071}
1072
1073/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001074 * Logs the duration of a davey (jank of >=700ms) when it occurs
1075 *
1076 * Logged from:
1077 * frameworks/base/libs/hwui/JankTracker.cpp
1078 */
1079message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001080 // The UID that logged this atom.
1081 optional int32 uid = 1;
1082
Tej Singhbb8554a2018-01-26 11:59:14 -08001083 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001084 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001085}
1086
1087/**
Bookatze5885242017-10-24 20:10:31 -07001088 * Logs phone signal strength changes.
1089 *
1090 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001091 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001092 */
1093message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001094 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1095 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001096}
1097
1098/**
1099 * Logs that a setting was updated.
1100 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001101 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001102 * The tag and is_default allow resetting of settings to default values based on the specified
1103 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1104 */
1105message SettingChanged {
1106 // The name of the setting.
1107 optional string setting = 1;
1108
1109 // The change being imposed on this setting. May represent a number, eg "3".
1110 optional string value = 2;
1111
1112 // The new value of this setting. For most settings, this is same as value. For some settings,
1113 // value is +X or -X where X represents an element in a set. For example, if the previous value
1114 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1115 // The +/- feature is currently only used for location_providers_allowed.
1116 optional string new_value = 3;
1117
1118 // The previous value of this setting.
1119 optional string prev_value = 4;
1120
1121 // The tag used with the is_default for resetting sets of settings. This is generally null.
1122 optional string tag = 5;
1123
Bookatz90867622018-01-31 15:05:57 -08001124 // True if this setting with tag should be resettable.
1125 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001126
David Chenbd789912018-03-16 17:19:55 -07001127 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001128 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001129
1130 enum ChangeReason {
1131 UPDATED = 1; // Updated can be an insertion or an update.
1132 DELETED = 2;
1133 }
1134 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001135}
Chenjie Yub3dda412017-10-24 13:41:59 -07001136
Chenjie Yu05013b32017-11-21 10:21:41 -08001137/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001138 * Logs activity going to foreground or background
1139 *
1140 * Logged from:
1141 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1142 */
1143message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -08001144 optional int32 uid = 1;
1145 optional string pkg_name = 2;
1146 optional string class_name = 3;
1147
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001148 enum Activity {
1149 MOVE_TO_BACKGROUND = 0;
1150 MOVE_TO_FOREGROUND = 1;
1151 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001152 optional Activity activity = 4;
1153}
David Chenc8a43242017-10-17 16:23:28 -07001154
1155/**
David Chen9e3808c2017-11-20 17:25:34 -08001156 * Logs when an error is written to dropbox.
1157 * Logged from:
1158 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1159 */
1160message DropboxErrorChanged {
1161 // The uid if available. -1 means not available.
1162 optional int32 uid = 1;
1163
1164 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
1165 optional string tag = 2;
1166
1167 // The name of the process.
1168 optional string process_name = 3;
1169
1170 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001171 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -08001172
1173 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -08001174 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -08001175
1176 // The activity name if available.
1177 optional string activity_name = 6;
1178
David Chen6e3e6cb2018-01-03 16:14:06 -08001179 // The package name if available.
1180 optional string package_name = 7;
1181
David Chen9e3808c2017-11-20 17:25:34 -08001182 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001183 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001184}
1185
David Chen0a368b22017-12-06 16:28:16 -08001186/*
1187 * Allows other apps to push events into statsd.
1188 * Logged from:
1189 * frameworks/base/core/java/android/util/StatsLog.java
1190 */
David Chen0b5c90c2018-01-25 16:51:49 -08001191message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001192 // The uid of the application that sent this custom atom.
1193 optional int32 uid = 1;
1194
1195 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1196 optional int32 label = 2;
1197
1198 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1199 // predicates for the metrics).
1200 enum State {
1201 UNKNOWN = 0;
1202 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1203 STOP = 2;
1204 START = 3;
1205 }
1206 optional State state = 3;
1207}
1208
David Chen9e3808c2017-11-20 17:25:34 -08001209/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001210 * Logs when statsd detects an anomaly.
1211 *
1212 * Logged from:
1213 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1214 */
1215message AnomalyDetected {
1216 // Uid that owns the config whose anomaly detection alert fired.
1217 optional int32 config_uid = 1;
1218
Yangster-mac94e197c2018-01-02 16:03:03 -08001219 // Id of the config whose anomaly detection alert fired.
1220 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001221
Yangster-mac94e197c2018-01-02 16:03:03 -08001222 // Id of the alert (i.e. name of the anomaly that was detected).
1223 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001224}
1225
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001226message AppStartChanged {
1227 // The uid if available. -1 means not available.
1228 optional int32 uid = 1;
1229
1230 // The app package name.
1231 optional string pkg_name = 2;
1232
1233 enum TransitionType {
1234 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1235 WARM = 1;
1236 HOT = 2;
1237 COLD = 3;
1238 }
1239 // The transition type.
1240 optional TransitionType type = 3;
1241
1242 // The activity name.
1243 optional string activity_name = 4;
1244
1245 // The name of the calling app. Empty if not set.
1246 optional string calling_pkg_name = 5;
1247
1248 // Whether the app is an instant app.
1249 optional bool is_instant_app = 6;
1250
1251 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001252 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001253
Bookatz80d11a02018-01-16 10:46:35 -08001254 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001255
David Chen0b5c90c2018-01-25 16:51:49 -08001256 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001257 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001258 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001259 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001260 optional int32 bind_application_delay_millis = 11;
1261 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001262
1263 // Empty if not set.
1264 optional string launch_token = 13;
1265
Calin Juravle759fbda2018-02-20 19:52:30 +00001266 // The compiler filter used when when the package was optimized.
1267 optional string package_optimization_compilation_filter = 14;
1268
1269 // The reason why the package was optimized.
1270 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001271}
1272
1273message AppStartCancelChanged {
1274 // The uid if available. -1 means not available.
1275 optional int32 uid = 1;
1276
1277 // The app package name.
1278 optional string pkg_name = 2;
1279
1280 enum TransitionType {
1281 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1282 WARM = 1;
1283 HOT = 2;
1284 COLD = 3;
1285 }
1286 // The transition type.
1287 optional TransitionType type = 3;
1288
1289 // The activity name.
1290 optional string activity_name = 4;
1291}
1292
1293message AppStartFullyDrawnChanged {
1294 // The uid if available. -1 means not available.
1295 optional int32 uid = 1;
1296
1297 // The app package name.
1298 optional string pkg_name = 2;
1299
1300 enum TransitionType {
1301 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1302 WITH_BUNDLE = 1;
1303 WITHOUT_BUNDLE = 2;
1304 }
1305 // The transition type.
1306 optional TransitionType type = 3;
1307
1308 // The activity name.
1309 optional string activity_name = 4;
1310
1311 optional bool transition_process_running = 5;
1312
1313 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001314 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001315}
1316
Bookatz8fcd09a2017-12-18 13:01:10 -08001317/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001318 * Logs a picture-in-picture action
1319 * Logged from:
1320 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1321 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1322 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1323 */
1324message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001325 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001326 optional int32 uid = 1;
1327
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001328 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001329
Chenjie Yu52cacc62017-12-08 18:11:45 -08001330 enum State {
1331 ENTERED = 1;
1332 EXPANDED_TO_FULL_SCREEN = 2;
1333 MINIMIZED = 3;
1334 DISMISSED = 4;
1335 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001336 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001337}
1338
1339/**
Chenjie Yue8904192017-12-08 19:12:57 -08001340 * Logs overlay action
1341 * Logged from:
1342 * services/core/java/com/android/server/wm/Session.java
1343 */
1344message OverlayStateChanged {
1345 optional int32 uid = 1;
1346
1347 optional string package_name = 2;
1348
1349 optional bool using_alert_window = 3;
1350
1351 enum State {
1352 ENTERED = 1;
1353 EXITED = 2;
1354 }
1355 optional State state = 4;
1356}
1357
Chenjie Yuccfe6452018-01-30 11:33:21 -08001358/*
1359 * Logs foreground service starts and stops.
1360 * Note that this is not when a service starts or stops, but when it is
1361 * considered foreground.
1362 * Logged from
1363 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1364 */
1365message ForegroundServiceStateChanged {
1366 optional int32 uid = 1;
1367 // package_name + "/" + class_name
1368 optional string short_name = 2;
1369
1370 enum State {
1371 ENTER = 1;
1372 EXIT = 2;
1373 }
1374 optional State state = 3;
1375}
1376
Chenjie Yue8904192017-12-08 19:12:57 -08001377/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001378 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1379 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1380 * attributed back to the parent (host) uid. One example is Chrome.
1381 *
1382 * Logged from:
1383 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1384 */
1385message IsolatedUidChanged {
1386 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1387 optional int32 parent_uid = 1;
1388
1389 optional int32 isolated_uid = 2;
1390
1391 // We expect an isolated uid to be removed before if it's used for another parent uid.
1392 enum Event {
1393 REMOVED = 0;
1394 CREATED = 1;
1395 }
1396 optional Event event = 3;
1397}
1398
1399/*
1400 * Logs the reception of an incoming network packet causing the main system to wake up for
1401 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1402 * and processed by WakeupController.cpp.
1403 */
1404message PacketWakeupOccurred {
1405 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1406 // delivered nowhere.
1407 optional int32 uid = 1;
1408 // The interface name on which the packet was received.
1409 optional string iface = 2;
1410 // The ethertype value of the packet.
1411 optional int32 ethertype = 3;
1412 // String representation of the destination MAC address of the packet.
1413 optional string destination_hardware_address = 4;
1414 // String representation of the source address of the packet if this was an IP packet.
1415 optional string source_ip = 5;
1416 // String representation of the destination address of the packet if this was an IP packet.
1417 optional string destination_ip = 6;
1418 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1419 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1420 // families.
1421 optional int32 ip_next_header = 7;
1422 // The source port if this was a TCP or UDP packet.
1423 optional int32 source_port = 8;
1424 // The destination port if this was a TCP or UDP packet.
1425 optional int32 destination_port = 9;
1426}
1427
1428/*
1429 * Logs the memory stats for an app on startup.
1430 * Logged from:
1431 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1432 */
1433message AppStartMemoryStateCaptured {
1434 // The uid if available. -1 means not available.
1435 optional int32 uid = 1;
1436
1437 // The process name.
1438 optional string process_name = 2;
1439
1440 // The activity name.
1441 optional string activity_name = 3;
1442
1443 // # of page-faults
1444 optional int64 pgfault = 4;
1445
1446 // # of major page-faults
1447 optional int64 pgmajfault = 5;
1448
1449 // RSS
1450 optional int64 rss_in_bytes = 6;
1451
1452 // CACHE
1453 optional int64 cache_in_bytes = 7;
1454
1455 // SWAP
1456 optional int64 swap_in_bytes = 8;
1457}
1458
1459/*
1460 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1461 * for LMK event.
1462 * Logged from:
1463 * system/core/lmkd/lmkd.c
1464 */
1465message LmkStateChanged {
1466 enum State {
1467 UNKNOWN = 0;
1468 START = 1;
1469 STOP = 2;
1470 }
1471 optional State state = 1;
1472}
1473
1474/*
1475 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1476 * Logged from:
1477 * system/core/lmkd/lmkd.c
1478 */
1479message LmkKillOccurred {
1480 // The uid if available. -1 means not available.
1481 optional int32 uid = 1;
1482
1483 // The process name.
1484 optional string process_name = 2;
1485
1486 // oom adj score.
1487 optional int32 oom_score = 3;
1488
1489 // # of page-faults
1490 optional int64 pgfault = 4;
1491
1492 // # of major page-faults
1493 optional int64 pgmajfault = 5;
1494
1495 // RSS
1496 optional int64 rss_in_bytes = 6;
1497
1498 // CACHE
1499 optional int64 cache_in_bytes = 7;
1500
1501 // SWAP
1502 optional int64 swap_in_bytes = 8;
1503}
1504
Rajeev Kumar51b54602018-03-01 12:18:26 -08001505/*
1506 * Logs when the ActivityManagerService detects that an app died.
1507 *
1508 * Logged from:
1509 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1510 */
1511message AppDied {
1512 // timestamp(elapsedRealtime) of record creation
1513 optional uint64 timestamp_millis = 1;
1514}
1515
Chenjie Yubbcbc602018-02-05 16:51:52 -08001516//////////////////////////////////////////////////////////////////////
1517// Pulled atoms below this line //
1518//////////////////////////////////////////////////////////////////////
1519
1520/**
David Chenc8a43242017-10-17 16:23:28 -07001521 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1522 *
1523 * Pulled from:
1524 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1525 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001526message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001527 optional int32 uid = 1;
1528
1529 optional int64 rx_bytes = 2;
1530
1531 optional int64 rx_packets = 3;
1532
1533 optional int64 tx_bytes = 4;
1534
1535 optional int64 tx_packets = 5;
1536}
1537
1538/**
1539 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1540 *
1541 * Pulled from:
1542 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1543 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001544message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001545 optional int32 uid = 1;
1546
1547 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1548 optional int32 is_foreground = 2;
1549
1550 optional int64 rx_bytes = 3;
1551
1552 optional int64 rx_packets = 4;
1553
1554 optional int64 tx_bytes = 5;
1555
1556 optional int64 tx_packets = 6;
1557}
1558
1559/**
1560 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1561 *
1562 * Pulled from:
1563 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1564 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001565message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001566 optional int32 uid = 1;
1567
1568 optional int64 rx_bytes = 2;
1569
1570 optional int64 rx_packets = 3;
1571
1572 optional int64 tx_bytes = 4;
1573
1574 optional int64 tx_packets = 5;
1575}
1576
1577/**
1578 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1579 *
1580 * Pulled from:
1581 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1582 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001583message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001584 optional int32 uid = 1;
1585
1586 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1587 optional int32 is_foreground = 2;
1588
1589 optional int64 rx_bytes = 3;
1590
1591 optional int64 rx_packets = 4;
1592
1593 optional int64 tx_bytes = 5;
1594
1595 optional int64 tx_packets = 6;
1596}
1597
1598/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001599 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1600 *
1601 * Pulled from:
1602 * StatsCompanionService
1603 */
1604message BluetoothBytesTransfer {
1605 optional int32 uid = 1;
1606
1607 optional int64 rx_bytes = 2;
1608
1609 optional int64 tx_bytes = 3;
1610}
1611
1612/**
David Chenc8a43242017-10-17 16:23:28 -07001613 * Pulls the kernel wakelock durations. This atom is adapted from
1614 * android/internal/os/KernelWakelockStats.java
1615 *
1616 * Pulled from:
1617 * StatsCompanionService using KernelWakelockReader.
1618 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001619message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001620 optional string name = 1;
1621
1622 optional int32 count = 2;
1623
1624 optional int32 version = 3;
1625
1626 optional int64 time = 4;
1627}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001628
Chenjie Yu05013b32017-11-21 10:21:41 -08001629/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001630 * Pulls low power state information. This includes platform and subsystem sleep state information,
1631 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001632 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001633 * hardware/interfaces/power/1.1/types.hal
1634 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001635message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001636 // Subsystem name
1637 optional string subsystem_name = 1;
1638 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1639 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1640 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001641 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001642 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001643 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001644 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001645}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001646
Chenjie Yu05013b32017-11-21 10:21:41 -08001647/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001648 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001649 * Pulls the time the cpu spend on the frequency index. Frequency index
1650 * starts from highest to lowest. The value should be monotonically
1651 * increasing since boot. However, if there is a cpu
1652 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001653 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001654message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001655 optional uint32 cluster = 1;
1656 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001657 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001658}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001659
Chenjie Yu05013b32017-11-21 10:21:41 -08001660/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001661 * Pulls Cpu Time Per Uid.
1662 * Note that isolated process uid time should be attributed to host uids.
1663 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001664message CpuTimePerUid {
Chenjie Yuec676612018-03-07 09:19:17 -08001665 optional int32 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001666 optional uint64 user_time_millis = 2;
1667 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001668}
1669
1670/**
1671 * Pulls Cpu Time Per Uid per frequency.
1672 * Note that isolated process uid time should be attributed to host uids.
1673 * For each uid, we order the time by descending frequencies.
1674 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001675message CpuTimePerUidFreq {
Chenjie Yuec676612018-03-07 09:19:17 -08001676 optional int32 uid = 1;
1677 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001678 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001679}
Hugo Benichi884970e2017-11-14 22:42:46 +09001680
Chenjie Yu05013b32017-11-21 10:21:41 -08001681/**
1682 * Pulls Wifi Controller Activity Energy Info
1683 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001684message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001685 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001686 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001687 // stack reported state
1688 // TODO: replace this with proto enum
1689 optional int32 stack_state = 2;
1690 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001691 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001692 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001693 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001694 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001695 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001696 // product of current(mA), voltage(V) and time(ms)
1697 optional uint64 controller_energy_used = 6;
1698}
1699
1700/**
1701 * Pulls Modem Activity Energy Info
1702 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001703message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001704 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001705 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001706 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001707 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001708 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001709 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001710 /**
1711 * Tx power index
1712 * index 0 = tx_power < 0dBm
1713 * index 1 = 0dBm < tx_power < 5dBm
1714 * index 2 = 5dBm < tx_power < 15dBm
1715 * index 3 = 15dBm < tx_power < 20dBm
1716 * index 4 = tx_power > 20dBm
1717 */
1718 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001719 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001720 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001721 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001722 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001723 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001724 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001725 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001726 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001727 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001728 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001729 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001730 // product of current(mA), voltage(V) and time(ms)
1731 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001732}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001733
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001734/**
1735 * Pulls Bluetooth Activity Energy Info
1736 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1737 */
1738message BluetoothActivityInfo {
1739 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001740 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001741 // bluetooth stack state
1742 optional int32 bluetooth_stack_state = 2;
1743 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001744 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001745 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001746 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001747 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001748 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001749 // product of current(mA), voltage(V) and time(ms)
1750 optional uint64 energy_used = 6;
1751}
1752
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001753/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001754 * Logs the memory stats for a process.
1755 */
1756message ProcessMemoryState {
1757 // The uid if available. -1 means not available.
1758 optional int32 uid = 1;
1759
1760 // The process name.
1761 optional string process_name = 2;
1762
1763 // oom adj score.
1764 optional int32 oom_score = 3;
1765
1766 // # of page-faults
1767 optional int64 pgfault = 4;
1768
1769 // # of major page-faults
1770 optional int64 pgmajfault = 5;
1771
Rajeev Kumar90235992018-01-29 11:06:48 -08001772 // RSS
1773 optional int64 rss_in_bytes = 6;
1774
1775 // CACHE
1776 optional int64 cache_in_bytes = 7;
1777
1778 // SWAP
1779 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001780}
1781
1782/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001783 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001784 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001785message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001786 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001787}
1788
1789/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001790 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001791 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001792message SystemUptime {
1793 // Milliseconds since the system was booted.
1794 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1795 // for external input).
1796 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001797 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001798}
1799
1800/*
1801 * Reads from /proc/uid_concurrent_active_time which has the format:
1802 * active: X (X is # cores)
1803 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1804 * [uid1]: [time-0] [time-1] [time-2] ... ...
1805 * ...
1806 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1807 * The file contains a monotonically increasing count of time for a single boot.
1808 */
1809message CpuActiveTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001810 optional int32 uid = 1;
1811 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001812}
1813
1814/**
1815 * Reads from /proc/uid_concurrent_policy_time which has the format:
1816 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1817 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1818 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1819 * ...
1820 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1821 * The file contains a monotonically increasing count of time for a single boot.
1822 */
1823message CpuClusterTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001824 optional int32 uid = 1;
1825 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001826 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001827}
1828
1829/*
1830 * Pulls free disk space, for data, system partition and temporary directory.
1831 */
1832message DiskSpace {
1833 // available bytes in data partition
1834 optional uint64 data_available_bytes = 1;
1835 // available bytes in system partition
1836 optional uint64 system_available_bytes = 2;
1837 // available bytes in download cache or temp directories
1838 optional uint64 temp_available_bytes = 3;
1839}
Tej Singhbf972d92018-01-10 20:51:13 -08001840
1841/**
1842 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001843 * Pulled from:
1844 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001845 */
1846message RemainingBatteryCapacity {
1847 optional int32 charge_uAh = 1;
1848}
1849
1850/**
1851 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001852 * Pulled from:
1853 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001854 */
1855message FullBatteryCapacity {
1856 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001857}
1858
1859/**
1860 * Pulls the temperature of various parts of the device, in Celsius.
1861 *
1862 * Pulled from:
1863 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1864 */
1865message Temperature {
1866 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1867 optional android.os.TemperatureTypeEnum sensor_location = 1;
1868
1869 // The name of the temperature source. Eg. CPU0
1870 optional string sensor_name = 2;
1871
1872 // Temperature in degrees C.
1873 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001874}