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