blob: 79ae23d777b46cd7ccc203203ce256a59f1062a5 [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 Singh33a412b2018-03-16 18:43:59 -070026import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080027import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080028import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080029import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080030import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080031import "frameworks/base/core/proto/android/telephony/enums.proto";
32import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080033
Yao Chend54f9dd2017-10-17 17:37:48 +000034/**
Stefan Lafonae2df012017-11-14 09:17:21 -080035 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000036 * raw stats log events from the Android system, also known as "atoms."
37 *
38 * This field contains a single oneof with all of the available messages.
39 * The stats-log-api-gen tool runs as part of the Android build and
40 * generates the android.util.StatsLog class, which contains the constants
41 * and methods that Android uses to log.
42 *
Stefan Lafonae2df012017-11-14 09:17:21 -080043 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000044 * Instead, statsd on Android constructs these messages synthetically,
45 * in the format defined here and in stats_log.proto.
46 */
Stefan Lafonae2df012017-11-14 09:17:21 -080047message Atom {
48 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070049 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070050 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
51 BleScanStateChanged ble_scan_state_changed = 2;
52 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
53 BleScanResultReceived ble_scan_result_received = 4;
54 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080055 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070056 SyncStateChanged sync_state_changed = 7;
57 ScheduledJobStateChanged scheduled_job_state_changed = 8;
58 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070059 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080060 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
61 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
62 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
63 // TODO: 14-19 are blank, but need not be
64 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
65 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
66 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070067 AudioStateChanged audio_state_changed = 23;
68 MediaCodecActivityChanged media_codec_activity_changed = 24;
69 CameraStateChanged camera_state_changed = 25;
70 FlashlightStateChanged flashlight_state_changed = 26;
71 UidProcessStateChanged uid_process_state_changed = 27;
72 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
73 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070074 BatteryLevelChanged battery_level_changed = 30;
75 ChargingStateChanged charging_state_changed = 31;
76 PluggedStateChanged plugged_state_changed = 32;
Tej Singh40298312018-02-16 00:15:09 -080077 // TODO: 33 is blank, but is available for use.
Bookatz8c6571b2017-10-24 15:04:41 -070078 DeviceOnStatusChanged device_on_status_changed = 34;
79 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
80 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070081 WifiLockStateChanged wifi_lock_state_changed = 37;
82 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
83 WifiScanStateChanged wifi_scan_state_changed = 39;
84 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070085 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070086 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070087 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090088 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080089 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080090 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080091 AppBreadcrumbReported app_breadcrumb_reported = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000092 AppStartChanged app_start_changed = 48;
93 AppStartCancelChanged app_start_cancel_changed = 49;
94 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080095 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080096 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080097 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080098 LmkStateChanged lmk_state_changed = 54;
99 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800100 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800101 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800102 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800103 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800104 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800105 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800106 KeyguardStateChanged keyguard_state_changed = 62;
107 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
108 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Rajeev Kumar51b54602018-03-01 12:18:26 -0800109 AppDied app_died=65;
Tej Singha883b372018-02-15 11:30:01 -0800110 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800111 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
112 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
113 BluetoothA2dpAudioStateChanged bluetooth_a2dp_audio_state_changed = 69;
Andrew Chant28d627e2018-02-22 15:17:05 -0800114 UsbConnectorStateChanged usb_connector_changed = 70;
115 SpeakerImpedanceReported speaker_impedance_reported = 71;
116 HardwareFailed hardware_failed = 72;
117 PhysicalDropDetected physical_drop_detected = 73;
118 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800119 MobileConnectionStateChanged mobile_connection_state_changed = 75;
120 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Yao Chend54f9dd2017-10-17 17:37:48 +0000121 }
David Chenc8a43242017-10-17 16:23:28 -0700122
David Chen6e3e6cb2018-01-03 16:14:06 -0800123 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800124 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700125 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800126 WifiBytesTransfer wifi_bytes_transfer = 10000;
127 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
128 MobileBytesTransfer mobile_bytes_transfer = 10002;
129 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800130 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800131 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800132 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800133 CpuTimePerFreq cpu_time_per_freq = 10008;
134 CpuTimePerUid cpu_time_per_uid = 10009;
135 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
136 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
137 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800138 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800139 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800140 SystemElapsedRealtime system_elapsed_realtime = 10014;
141 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800142 CpuActiveTime cpu_active_time = 10016;
143 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800144 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800145 RemainingBatteryCapacity remaining_battery_capacity = 10019;
146 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800147 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700148 }
yroa1fe77c2018-02-26 14:22:54 -0800149
150 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
151 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700152}
153
Yao Chend54f9dd2017-10-17 17:37:48 +0000154/**
Yangster-mac20877162017-12-22 17:19:39 -0800155 * This proto represents a node of an attribution chain.
156 * Note: All attribution chains are represented as a repeated field of type
157 * AttributionNode. It is understood that in such arrays, the order is that
158 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000159 */
Yangster-mac20877162017-12-22 17:19:39 -0800160message AttributionNode {
161 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800162 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800163
Yangster-mac20877162017-12-22 17:19:39 -0800164 // The (optional) string tag for an element in the attribution chain. If the
165 // element has no tag, it is encoded as an empty string.
166 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700167}
168
Yao Chend54f9dd2017-10-17 17:37:48 +0000169/*
170 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800171 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 *
173 * RULES:
174 * - The field ids for each atom must start at 1, and count upwards by 1.
175 * Skipping field ids is not allowed.
176 * - These form an API, so renaming, renumbering or removing fields is
177 * not allowed between android releases. (This is not currently enforced,
178 * but there will be a tool to enforce this restriction).
179 * - The types must be built-in protocol buffer types, namely, no sub-messages
180 * are allowed (yet). The bytes type is also not allowed.
181 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800182 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000183 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800184 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000185 * - A field that is a uid should be a string field, tagged with the [xxx]
186 * annotation. The generated code on android will be represented by UIDs,
187 * and those UIDs will be translated in xxx to those strings.
188 *
189 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700190 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000191 * - If there is a UID, it goes first. Think in an object-oriented fashion.
192 * *****************************************************************************
193 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700194
Yao Chend54f9dd2017-10-17 17:37:48 +0000195/**
196 * Logs when the screen state changes.
197 *
198 * Logged from:
199 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
200 */
201message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800202 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800203 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700204}
Yao Chend54f9dd2017-10-17 17:37:48 +0000205
206/**
Bookatzc1a050a2017-10-10 15:49:28 -0700207 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000208 *
209 * Logged from:
210 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
211 */
Bookatzc1a050a2017-10-10 15:49:28 -0700212message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800213 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000214
Bookatzdb026a22018-01-10 19:01:56 -0800215 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800216 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000217}
218
219/**
Bookatzc1a050a2017-10-10 15:49:28 -0700220 * Logs that a process started, finished, crashed, or ANRed.
221 *
222 * Logged from:
223 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
224 */
225message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800226 // TODO: should be a string tagged w/ uid annotation
227 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700228
David Chen0b5c90c2018-01-25 16:51:49 -0800229 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700230 optional string name = 2;
231
Bookatzddccf0a2017-11-28 16:48:14 -0800232 // What lifecycle state the process changed to.
233 // This enum is specific to atoms.proto.
234 enum Event {
235 PROCESS_FINISHED = 0;
236 PROCESS_STARTED = 1;
237 PROCESS_CRASHED = 2;
238 PROCESS_ANRED = 3;
239 }
240 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700241}
242
Bookatzc1a050a2017-10-10 15:49:28 -0700243/**
244 * Logs when the ble scan state changes.
245 *
246 * Logged from:
247 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
248 */
249message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800250 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700251
252 enum State {
253 OFF = 0;
254 ON = 1;
255 }
256 optional State state = 2;
257}
258
259/**
260 * Logs when an unoptimized ble scan state changes.
261 *
262 * Logged from:
263 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
264 */
265// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
266message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800267 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700268
269 enum State {
270 OFF = 0;
271 ON = 1;
272 }
273 optional State state = 2;
274}
275
276/**
277 * Logs reporting of a ble scan finding results.
278 *
279 * Logged from:
280 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
281 */
282// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
283message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800284 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700285
286 // Number of ble scan results returned.
287 optional int32 num_of_results = 2;
288}
289
290/**
291 * Logs when a sensor state changes.
292 *
293 * Logged from:
294 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
295 */
296message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800297 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700298
299 // TODO: Is there a way to get the actual name of the sensor?
300 // The id (int) of the sensor.
301 optional int32 sensor_id = 2;
302
303 enum State {
304 OFF = 0;
305 ON = 1;
306 }
307 optional State state = 3;
308}
309
310
311/**
312 * Logs when GPS state changes.
313 *
314 * Logged from:
315 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
316 */
317message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800318 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700319
320 enum State {
321 OFF = 0;
322 ON = 1;
323 }
324 optional State state = 2;
325}
326
327
328/**
329 * Logs when a sync manager sync state changes.
330 *
331 * Logged from:
332 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
333 */
334message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800335 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700336
David Chen0b5c90c2018-01-25 16:51:49 -0800337 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700338 optional string name = 2;
339
340 enum State {
341 OFF = 0;
342 ON = 1;
343 }
344 optional State state = 3;
345}
346
347/**
348 * Logs when a job scheduler job state changes.
349 *
350 * Logged from:
351 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
352 */
353message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800354 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700355
356 // Name of the job (as named in the app)
357 optional string name = 2;
358
359 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800360 FINISHED = 0;
361 STARTED = 1;
362 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700363 }
364 optional State state = 3;
365
Tej Singh33a412b2018-03-16 18:43:59 -0700366 // The reason a job has stopped.
367 // This is only applicable when the state is FINISHED.
368 // The default value is CANCELED.
369 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700370}
371
372/**
373 * Logs when the audio state changes.
374 *
375 * Logged from:
376 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
377 */
378message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800379 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700380
381 enum State {
382 OFF = 0;
383 ON = 1;
384 }
385 optional State state = 2;
386}
387
388/**
389 * Logs when the video codec state changes.
390 *
391 * Logged from:
392 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
393 */
394message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800395 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700396
397 enum State {
398 OFF = 0;
399 ON = 1;
400 }
401 optional State state = 2;
402}
403
404/**
405 * Logs when the flashlight state changes.
406 *
407 * Logged from:
408 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
409 */
410message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800411 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700412
413 enum State {
414 OFF = 0;
415 ON = 1;
416 }
417 optional State state = 2;
418}
419
420/**
421 * Logs when the camera state changes.
422 *
423 * Logged from:
424 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
425 */
426message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800427 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700428
429 enum State {
430 OFF = 0;
431 ON = 1;
432 }
433 optional State state = 2;
434}
435
436/**
437 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000438 *
439 * Logged from:
440 * TODO
441 */
Bookatzd6746242017-10-24 18:39:35 -0700442message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800443 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000444
Bookatz1a1b0462018-01-12 11:47:03 -0800445 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
446 // From frameworks/base/core/proto/android/os/enums.proto.
447 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700448
449 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
450 optional string tag = 3;
451
452 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800453 RELEASE = 0;
454 ACQUIRE = 1;
455 CHANGE_RELEASE = 2;
456 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700457 }
458 optional State state = 4;
459}
460
461/**
Bookatzc1a050a2017-10-10 15:49:28 -0700462 * Logs when a partial wakelock is considered 'long' (over 1 min).
463 *
464 * Logged from:
465 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
466 */
467message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800468 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700469
Yao Chend54f9dd2017-10-17 17:37:48 +0000470 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
471 optional string tag = 2;
472
Bookatzc1a050a2017-10-10 15:49:28 -0700473 // TODO: I have no idea what this is.
474 optional string history_tag = 3;
475
476 enum State {
477 OFF = 0;
478 ON = 1;
479 }
480 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000481}
482
Bookatzc1a050a2017-10-10 15:49:28 -0700483/**
484 * Logs Battery Saver state change.
485 *
486 * Logged from:
487 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
488 */
489message BatterySaverModeStateChanged {
490 enum State {
491 OFF = 0;
492 ON = 1;
493 }
494 optional State state = 1;
495}
496
497/**
498 * Logs Doze mode state change.
499 *
500 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800501 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700502 */
503message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800504 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800505}
506
507
508/**
509 * Logs state change of Doze mode including maintenance windows.
510 *
511 * Logged from:
512 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
513 */
514message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800515 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700516}
517
518/**
519 * Logs screen brightness level.
520 *
521 * Logged from:
522 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
523 */
524message ScreenBrightnessChanged {
525 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
526 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700527}
528
529/**
530 * Logs battery level (percent full, from 0 to 100).
531 *
532 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700533 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700534 */
535message BatteryLevelChanged {
536 // Battery level. Should be in [0, 100].
537 optional int32 battery_level = 1;
538}
539
540/**
541 * Logs change in charging status of the device.
542 *
543 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700544 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700545 */
546message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800547 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
548 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700549}
550
551/**
552 * Logs whether the device is plugged in, and what power source it is using.
553 *
554 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700555 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700556 */
557message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800558 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
559 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700560}
561
Bookatz8c6571b2017-10-24 15:04:41 -0700562// TODO: Define this more precisely.
563// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
564/**
565 * Logs when the device turns off or on.
566 *
567 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700568 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700569 */
570message DeviceOnStatusChanged {
571 enum State {
572 OFF = 0;
573 ON = 1;
574 }
575 optional State state = 1;
576}
577
578/**
579 * Logs when an app's wakeup alarm fires.
580 *
581 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700582 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700583 */
584message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800585 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800586
587 // Name of the wakeup alarm.
588 optional string tag = 2;
589}
590
591/**
592 * Logs when an an app causes the mobile radio to change state.
593 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
594 *
595 * Logged from:
596 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
597 */
598message MobileRadioPowerStateChanged {
599 // TODO: Add attribution instead of uid?
600 optional int32 uid = 1;
601
Bookatz1a1b0462018-01-12 11:47:03 -0800602 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
603 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800604}
605
606/**
607 * Logs when an an app causes the wifi radio to change state.
608 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
609 *
610 * Logged from:
611 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
612 */
613message WifiRadioPowerStateChanged {
614 // TODO: Add attribution instead of uid?
615 optional int32 uid = 1;
616
Bookatz1a1b0462018-01-12 11:47:03 -0800617 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
618 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700619}
620
621/**
622 * Logs kernel wakeup reasons and aborts.
623 *
624 * Logged from:
625 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
626 */
627message KernelWakeupReported {
628 // Name of the kernel wakeup reason (or abort).
629 optional string wakeup_reason_name = 1;
630
631 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800632 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700633}
634
635/**
636 * Logs wifi locks held by an app.
637 *
638 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700639 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700640 */
641message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800642 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700643
644 enum State {
645 OFF = 0;
646 ON = 1;
647 }
648 optional State state = 2;
649}
650
651/**
652 * Logs wifi signal strength changes.
653 *
654 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700655 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700656 */
657message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800658 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
659 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700660}
661
662/**
663 * Logs wifi scans performed by an app.
664 *
665 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700666 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700667 */
668message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800669 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700670
671 enum State {
672 OFF = 0;
673 ON = 1;
674 }
675 optional State state = 2;
676}
677
678/**
Tej Singh4503e102018-01-04 14:35:01 -0800679 * Logs wifi multicast locks held by an app
680 *
681 * Logged from:
682 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
683 */
684message WifiMulticastLockStateChanged {
685 repeated AttributionNode attribution_node = 1;
686
687 enum State {
688 OFF = 0;
689 ON = 1;
690 }
691 optional State state = 2;
692}
693
694/**
Tej Singh1ea42892018-01-19 09:27:00 -0800695 * Logs shutdown reason and duration on next boot.
696 *
697 * Logged from:
698 * frameworks/base/core/java/com/android/server/BootReceiver.java
699 */
700message ShutdownSequenceReported {
701 // True if shutdown is for a reboot. Default: false if we do not know.
702 optional bool reboot = 1;
703
704 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
705 optional string reason = 2;
706
707 // Beginning of shutdown time in ms using wall clock time since unix epoch.
708 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800709 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800710
711 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800712 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800713}
714
Tej Singh6483ea42018-01-25 17:45:49 -0800715
716/**
717 * Logs boot reason and duration.
718 *
719 * Logged from:
720 * system/core/bootstat/bootstat.cpp
721 */
722message BootSequenceReported {
723 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
724 // Default: "<EMPTY>" if not available.
725 optional string bootloader_reason = 1;
726
727 // Reason for system boot. Eg. bootloader, reboot,userrequested
728 // Default: "<EMPTY>" if not available.
729 optional string system_reason = 2;
730
731 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800732 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800733
734 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800735 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800736
737 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800738 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800739
740 // Time since last boot in ms. Default: 0 if not available.
741 optional int64 time_since_last_boot = 6;
742}
743
Tej Singhc477d9c2018-02-05 18:31:39 -0800744
745/**
746 * Logs call state and disconnect cause (if applicable).
747 *
748 * Logged from:
749 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
750 */
751message CallStateChanged {
752 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
753 // From frameworks/base/core/proto/android/telecomm/enums.proto.
754 optional android.telecom.CallStateEnum call_state = 1;
755
756 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
757 // This value is only applicable when the call_state is DISCONNECTED, and
758 // should always be UNKNOWN if the call_state is not DISCONNECTED.
759 // From frameworks/base/core/proto/android/telecomm/enums.proto.
760 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
761
762 // True if the call is self-managed, which are apps that use the
763 // telecom infrastructure to make their own calls.
764 optional bool self_managed = 3;
765
766 // True if call is external. External calls are calls on connected Wear
767 // devices but show up in Telecom so the user can pull them onto the device.
768 optional bool external_call = 4;
769}
770
Tej Singh1ea42892018-01-19 09:27:00 -0800771/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800772 * Logs keyguard state. The keyguard is the lock screen.
773 *
774 * Logged from:
775 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
776 */
777message KeyguardStateChanged {
778 enum State {
779 UNKNOWN = 0;
780 // The keyguard is hidden when the phone is unlocked.
781 HIDDEN = 1;
782 // The keyguard is shown when the phone is locked (screen turns off).
783 SHOWN= 2;
784 // The keyguard is occluded when something is overlaying the keyguard.
785 // Eg. Opening the camera while on the lock screen.
786 OCCLUDED = 3;
787 }
788 optional State state = 1;
789}
790
791/**
792 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
793 * prompts the user to enter a password (pattern, pin, etc).
794 *
795 * Logged from:
796 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
797 */
798
799message KeyguardBouncerStateChanged {
800 enum State {
801 UNKNOWN = 0;
802 // Bouncer is hidden, either as a result of successfully entering the
803 // password, screen timing out, or user going back to lock screen.
804 HIDDEN = 1;
805 // This is when the user is being prompted to enter the password.
806 SHOWN = 2;
807 }
808 optional State state = 1;
809}
810
811/**
812 * Logs the result of entering a password into the keyguard bouncer.
813 *
814 * Logged from:
815 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
816 */
817message KeyguardBouncerPasswordEntered {
818 enum BouncerResult {
819 UNKNOWN = 0;
820 // The password entered was incorrect.
821 FAILURE = 1;
822 // The password entered was correct.
823 SUCCESS = 2;
824 }
825 optional BouncerResult result = 1;
826}
827
Tej Singha883b372018-02-15 11:30:01 -0800828/*
829 * Logs changes to the configuration of the device. The configuration is defined
830 * in frameworks/base/core/java/android/content/res/Configuration.java
831 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
832 * Please go there to interpret the possible values each field can be.
833 *
834 * Logged from:
835 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
836 */
837message ResourceConfigurationChanged {
838 // Bit mask of color capabilities of the screen.
839 // Contains information about the color gamut and hdr mode of the screen.
840 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
841 optional int32 colorMode = 1;
842
843 // The target screen density being rendered to.
844 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
845 optional int32 densityDpi = 2;
846
847 // Current user preference for the scaling factor for fonts,
848 // relative to the base density scaling.
849 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
850 optional float fontScale = 3;
851
852 // Flag indicating whether the hard keyboard is hidden.
853 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
854 optional int32 hardKeyboardHidden = 4;
855
856 // The type of keyboard attached to the device.
857 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
858 optional int32 keyboard = 5;
859
860 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
861 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
862 optional int32 keyboardHideen = 6;
863
864 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
865 // 0 if undefined.
866 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
867 optional int32 mcc = 7;
868
869 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
870 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
871 // MNC_ZERO symbol defined in Configuration.java.
872 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
873 optional int32 mnc = 8;
874
875 // The kind of navigation available on the device.
876 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
877 optional int32 navigation = 9;
878
879 // Flag indicating whether the navigation is available.
880 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
881 optional int32 navigationHidden = 10;
882
883 // Overall orientation of the screen.
884 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
885 optional int32 orientation = 11;
886
887 // The current height of the available screen space, in dp units.
888 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
889 optional int32 screenHeightDp = 12;
890
891 // Bit mask of overall layout of the screen.
892 // Contains information about screen size, whether the screen is wider/taller
893 // than normal, whether the screen layout is right-tl-left or left-to-right,
894 // and whether the screen has a rounded shape.
895 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
896 optional int32 screenLayout = 13;
897
898 // Current width of the available screen space, in dp units.
899 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
900 optional int32 screenWidthDp = 14;
901
902 // The smallest screen size an application will see in normal operation.
903 // This is the smallest value of both screenWidthDp and screenHeightDp
904 // in portrait and landscape.
905 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
906 optional int32 smallestScreenWidthDp = 15;
907
908 // The type of touch screen attached to the device.
909 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
910 optional int32 touchscreen = 16;
911
912 // Bit mask of the ui mode.
913 // Contains information about the overall ui mode of the device.
914 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
915 // Also contains information about whether the device is in night mode.
916 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
917 optional int32 uiMode = 17;
918}
919
Tej Singheee317b2018-03-07 19:28:05 -0800920
921/**
922 * Logs changes in the connection state of the mobile radio.
923 *
924 * Logged from:
925 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
926 */
927message MobileConnectionStateChanged {
928 // States are from the state machine DataConnection.java.
929 enum State {
930 UNKNOWN = 0;
931 // The connection is inactive, or disconnected.
932 INACTIVE = 1;
933 // The connection is being activated, or connecting.
934 ACTIVATING = 2;
935 // The connection is active, or connected.
936 ACTIVE = 3;
937 // The connection is disconnecting.
938 DISCONNECTING = 4;
939 // The connection is disconnecting after creating a connection.
940 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
941 }
942 optional State state = 1;
943 // For multi-sim phones, this distinguishes between the sim cards.
944 optional int32 sim_slot_index = 2;
945 // Used to identify the connection. Starts at 0 and increments by 1 for
946 // every new network created. Resets whenever the device reboots.
947 optional int32 data_connection_id = 3;
948 // A bitmask for the capabilities of this connection.
949 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
950 // Default value (if we have no information): 0
951 optional int64 capabilities = 4;
952 // If this connection has internet.
953 // This just checks if the DEFAULT bit of capabilities is set.
954 optional bool has_internet = 5;
955}
956
957/**
958 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
959 *
960 * Logged from:
961 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
962 */
963message MobileRadioTechnologyChanged {
964 optional android.telephony.NetworkTypeEnum state = 1;
965 // For multi-sim phones, this distinguishes between the sim cards.
966 optional int32 sim_slot_index = 2;
967}
968
969
Tej Singhdd7bd352018-02-09 19:33:15 -0800970/**
Tej Singh5d991e12018-03-09 19:48:11 -0800971 * Logs when Bluetooth is enabled and disabled.
972 *
973 * Logged from:
974 * services/core/java/com/android/server/BluetoothManagerService.java
975 */
976message BluetoothEnabledStateChanged {
977 repeated AttributionNode attribution_node = 1;
978 // Whether or not bluetooth is enabled on the device.
979 enum State {
980 UNKNOWN = 0;
981 ENABLED = 1;
982 DISABLED = 2;
983 }
984 optional State state = 2;
985 // The reason for being enabled/disabled.
986 // Eg. Airplane mode, crash, application request.
987 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
988 // If the reason is an application request, this will be the package name.
989 optional string pkgName = 4;
990}
991
992/**
993 * Logs when a Bluetooth device connects and disconnects.
994 *
995 * Logged from:
996 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
997 */
998message BluetoothConnectionStateChanged {
999 // The state of the connection.
1000 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1001 optional android.bluetooth.ConnectionStateEnum state = 1;
1002 // An identifier that can be used to match connect and disconnect events.
1003 // Currently is last two bytes of a hash of a device level ID and
1004 // the mac address of the bluetooth device that is connected.
1005 optional int32 obfuscated_id = 2;
1006 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1007 // From android.bluetooth.BluetoothAdapter.java
1008 optional int32 bt_profile = 3;
1009}
1010
1011/**
1012 * Logs when Bluetooth A2dp audio streaming state changes.
1013 *
1014 * Logged from:
1015 * TODO(b/73971848)
1016 */
1017message BluetoothA2dpAudioStateChanged {
1018 // Whether or not audio is being played using Bluetooth A2dp.
1019 enum State {
1020 UNKNOWN = 0;
1021 PLAY = 1;
1022 STOP = 2;
1023 }
1024 optional State state = 1;
1025}
1026
1027/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001028 * Logs when something is plugged into or removed from the USB-C connector.
1029 *
1030 * Logged from:
1031 * Vendor USB HAL.
1032 */
1033message UsbConnectorStateChanged {
1034 enum State {
1035 DISCONNECTED = 0;
1036 CONNECTED = 1;
1037 }
1038 optional State state = 1;
1039}
1040
1041/**
1042 * Logs the reported speaker impedance.
1043 *
1044 * Logged from:
1045 * Vendor audio implementation.
1046 */
1047message SpeakerImpedanceReported {
1048 optional int32 speaker_location = 1;
1049 optional int32 impedance = 2;
1050}
1051
1052/**
1053 * Logs the report of a failed hardware.
1054 *
1055 * Logged from:
1056 * Vendor HALs.
1057 *
1058 */
1059message HardwareFailed {
1060 enum HardwareType {
1061 HARDWARE_FAILED_UNKNOWN = 0;
1062 HARDWARE_FAILED_MICROPHONE = 1;
1063 HARDWARE_FAILED_CODEC = 2;
1064 HARDWARE_FAILED_SPEAKER = 3;
1065 HARDWARE_FAILED_FINGERPRINT = 4;
1066 }
1067 optional HardwareType hardware_type = 1;
1068
1069 /* hardware_location allows vendors to differentiate between multiple instances of
1070 * the same hardware_type. The specific locations are vendor defined integers,
1071 * referring to board-specific numbering schemes.
1072 */
1073 optional int32 hardware_location = 2;
1074
1075 /* failure_code is specific to the HardwareType of the failed hardware.
1076 * It should use the enum values defined below.
1077 */
1078 enum MicrophoneFailureCode {
1079 MICROPHONE_FAILURE_COMPLETE = 0;
1080 }
1081 enum CodecFailureCode {
1082 CODEC_FAILURE_COMPLETE = 0;
1083 }
1084 enum SpeakerFailureCode {
1085 SPEAKER_FAILURE_COMPLETE = 0;
1086 SPEAKER_FAILURE_HIGH_Z = 1;
1087 SPEAKER_FAILURE_SHORT = 2;
1088 }
1089 enum FingerprintFailureCode {
1090 FINGERPRINT_FAILURE_COMPLETE = 0;
1091 FINGERPRINT_SENSOR_BROKEN = 1;
1092 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1093 }
1094 optional int32 failure_code = 3;
1095}
1096
1097/**
1098 * Log an event when the device has been physically dropped.
1099 * Reported from the /vendor partition.
1100 */
1101message PhysicalDropDetected {
1102 // Confidence that the event was actually a drop, 0 -> 100
1103 optional int32 confidence_pctg = 1;
1104 // Peak acceleration of the drop, in 1/1000s of a g.
1105 optional int32 accel_peak_thousandths_g = 2;
1106}
1107
1108/**
1109 * Log bucketed battery charge cycles.
1110 *
1111 * Each bucket represents cycles of the battery past
1112 * a given charge point. For example, bucket 1 is the
1113 * lowest 1/8th of the battery, and bucket 8 is 100%.
1114 *
1115 * Logged from:
1116 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1117 */
1118message ChargeCyclesReported {
1119 optional int32 cycle_bucket_1 = 1;
1120 optional int32 cycle_bucket_2 = 2;
1121 optional int32 cycle_bucket_3 = 3;
1122 optional int32 cycle_bucket_4 = 4;
1123 optional int32 cycle_bucket_5 = 5;
1124 optional int32 cycle_bucket_6 = 6;
1125 optional int32 cycle_bucket_7 = 7;
1126 optional int32 cycle_bucket_8 = 8;
1127}
1128
1129/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001130 * Logs the duration of a davey (jank of >=700ms) when it occurs
1131 *
1132 * Logged from:
1133 * frameworks/base/libs/hwui/JankTracker.cpp
1134 */
1135message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001136 // The UID that logged this atom.
1137 optional int32 uid = 1;
1138
Tej Singhbb8554a2018-01-26 11:59:14 -08001139 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001140 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001141}
1142
1143/**
Bookatze5885242017-10-24 20:10:31 -07001144 * Logs phone signal strength changes.
1145 *
1146 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001147 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001148 */
1149message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001150 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1151 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001152}
1153
1154/**
1155 * Logs that a setting was updated.
1156 * Logged from:
1157 * frameworks/base/core/java/android/provider/Settings.java
1158 * The tag and is_default allow resetting of settings to default values based on the specified
1159 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1160 */
1161message SettingChanged {
1162 // The name of the setting.
1163 optional string setting = 1;
1164
1165 // The change being imposed on this setting. May represent a number, eg "3".
1166 optional string value = 2;
1167
1168 // The new value of this setting. For most settings, this is same as value. For some settings,
1169 // value is +X or -X where X represents an element in a set. For example, if the previous value
1170 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1171 // The +/- feature is currently only used for location_providers_allowed.
1172 optional string new_value = 3;
1173
1174 // The previous value of this setting.
1175 optional string prev_value = 4;
1176
1177 // The tag used with the is_default for resetting sets of settings. This is generally null.
1178 optional string tag = 5;
1179
Bookatz90867622018-01-31 15:05:57 -08001180 // True if this setting with tag should be resettable.
1181 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001182
1183 // The user ID associated. Defined in android/os/UserHandle.java
1184 optional int32 user = 7;
1185}
Chenjie Yub3dda412017-10-24 13:41:59 -07001186
Chenjie Yu05013b32017-11-21 10:21:41 -08001187/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001188 * Logs activity going to foreground or background
1189 *
1190 * Logged from:
1191 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1192 */
1193message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -08001194 optional int32 uid = 1;
1195 optional string pkg_name = 2;
1196 optional string class_name = 3;
1197
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001198 enum Activity {
1199 MOVE_TO_BACKGROUND = 0;
1200 MOVE_TO_FOREGROUND = 1;
1201 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001202 optional Activity activity = 4;
1203}
David Chenc8a43242017-10-17 16:23:28 -07001204
1205/**
David Chen9e3808c2017-11-20 17:25:34 -08001206 * Logs when an error is written to dropbox.
1207 * Logged from:
1208 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1209 */
1210message DropboxErrorChanged {
1211 // The uid if available. -1 means not available.
1212 optional int32 uid = 1;
1213
1214 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
1215 optional string tag = 2;
1216
1217 // The name of the process.
1218 optional string process_name = 3;
1219
1220 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001221 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -08001222
1223 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -08001224 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -08001225
1226 // The activity name if available.
1227 optional string activity_name = 6;
1228
David Chen6e3e6cb2018-01-03 16:14:06 -08001229 // The package name if available.
1230 optional string package_name = 7;
1231
David Chen9e3808c2017-11-20 17:25:34 -08001232 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001233 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001234}
1235
David Chen0a368b22017-12-06 16:28:16 -08001236/*
1237 * Allows other apps to push events into statsd.
1238 * Logged from:
1239 * frameworks/base/core/java/android/util/StatsLog.java
1240 */
David Chen0b5c90c2018-01-25 16:51:49 -08001241message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001242 // The uid of the application that sent this custom atom.
1243 optional int32 uid = 1;
1244
1245 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1246 optional int32 label = 2;
1247
1248 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1249 // predicates for the metrics).
1250 enum State {
1251 UNKNOWN = 0;
1252 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1253 STOP = 2;
1254 START = 3;
1255 }
1256 optional State state = 3;
1257}
1258
David Chen9e3808c2017-11-20 17:25:34 -08001259/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001260 * Logs when statsd detects an anomaly.
1261 *
1262 * Logged from:
1263 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1264 */
1265message AnomalyDetected {
1266 // Uid that owns the config whose anomaly detection alert fired.
1267 optional int32 config_uid = 1;
1268
Yangster-mac94e197c2018-01-02 16:03:03 -08001269 // Id of the config whose anomaly detection alert fired.
1270 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001271
Yangster-mac94e197c2018-01-02 16:03:03 -08001272 // Id of the alert (i.e. name of the anomaly that was detected).
1273 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001274}
1275
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001276message AppStartChanged {
1277 // The uid if available. -1 means not available.
1278 optional int32 uid = 1;
1279
1280 // The app package name.
1281 optional string pkg_name = 2;
1282
1283 enum TransitionType {
1284 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1285 WARM = 1;
1286 HOT = 2;
1287 COLD = 3;
1288 }
1289 // The transition type.
1290 optional TransitionType type = 3;
1291
1292 // The activity name.
1293 optional string activity_name = 4;
1294
1295 // The name of the calling app. Empty if not set.
1296 optional string calling_pkg_name = 5;
1297
1298 // Whether the app is an instant app.
1299 optional bool is_instant_app = 6;
1300
1301 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001302 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001303
Bookatz80d11a02018-01-16 10:46:35 -08001304 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001305
David Chen0b5c90c2018-01-25 16:51:49 -08001306 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001307 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001308 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001309 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001310 optional int32 bind_application_delay_millis = 11;
1311 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001312
1313 // Empty if not set.
1314 optional string launch_token = 13;
1315
Calin Juravle759fbda2018-02-20 19:52:30 +00001316 // The compiler filter used when when the package was optimized.
1317 optional string package_optimization_compilation_filter = 14;
1318
1319 // The reason why the package was optimized.
1320 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001321}
1322
1323message AppStartCancelChanged {
1324 // The uid if available. -1 means not available.
1325 optional int32 uid = 1;
1326
1327 // The app package name.
1328 optional string pkg_name = 2;
1329
1330 enum TransitionType {
1331 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1332 WARM = 1;
1333 HOT = 2;
1334 COLD = 3;
1335 }
1336 // The transition type.
1337 optional TransitionType type = 3;
1338
1339 // The activity name.
1340 optional string activity_name = 4;
1341}
1342
1343message AppStartFullyDrawnChanged {
1344 // The uid if available. -1 means not available.
1345 optional int32 uid = 1;
1346
1347 // The app package name.
1348 optional string pkg_name = 2;
1349
1350 enum TransitionType {
1351 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1352 WITH_BUNDLE = 1;
1353 WITHOUT_BUNDLE = 2;
1354 }
1355 // The transition type.
1356 optional TransitionType type = 3;
1357
1358 // The activity name.
1359 optional string activity_name = 4;
1360
1361 optional bool transition_process_running = 5;
1362
1363 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001364 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001365}
1366
Bookatz8fcd09a2017-12-18 13:01:10 -08001367/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001368 * Logs a picture-in-picture action
1369 * Logged from:
1370 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1371 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1372 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1373 */
1374message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001375 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001376 optional int32 uid = 1;
1377
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001378 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001379
Chenjie Yu52cacc62017-12-08 18:11:45 -08001380 enum State {
1381 ENTERED = 1;
1382 EXPANDED_TO_FULL_SCREEN = 2;
1383 MINIMIZED = 3;
1384 DISMISSED = 4;
1385 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001386 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001387}
1388
1389/**
Chenjie Yue8904192017-12-08 19:12:57 -08001390 * Logs overlay action
1391 * Logged from:
1392 * services/core/java/com/android/server/wm/Session.java
1393 */
1394message OverlayStateChanged {
1395 optional int32 uid = 1;
1396
1397 optional string package_name = 2;
1398
1399 optional bool using_alert_window = 3;
1400
1401 enum State {
1402 ENTERED = 1;
1403 EXITED = 2;
1404 }
1405 optional State state = 4;
1406}
1407
Chenjie Yuccfe6452018-01-30 11:33:21 -08001408/*
1409 * Logs foreground service starts and stops.
1410 * Note that this is not when a service starts or stops, but when it is
1411 * considered foreground.
1412 * Logged from
1413 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1414 */
1415message ForegroundServiceStateChanged {
1416 optional int32 uid = 1;
1417 // package_name + "/" + class_name
1418 optional string short_name = 2;
1419
1420 enum State {
1421 ENTER = 1;
1422 EXIT = 2;
1423 }
1424 optional State state = 3;
1425}
1426
Chenjie Yue8904192017-12-08 19:12:57 -08001427/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001428 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1429 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1430 * attributed back to the parent (host) uid. One example is Chrome.
1431 *
1432 * Logged from:
1433 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1434 */
1435message IsolatedUidChanged {
1436 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1437 optional int32 parent_uid = 1;
1438
1439 optional int32 isolated_uid = 2;
1440
1441 // We expect an isolated uid to be removed before if it's used for another parent uid.
1442 enum Event {
1443 REMOVED = 0;
1444 CREATED = 1;
1445 }
1446 optional Event event = 3;
1447}
1448
1449/*
1450 * Logs the reception of an incoming network packet causing the main system to wake up for
1451 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1452 * and processed by WakeupController.cpp.
1453 */
1454message PacketWakeupOccurred {
1455 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1456 // delivered nowhere.
1457 optional int32 uid = 1;
1458 // The interface name on which the packet was received.
1459 optional string iface = 2;
1460 // The ethertype value of the packet.
1461 optional int32 ethertype = 3;
1462 // String representation of the destination MAC address of the packet.
1463 optional string destination_hardware_address = 4;
1464 // String representation of the source address of the packet if this was an IP packet.
1465 optional string source_ip = 5;
1466 // String representation of the destination address of the packet if this was an IP packet.
1467 optional string destination_ip = 6;
1468 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1469 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1470 // families.
1471 optional int32 ip_next_header = 7;
1472 // The source port if this was a TCP or UDP packet.
1473 optional int32 source_port = 8;
1474 // The destination port if this was a TCP or UDP packet.
1475 optional int32 destination_port = 9;
1476}
1477
1478/*
1479 * Logs the memory stats for an app on startup.
1480 * Logged from:
1481 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1482 */
1483message AppStartMemoryStateCaptured {
1484 // The uid if available. -1 means not available.
1485 optional int32 uid = 1;
1486
1487 // The process name.
1488 optional string process_name = 2;
1489
1490 // The activity name.
1491 optional string activity_name = 3;
1492
1493 // # of page-faults
1494 optional int64 pgfault = 4;
1495
1496 // # of major page-faults
1497 optional int64 pgmajfault = 5;
1498
1499 // RSS
1500 optional int64 rss_in_bytes = 6;
1501
1502 // CACHE
1503 optional int64 cache_in_bytes = 7;
1504
1505 // SWAP
1506 optional int64 swap_in_bytes = 8;
1507}
1508
1509/*
1510 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1511 * for LMK event.
1512 * Logged from:
1513 * system/core/lmkd/lmkd.c
1514 */
1515message LmkStateChanged {
1516 enum State {
1517 UNKNOWN = 0;
1518 START = 1;
1519 STOP = 2;
1520 }
1521 optional State state = 1;
1522}
1523
1524/*
1525 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1526 * Logged from:
1527 * system/core/lmkd/lmkd.c
1528 */
1529message LmkKillOccurred {
1530 // The uid if available. -1 means not available.
1531 optional int32 uid = 1;
1532
1533 // The process name.
1534 optional string process_name = 2;
1535
1536 // oom adj score.
1537 optional int32 oom_score = 3;
1538
1539 // # of page-faults
1540 optional int64 pgfault = 4;
1541
1542 // # of major page-faults
1543 optional int64 pgmajfault = 5;
1544
1545 // RSS
1546 optional int64 rss_in_bytes = 6;
1547
1548 // CACHE
1549 optional int64 cache_in_bytes = 7;
1550
1551 // SWAP
1552 optional int64 swap_in_bytes = 8;
1553}
1554
Rajeev Kumar51b54602018-03-01 12:18:26 -08001555/*
1556 * Logs when the ActivityManagerService detects that an app died.
1557 *
1558 * Logged from:
1559 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1560 */
1561message AppDied {
1562 // timestamp(elapsedRealtime) of record creation
1563 optional uint64 timestamp_millis = 1;
1564}
1565
Chenjie Yubbcbc602018-02-05 16:51:52 -08001566//////////////////////////////////////////////////////////////////////
1567// Pulled atoms below this line //
1568//////////////////////////////////////////////////////////////////////
1569
1570/**
David Chenc8a43242017-10-17 16:23:28 -07001571 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1572 *
1573 * Pulled from:
1574 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1575 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001576message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001577 optional int32 uid = 1;
1578
1579 optional int64 rx_bytes = 2;
1580
1581 optional int64 rx_packets = 3;
1582
1583 optional int64 tx_bytes = 4;
1584
1585 optional int64 tx_packets = 5;
1586}
1587
1588/**
1589 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1590 *
1591 * Pulled from:
1592 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1593 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001594message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001595 optional int32 uid = 1;
1596
1597 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1598 optional int32 is_foreground = 2;
1599
1600 optional int64 rx_bytes = 3;
1601
1602 optional int64 rx_packets = 4;
1603
1604 optional int64 tx_bytes = 5;
1605
1606 optional int64 tx_packets = 6;
1607}
1608
1609/**
1610 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1611 *
1612 * Pulled from:
1613 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1614 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001615message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001616 optional int32 uid = 1;
1617
1618 optional int64 rx_bytes = 2;
1619
1620 optional int64 rx_packets = 3;
1621
1622 optional int64 tx_bytes = 4;
1623
1624 optional int64 tx_packets = 5;
1625}
1626
1627/**
1628 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1629 *
1630 * Pulled from:
1631 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1632 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001633message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001634 optional int32 uid = 1;
1635
1636 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1637 optional int32 is_foreground = 2;
1638
1639 optional int64 rx_bytes = 3;
1640
1641 optional int64 rx_packets = 4;
1642
1643 optional int64 tx_bytes = 5;
1644
1645 optional int64 tx_packets = 6;
1646}
1647
1648/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001649 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1650 *
1651 * Pulled from:
1652 * StatsCompanionService
1653 */
1654message BluetoothBytesTransfer {
1655 optional int32 uid = 1;
1656
1657 optional int64 rx_bytes = 2;
1658
1659 optional int64 tx_bytes = 3;
1660}
1661
1662/**
David Chenc8a43242017-10-17 16:23:28 -07001663 * Pulls the kernel wakelock durations. This atom is adapted from
1664 * android/internal/os/KernelWakelockStats.java
1665 *
1666 * Pulled from:
1667 * StatsCompanionService using KernelWakelockReader.
1668 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001669message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001670 optional string name = 1;
1671
1672 optional int32 count = 2;
1673
1674 optional int32 version = 3;
1675
1676 optional int64 time = 4;
1677}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001678
Chenjie Yu05013b32017-11-21 10:21:41 -08001679/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001680 * Pulls low power state information. This includes platform and subsystem sleep state information,
1681 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001682 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001683 * hardware/interfaces/power/1.1/types.hal
1684 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001685message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001686 // Subsystem name
1687 optional string subsystem_name = 1;
1688 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1689 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1690 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001691 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001692 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001693 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001694 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001695}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001696
Chenjie Yu05013b32017-11-21 10:21:41 -08001697/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001698 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001699 * Pulls the time the cpu spend on the frequency index. Frequency index
1700 * starts from highest to lowest. The value should be monotonically
1701 * increasing since boot. However, if there is a cpu
1702 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001703 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001704message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001705 optional uint32 cluster = 1;
1706 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001707 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001708}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001709
Chenjie Yu05013b32017-11-21 10:21:41 -08001710/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001711 * Pulls Cpu Time Per Uid.
1712 * Note that isolated process uid time should be attributed to host uids.
1713 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001714message CpuTimePerUid {
Chenjie Yuec676612018-03-07 09:19:17 -08001715 optional int32 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001716 optional uint64 user_time_millis = 2;
1717 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001718}
1719
1720/**
1721 * Pulls Cpu Time Per Uid per frequency.
1722 * Note that isolated process uid time should be attributed to host uids.
1723 * For each uid, we order the time by descending frequencies.
1724 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001725message CpuTimePerUidFreq {
Chenjie Yuec676612018-03-07 09:19:17 -08001726 optional int32 uid = 1;
1727 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001728 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001729}
Hugo Benichi884970e2017-11-14 22:42:46 +09001730
Chenjie Yu05013b32017-11-21 10:21:41 -08001731/**
1732 * Pulls Wifi Controller Activity Energy Info
1733 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001734message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001735 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001736 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001737 // stack reported state
1738 // TODO: replace this with proto enum
1739 optional int32 stack_state = 2;
1740 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001741 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001742 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001743 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001744 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001745 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001746 // product of current(mA), voltage(V) and time(ms)
1747 optional uint64 controller_energy_used = 6;
1748}
1749
1750/**
1751 * Pulls Modem Activity Energy Info
1752 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001753message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001754 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001755 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001756 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001757 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001758 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001759 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001760 /**
1761 * Tx power index
1762 * index 0 = tx_power < 0dBm
1763 * index 1 = 0dBm < tx_power < 5dBm
1764 * index 2 = 5dBm < tx_power < 15dBm
1765 * index 3 = 15dBm < tx_power < 20dBm
1766 * index 4 = tx_power > 20dBm
1767 */
1768 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001769 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001770 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001771 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001772 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001773 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001774 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001775 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001776 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001777 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001778 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001779 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001780 // product of current(mA), voltage(V) and time(ms)
1781 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001782}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001783
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001784/**
1785 * Pulls Bluetooth Activity Energy Info
1786 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1787 */
1788message BluetoothActivityInfo {
1789 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001790 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001791 // bluetooth stack state
1792 optional int32 bluetooth_stack_state = 2;
1793 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001794 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001795 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001796 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001797 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001798 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001799 // product of current(mA), voltage(V) and time(ms)
1800 optional uint64 energy_used = 6;
1801}
1802
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001803/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001804 * Logs the memory stats for a process.
1805 */
1806message ProcessMemoryState {
1807 // The uid if available. -1 means not available.
1808 optional int32 uid = 1;
1809
1810 // The process name.
1811 optional string process_name = 2;
1812
1813 // oom adj score.
1814 optional int32 oom_score = 3;
1815
1816 // # of page-faults
1817 optional int64 pgfault = 4;
1818
1819 // # of major page-faults
1820 optional int64 pgmajfault = 5;
1821
Rajeev Kumar90235992018-01-29 11:06:48 -08001822 // RSS
1823 optional int64 rss_in_bytes = 6;
1824
1825 // CACHE
1826 optional int64 cache_in_bytes = 7;
1827
1828 // SWAP
1829 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001830}
1831
1832/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001833 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001834 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001835message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001836 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001837}
1838
1839/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001840 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001841 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001842message SystemUptime {
1843 // Milliseconds since the system was booted.
1844 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1845 // for external input).
1846 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001847 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001848}
1849
1850/*
1851 * Reads from /proc/uid_concurrent_active_time which has the format:
1852 * active: X (X is # cores)
1853 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1854 * [uid1]: [time-0] [time-1] [time-2] ... ...
1855 * ...
1856 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1857 * The file contains a monotonically increasing count of time for a single boot.
1858 */
1859message CpuActiveTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001860 optional int32 uid = 1;
1861 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001862}
1863
1864/**
1865 * Reads from /proc/uid_concurrent_policy_time which has the format:
1866 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1867 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1868 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1869 * ...
1870 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1871 * The file contains a monotonically increasing count of time for a single boot.
1872 */
1873message CpuClusterTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001874 optional int32 uid = 1;
1875 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001876 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001877}
1878
1879/*
1880 * Pulls free disk space, for data, system partition and temporary directory.
1881 */
1882message DiskSpace {
1883 // available bytes in data partition
1884 optional uint64 data_available_bytes = 1;
1885 // available bytes in system partition
1886 optional uint64 system_available_bytes = 2;
1887 // available bytes in download cache or temp directories
1888 optional uint64 temp_available_bytes = 3;
1889}
Tej Singhbf972d92018-01-10 20:51:13 -08001890
1891/**
1892 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001893 * Pulled from:
1894 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001895 */
1896message RemainingBatteryCapacity {
1897 optional int32 charge_uAh = 1;
1898}
1899
1900/**
1901 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001902 * Pulled from:
1903 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001904 */
1905message FullBatteryCapacity {
1906 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001907}
1908
1909/**
1910 * Pulls the temperature of various parts of the device, in Celsius.
1911 *
1912 * Pulled from:
1913 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1914 */
1915message Temperature {
1916 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1917 optional android.os.TemperatureTypeEnum sensor_location = 1;
1918
1919 // The name of the temperature source. Eg. CPU0
1920 optional string sensor_name = 2;
1921
1922 // Temperature in degrees C.
1923 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001924}