blob: f74188f5e69f8336ef4cb0c9fc4d37b78479716a [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;
Tej Singheee317b2018-03-07 19:28:05 -0800118 MobileConnectionStateChanged mobile_connection_state_changed = 75;
119 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Yao Chend54f9dd2017-10-17 17:37:48 +0000120 }
David Chenc8a43242017-10-17 16:23:28 -0700121
David Chen6e3e6cb2018-01-03 16:14:06 -0800122 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800123 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700124 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800125 WifiBytesTransfer wifi_bytes_transfer = 10000;
126 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
127 MobileBytesTransfer mobile_bytes_transfer = 10002;
128 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800129 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800130 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800131 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800132 CpuTimePerFreq cpu_time_per_freq = 10008;
133 CpuTimePerUid cpu_time_per_uid = 10009;
134 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
135 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
136 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800137 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800138 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800139 SystemElapsedRealtime system_elapsed_realtime = 10014;
140 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800141 CpuActiveTime cpu_active_time = 10016;
142 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800143 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800144 RemainingBatteryCapacity remaining_battery_capacity = 10019;
145 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800146 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700147 }
yroa1fe77c2018-02-26 14:22:54 -0800148
149 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
150 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700151}
152
Yao Chend54f9dd2017-10-17 17:37:48 +0000153/**
Yangster-mac20877162017-12-22 17:19:39 -0800154 * This proto represents a node of an attribution chain.
155 * Note: All attribution chains are represented as a repeated field of type
156 * AttributionNode. It is understood that in such arrays, the order is that
157 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000158 */
Yangster-mac20877162017-12-22 17:19:39 -0800159message AttributionNode {
160 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800161 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800162
Yangster-mac20877162017-12-22 17:19:39 -0800163 // The (optional) string tag for an element in the attribution chain. If the
164 // element has no tag, it is encoded as an empty string.
165 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700166}
167
Yao Chend54f9dd2017-10-17 17:37:48 +0000168/*
169 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800170 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000171 *
172 * RULES:
173 * - The field ids for each atom must start at 1, and count upwards by 1.
174 * Skipping field ids is not allowed.
175 * - These form an API, so renaming, renumbering or removing fields is
176 * not allowed between android releases. (This is not currently enforced,
177 * but there will be a tool to enforce this restriction).
178 * - The types must be built-in protocol buffer types, namely, no sub-messages
179 * are allowed (yet). The bytes type is also not allowed.
180 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800181 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000182 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800183 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 * - A field that is a uid should be a string field, tagged with the [xxx]
185 * annotation. The generated code on android will be represented by UIDs,
186 * and those UIDs will be translated in xxx to those strings.
187 *
188 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700189 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000190 * - If there is a UID, it goes first. Think in an object-oriented fashion.
191 * *****************************************************************************
192 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700193
Yao Chend54f9dd2017-10-17 17:37:48 +0000194/**
195 * Logs when the screen state changes.
196 *
197 * Logged from:
198 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
199 */
200message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800201 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800202 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700203}
Yao Chend54f9dd2017-10-17 17:37:48 +0000204
205/**
Bookatzc1a050a2017-10-10 15:49:28 -0700206 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000207 *
208 * Logged from:
209 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
210 */
Bookatzc1a050a2017-10-10 15:49:28 -0700211message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800212 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000213
Bookatzdb026a22018-01-10 19:01:56 -0800214 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800215 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000216}
217
218/**
Bookatzc1a050a2017-10-10 15:49:28 -0700219 * Logs that a process started, finished, crashed, or ANRed.
220 *
221 * Logged from:
222 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
223 */
224message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800225 // TODO: should be a string tagged w/ uid annotation
226 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700227
David Chen0b5c90c2018-01-25 16:51:49 -0800228 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700229 optional string name = 2;
230
Bookatzddccf0a2017-11-28 16:48:14 -0800231 // What lifecycle state the process changed to.
232 // This enum is specific to atoms.proto.
233 enum Event {
234 PROCESS_FINISHED = 0;
235 PROCESS_STARTED = 1;
236 PROCESS_CRASHED = 2;
237 PROCESS_ANRED = 3;
238 }
239 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700240}
241
Bookatzc1a050a2017-10-10 15:49:28 -0700242/**
243 * Logs when the ble scan state changes.
244 *
245 * Logged from:
246 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
247 */
248message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800249 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700250
251 enum State {
252 OFF = 0;
253 ON = 1;
254 }
255 optional State state = 2;
256}
257
258/**
259 * Logs when an unoptimized ble scan state changes.
260 *
261 * Logged from:
262 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
263 */
264// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
265message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800266 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700267
268 enum State {
269 OFF = 0;
270 ON = 1;
271 }
272 optional State state = 2;
273}
274
275/**
276 * Logs reporting of a ble scan finding results.
277 *
278 * Logged from:
279 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
280 */
281// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
282message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800283 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700284
285 // Number of ble scan results returned.
286 optional int32 num_of_results = 2;
287}
288
289/**
290 * Logs when a sensor state changes.
291 *
292 * Logged from:
293 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
294 */
295message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800296 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700297
298 // TODO: Is there a way to get the actual name of the sensor?
299 // The id (int) of the sensor.
300 optional int32 sensor_id = 2;
301
302 enum State {
303 OFF = 0;
304 ON = 1;
305 }
306 optional State state = 3;
307}
308
309
310/**
311 * Logs when GPS state changes.
312 *
313 * Logged from:
314 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
315 */
316message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800317 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700318
319 enum State {
320 OFF = 0;
321 ON = 1;
322 }
323 optional State state = 2;
324}
325
326
327/**
328 * Logs when a sync manager sync state changes.
329 *
330 * Logged from:
331 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
332 */
333message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800334 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700335
David Chen0b5c90c2018-01-25 16:51:49 -0800336 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700337 optional string name = 2;
338
339 enum State {
340 OFF = 0;
341 ON = 1;
342 }
343 optional State state = 3;
344}
345
346/**
347 * Logs when a job scheduler job state changes.
348 *
349 * Logged from:
350 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
351 */
352message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800353 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700354
355 // Name of the job (as named in the app)
356 optional string name = 2;
357
358 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800359 FINISHED = 0;
360 STARTED = 1;
361 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700362 }
363 optional State state = 3;
364
365 // TODO: Consider adding the stopReason (int)
366}
367
368/**
369 * Logs when the audio state changes.
370 *
371 * Logged from:
372 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
373 */
374message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800375 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700376
377 enum State {
378 OFF = 0;
379 ON = 1;
380 }
381 optional State state = 2;
382}
383
384/**
385 * Logs when the video codec state changes.
386 *
387 * Logged from:
388 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
389 */
390message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800391 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700392
393 enum State {
394 OFF = 0;
395 ON = 1;
396 }
397 optional State state = 2;
398}
399
400/**
401 * Logs when the flashlight state changes.
402 *
403 * Logged from:
404 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
405 */
406message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800407 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700408
409 enum State {
410 OFF = 0;
411 ON = 1;
412 }
413 optional State state = 2;
414}
415
416/**
417 * Logs when the camera state changes.
418 *
419 * Logged from:
420 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
421 */
422message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800423 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700424
425 enum State {
426 OFF = 0;
427 ON = 1;
428 }
429 optional State state = 2;
430}
431
432/**
433 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000434 *
435 * Logged from:
436 * TODO
437 */
Bookatzd6746242017-10-24 18:39:35 -0700438message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800439 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000440
Bookatz1a1b0462018-01-12 11:47:03 -0800441 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
442 // From frameworks/base/core/proto/android/os/enums.proto.
443 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700444
445 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
446 optional string tag = 3;
447
448 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800449 RELEASE = 0;
450 ACQUIRE = 1;
451 CHANGE_RELEASE = 2;
452 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700453 }
454 optional State state = 4;
455}
456
457/**
Bookatzc1a050a2017-10-10 15:49:28 -0700458 * Logs when a partial wakelock is considered 'long' (over 1 min).
459 *
460 * Logged from:
461 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
462 */
463message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800464 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700465
Yao Chend54f9dd2017-10-17 17:37:48 +0000466 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
467 optional string tag = 2;
468
Bookatzc1a050a2017-10-10 15:49:28 -0700469 // TODO: I have no idea what this is.
470 optional string history_tag = 3;
471
472 enum State {
473 OFF = 0;
474 ON = 1;
475 }
476 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000477}
478
Bookatzc1a050a2017-10-10 15:49:28 -0700479/**
480 * Logs Battery Saver state change.
481 *
482 * Logged from:
483 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
484 */
485message BatterySaverModeStateChanged {
486 enum State {
487 OFF = 0;
488 ON = 1;
489 }
490 optional State state = 1;
491}
492
493/**
494 * Logs Doze mode state change.
495 *
496 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800497 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700498 */
499message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800500 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800501}
502
503
504/**
505 * Logs state change of Doze mode including maintenance windows.
506 *
507 * Logged from:
508 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
509 */
510message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800511 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700512}
513
514/**
515 * Logs screen brightness level.
516 *
517 * Logged from:
518 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
519 */
520message ScreenBrightnessChanged {
521 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
522 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700523}
524
525/**
526 * Logs battery level (percent full, from 0 to 100).
527 *
528 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700529 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700530 */
531message BatteryLevelChanged {
532 // Battery level. Should be in [0, 100].
533 optional int32 battery_level = 1;
534}
535
536/**
537 * Logs change in charging status of the device.
538 *
539 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700540 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700541 */
542message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800543 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
544 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700545}
546
547/**
548 * Logs whether the device is plugged in, and what power source it is using.
549 *
550 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700551 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700552 */
553message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800554 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
555 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700556}
557
Bookatz8c6571b2017-10-24 15:04:41 -0700558// TODO: Define this more precisely.
559// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
560/**
561 * Logs when the device turns off or on.
562 *
563 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700564 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700565 */
566message DeviceOnStatusChanged {
567 enum State {
568 OFF = 0;
569 ON = 1;
570 }
571 optional State state = 1;
572}
573
574/**
575 * Logs when an app's wakeup alarm fires.
576 *
577 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700578 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700579 */
580message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800581 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800582
583 // Name of the wakeup alarm.
584 optional string tag = 2;
585}
586
587/**
588 * Logs when an an app causes the mobile radio to change state.
589 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
590 *
591 * Logged from:
592 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
593 */
594message MobileRadioPowerStateChanged {
595 // TODO: Add attribution instead of uid?
596 optional int32 uid = 1;
597
Bookatz1a1b0462018-01-12 11:47:03 -0800598 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
599 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800600}
601
602/**
603 * Logs when an an app causes the wifi radio to change state.
604 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
605 *
606 * Logged from:
607 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
608 */
609message WifiRadioPowerStateChanged {
610 // TODO: Add attribution instead of uid?
611 optional int32 uid = 1;
612
Bookatz1a1b0462018-01-12 11:47:03 -0800613 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
614 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700615}
616
617/**
618 * Logs kernel wakeup reasons and aborts.
619 *
620 * Logged from:
621 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
622 */
623message KernelWakeupReported {
624 // Name of the kernel wakeup reason (or abort).
625 optional string wakeup_reason_name = 1;
626
627 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800628 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700629}
630
631/**
632 * Logs wifi locks held by an app.
633 *
634 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700635 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700636 */
637message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800638 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700639
640 enum State {
641 OFF = 0;
642 ON = 1;
643 }
644 optional State state = 2;
645}
646
647/**
648 * Logs wifi signal strength changes.
649 *
650 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700651 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700652 */
653message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800654 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
655 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700656}
657
658/**
659 * Logs wifi scans performed by an app.
660 *
661 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700662 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700663 */
664message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800665 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700666
667 enum State {
668 OFF = 0;
669 ON = 1;
670 }
671 optional State state = 2;
672}
673
674/**
Tej Singh4503e102018-01-04 14:35:01 -0800675 * Logs wifi multicast locks held by an app
676 *
677 * Logged from:
678 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
679 */
680message WifiMulticastLockStateChanged {
681 repeated AttributionNode attribution_node = 1;
682
683 enum State {
684 OFF = 0;
685 ON = 1;
686 }
687 optional State state = 2;
688}
689
690/**
Tej Singh1ea42892018-01-19 09:27:00 -0800691 * Logs shutdown reason and duration on next boot.
692 *
693 * Logged from:
694 * frameworks/base/core/java/com/android/server/BootReceiver.java
695 */
696message ShutdownSequenceReported {
697 // True if shutdown is for a reboot. Default: false if we do not know.
698 optional bool reboot = 1;
699
700 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
701 optional string reason = 2;
702
703 // Beginning of shutdown time in ms using wall clock time since unix epoch.
704 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800705 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800706
707 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800708 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800709}
710
Tej Singh6483ea42018-01-25 17:45:49 -0800711
712/**
713 * Logs boot reason and duration.
714 *
715 * Logged from:
716 * system/core/bootstat/bootstat.cpp
717 */
718message BootSequenceReported {
719 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
720 // Default: "<EMPTY>" if not available.
721 optional string bootloader_reason = 1;
722
723 // Reason for system boot. Eg. bootloader, reboot,userrequested
724 // Default: "<EMPTY>" if not available.
725 optional string system_reason = 2;
726
727 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800728 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800729
730 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800731 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800732
733 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800734 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800735
736 // Time since last boot in ms. Default: 0 if not available.
737 optional int64 time_since_last_boot = 6;
738}
739
Tej Singhc477d9c2018-02-05 18:31:39 -0800740
741/**
742 * Logs call state and disconnect cause (if applicable).
743 *
744 * Logged from:
745 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
746 */
747message CallStateChanged {
748 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
749 // From frameworks/base/core/proto/android/telecomm/enums.proto.
750 optional android.telecom.CallStateEnum call_state = 1;
751
752 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
753 // This value is only applicable when the call_state is DISCONNECTED, and
754 // should always be UNKNOWN if the call_state is not DISCONNECTED.
755 // From frameworks/base/core/proto/android/telecomm/enums.proto.
756 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
757
758 // True if the call is self-managed, which are apps that use the
759 // telecom infrastructure to make their own calls.
760 optional bool self_managed = 3;
761
762 // True if call is external. External calls are calls on connected Wear
763 // devices but show up in Telecom so the user can pull them onto the device.
764 optional bool external_call = 4;
765}
766
Tej Singh1ea42892018-01-19 09:27:00 -0800767/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800768 * Logs keyguard state. The keyguard is the lock screen.
769 *
770 * Logged from:
771 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
772 */
773message KeyguardStateChanged {
774 enum State {
775 UNKNOWN = 0;
776 // The keyguard is hidden when the phone is unlocked.
777 HIDDEN = 1;
778 // The keyguard is shown when the phone is locked (screen turns off).
779 SHOWN= 2;
780 // The keyguard is occluded when something is overlaying the keyguard.
781 // Eg. Opening the camera while on the lock screen.
782 OCCLUDED = 3;
783 }
784 optional State state = 1;
785}
786
787/**
788 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
789 * prompts the user to enter a password (pattern, pin, etc).
790 *
791 * Logged from:
792 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
793 */
794
795message KeyguardBouncerStateChanged {
796 enum State {
797 UNKNOWN = 0;
798 // Bouncer is hidden, either as a result of successfully entering the
799 // password, screen timing out, or user going back to lock screen.
800 HIDDEN = 1;
801 // This is when the user is being prompted to enter the password.
802 SHOWN = 2;
803 }
804 optional State state = 1;
805}
806
807/**
808 * Logs the result of entering a password into the keyguard bouncer.
809 *
810 * Logged from:
811 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
812 */
813message KeyguardBouncerPasswordEntered {
814 enum BouncerResult {
815 UNKNOWN = 0;
816 // The password entered was incorrect.
817 FAILURE = 1;
818 // The password entered was correct.
819 SUCCESS = 2;
820 }
821 optional BouncerResult result = 1;
822}
823
Tej Singha883b372018-02-15 11:30:01 -0800824/*
825 * Logs changes to the configuration of the device. The configuration is defined
826 * in frameworks/base/core/java/android/content/res/Configuration.java
827 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
828 * Please go there to interpret the possible values each field can be.
829 *
830 * Logged from:
831 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
832 */
833message ResourceConfigurationChanged {
834 // Bit mask of color capabilities of the screen.
835 // Contains information about the color gamut and hdr mode of the screen.
836 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
837 optional int32 colorMode = 1;
838
839 // The target screen density being rendered to.
840 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
841 optional int32 densityDpi = 2;
842
843 // Current user preference for the scaling factor for fonts,
844 // relative to the base density scaling.
845 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
846 optional float fontScale = 3;
847
848 // Flag indicating whether the hard keyboard is hidden.
849 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
850 optional int32 hardKeyboardHidden = 4;
851
852 // The type of keyboard attached to the device.
853 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
854 optional int32 keyboard = 5;
855
856 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
857 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
858 optional int32 keyboardHideen = 6;
859
860 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
861 // 0 if undefined.
862 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
863 optional int32 mcc = 7;
864
865 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
866 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
867 // MNC_ZERO symbol defined in Configuration.java.
868 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
869 optional int32 mnc = 8;
870
871 // The kind of navigation available on the device.
872 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
873 optional int32 navigation = 9;
874
875 // Flag indicating whether the navigation is available.
876 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
877 optional int32 navigationHidden = 10;
878
879 // Overall orientation of the screen.
880 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
881 optional int32 orientation = 11;
882
883 // The current height of the available screen space, in dp units.
884 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
885 optional int32 screenHeightDp = 12;
886
887 // Bit mask of overall layout of the screen.
888 // Contains information about screen size, whether the screen is wider/taller
889 // than normal, whether the screen layout is right-tl-left or left-to-right,
890 // and whether the screen has a rounded shape.
891 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
892 optional int32 screenLayout = 13;
893
894 // Current width of the available screen space, in dp units.
895 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
896 optional int32 screenWidthDp = 14;
897
898 // The smallest screen size an application will see in normal operation.
899 // This is the smallest value of both screenWidthDp and screenHeightDp
900 // in portrait and landscape.
901 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
902 optional int32 smallestScreenWidthDp = 15;
903
904 // The type of touch screen attached to the device.
905 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
906 optional int32 touchscreen = 16;
907
908 // Bit mask of the ui mode.
909 // Contains information about the overall ui mode of the device.
910 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
911 // Also contains information about whether the device is in night mode.
912 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
913 optional int32 uiMode = 17;
914}
915
Tej Singheee317b2018-03-07 19:28:05 -0800916
917/**
918 * Logs changes in the connection state of the mobile radio.
919 *
920 * Logged from:
921 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
922 */
923message MobileConnectionStateChanged {
924 // States are from the state machine DataConnection.java.
925 enum State {
926 UNKNOWN = 0;
927 // The connection is inactive, or disconnected.
928 INACTIVE = 1;
929 // The connection is being activated, or connecting.
930 ACTIVATING = 2;
931 // The connection is active, or connected.
932 ACTIVE = 3;
933 // The connection is disconnecting.
934 DISCONNECTING = 4;
935 // The connection is disconnecting after creating a connection.
936 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
937 }
938 optional State state = 1;
939 // For multi-sim phones, this distinguishes between the sim cards.
940 optional int32 sim_slot_index = 2;
941 // Used to identify the connection. Starts at 0 and increments by 1 for
942 // every new network created. Resets whenever the device reboots.
943 optional int32 data_connection_id = 3;
944 // A bitmask for the capabilities of this connection.
945 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
946 // Default value (if we have no information): 0
947 optional int64 capabilities = 4;
948 // If this connection has internet.
949 // This just checks if the DEFAULT bit of capabilities is set.
950 optional bool has_internet = 5;
951}
952
953/**
954 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
955 *
956 * Logged from:
957 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
958 */
959message MobileRadioTechnologyChanged {
960 optional android.telephony.NetworkTypeEnum state = 1;
961 // For multi-sim phones, this distinguishes between the sim cards.
962 optional int32 sim_slot_index = 2;
963}
964
965
Tej Singhdd7bd352018-02-09 19:33:15 -0800966/**
Tej Singh5d991e12018-03-09 19:48:11 -0800967 * Logs when Bluetooth is enabled and disabled.
968 *
969 * Logged from:
970 * services/core/java/com/android/server/BluetoothManagerService.java
971 */
972message BluetoothEnabledStateChanged {
973 repeated AttributionNode attribution_node = 1;
974 // Whether or not bluetooth is enabled on the device.
975 enum State {
976 UNKNOWN = 0;
977 ENABLED = 1;
978 DISABLED = 2;
979 }
980 optional State state = 2;
981 // The reason for being enabled/disabled.
982 // Eg. Airplane mode, crash, application request.
983 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
984 // If the reason is an application request, this will be the package name.
985 optional string pkgName = 4;
986}
987
988/**
989 * Logs when a Bluetooth device connects and disconnects.
990 *
991 * Logged from:
992 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
993 */
994message BluetoothConnectionStateChanged {
995 // The state of the connection.
996 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
997 optional android.bluetooth.ConnectionStateEnum state = 1;
998 // An identifier that can be used to match connect and disconnect events.
999 // Currently is last two bytes of a hash of a device level ID and
1000 // the mac address of the bluetooth device that is connected.
1001 optional int32 obfuscated_id = 2;
1002 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1003 // From android.bluetooth.BluetoothAdapter.java
1004 optional int32 bt_profile = 3;
1005}
1006
1007/**
1008 * Logs when Bluetooth A2dp audio streaming state changes.
1009 *
1010 * Logged from:
1011 * TODO(b/73971848)
1012 */
1013message BluetoothA2dpAudioStateChanged {
1014 // Whether or not audio is being played using Bluetooth A2dp.
1015 enum State {
1016 UNKNOWN = 0;
1017 PLAY = 1;
1018 STOP = 2;
1019 }
1020 optional State state = 1;
1021}
1022
1023/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001024 * Logs when something is plugged into or removed from the USB-C connector.
1025 *
1026 * Logged from:
1027 * Vendor USB HAL.
1028 */
1029message UsbConnectorStateChanged {
1030 enum State {
1031 DISCONNECTED = 0;
1032 CONNECTED = 1;
1033 }
1034 optional State state = 1;
1035}
1036
1037/**
1038 * Logs the reported speaker impedance.
1039 *
1040 * Logged from:
1041 * Vendor audio implementation.
1042 */
1043message SpeakerImpedanceReported {
1044 optional int32 speaker_location = 1;
1045 optional int32 impedance = 2;
1046}
1047
1048/**
1049 * Logs the report of a failed hardware.
1050 *
1051 * Logged from:
1052 * Vendor HALs.
1053 *
1054 */
1055message HardwareFailed {
1056 enum HardwareType {
1057 HARDWARE_FAILED_UNKNOWN = 0;
1058 HARDWARE_FAILED_MICROPHONE = 1;
1059 HARDWARE_FAILED_CODEC = 2;
1060 HARDWARE_FAILED_SPEAKER = 3;
1061 HARDWARE_FAILED_FINGERPRINT = 4;
1062 }
1063 optional HardwareType hardware_type = 1;
1064
1065 /* hardware_location allows vendors to differentiate between multiple instances of
1066 * the same hardware_type. The specific locations are vendor defined integers,
1067 * referring to board-specific numbering schemes.
1068 */
1069 optional int32 hardware_location = 2;
1070
1071 /* failure_code is specific to the HardwareType of the failed hardware.
1072 * It should use the enum values defined below.
1073 */
1074 enum MicrophoneFailureCode {
1075 MICROPHONE_FAILURE_COMPLETE = 0;
1076 }
1077 enum CodecFailureCode {
1078 CODEC_FAILURE_COMPLETE = 0;
1079 }
1080 enum SpeakerFailureCode {
1081 SPEAKER_FAILURE_COMPLETE = 0;
1082 SPEAKER_FAILURE_HIGH_Z = 1;
1083 SPEAKER_FAILURE_SHORT = 2;
1084 }
1085 enum FingerprintFailureCode {
1086 FINGERPRINT_FAILURE_COMPLETE = 0;
1087 FINGERPRINT_SENSOR_BROKEN = 1;
1088 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1089 }
1090 optional int32 failure_code = 3;
1091}
1092
1093/**
1094 * Log an event when the device has been physically dropped.
1095 * Reported from the /vendor partition.
1096 */
1097message PhysicalDropDetected {
1098 // Confidence that the event was actually a drop, 0 -> 100
1099 optional int32 confidence_pctg = 1;
1100 // Peak acceleration of the drop, in 1/1000s of a g.
1101 optional int32 accel_peak_thousandths_g = 2;
1102}
1103
1104/**
1105 * Log bucketed battery charge cycles.
1106 *
1107 * Each bucket represents cycles of the battery past
1108 * a given charge point. For example, bucket 1 is the
1109 * lowest 1/8th of the battery, and bucket 8 is 100%.
1110 *
1111 * Logged from:
1112 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1113 */
1114message ChargeCyclesReported {
1115 optional int32 cycle_bucket_1 = 1;
1116 optional int32 cycle_bucket_2 = 2;
1117 optional int32 cycle_bucket_3 = 3;
1118 optional int32 cycle_bucket_4 = 4;
1119 optional int32 cycle_bucket_5 = 5;
1120 optional int32 cycle_bucket_6 = 6;
1121 optional int32 cycle_bucket_7 = 7;
1122 optional int32 cycle_bucket_8 = 8;
1123}
1124
1125/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001126 * Logs the duration of a davey (jank of >=700ms) when it occurs
1127 *
1128 * Logged from:
1129 * frameworks/base/libs/hwui/JankTracker.cpp
1130 */
1131message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001132 // The UID that logged this atom.
1133 optional int32 uid = 1;
1134
Tej Singhbb8554a2018-01-26 11:59:14 -08001135 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001136 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001137}
1138
1139/**
Bookatze5885242017-10-24 20:10:31 -07001140 * Logs phone signal strength changes.
1141 *
1142 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001143 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001144 */
1145message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001146 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1147 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001148}
1149
1150/**
1151 * Logs that a setting was updated.
1152 * Logged from:
1153 * frameworks/base/core/java/android/provider/Settings.java
1154 * The tag and is_default allow resetting of settings to default values based on the specified
1155 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1156 */
1157message SettingChanged {
1158 // The name of the setting.
1159 optional string setting = 1;
1160
1161 // The change being imposed on this setting. May represent a number, eg "3".
1162 optional string value = 2;
1163
1164 // The new value of this setting. For most settings, this is same as value. For some settings,
1165 // value is +X or -X where X represents an element in a set. For example, if the previous value
1166 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1167 // The +/- feature is currently only used for location_providers_allowed.
1168 optional string new_value = 3;
1169
1170 // The previous value of this setting.
1171 optional string prev_value = 4;
1172
1173 // The tag used with the is_default for resetting sets of settings. This is generally null.
1174 optional string tag = 5;
1175
Bookatz90867622018-01-31 15:05:57 -08001176 // True if this setting with tag should be resettable.
1177 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001178
1179 // The user ID associated. Defined in android/os/UserHandle.java
1180 optional int32 user = 7;
1181}
Chenjie Yub3dda412017-10-24 13:41:59 -07001182
Chenjie Yu05013b32017-11-21 10:21:41 -08001183/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001184 * Logs activity going to foreground or background
1185 *
1186 * Logged from:
1187 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1188 */
1189message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -08001190 optional int32 uid = 1;
1191 optional string pkg_name = 2;
1192 optional string class_name = 3;
1193
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001194 enum Activity {
1195 MOVE_TO_BACKGROUND = 0;
1196 MOVE_TO_FOREGROUND = 1;
1197 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001198 optional Activity activity = 4;
1199}
David Chenc8a43242017-10-17 16:23:28 -07001200
1201/**
David Chen9e3808c2017-11-20 17:25:34 -08001202 * Logs when an error is written to dropbox.
1203 * Logged from:
1204 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1205 */
1206message DropboxErrorChanged {
1207 // The uid if available. -1 means not available.
1208 optional int32 uid = 1;
1209
1210 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
1211 optional string tag = 2;
1212
1213 // The name of the process.
1214 optional string process_name = 3;
1215
1216 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001217 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -08001218
1219 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -08001220 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -08001221
1222 // The activity name if available.
1223 optional string activity_name = 6;
1224
David Chen6e3e6cb2018-01-03 16:14:06 -08001225 // The package name if available.
1226 optional string package_name = 7;
1227
David Chen9e3808c2017-11-20 17:25:34 -08001228 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001229 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001230}
1231
David Chen0a368b22017-12-06 16:28:16 -08001232/*
1233 * Allows other apps to push events into statsd.
1234 * Logged from:
1235 * frameworks/base/core/java/android/util/StatsLog.java
1236 */
David Chen0b5c90c2018-01-25 16:51:49 -08001237message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001238 // The uid of the application that sent this custom atom.
1239 optional int32 uid = 1;
1240
1241 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1242 optional int32 label = 2;
1243
1244 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1245 // predicates for the metrics).
1246 enum State {
1247 UNKNOWN = 0;
1248 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1249 STOP = 2;
1250 START = 3;
1251 }
1252 optional State state = 3;
1253}
1254
David Chen9e3808c2017-11-20 17:25:34 -08001255/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001256 * Logs when statsd detects an anomaly.
1257 *
1258 * Logged from:
1259 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1260 */
1261message AnomalyDetected {
1262 // Uid that owns the config whose anomaly detection alert fired.
1263 optional int32 config_uid = 1;
1264
Yangster-mac94e197c2018-01-02 16:03:03 -08001265 // Id of the config whose anomaly detection alert fired.
1266 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001267
Yangster-mac94e197c2018-01-02 16:03:03 -08001268 // Id of the alert (i.e. name of the anomaly that was detected).
1269 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001270}
1271
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001272message AppStartChanged {
1273 // The uid if available. -1 means not available.
1274 optional int32 uid = 1;
1275
1276 // The app package name.
1277 optional string pkg_name = 2;
1278
1279 enum TransitionType {
1280 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1281 WARM = 1;
1282 HOT = 2;
1283 COLD = 3;
1284 }
1285 // The transition type.
1286 optional TransitionType type = 3;
1287
1288 // The activity name.
1289 optional string activity_name = 4;
1290
1291 // The name of the calling app. Empty if not set.
1292 optional string calling_pkg_name = 5;
1293
1294 // Whether the app is an instant app.
1295 optional bool is_instant_app = 6;
1296
1297 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001298 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001299
Bookatz80d11a02018-01-16 10:46:35 -08001300 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001301
David Chen0b5c90c2018-01-25 16:51:49 -08001302 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001303 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001304 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001305 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001306 optional int32 bind_application_delay_millis = 11;
1307 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001308
1309 // Empty if not set.
1310 optional string launch_token = 13;
1311
Calin Juravle759fbda2018-02-20 19:52:30 +00001312 // The compiler filter used when when the package was optimized.
1313 optional string package_optimization_compilation_filter = 14;
1314
1315 // The reason why the package was optimized.
1316 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001317}
1318
1319message AppStartCancelChanged {
1320 // The uid if available. -1 means not available.
1321 optional int32 uid = 1;
1322
1323 // The app package name.
1324 optional string pkg_name = 2;
1325
1326 enum TransitionType {
1327 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1328 WARM = 1;
1329 HOT = 2;
1330 COLD = 3;
1331 }
1332 // The transition type.
1333 optional TransitionType type = 3;
1334
1335 // The activity name.
1336 optional string activity_name = 4;
1337}
1338
1339message AppStartFullyDrawnChanged {
1340 // The uid if available. -1 means not available.
1341 optional int32 uid = 1;
1342
1343 // The app package name.
1344 optional string pkg_name = 2;
1345
1346 enum TransitionType {
1347 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1348 WITH_BUNDLE = 1;
1349 WITHOUT_BUNDLE = 2;
1350 }
1351 // The transition type.
1352 optional TransitionType type = 3;
1353
1354 // The activity name.
1355 optional string activity_name = 4;
1356
1357 optional bool transition_process_running = 5;
1358
1359 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001360 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001361}
1362
Bookatz8fcd09a2017-12-18 13:01:10 -08001363/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001364 * Logs a picture-in-picture action
1365 * Logged from:
1366 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1367 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1368 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1369 */
1370message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001371 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001372 optional int32 uid = 1;
1373
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001374 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001375
Chenjie Yu52cacc62017-12-08 18:11:45 -08001376 enum State {
1377 ENTERED = 1;
1378 EXPANDED_TO_FULL_SCREEN = 2;
1379 MINIMIZED = 3;
1380 DISMISSED = 4;
1381 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001382 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001383}
1384
1385/**
Chenjie Yue8904192017-12-08 19:12:57 -08001386 * Logs overlay action
1387 * Logged from:
1388 * services/core/java/com/android/server/wm/Session.java
1389 */
1390message OverlayStateChanged {
1391 optional int32 uid = 1;
1392
1393 optional string package_name = 2;
1394
1395 optional bool using_alert_window = 3;
1396
1397 enum State {
1398 ENTERED = 1;
1399 EXITED = 2;
1400 }
1401 optional State state = 4;
1402}
1403
Chenjie Yuccfe6452018-01-30 11:33:21 -08001404/*
1405 * Logs foreground service starts and stops.
1406 * Note that this is not when a service starts or stops, but when it is
1407 * considered foreground.
1408 * Logged from
1409 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1410 */
1411message ForegroundServiceStateChanged {
1412 optional int32 uid = 1;
1413 // package_name + "/" + class_name
1414 optional string short_name = 2;
1415
1416 enum State {
1417 ENTER = 1;
1418 EXIT = 2;
1419 }
1420 optional State state = 3;
1421}
1422
Chenjie Yue8904192017-12-08 19:12:57 -08001423/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001424 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1425 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1426 * attributed back to the parent (host) uid. One example is Chrome.
1427 *
1428 * Logged from:
1429 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1430 */
1431message IsolatedUidChanged {
1432 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1433 optional int32 parent_uid = 1;
1434
1435 optional int32 isolated_uid = 2;
1436
1437 // We expect an isolated uid to be removed before if it's used for another parent uid.
1438 enum Event {
1439 REMOVED = 0;
1440 CREATED = 1;
1441 }
1442 optional Event event = 3;
1443}
1444
1445/*
1446 * Logs the reception of an incoming network packet causing the main system to wake up for
1447 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1448 * and processed by WakeupController.cpp.
1449 */
1450message PacketWakeupOccurred {
1451 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1452 // delivered nowhere.
1453 optional int32 uid = 1;
1454 // The interface name on which the packet was received.
1455 optional string iface = 2;
1456 // The ethertype value of the packet.
1457 optional int32 ethertype = 3;
1458 // String representation of the destination MAC address of the packet.
1459 optional string destination_hardware_address = 4;
1460 // String representation of the source address of the packet if this was an IP packet.
1461 optional string source_ip = 5;
1462 // String representation of the destination address of the packet if this was an IP packet.
1463 optional string destination_ip = 6;
1464 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1465 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1466 // families.
1467 optional int32 ip_next_header = 7;
1468 // The source port if this was a TCP or UDP packet.
1469 optional int32 source_port = 8;
1470 // The destination port if this was a TCP or UDP packet.
1471 optional int32 destination_port = 9;
1472}
1473
1474/*
1475 * Logs the memory stats for an app on startup.
1476 * Logged from:
1477 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1478 */
1479message AppStartMemoryStateCaptured {
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 // The activity name.
1487 optional string activity_name = 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
1505/*
1506 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1507 * for LMK event.
1508 * Logged from:
1509 * system/core/lmkd/lmkd.c
1510 */
1511message LmkStateChanged {
1512 enum State {
1513 UNKNOWN = 0;
1514 START = 1;
1515 STOP = 2;
1516 }
1517 optional State state = 1;
1518}
1519
1520/*
1521 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1522 * Logged from:
1523 * system/core/lmkd/lmkd.c
1524 */
1525message LmkKillOccurred {
1526 // The uid if available. -1 means not available.
1527 optional int32 uid = 1;
1528
1529 // The process name.
1530 optional string process_name = 2;
1531
1532 // oom adj score.
1533 optional int32 oom_score = 3;
1534
1535 // # of page-faults
1536 optional int64 pgfault = 4;
1537
1538 // # of major page-faults
1539 optional int64 pgmajfault = 5;
1540
1541 // RSS
1542 optional int64 rss_in_bytes = 6;
1543
1544 // CACHE
1545 optional int64 cache_in_bytes = 7;
1546
1547 // SWAP
1548 optional int64 swap_in_bytes = 8;
1549}
1550
Rajeev Kumar51b54602018-03-01 12:18:26 -08001551/*
1552 * Logs when the ActivityManagerService detects that an app died.
1553 *
1554 * Logged from:
1555 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1556 */
1557message AppDied {
1558 // timestamp(elapsedRealtime) of record creation
1559 optional uint64 timestamp_millis = 1;
1560}
1561
Chenjie Yubbcbc602018-02-05 16:51:52 -08001562//////////////////////////////////////////////////////////////////////
1563// Pulled atoms below this line //
1564//////////////////////////////////////////////////////////////////////
1565
1566/**
David Chenc8a43242017-10-17 16:23:28 -07001567 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1568 *
1569 * Pulled from:
1570 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1571 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001572message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001573 optional int32 uid = 1;
1574
1575 optional int64 rx_bytes = 2;
1576
1577 optional int64 rx_packets = 3;
1578
1579 optional int64 tx_bytes = 4;
1580
1581 optional int64 tx_packets = 5;
1582}
1583
1584/**
1585 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1586 *
1587 * Pulled from:
1588 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1589 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001590message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001591 optional int32 uid = 1;
1592
1593 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1594 optional int32 is_foreground = 2;
1595
1596 optional int64 rx_bytes = 3;
1597
1598 optional int64 rx_packets = 4;
1599
1600 optional int64 tx_bytes = 5;
1601
1602 optional int64 tx_packets = 6;
1603}
1604
1605/**
1606 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1607 *
1608 * Pulled from:
1609 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1610 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001611message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001612 optional int32 uid = 1;
1613
1614 optional int64 rx_bytes = 2;
1615
1616 optional int64 rx_packets = 3;
1617
1618 optional int64 tx_bytes = 4;
1619
1620 optional int64 tx_packets = 5;
1621}
1622
1623/**
1624 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1625 *
1626 * Pulled from:
1627 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1628 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001629message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001630 optional int32 uid = 1;
1631
1632 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1633 optional int32 is_foreground = 2;
1634
1635 optional int64 rx_bytes = 3;
1636
1637 optional int64 rx_packets = 4;
1638
1639 optional int64 tx_bytes = 5;
1640
1641 optional int64 tx_packets = 6;
1642}
1643
1644/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001645 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1646 *
1647 * Pulled from:
1648 * StatsCompanionService
1649 */
1650message BluetoothBytesTransfer {
1651 optional int32 uid = 1;
1652
1653 optional int64 rx_bytes = 2;
1654
1655 optional int64 tx_bytes = 3;
1656}
1657
1658/**
David Chenc8a43242017-10-17 16:23:28 -07001659 * Pulls the kernel wakelock durations. This atom is adapted from
1660 * android/internal/os/KernelWakelockStats.java
1661 *
1662 * Pulled from:
1663 * StatsCompanionService using KernelWakelockReader.
1664 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001665message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001666 optional string name = 1;
1667
1668 optional int32 count = 2;
1669
1670 optional int32 version = 3;
1671
1672 optional int64 time = 4;
1673}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001674
Chenjie Yu05013b32017-11-21 10:21:41 -08001675/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001676 * Pulls low power state information. This includes platform and subsystem sleep state information,
1677 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001678 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001679 * hardware/interfaces/power/1.1/types.hal
1680 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001681message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001682 // Subsystem name
1683 optional string subsystem_name = 1;
1684 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1685 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1686 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001687 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001688 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001689 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001690 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001691}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001692
Chenjie Yu05013b32017-11-21 10:21:41 -08001693/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001694 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001695 * Pulls the time the cpu spend on the frequency index. Frequency index
1696 * starts from highest to lowest. The value should be monotonically
1697 * increasing since boot. However, if there is a cpu
1698 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001699 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001700message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001701 optional uint32 cluster = 1;
1702 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001703 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001704}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001705
Chenjie Yu05013b32017-11-21 10:21:41 -08001706/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001707 * Pulls Cpu Time Per Uid.
1708 * Note that isolated process uid time should be attributed to host uids.
1709 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001710message CpuTimePerUid {
Chenjie Yuec676612018-03-07 09:19:17 -08001711 optional int32 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001712 optional uint64 user_time_millis = 2;
1713 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001714}
1715
1716/**
1717 * Pulls Cpu Time Per Uid per frequency.
1718 * Note that isolated process uid time should be attributed to host uids.
1719 * For each uid, we order the time by descending frequencies.
1720 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001721message CpuTimePerUidFreq {
Chenjie Yuec676612018-03-07 09:19:17 -08001722 optional int32 uid = 1;
1723 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001724 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001725}
Hugo Benichi884970e2017-11-14 22:42:46 +09001726
Chenjie Yu05013b32017-11-21 10:21:41 -08001727/**
1728 * Pulls Wifi Controller Activity Energy Info
1729 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001730message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001731 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001732 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001733 // stack reported state
1734 // TODO: replace this with proto enum
1735 optional int32 stack_state = 2;
1736 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001737 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001738 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001739 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001740 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001741 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001742 // product of current(mA), voltage(V) and time(ms)
1743 optional uint64 controller_energy_used = 6;
1744}
1745
1746/**
1747 * Pulls Modem Activity Energy Info
1748 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001749message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001750 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001751 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001752 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001753 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001754 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001755 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001756 /**
1757 * Tx power index
1758 * index 0 = tx_power < 0dBm
1759 * index 1 = 0dBm < tx_power < 5dBm
1760 * index 2 = 5dBm < tx_power < 15dBm
1761 * index 3 = 15dBm < tx_power < 20dBm
1762 * index 4 = tx_power > 20dBm
1763 */
1764 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001765 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001766 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001767 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001768 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001769 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001770 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001771 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001772 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001773 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001774 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001775 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001776 // product of current(mA), voltage(V) and time(ms)
1777 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001778}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001779
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001780/**
1781 * Pulls Bluetooth Activity Energy Info
1782 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1783 */
1784message BluetoothActivityInfo {
1785 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001786 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001787 // bluetooth stack state
1788 optional int32 bluetooth_stack_state = 2;
1789 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001790 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001791 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001792 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001793 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001794 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001795 // product of current(mA), voltage(V) and time(ms)
1796 optional uint64 energy_used = 6;
1797}
1798
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001799/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001800 * Logs the memory stats for a process.
1801 */
1802message ProcessMemoryState {
1803 // The uid if available. -1 means not available.
1804 optional int32 uid = 1;
1805
1806 // The process name.
1807 optional string process_name = 2;
1808
1809 // oom adj score.
1810 optional int32 oom_score = 3;
1811
1812 // # of page-faults
1813 optional int64 pgfault = 4;
1814
1815 // # of major page-faults
1816 optional int64 pgmajfault = 5;
1817
Rajeev Kumar90235992018-01-29 11:06:48 -08001818 // RSS
1819 optional int64 rss_in_bytes = 6;
1820
1821 // CACHE
1822 optional int64 cache_in_bytes = 7;
1823
1824 // SWAP
1825 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001826}
1827
1828/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001829 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001830 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001831message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001832 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001833}
1834
1835/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001836 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001837 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001838message SystemUptime {
1839 // Milliseconds since the system was booted.
1840 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1841 // for external input).
1842 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001843 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001844}
1845
1846/*
1847 * Reads from /proc/uid_concurrent_active_time which has the format:
1848 * active: X (X is # cores)
1849 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1850 * [uid1]: [time-0] [time-1] [time-2] ... ...
1851 * ...
1852 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1853 * The file contains a monotonically increasing count of time for a single boot.
1854 */
1855message CpuActiveTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001856 optional int32 uid = 1;
1857 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001858}
1859
1860/**
1861 * Reads from /proc/uid_concurrent_policy_time which has the format:
1862 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1863 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1864 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1865 * ...
1866 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1867 * The file contains a monotonically increasing count of time for a single boot.
1868 */
1869message CpuClusterTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001870 optional int32 uid = 1;
1871 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001872 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001873}
1874
1875/*
1876 * Pulls free disk space, for data, system partition and temporary directory.
1877 */
1878message DiskSpace {
1879 // available bytes in data partition
1880 optional uint64 data_available_bytes = 1;
1881 // available bytes in system partition
1882 optional uint64 system_available_bytes = 2;
1883 // available bytes in download cache or temp directories
1884 optional uint64 temp_available_bytes = 3;
1885}
Tej Singhbf972d92018-01-10 20:51:13 -08001886
1887/**
1888 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001889 * Pulled from:
1890 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001891 */
1892message RemainingBatteryCapacity {
1893 optional int32 charge_uAh = 1;
1894}
1895
1896/**
1897 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001898 * Pulled from:
1899 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001900 */
1901message FullBatteryCapacity {
1902 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001903}
1904
1905/**
1906 * Pulls the temperature of various parts of the device, in Celsius.
1907 *
1908 * Pulled from:
1909 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1910 */
1911message Temperature {
1912 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1913 optional android.os.TemperatureTypeEnum sensor_location = 1;
1914
1915 // The name of the temperature source. Eg. CPU0
1916 optional string sensor_name = 2;
1917
1918 // Temperature in degrees C.
1919 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001920}