blob: 0cb9efd8f437bbdb47f476114187bec5aba44144 [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 Chantb56388b2018-03-22 21:07:33 -0700114 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800115 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;
Andrew Chantb56388b2018-03-22 21:07:33 -0700121 UsbDeviceAttached usb_device_attached = 77;
Yao Chend54f9dd2017-10-17 17:37:48 +0000122 }
David Chenc8a43242017-10-17 16:23:28 -0700123
David Chen6e3e6cb2018-01-03 16:14:06 -0800124 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800125 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700126 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800127 WifiBytesTransfer wifi_bytes_transfer = 10000;
128 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
129 MobileBytesTransfer mobile_bytes_transfer = 10002;
130 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800131 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800132 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800133 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800134 CpuTimePerFreq cpu_time_per_freq = 10008;
135 CpuTimePerUid cpu_time_per_uid = 10009;
136 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
137 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
138 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800139 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800140 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800141 SystemElapsedRealtime system_elapsed_realtime = 10014;
142 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800143 CpuActiveTime cpu_active_time = 10016;
144 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800145 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800146 RemainingBatteryCapacity remaining_battery_capacity = 10019;
147 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800148 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700149 }
yroa1fe77c2018-02-26 14:22:54 -0800150
151 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
152 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700153}
154
Yao Chend54f9dd2017-10-17 17:37:48 +0000155/**
Yangster-mac20877162017-12-22 17:19:39 -0800156 * This proto represents a node of an attribution chain.
157 * Note: All attribution chains are represented as a repeated field of type
158 * AttributionNode. It is understood that in such arrays, the order is that
159 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000160 */
Yangster-mac20877162017-12-22 17:19:39 -0800161message AttributionNode {
162 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800163 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800164
Yangster-mac20877162017-12-22 17:19:39 -0800165 // The (optional) string tag for an element in the attribution chain. If the
166 // element has no tag, it is encoded as an empty string.
167 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700168}
169
Yao Chend54f9dd2017-10-17 17:37:48 +0000170/*
171 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800172 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000173 *
174 * RULES:
175 * - The field ids for each atom must start at 1, and count upwards by 1.
176 * Skipping field ids is not allowed.
177 * - These form an API, so renaming, renumbering or removing fields is
178 * not allowed between android releases. (This is not currently enforced,
179 * but there will be a tool to enforce this restriction).
180 * - The types must be built-in protocol buffer types, namely, no sub-messages
181 * are allowed (yet). The bytes type is also not allowed.
182 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800183 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800185 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000186 * - A field that is a uid should be a string field, tagged with the [xxx]
187 * annotation. The generated code on android will be represented by UIDs,
188 * and those UIDs will be translated in xxx to those strings.
189 *
190 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700191 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000192 * - If there is a UID, it goes first. Think in an object-oriented fashion.
193 * *****************************************************************************
194 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700195
Yao Chend54f9dd2017-10-17 17:37:48 +0000196/**
197 * Logs when the screen state changes.
198 *
199 * Logged from:
200 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
201 */
202message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800203 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800204 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700205}
Yao Chend54f9dd2017-10-17 17:37:48 +0000206
207/**
Bookatzc1a050a2017-10-10 15:49:28 -0700208 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000209 *
210 * Logged from:
211 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
212 */
Bookatzc1a050a2017-10-10 15:49:28 -0700213message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700214 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000215
Bookatzdb026a22018-01-10 19:01:56 -0800216 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800217 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000218}
219
220/**
Bookatzc1a050a2017-10-10 15:49:28 -0700221 * Logs that a process started, finished, crashed, or ANRed.
222 *
223 * Logged from:
224 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
225 */
226message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800227 // TODO: should be a string tagged w/ uid annotation
Yao Chenc40a19d2018-03-15 16:48:25 -0700228 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700229
David Chen0b5c90c2018-01-25 16:51:49 -0800230 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700231 optional string name = 2;
232
Bookatzddccf0a2017-11-28 16:48:14 -0800233 // What lifecycle state the process changed to.
234 // This enum is specific to atoms.proto.
235 enum Event {
236 PROCESS_FINISHED = 0;
237 PROCESS_STARTED = 1;
238 PROCESS_CRASHED = 2;
239 PROCESS_ANRED = 3;
240 }
241 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700242}
243
Bookatzc1a050a2017-10-10 15:49:28 -0700244/**
245 * Logs when the ble scan state changes.
246 *
247 * Logged from:
248 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
249 */
250message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800251 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700252
253 enum State {
254 OFF = 0;
255 ON = 1;
256 }
257 optional State state = 2;
258}
259
260/**
261 * Logs when an unoptimized ble scan state changes.
262 *
263 * Logged from:
264 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
265 */
266// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
267message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800268 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700269
270 enum State {
271 OFF = 0;
272 ON = 1;
273 }
274 optional State state = 2;
275}
276
277/**
278 * Logs reporting of a ble scan finding results.
279 *
280 * Logged from:
281 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
282 */
283// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
284message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800285 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700286
287 // Number of ble scan results returned.
288 optional int32 num_of_results = 2;
289}
290
291/**
292 * Logs when a sensor state changes.
293 *
294 * Logged from:
295 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
296 */
297message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800298 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700299
300 // TODO: Is there a way to get the actual name of the sensor?
301 // The id (int) of the sensor.
302 optional int32 sensor_id = 2;
303
304 enum State {
305 OFF = 0;
306 ON = 1;
307 }
308 optional State state = 3;
309}
310
311
312/**
313 * Logs when GPS state changes.
314 *
315 * Logged from:
316 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
317 */
318message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800319 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700320
321 enum State {
322 OFF = 0;
323 ON = 1;
324 }
325 optional State state = 2;
326}
327
328
329/**
330 * Logs when a sync manager sync state changes.
331 *
332 * Logged from:
333 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
334 */
335message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800336 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700337
David Chen0b5c90c2018-01-25 16:51:49 -0800338 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700339 optional string name = 2;
340
341 enum State {
342 OFF = 0;
343 ON = 1;
344 }
345 optional State state = 3;
346}
347
348/**
349 * Logs when a job scheduler job state changes.
350 *
351 * Logged from:
352 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
353 */
354message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800355 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700356
357 // Name of the job (as named in the app)
358 optional string name = 2;
359
360 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800361 FINISHED = 0;
362 STARTED = 1;
363 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700364 }
365 optional State state = 3;
366
Tej Singh33a412b2018-03-16 18:43:59 -0700367 // The reason a job has stopped.
368 // This is only applicable when the state is FINISHED.
369 // The default value is CANCELED.
370 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700371}
372
373/**
374 * Logs when the audio state changes.
375 *
376 * Logged from:
377 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
378 */
379message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800380 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700381
382 enum State {
383 OFF = 0;
384 ON = 1;
385 }
386 optional State state = 2;
387}
388
389/**
390 * Logs when the video codec state changes.
391 *
392 * Logged from:
393 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
394 */
395message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800396 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700397
398 enum State {
399 OFF = 0;
400 ON = 1;
401 }
402 optional State state = 2;
403}
404
405/**
406 * Logs when the flashlight state changes.
407 *
408 * Logged from:
409 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
410 */
411message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800412 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700413
414 enum State {
415 OFF = 0;
416 ON = 1;
417 }
418 optional State state = 2;
419}
420
421/**
422 * Logs when the camera state changes.
423 *
424 * Logged from:
425 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
426 */
427message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800428 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700429
430 enum State {
431 OFF = 0;
432 ON = 1;
433 }
434 optional State state = 2;
435}
436
437/**
438 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000439 *
440 * Logged from:
441 * TODO
442 */
Bookatzd6746242017-10-24 18:39:35 -0700443message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800444 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000445
Bookatz1a1b0462018-01-12 11:47:03 -0800446 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
447 // From frameworks/base/core/proto/android/os/enums.proto.
448 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700449
450 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
451 optional string tag = 3;
452
453 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800454 RELEASE = 0;
455 ACQUIRE = 1;
456 CHANGE_RELEASE = 2;
457 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700458 }
459 optional State state = 4;
460}
461
462/**
Bookatzc1a050a2017-10-10 15:49:28 -0700463 * Logs when a partial wakelock is considered 'long' (over 1 min).
464 *
465 * Logged from:
466 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
467 */
468message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800469 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700470
Yao Chend54f9dd2017-10-17 17:37:48 +0000471 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
472 optional string tag = 2;
473
Bookatzc1a050a2017-10-10 15:49:28 -0700474 // TODO: I have no idea what this is.
475 optional string history_tag = 3;
476
477 enum State {
478 OFF = 0;
479 ON = 1;
480 }
481 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000482}
483
Bookatzc1a050a2017-10-10 15:49:28 -0700484/**
485 * Logs Battery Saver state change.
486 *
487 * Logged from:
488 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
489 */
490message BatterySaverModeStateChanged {
491 enum State {
492 OFF = 0;
493 ON = 1;
494 }
495 optional State state = 1;
496}
497
498/**
499 * Logs Doze mode state change.
500 *
501 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800502 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700503 */
504message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800505 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800506}
507
508
509/**
510 * Logs state change of Doze mode including maintenance windows.
511 *
512 * Logged from:
513 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
514 */
515message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800516 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700517}
518
519/**
520 * Logs screen brightness level.
521 *
522 * Logged from:
523 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
524 */
525message ScreenBrightnessChanged {
526 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
527 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700528}
529
530/**
531 * Logs battery level (percent full, from 0 to 100).
532 *
533 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700534 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700535 */
536message BatteryLevelChanged {
537 // Battery level. Should be in [0, 100].
538 optional int32 battery_level = 1;
539}
540
541/**
542 * Logs change in charging status of the device.
543 *
544 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700545 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700546 */
547message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800548 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
549 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700550}
551
552/**
553 * Logs whether the device is plugged in, and what power source it is using.
554 *
555 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700556 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700557 */
558message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800559 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
560 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700561}
562
Bookatz8c6571b2017-10-24 15:04:41 -0700563// TODO: Define this more precisely.
564// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
565/**
566 * Logs when the device turns off or on.
567 *
568 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700569 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700570 */
571message DeviceOnStatusChanged {
572 enum State {
573 OFF = 0;
574 ON = 1;
575 }
576 optional State state = 1;
577}
578
579/**
580 * Logs when an app's wakeup alarm fires.
581 *
582 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700583 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700584 */
585message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800586 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800587
588 // Name of the wakeup alarm.
589 optional string tag = 2;
590}
591
592/**
593 * Logs when an an app causes the mobile radio to change state.
594 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
595 *
596 * Logged from:
597 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
598 */
599message MobileRadioPowerStateChanged {
600 // TODO: Add attribution instead of uid?
Yao Chenc40a19d2018-03-15 16:48:25 -0700601 optional int32 uid = 1 [(is_uid) = true];
Bookatzddccf0a2017-11-28 16:48:14 -0800602
Bookatz1a1b0462018-01-12 11:47:03 -0800603 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
604 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800605}
606
607/**
608 * Logs when an an app causes the wifi radio to change state.
609 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
610 *
611 * Logged from:
612 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
613 */
614message WifiRadioPowerStateChanged {
615 // TODO: Add attribution instead of uid?
Yao Chenc40a19d2018-03-15 16:48:25 -0700616 optional int32 uid = 1 [(is_uid) = true];
Bookatzddccf0a2017-11-28 16:48:14 -0800617
Bookatz1a1b0462018-01-12 11:47:03 -0800618 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
619 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700620}
621
622/**
623 * Logs kernel wakeup reasons and aborts.
624 *
625 * Logged from:
626 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
627 */
628message KernelWakeupReported {
629 // Name of the kernel wakeup reason (or abort).
630 optional string wakeup_reason_name = 1;
631
632 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800633 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700634}
635
636/**
637 * Logs wifi locks held by an app.
638 *
639 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700640 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700641 */
642message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800643 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700644
645 enum State {
646 OFF = 0;
647 ON = 1;
648 }
649 optional State state = 2;
650}
651
652/**
653 * Logs wifi signal strength changes.
654 *
655 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700656 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700657 */
658message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800659 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
660 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700661}
662
663/**
664 * Logs wifi scans performed by an app.
665 *
666 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700667 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700668 */
669message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800670 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700671
672 enum State {
673 OFF = 0;
674 ON = 1;
675 }
676 optional State state = 2;
677}
678
679/**
Tej Singh4503e102018-01-04 14:35:01 -0800680 * Logs wifi multicast locks held by an app
681 *
682 * Logged from:
683 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
684 */
685message WifiMulticastLockStateChanged {
686 repeated AttributionNode attribution_node = 1;
687
688 enum State {
689 OFF = 0;
690 ON = 1;
691 }
692 optional State state = 2;
693}
694
695/**
Tej Singh1ea42892018-01-19 09:27:00 -0800696 * Logs shutdown reason and duration on next boot.
697 *
698 * Logged from:
699 * frameworks/base/core/java/com/android/server/BootReceiver.java
700 */
701message ShutdownSequenceReported {
702 // True if shutdown is for a reboot. Default: false if we do not know.
703 optional bool reboot = 1;
704
705 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
706 optional string reason = 2;
707
708 // Beginning of shutdown time in ms using wall clock time since unix epoch.
709 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800710 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800711
712 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800713 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800714}
715
Tej Singh6483ea42018-01-25 17:45:49 -0800716
717/**
718 * Logs boot reason and duration.
719 *
720 * Logged from:
721 * system/core/bootstat/bootstat.cpp
722 */
723message BootSequenceReported {
724 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
725 // Default: "<EMPTY>" if not available.
726 optional string bootloader_reason = 1;
727
728 // Reason for system boot. Eg. bootloader, reboot,userrequested
729 // Default: "<EMPTY>" if not available.
730 optional string system_reason = 2;
731
732 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800733 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800734
735 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800736 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800737
738 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800739 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800740
741 // Time since last boot in ms. Default: 0 if not available.
742 optional int64 time_since_last_boot = 6;
743}
744
Tej Singhc477d9c2018-02-05 18:31:39 -0800745
746/**
747 * Logs call state and disconnect cause (if applicable).
748 *
749 * Logged from:
750 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
751 */
752message CallStateChanged {
753 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
754 // From frameworks/base/core/proto/android/telecomm/enums.proto.
755 optional android.telecom.CallStateEnum call_state = 1;
756
757 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
758 // This value is only applicable when the call_state is DISCONNECTED, and
759 // should always be UNKNOWN if the call_state is not DISCONNECTED.
760 // From frameworks/base/core/proto/android/telecomm/enums.proto.
761 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
762
763 // True if the call is self-managed, which are apps that use the
764 // telecom infrastructure to make their own calls.
765 optional bool self_managed = 3;
766
767 // True if call is external. External calls are calls on connected Wear
768 // devices but show up in Telecom so the user can pull them onto the device.
769 optional bool external_call = 4;
770}
771
Tej Singh1ea42892018-01-19 09:27:00 -0800772/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800773 * Logs keyguard state. The keyguard is the lock screen.
774 *
775 * Logged from:
776 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
777 */
778message KeyguardStateChanged {
779 enum State {
780 UNKNOWN = 0;
781 // The keyguard is hidden when the phone is unlocked.
782 HIDDEN = 1;
783 // The keyguard is shown when the phone is locked (screen turns off).
784 SHOWN= 2;
785 // The keyguard is occluded when something is overlaying the keyguard.
786 // Eg. Opening the camera while on the lock screen.
787 OCCLUDED = 3;
788 }
789 optional State state = 1;
790}
791
792/**
793 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
794 * prompts the user to enter a password (pattern, pin, etc).
795 *
796 * Logged from:
797 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
798 */
799
800message KeyguardBouncerStateChanged {
801 enum State {
802 UNKNOWN = 0;
803 // Bouncer is hidden, either as a result of successfully entering the
804 // password, screen timing out, or user going back to lock screen.
805 HIDDEN = 1;
806 // This is when the user is being prompted to enter the password.
807 SHOWN = 2;
808 }
809 optional State state = 1;
810}
811
812/**
813 * Logs the result of entering a password into the keyguard bouncer.
814 *
815 * Logged from:
816 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
817 */
818message KeyguardBouncerPasswordEntered {
819 enum BouncerResult {
820 UNKNOWN = 0;
821 // The password entered was incorrect.
822 FAILURE = 1;
823 // The password entered was correct.
824 SUCCESS = 2;
825 }
826 optional BouncerResult result = 1;
827}
828
Tej Singha883b372018-02-15 11:30:01 -0800829/*
830 * Logs changes to the configuration of the device. The configuration is defined
831 * in frameworks/base/core/java/android/content/res/Configuration.java
832 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
833 * Please go there to interpret the possible values each field can be.
834 *
835 * Logged from:
836 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
837 */
838message ResourceConfigurationChanged {
839 // Bit mask of color capabilities of the screen.
840 // Contains information about the color gamut and hdr mode of the screen.
841 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
842 optional int32 colorMode = 1;
843
844 // The target screen density being rendered to.
845 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
846 optional int32 densityDpi = 2;
847
848 // Current user preference for the scaling factor for fonts,
849 // relative to the base density scaling.
850 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
851 optional float fontScale = 3;
852
853 // Flag indicating whether the hard keyboard is hidden.
854 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
855 optional int32 hardKeyboardHidden = 4;
856
857 // The type of keyboard attached to the device.
858 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
859 optional int32 keyboard = 5;
860
861 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
862 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
863 optional int32 keyboardHideen = 6;
864
865 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
866 // 0 if undefined.
867 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
868 optional int32 mcc = 7;
869
870 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
871 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
872 // MNC_ZERO symbol defined in Configuration.java.
873 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
874 optional int32 mnc = 8;
875
876 // The kind of navigation available on the device.
877 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
878 optional int32 navigation = 9;
879
880 // Flag indicating whether the navigation is available.
881 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
882 optional int32 navigationHidden = 10;
883
884 // Overall orientation of the screen.
885 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
886 optional int32 orientation = 11;
887
888 // The current height of the available screen space, in dp units.
889 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
890 optional int32 screenHeightDp = 12;
891
892 // Bit mask of overall layout of the screen.
893 // Contains information about screen size, whether the screen is wider/taller
894 // than normal, whether the screen layout is right-tl-left or left-to-right,
895 // and whether the screen has a rounded shape.
896 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
897 optional int32 screenLayout = 13;
898
899 // Current width of the available screen space, in dp units.
900 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
901 optional int32 screenWidthDp = 14;
902
903 // The smallest screen size an application will see in normal operation.
904 // This is the smallest value of both screenWidthDp and screenHeightDp
905 // in portrait and landscape.
906 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
907 optional int32 smallestScreenWidthDp = 15;
908
909 // The type of touch screen attached to the device.
910 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
911 optional int32 touchscreen = 16;
912
913 // Bit mask of the ui mode.
914 // Contains information about the overall ui mode of the device.
915 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
916 // Also contains information about whether the device is in night mode.
917 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
918 optional int32 uiMode = 17;
919}
920
Tej Singheee317b2018-03-07 19:28:05 -0800921
922/**
923 * Logs changes in the connection state of the mobile radio.
924 *
925 * Logged from:
926 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
927 */
928message MobileConnectionStateChanged {
929 // States are from the state machine DataConnection.java.
930 enum State {
931 UNKNOWN = 0;
932 // The connection is inactive, or disconnected.
933 INACTIVE = 1;
934 // The connection is being activated, or connecting.
935 ACTIVATING = 2;
936 // The connection is active, or connected.
937 ACTIVE = 3;
938 // The connection is disconnecting.
939 DISCONNECTING = 4;
940 // The connection is disconnecting after creating a connection.
941 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
942 }
943 optional State state = 1;
944 // For multi-sim phones, this distinguishes between the sim cards.
945 optional int32 sim_slot_index = 2;
946 // Used to identify the connection. Starts at 0 and increments by 1 for
947 // every new network created. Resets whenever the device reboots.
948 optional int32 data_connection_id = 3;
949 // A bitmask for the capabilities of this connection.
950 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
951 // Default value (if we have no information): 0
952 optional int64 capabilities = 4;
953 // If this connection has internet.
954 // This just checks if the DEFAULT bit of capabilities is set.
955 optional bool has_internet = 5;
956}
957
958/**
959 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
960 *
961 * Logged from:
962 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
963 */
964message MobileRadioTechnologyChanged {
965 optional android.telephony.NetworkTypeEnum state = 1;
966 // For multi-sim phones, this distinguishes between the sim cards.
967 optional int32 sim_slot_index = 2;
968}
969
Andrew Chantb56388b2018-03-22 21:07:33 -0700970/**
971 * Logs the VID and PID of any connected USB devices.
972 *
973 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
974 *
975 * Logged by Vendor.
976 */
977message UsbDeviceAttached {
978 optional int32 vid = 1;
979 optional int32 pid = 2;
980 optional bool has_audio = 3;
981 optional bool has_hid = 4;
982 optional bool has_storage = 5;
983}
984
Tej Singheee317b2018-03-07 19:28:05 -0800985
Tej Singhdd7bd352018-02-09 19:33:15 -0800986/**
Tej Singh5d991e12018-03-09 19:48:11 -0800987 * Logs when Bluetooth is enabled and disabled.
988 *
989 * Logged from:
990 * services/core/java/com/android/server/BluetoothManagerService.java
991 */
992message BluetoothEnabledStateChanged {
993 repeated AttributionNode attribution_node = 1;
994 // Whether or not bluetooth is enabled on the device.
995 enum State {
996 UNKNOWN = 0;
997 ENABLED = 1;
998 DISABLED = 2;
999 }
1000 optional State state = 2;
1001 // The reason for being enabled/disabled.
1002 // Eg. Airplane mode, crash, application request.
1003 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1004 // If the reason is an application request, this will be the package name.
1005 optional string pkgName = 4;
1006}
1007
1008/**
1009 * Logs when a Bluetooth device connects and disconnects.
1010 *
1011 * Logged from:
1012 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1013 */
1014message BluetoothConnectionStateChanged {
1015 // The state of the connection.
1016 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1017 optional android.bluetooth.ConnectionStateEnum state = 1;
1018 // An identifier that can be used to match connect and disconnect events.
1019 // Currently is last two bytes of a hash of a device level ID and
1020 // the mac address of the bluetooth device that is connected.
1021 optional int32 obfuscated_id = 2;
1022 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1023 // From android.bluetooth.BluetoothAdapter.java
1024 optional int32 bt_profile = 3;
1025}
1026
1027/**
1028 * Logs when Bluetooth A2dp audio streaming state changes.
1029 *
1030 * Logged from:
1031 * TODO(b/73971848)
1032 */
1033message BluetoothA2dpAudioStateChanged {
1034 // Whether or not audio is being played using Bluetooth A2dp.
1035 enum State {
1036 UNKNOWN = 0;
1037 PLAY = 1;
1038 STOP = 2;
1039 }
1040 optional State state = 1;
1041}
1042
1043/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001044 * Logs when something is plugged into or removed from the USB-C connector.
1045 *
1046 * Logged from:
1047 * Vendor USB HAL.
1048 */
1049message UsbConnectorStateChanged {
1050 enum State {
1051 DISCONNECTED = 0;
1052 CONNECTED = 1;
1053 }
1054 optional State state = 1;
1055}
1056
1057/**
1058 * Logs the reported speaker impedance.
1059 *
1060 * Logged from:
1061 * Vendor audio implementation.
1062 */
1063message SpeakerImpedanceReported {
1064 optional int32 speaker_location = 1;
1065 optional int32 impedance = 2;
1066}
1067
1068/**
1069 * Logs the report of a failed hardware.
1070 *
1071 * Logged from:
1072 * Vendor HALs.
1073 *
1074 */
1075message HardwareFailed {
1076 enum HardwareType {
1077 HARDWARE_FAILED_UNKNOWN = 0;
1078 HARDWARE_FAILED_MICROPHONE = 1;
1079 HARDWARE_FAILED_CODEC = 2;
1080 HARDWARE_FAILED_SPEAKER = 3;
1081 HARDWARE_FAILED_FINGERPRINT = 4;
1082 }
1083 optional HardwareType hardware_type = 1;
1084
1085 /* hardware_location allows vendors to differentiate between multiple instances of
1086 * the same hardware_type. The specific locations are vendor defined integers,
1087 * referring to board-specific numbering schemes.
1088 */
1089 optional int32 hardware_location = 2;
1090
1091 /* failure_code is specific to the HardwareType of the failed hardware.
1092 * It should use the enum values defined below.
1093 */
1094 enum MicrophoneFailureCode {
1095 MICROPHONE_FAILURE_COMPLETE = 0;
1096 }
1097 enum CodecFailureCode {
1098 CODEC_FAILURE_COMPLETE = 0;
1099 }
1100 enum SpeakerFailureCode {
1101 SPEAKER_FAILURE_COMPLETE = 0;
1102 SPEAKER_FAILURE_HIGH_Z = 1;
1103 SPEAKER_FAILURE_SHORT = 2;
1104 }
1105 enum FingerprintFailureCode {
1106 FINGERPRINT_FAILURE_COMPLETE = 0;
1107 FINGERPRINT_SENSOR_BROKEN = 1;
1108 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1109 }
1110 optional int32 failure_code = 3;
1111}
1112
1113/**
1114 * Log an event when the device has been physically dropped.
1115 * Reported from the /vendor partition.
1116 */
1117message PhysicalDropDetected {
1118 // Confidence that the event was actually a drop, 0 -> 100
1119 optional int32 confidence_pctg = 1;
1120 // Peak acceleration of the drop, in 1/1000s of a g.
1121 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001122 // Duration of freefall in ms
1123 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001124}
1125
1126/**
1127 * Log bucketed battery charge cycles.
1128 *
1129 * Each bucket represents cycles of the battery past
1130 * a given charge point. For example, bucket 1 is the
1131 * lowest 1/8th of the battery, and bucket 8 is 100%.
1132 *
1133 * Logged from:
1134 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1135 */
1136message ChargeCyclesReported {
1137 optional int32 cycle_bucket_1 = 1;
1138 optional int32 cycle_bucket_2 = 2;
1139 optional int32 cycle_bucket_3 = 3;
1140 optional int32 cycle_bucket_4 = 4;
1141 optional int32 cycle_bucket_5 = 5;
1142 optional int32 cycle_bucket_6 = 6;
1143 optional int32 cycle_bucket_7 = 7;
1144 optional int32 cycle_bucket_8 = 8;
1145}
1146
1147/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001148 * Logs the duration of a davey (jank of >=700ms) when it occurs
1149 *
1150 * Logged from:
1151 * frameworks/base/libs/hwui/JankTracker.cpp
1152 */
1153message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001154 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001155 optional int32 uid = 1 [(is_uid) = true];
1156 ;
David Chen77ef6712018-02-23 18:23:42 -08001157
Tej Singhbb8554a2018-01-26 11:59:14 -08001158 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001159 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001160}
1161
1162/**
Bookatze5885242017-10-24 20:10:31 -07001163 * Logs phone signal strength changes.
1164 *
1165 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001166 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001167 */
1168message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001169 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1170 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001171}
1172
1173/**
1174 * Logs that a setting was updated.
1175 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001176 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001177 * The tag and is_default allow resetting of settings to default values based on the specified
1178 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1179 */
1180message SettingChanged {
1181 // The name of the setting.
1182 optional string setting = 1;
1183
1184 // The change being imposed on this setting. May represent a number, eg "3".
1185 optional string value = 2;
1186
1187 // The new value of this setting. For most settings, this is same as value. For some settings,
1188 // value is +X or -X where X represents an element in a set. For example, if the previous value
1189 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1190 // The +/- feature is currently only used for location_providers_allowed.
1191 optional string new_value = 3;
1192
1193 // The previous value of this setting.
1194 optional string prev_value = 4;
1195
1196 // The tag used with the is_default for resetting sets of settings. This is generally null.
1197 optional string tag = 5;
1198
Bookatz90867622018-01-31 15:05:57 -08001199 // True if this setting with tag should be resettable.
1200 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001201
David Chenbd789912018-03-16 17:19:55 -07001202 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001203 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001204
1205 enum ChangeReason {
1206 UPDATED = 1; // Updated can be an insertion or an update.
1207 DELETED = 2;
1208 }
1209 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001210}
Chenjie Yub3dda412017-10-24 13:41:59 -07001211
Chenjie Yu05013b32017-11-21 10:21:41 -08001212/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001213 * Logs activity going to foreground or background
1214 *
1215 * Logged from:
1216 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1217 */
1218message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001219 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001220 optional string pkg_name = 2;
1221 optional string class_name = 3;
1222
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001223 enum Activity {
1224 MOVE_TO_BACKGROUND = 0;
1225 MOVE_TO_FOREGROUND = 1;
1226 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001227 optional Activity activity = 4;
1228}
David Chenc8a43242017-10-17 16:23:28 -07001229
1230/**
David Chen9e3808c2017-11-20 17:25:34 -08001231 * Logs when an error is written to dropbox.
1232 * Logged from:
1233 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1234 */
1235message DropboxErrorChanged {
1236 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001237 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001238
1239 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
1240 optional string tag = 2;
1241
1242 // The name of the process.
1243 optional string process_name = 3;
1244
1245 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001246 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -08001247
1248 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -08001249 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -08001250
1251 // The activity name if available.
1252 optional string activity_name = 6;
1253
David Chen6e3e6cb2018-01-03 16:14:06 -08001254 // The package name if available.
1255 optional string package_name = 7;
1256
David Chen9e3808c2017-11-20 17:25:34 -08001257 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001258 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001259}
1260
David Chen0a368b22017-12-06 16:28:16 -08001261/*
1262 * Allows other apps to push events into statsd.
1263 * Logged from:
1264 * frameworks/base/core/java/android/util/StatsLog.java
1265 */
David Chen0b5c90c2018-01-25 16:51:49 -08001266message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001267 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001268 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001269
1270 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1271 optional int32 label = 2;
1272
1273 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1274 // predicates for the metrics).
1275 enum State {
1276 UNKNOWN = 0;
1277 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1278 STOP = 2;
1279 START = 3;
1280 }
1281 optional State state = 3;
1282}
1283
David Chen9e3808c2017-11-20 17:25:34 -08001284/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001285 * Logs when statsd detects an anomaly.
1286 *
1287 * Logged from:
1288 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1289 */
1290message AnomalyDetected {
1291 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001292 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001293
Yangster-mac94e197c2018-01-02 16:03:03 -08001294 // Id of the config whose anomaly detection alert fired.
1295 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001296
Yangster-mac94e197c2018-01-02 16:03:03 -08001297 // Id of the alert (i.e. name of the anomaly that was detected).
1298 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001299}
1300
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001301message AppStartChanged {
1302 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001303 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001304
1305 // The app package name.
1306 optional string pkg_name = 2;
1307
1308 enum TransitionType {
1309 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1310 WARM = 1;
1311 HOT = 2;
1312 COLD = 3;
1313 }
1314 // The transition type.
1315 optional TransitionType type = 3;
1316
1317 // The activity name.
1318 optional string activity_name = 4;
1319
1320 // The name of the calling app. Empty if not set.
1321 optional string calling_pkg_name = 5;
1322
1323 // Whether the app is an instant app.
1324 optional bool is_instant_app = 6;
1325
1326 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001327 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001328
Bookatz80d11a02018-01-16 10:46:35 -08001329 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001330
David Chen0b5c90c2018-01-25 16:51:49 -08001331 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001332 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001333 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001334 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001335 optional int32 bind_application_delay_millis = 11;
1336 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001337
1338 // Empty if not set.
1339 optional string launch_token = 13;
1340
Calin Juravle759fbda2018-02-20 19:52:30 +00001341 // The compiler filter used when when the package was optimized.
1342 optional string package_optimization_compilation_filter = 14;
1343
1344 // The reason why the package was optimized.
1345 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001346}
1347
1348message AppStartCancelChanged {
1349 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001350 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001351
1352 // The app package name.
1353 optional string pkg_name = 2;
1354
1355 enum TransitionType {
1356 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1357 WARM = 1;
1358 HOT = 2;
1359 COLD = 3;
1360 }
1361 // The transition type.
1362 optional TransitionType type = 3;
1363
1364 // The activity name.
1365 optional string activity_name = 4;
1366}
1367
1368message AppStartFullyDrawnChanged {
1369 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001370 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001371
1372 // The app package name.
1373 optional string pkg_name = 2;
1374
1375 enum TransitionType {
1376 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1377 WITH_BUNDLE = 1;
1378 WITHOUT_BUNDLE = 2;
1379 }
1380 // The transition type.
1381 optional TransitionType type = 3;
1382
1383 // The activity name.
1384 optional string activity_name = 4;
1385
1386 optional bool transition_process_running = 5;
1387
1388 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001389 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001390}
1391
Bookatz8fcd09a2017-12-18 13:01:10 -08001392/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001393 * Logs a picture-in-picture action
1394 * Logged from:
1395 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1396 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1397 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1398 */
1399message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001400 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001401 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001402
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001403 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001404
Chenjie Yu52cacc62017-12-08 18:11:45 -08001405 enum State {
1406 ENTERED = 1;
1407 EXPANDED_TO_FULL_SCREEN = 2;
1408 MINIMIZED = 3;
1409 DISMISSED = 4;
1410 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001411 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001412}
1413
1414/**
Chenjie Yue8904192017-12-08 19:12:57 -08001415 * Logs overlay action
1416 * Logged from:
1417 * services/core/java/com/android/server/wm/Session.java
1418 */
1419message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001420 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001421
1422 optional string package_name = 2;
1423
1424 optional bool using_alert_window = 3;
1425
1426 enum State {
1427 ENTERED = 1;
1428 EXITED = 2;
1429 }
1430 optional State state = 4;
1431}
1432
Chenjie Yuccfe6452018-01-30 11:33:21 -08001433/*
1434 * Logs foreground service starts and stops.
1435 * Note that this is not when a service starts or stops, but when it is
1436 * considered foreground.
1437 * Logged from
1438 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1439 */
1440message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001441 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001442 // package_name + "/" + class_name
1443 optional string short_name = 2;
1444
1445 enum State {
1446 ENTER = 1;
1447 EXIT = 2;
1448 }
1449 optional State state = 3;
1450}
1451
Chenjie Yue8904192017-12-08 19:12:57 -08001452/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001453 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1454 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1455 * attributed back to the parent (host) uid. One example is Chrome.
1456 *
1457 * Logged from:
1458 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1459 */
1460message IsolatedUidChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001461 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001462 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1463 optional int32 parent_uid = 1;
1464
1465 optional int32 isolated_uid = 2;
1466
1467 // We expect an isolated uid to be removed before if it's used for another parent uid.
1468 enum Event {
1469 REMOVED = 0;
1470 CREATED = 1;
1471 }
1472 optional Event event = 3;
1473}
1474
1475/*
1476 * Logs the reception of an incoming network packet causing the main system to wake up for
1477 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1478 * and processed by WakeupController.cpp.
1479 */
1480message PacketWakeupOccurred {
1481 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1482 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001483 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001484 // The interface name on which the packet was received.
1485 optional string iface = 2;
1486 // The ethertype value of the packet.
1487 optional int32 ethertype = 3;
1488 // String representation of the destination MAC address of the packet.
1489 optional string destination_hardware_address = 4;
1490 // String representation of the source address of the packet if this was an IP packet.
1491 optional string source_ip = 5;
1492 // String representation of the destination address of the packet if this was an IP packet.
1493 optional string destination_ip = 6;
1494 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1495 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1496 // families.
1497 optional int32 ip_next_header = 7;
1498 // The source port if this was a TCP or UDP packet.
1499 optional int32 source_port = 8;
1500 // The destination port if this was a TCP or UDP packet.
1501 optional int32 destination_port = 9;
1502}
1503
1504/*
1505 * Logs the memory stats for an app on startup.
1506 * Logged from:
1507 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1508 */
1509message AppStartMemoryStateCaptured {
1510 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001511 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001512
1513 // The process name.
1514 optional string process_name = 2;
1515
1516 // The activity name.
1517 optional string activity_name = 3;
1518
1519 // # of page-faults
1520 optional int64 pgfault = 4;
1521
1522 // # of major page-faults
1523 optional int64 pgmajfault = 5;
1524
1525 // RSS
1526 optional int64 rss_in_bytes = 6;
1527
1528 // CACHE
1529 optional int64 cache_in_bytes = 7;
1530
1531 // SWAP
1532 optional int64 swap_in_bytes = 8;
1533}
1534
1535/*
1536 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1537 * for LMK event.
1538 * Logged from:
1539 * system/core/lmkd/lmkd.c
1540 */
1541message LmkStateChanged {
1542 enum State {
1543 UNKNOWN = 0;
1544 START = 1;
1545 STOP = 2;
1546 }
1547 optional State state = 1;
1548}
1549
1550/*
1551 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1552 * Logged from:
1553 * system/core/lmkd/lmkd.c
1554 */
1555message LmkKillOccurred {
1556 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001557 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001558
1559 // The process name.
1560 optional string process_name = 2;
1561
1562 // oom adj score.
1563 optional int32 oom_score = 3;
1564
1565 // # of page-faults
1566 optional int64 pgfault = 4;
1567
1568 // # of major page-faults
1569 optional int64 pgmajfault = 5;
1570
1571 // RSS
1572 optional int64 rss_in_bytes = 6;
1573
1574 // CACHE
1575 optional int64 cache_in_bytes = 7;
1576
1577 // SWAP
1578 optional int64 swap_in_bytes = 8;
1579}
1580
Rajeev Kumar51b54602018-03-01 12:18:26 -08001581/*
1582 * Logs when the ActivityManagerService detects that an app died.
1583 *
1584 * Logged from:
1585 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1586 */
1587message AppDied {
1588 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001589 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001590}
1591
Chenjie Yubbcbc602018-02-05 16:51:52 -08001592//////////////////////////////////////////////////////////////////////
1593// Pulled atoms below this line //
1594//////////////////////////////////////////////////////////////////////
1595
1596/**
David Chenc8a43242017-10-17 16:23:28 -07001597 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1598 *
1599 * Pulled from:
1600 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1601 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001602message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001603 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001604
1605 optional int64 rx_bytes = 2;
1606
1607 optional int64 rx_packets = 3;
1608
1609 optional int64 tx_bytes = 4;
1610
1611 optional int64 tx_packets = 5;
1612}
1613
1614/**
1615 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1616 *
1617 * Pulled from:
1618 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1619 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001620message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001621 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001622
Yao Chenc40a19d2018-03-15 16:48:25 -07001623 // 1 denotes foreground and 0 denotes background. This is called Set in
1624 // NetworkStats.
David Chenc8a43242017-10-17 16:23:28 -07001625 optional int32 is_foreground = 2;
1626
1627 optional int64 rx_bytes = 3;
1628
1629 optional int64 rx_packets = 4;
1630
1631 optional int64 tx_bytes = 5;
1632
1633 optional int64 tx_packets = 6;
1634}
1635
1636/**
1637 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1638 *
1639 * Pulled from:
1640 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1641 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001642message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001643 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001644
1645 optional int64 rx_bytes = 2;
1646
1647 optional int64 rx_packets = 3;
1648
1649 optional int64 tx_bytes = 4;
1650
1651 optional int64 tx_packets = 5;
1652}
1653
1654/**
1655 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1656 *
1657 * Pulled from:
1658 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1659 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001660message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001661 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001662
Yao Chenc40a19d2018-03-15 16:48:25 -07001663 // 1 denotes foreground and 0 denotes background. This is called Set in
1664 // NetworkStats.
David Chenc8a43242017-10-17 16:23:28 -07001665 optional int32 is_foreground = 2;
1666
1667 optional int64 rx_bytes = 3;
1668
1669 optional int64 rx_packets = 4;
1670
1671 optional int64 tx_bytes = 5;
1672
1673 optional int64 tx_packets = 6;
1674}
1675
1676/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001677 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1678 *
1679 * Pulled from:
1680 * StatsCompanionService
1681 */
1682message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001683 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001684
1685 optional int64 rx_bytes = 2;
1686
1687 optional int64 tx_bytes = 3;
1688}
1689
1690/**
David Chenc8a43242017-10-17 16:23:28 -07001691 * Pulls the kernel wakelock durations. This atom is adapted from
1692 * android/internal/os/KernelWakelockStats.java
1693 *
1694 * Pulled from:
1695 * StatsCompanionService using KernelWakelockReader.
1696 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001697message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001698 optional string name = 1;
1699
1700 optional int32 count = 2;
1701
1702 optional int32 version = 3;
1703
1704 optional int64 time = 4;
1705}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001706
Chenjie Yu05013b32017-11-21 10:21:41 -08001707/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001708 * Pulls low power state information. This includes platform and subsystem sleep state information,
1709 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001710 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001711 * hardware/interfaces/power/1.1/types.hal
1712 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001713message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001714 // Subsystem name
1715 optional string subsystem_name = 1;
1716 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1717 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1718 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001719 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001720 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001721 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001722 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001723}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001724
Chenjie Yu05013b32017-11-21 10:21:41 -08001725/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001726 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001727 * Pulls the time the cpu spend on the frequency index. Frequency index
1728 * starts from highest to lowest. The value should be monotonically
1729 * increasing since boot. However, if there is a cpu
1730 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001731 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001732message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001733 optional uint32 cluster = 1;
1734 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001735 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001736}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001737
Chenjie Yu05013b32017-11-21 10:21:41 -08001738/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001739 * Pulls Cpu Time Per Uid.
1740 * Note that isolated process uid time should be attributed to host uids.
1741 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001742message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001743 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001744 optional uint64 user_time_millis = 2;
1745 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001746}
1747
1748/**
1749 * Pulls Cpu Time Per Uid per frequency.
1750 * Note that isolated process uid time should be attributed to host uids.
1751 * For each uid, we order the time by descending frequencies.
1752 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001753message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001754 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001755 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001756 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001757}
Hugo Benichi884970e2017-11-14 22:42:46 +09001758
Chenjie Yu05013b32017-11-21 10:21:41 -08001759/**
1760 * Pulls Wifi Controller Activity Energy Info
1761 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001762message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001763 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001764 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001765 // stack reported state
1766 // TODO: replace this with proto enum
1767 optional int32 stack_state = 2;
1768 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001769 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001770 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001771 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001772 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001773 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001774 // product of current(mA), voltage(V) and time(ms)
1775 optional uint64 controller_energy_used = 6;
1776}
1777
1778/**
1779 * Pulls Modem Activity Energy Info
1780 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001781message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001782 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001783 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001784 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001785 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001786 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001787 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001788 /**
1789 * Tx power index
1790 * index 0 = tx_power < 0dBm
1791 * index 1 = 0dBm < tx_power < 5dBm
1792 * index 2 = 5dBm < tx_power < 15dBm
1793 * index 3 = 15dBm < tx_power < 20dBm
1794 * index 4 = tx_power > 20dBm
1795 */
1796 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001797 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001798 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001799 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001800 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001801 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001802 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001803 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001804 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001805 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001806 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001807 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001808 // product of current(mA), voltage(V) and time(ms)
1809 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001810}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001811
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001812/**
1813 * Pulls Bluetooth Activity Energy Info
1814 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1815 */
1816message BluetoothActivityInfo {
1817 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001818 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001819 // bluetooth stack state
1820 optional int32 bluetooth_stack_state = 2;
1821 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001822 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001823 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001824 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001825 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001826 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001827 // product of current(mA), voltage(V) and time(ms)
1828 optional uint64 energy_used = 6;
1829}
1830
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001831/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001832 * Logs the memory stats for a process.
1833 */
1834message ProcessMemoryState {
1835 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001836 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001837
1838 // The process name.
1839 optional string process_name = 2;
1840
1841 // oom adj score.
1842 optional int32 oom_score = 3;
1843
1844 // # of page-faults
1845 optional int64 pgfault = 4;
1846
1847 // # of major page-faults
1848 optional int64 pgmajfault = 5;
1849
Rajeev Kumar90235992018-01-29 11:06:48 -08001850 // RSS
1851 optional int64 rss_in_bytes = 6;
1852
1853 // CACHE
1854 optional int64 cache_in_bytes = 7;
1855
1856 // SWAP
1857 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001858}
1859
1860/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001861 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001862 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001863message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001864 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001865}
1866
1867/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001868 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001869 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001870message SystemUptime {
1871 // Milliseconds since the system was booted.
1872 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1873 // for external input).
1874 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001875 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001876}
1877
1878/*
1879 * Reads from /proc/uid_concurrent_active_time which has the format:
1880 * active: X (X is # cores)
1881 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1882 * [uid1]: [time-0] [time-1] [time-2] ... ...
1883 * ...
1884 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1885 * The file contains a monotonically increasing count of time for a single boot.
1886 */
1887message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001888 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001889 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001890}
1891
1892/**
1893 * Reads from /proc/uid_concurrent_policy_time which has the format:
1894 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1895 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1896 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1897 * ...
1898 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1899 * The file contains a monotonically increasing count of time for a single boot.
1900 */
1901message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001902 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001903 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001904 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001905}
1906
1907/*
1908 * Pulls free disk space, for data, system partition and temporary directory.
1909 */
1910message DiskSpace {
1911 // available bytes in data partition
1912 optional uint64 data_available_bytes = 1;
1913 // available bytes in system partition
1914 optional uint64 system_available_bytes = 2;
1915 // available bytes in download cache or temp directories
1916 optional uint64 temp_available_bytes = 3;
1917}
Tej Singhbf972d92018-01-10 20:51:13 -08001918
1919/**
1920 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001921 * Pulled from:
1922 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001923 */
1924message RemainingBatteryCapacity {
1925 optional int32 charge_uAh = 1;
1926}
1927
1928/**
1929 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001930 * Pulled from:
1931 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001932 */
1933message FullBatteryCapacity {
1934 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001935}
1936
1937/**
1938 * Pulls the temperature of various parts of the device, in Celsius.
1939 *
1940 * Pulled from:
1941 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1942 */
1943message Temperature {
1944 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1945 optional android.os.TemperatureTypeEnum sensor_location = 1;
1946
1947 // The name of the temperature source. Eg. CPU0
1948 optional string sensor_name = 2;
1949
1950 // Temperature in degrees C.
1951 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001952}