blob: 2d766be7949698c727345136bbcbc3dc842df95a [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
Yao Chend54f9dd2017-10-17 17:37:48 +000019// TODO: Not the right package and class name
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070021option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080022option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070023
Yao Chen9c1debe2018-02-19 14:39:19 -080024import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080025import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080026import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080028import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080029import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/telephony/enums.proto";
31import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080032
Yao Chend54f9dd2017-10-17 17:37:48 +000033/**
Stefan Lafonae2df012017-11-14 09:17:21 -080034 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000035 * raw stats log events from the Android system, also known as "atoms."
36 *
37 * This field contains a single oneof with all of the available messages.
38 * The stats-log-api-gen tool runs as part of the Android build and
39 * generates the android.util.StatsLog class, which contains the constants
40 * and methods that Android uses to log.
41 *
Stefan Lafonae2df012017-11-14 09:17:21 -080042 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000043 * Instead, statsd on Android constructs these messages synthetically,
44 * in the format defined here and in stats_log.proto.
45 */
Stefan Lafonae2df012017-11-14 09:17:21 -080046message Atom {
47 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070048 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070049 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
50 BleScanStateChanged ble_scan_state_changed = 2;
51 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
52 BleScanResultReceived ble_scan_result_received = 4;
53 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080054 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070055 SyncStateChanged sync_state_changed = 7;
56 ScheduledJobStateChanged scheduled_job_state_changed = 8;
57 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070058 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080059 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
60 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
61 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
62 // TODO: 14-19 are blank, but need not be
63 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
64 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
65 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070066 AudioStateChanged audio_state_changed = 23;
67 MediaCodecActivityChanged media_codec_activity_changed = 24;
68 CameraStateChanged camera_state_changed = 25;
69 FlashlightStateChanged flashlight_state_changed = 26;
70 UidProcessStateChanged uid_process_state_changed = 27;
71 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
72 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070073 BatteryLevelChanged battery_level_changed = 30;
74 ChargingStateChanged charging_state_changed = 31;
75 PluggedStateChanged plugged_state_changed = 32;
Tej Singh40298312018-02-16 00:15:09 -080076 // TODO: 33 is blank, but is available for use.
Bookatz8c6571b2017-10-24 15:04:41 -070077 DeviceOnStatusChanged device_on_status_changed = 34;
78 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
79 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070080 WifiLockStateChanged wifi_lock_state_changed = 37;
81 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
82 WifiScanStateChanged wifi_scan_state_changed = 39;
83 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070084 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070085 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070086 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090087 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080088 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080089 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080090 AppBreadcrumbReported app_breadcrumb_reported = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000091 AppStartChanged app_start_changed = 48;
92 AppStartCancelChanged app_start_cancel_changed = 49;
93 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080094 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080095 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080096 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080097 LmkStateChanged lmk_state_changed = 54;
98 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080099 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800100 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800101 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800102 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800103 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800104 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800105 KeyguardStateChanged keyguard_state_changed = 62;
106 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
107 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Rajeev Kumar51b54602018-03-01 12:18:26 -0800108 AppDied app_died=65;
Tej Singha883b372018-02-15 11:30:01 -0800109 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800110 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
111 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
112 BluetoothA2dpAudioStateChanged bluetooth_a2dp_audio_state_changed = 69;
Andrew Chant28d627e2018-02-22 15:17:05 -0800113 UsbConnectorStateChanged usb_connector_changed = 70;
114 SpeakerImpedanceReported speaker_impedance_reported = 71;
115 HardwareFailed hardware_failed = 72;
116 PhysicalDropDetected physical_drop_detected = 73;
117 ChargeCyclesReported charge_cycles_reported = 74;
Bookatzc1a050a2017-10-10 15:49:28 -0700118 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000119 }
David Chenc8a43242017-10-17 16:23:28 -0700120
David Chen6e3e6cb2018-01-03 16:14:06 -0800121 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800122 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700123 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800124 WifiBytesTransfer wifi_bytes_transfer = 10000;
125 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
126 MobileBytesTransfer mobile_bytes_transfer = 10002;
127 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800128 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800129 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800130 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800131 CpuTimePerFreq cpu_time_per_freq = 10008;
132 CpuTimePerUid cpu_time_per_uid = 10009;
133 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
134 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
135 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800136 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800137 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800138 SystemElapsedRealtime system_elapsed_realtime = 10014;
139 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800140 CpuActiveTime cpu_active_time = 10016;
141 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800142 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800143 RemainingBatteryCapacity remaining_battery_capacity = 10019;
144 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800145 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700146 }
yroa1fe77c2018-02-26 14:22:54 -0800147
148 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
149 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700150}
151
Yao Chend54f9dd2017-10-17 17:37:48 +0000152/**
Yangster-mac20877162017-12-22 17:19:39 -0800153 * This proto represents a node of an attribution chain.
154 * Note: All attribution chains are represented as a repeated field of type
155 * AttributionNode. It is understood that in such arrays, the order is that
156 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000157 */
Yangster-mac20877162017-12-22 17:19:39 -0800158message AttributionNode {
159 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800160 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800161
Yangster-mac20877162017-12-22 17:19:39 -0800162 // The (optional) string tag for an element in the attribution chain. If the
163 // element has no tag, it is encoded as an empty string.
164 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700165}
166
Yao Chend54f9dd2017-10-17 17:37:48 +0000167/*
168 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800169 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000170 *
171 * RULES:
172 * - The field ids for each atom must start at 1, and count upwards by 1.
173 * Skipping field ids is not allowed.
174 * - These form an API, so renaming, renumbering or removing fields is
175 * not allowed between android releases. (This is not currently enforced,
176 * but there will be a tool to enforce this restriction).
177 * - The types must be built-in protocol buffer types, namely, no sub-messages
178 * are allowed (yet). The bytes type is also not allowed.
179 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800180 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000181 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800182 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000183 * - A field that is a uid should be a string field, tagged with the [xxx]
184 * annotation. The generated code on android will be represented by UIDs,
185 * and those UIDs will be translated in xxx to those strings.
186 *
187 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700188 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000189 * - If there is a UID, it goes first. Think in an object-oriented fashion.
190 * *****************************************************************************
191 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700192
Yao Chend54f9dd2017-10-17 17:37:48 +0000193/**
194 * Logs when the screen state changes.
195 *
196 * Logged from:
197 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
198 */
199message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800200 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800201 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700202}
Yao Chend54f9dd2017-10-17 17:37:48 +0000203
204/**
Bookatzc1a050a2017-10-10 15:49:28 -0700205 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000206 *
207 * Logged from:
208 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
209 */
Bookatzc1a050a2017-10-10 15:49:28 -0700210message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700211 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000212
Bookatzdb026a22018-01-10 19:01:56 -0800213 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800214 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000215}
216
217/**
Bookatzc1a050a2017-10-10 15:49:28 -0700218 * Logs that a process started, finished, crashed, or ANRed.
219 *
220 * Logged from:
221 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
222 */
223message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800224 // TODO: should be a string tagged w/ uid annotation
Yao Chenc40a19d2018-03-15 16:48:25 -0700225 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700226
David Chen0b5c90c2018-01-25 16:51:49 -0800227 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700228 optional string name = 2;
229
Bookatzddccf0a2017-11-28 16:48:14 -0800230 // What lifecycle state the process changed to.
231 // This enum is specific to atoms.proto.
232 enum Event {
233 PROCESS_FINISHED = 0;
234 PROCESS_STARTED = 1;
235 PROCESS_CRASHED = 2;
236 PROCESS_ANRED = 3;
237 }
238 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700239}
240
Bookatzc1a050a2017-10-10 15:49:28 -0700241/**
242 * Logs when the ble scan state changes.
243 *
244 * Logged from:
245 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
246 */
247message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800248 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700249
250 enum State {
251 OFF = 0;
252 ON = 1;
253 }
254 optional State state = 2;
255}
256
257/**
258 * Logs when an unoptimized ble scan state changes.
259 *
260 * Logged from:
261 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
262 */
263// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
264message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800265 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700266
267 enum State {
268 OFF = 0;
269 ON = 1;
270 }
271 optional State state = 2;
272}
273
274/**
275 * Logs reporting of a ble scan finding results.
276 *
277 * Logged from:
278 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
279 */
280// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
281message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800282 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700283
284 // Number of ble scan results returned.
285 optional int32 num_of_results = 2;
286}
287
288/**
289 * Logs when a sensor state changes.
290 *
291 * Logged from:
292 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
293 */
294message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800295 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700296
297 // TODO: Is there a way to get the actual name of the sensor?
298 // The id (int) of the sensor.
299 optional int32 sensor_id = 2;
300
301 enum State {
302 OFF = 0;
303 ON = 1;
304 }
305 optional State state = 3;
306}
307
308
309/**
310 * Logs when GPS state changes.
311 *
312 * Logged from:
313 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
314 */
315message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800316 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700317
318 enum State {
319 OFF = 0;
320 ON = 1;
321 }
322 optional State state = 2;
323}
324
325
326/**
327 * Logs when a sync manager sync state changes.
328 *
329 * Logged from:
330 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
331 */
332message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800333 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700334
David Chen0b5c90c2018-01-25 16:51:49 -0800335 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700336 optional string name = 2;
337
338 enum State {
339 OFF = 0;
340 ON = 1;
341 }
342 optional State state = 3;
343}
344
345/**
346 * Logs when a job scheduler job state changes.
347 *
348 * Logged from:
349 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
350 */
351message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800352 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700353
354 // Name of the job (as named in the app)
355 optional string name = 2;
356
357 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800358 FINISHED = 0;
359 STARTED = 1;
360 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700361 }
362 optional State state = 3;
363
364 // TODO: Consider adding the stopReason (int)
365}
366
367/**
368 * Logs when the audio state changes.
369 *
370 * Logged from:
371 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
372 */
373message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800374 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700375
376 enum State {
377 OFF = 0;
378 ON = 1;
379 }
380 optional State state = 2;
381}
382
383/**
384 * Logs when the video codec state changes.
385 *
386 * Logged from:
387 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
388 */
389message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800390 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700391
392 enum State {
393 OFF = 0;
394 ON = 1;
395 }
396 optional State state = 2;
397}
398
399/**
400 * Logs when the flashlight state changes.
401 *
402 * Logged from:
403 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
404 */
405message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800406 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700407
408 enum State {
409 OFF = 0;
410 ON = 1;
411 }
412 optional State state = 2;
413}
414
415/**
416 * Logs when the camera state changes.
417 *
418 * Logged from:
419 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
420 */
421message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800422 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700423
424 enum State {
425 OFF = 0;
426 ON = 1;
427 }
428 optional State state = 2;
429}
430
431/**
432 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000433 *
434 * Logged from:
435 * TODO
436 */
Bookatzd6746242017-10-24 18:39:35 -0700437message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800438 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000439
Bookatz1a1b0462018-01-12 11:47:03 -0800440 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
441 // From frameworks/base/core/proto/android/os/enums.proto.
442 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700443
444 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
445 optional string tag = 3;
446
447 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800448 RELEASE = 0;
449 ACQUIRE = 1;
450 CHANGE_RELEASE = 2;
451 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700452 }
453 optional State state = 4;
454}
455
456/**
Bookatzc1a050a2017-10-10 15:49:28 -0700457 * Logs when a partial wakelock is considered 'long' (over 1 min).
458 *
459 * Logged from:
460 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
461 */
462message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800463 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700464
Yao Chend54f9dd2017-10-17 17:37:48 +0000465 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
466 optional string tag = 2;
467
Bookatzc1a050a2017-10-10 15:49:28 -0700468 // TODO: I have no idea what this is.
469 optional string history_tag = 3;
470
471 enum State {
472 OFF = 0;
473 ON = 1;
474 }
475 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000476}
477
Bookatzc1a050a2017-10-10 15:49:28 -0700478/**
479 * Logs Battery Saver state change.
480 *
481 * Logged from:
482 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
483 */
484message BatterySaverModeStateChanged {
485 enum State {
486 OFF = 0;
487 ON = 1;
488 }
489 optional State state = 1;
490}
491
492/**
493 * Logs Doze mode state change.
494 *
495 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800496 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700497 */
498message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800499 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800500}
501
502
503/**
504 * Logs state change of Doze mode including maintenance windows.
505 *
506 * Logged from:
507 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
508 */
509message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800510 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700511}
512
513/**
514 * Logs screen brightness level.
515 *
516 * Logged from:
517 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
518 */
519message ScreenBrightnessChanged {
520 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
521 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700522}
523
524/**
525 * Logs battery level (percent full, from 0 to 100).
526 *
527 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700528 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700529 */
530message BatteryLevelChanged {
531 // Battery level. Should be in [0, 100].
532 optional int32 battery_level = 1;
533}
534
535/**
536 * Logs change in charging status of the device.
537 *
538 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700539 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700540 */
541message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800542 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
543 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700544}
545
546/**
547 * Logs whether the device is plugged in, and what power source it is using.
548 *
549 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700550 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700551 */
552message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800553 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
554 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700555}
556
Bookatz8c6571b2017-10-24 15:04:41 -0700557// TODO: Define this more precisely.
558// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
559/**
560 * Logs when the device turns off or on.
561 *
562 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700563 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700564 */
565message DeviceOnStatusChanged {
566 enum State {
567 OFF = 0;
568 ON = 1;
569 }
570 optional State state = 1;
571}
572
573/**
574 * Logs when an app's wakeup alarm fires.
575 *
576 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700577 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700578 */
579message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800580 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800581
582 // Name of the wakeup alarm.
583 optional string tag = 2;
584}
585
586/**
587 * Logs when an an app causes the mobile radio to change state.
588 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
589 *
590 * Logged from:
591 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
592 */
593message MobileRadioPowerStateChanged {
594 // TODO: Add attribution instead of uid?
Yao Chenc40a19d2018-03-15 16:48:25 -0700595 optional int32 uid = 1 [(is_uid) = true];
Bookatzddccf0a2017-11-28 16:48:14 -0800596
Bookatz1a1b0462018-01-12 11:47:03 -0800597 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
598 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800599}
600
601/**
602 * Logs when an an app causes the wifi radio to change state.
603 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
604 *
605 * Logged from:
606 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
607 */
608message WifiRadioPowerStateChanged {
609 // TODO: Add attribution instead of uid?
Yao Chenc40a19d2018-03-15 16:48:25 -0700610 optional int32 uid = 1 [(is_uid) = true];
Bookatzddccf0a2017-11-28 16:48:14 -0800611
Bookatz1a1b0462018-01-12 11:47:03 -0800612 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
613 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700614}
615
616/**
617 * Logs kernel wakeup reasons and aborts.
618 *
619 * Logged from:
620 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
621 */
622message KernelWakeupReported {
623 // Name of the kernel wakeup reason (or abort).
624 optional string wakeup_reason_name = 1;
625
626 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800627 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700628}
629
630/**
631 * Logs wifi locks held by an app.
632 *
633 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700634 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700635 */
636message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800637 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700638
639 enum State {
640 OFF = 0;
641 ON = 1;
642 }
643 optional State state = 2;
644}
645
646/**
647 * Logs wifi signal strength changes.
648 *
649 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700650 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700651 */
652message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800653 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
654 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700655}
656
657/**
658 * Logs wifi scans performed by an app.
659 *
660 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700661 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700662 */
663message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800664 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700665
666 enum State {
667 OFF = 0;
668 ON = 1;
669 }
670 optional State state = 2;
671}
672
673/**
Tej Singh4503e102018-01-04 14:35:01 -0800674 * Logs wifi multicast locks held by an app
675 *
676 * Logged from:
677 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
678 */
679message WifiMulticastLockStateChanged {
680 repeated AttributionNode attribution_node = 1;
681
682 enum State {
683 OFF = 0;
684 ON = 1;
685 }
686 optional State state = 2;
687}
688
689/**
Tej Singh1ea42892018-01-19 09:27:00 -0800690 * Logs shutdown reason and duration on next boot.
691 *
692 * Logged from:
693 * frameworks/base/core/java/com/android/server/BootReceiver.java
694 */
695message ShutdownSequenceReported {
696 // True if shutdown is for a reboot. Default: false if we do not know.
697 optional bool reboot = 1;
698
699 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
700 optional string reason = 2;
701
702 // Beginning of shutdown time in ms using wall clock time since unix epoch.
703 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800704 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800705
706 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800707 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800708}
709
Tej Singh6483ea42018-01-25 17:45:49 -0800710
711/**
712 * Logs boot reason and duration.
713 *
714 * Logged from:
715 * system/core/bootstat/bootstat.cpp
716 */
717message BootSequenceReported {
718 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
719 // Default: "<EMPTY>" if not available.
720 optional string bootloader_reason = 1;
721
722 // Reason for system boot. Eg. bootloader, reboot,userrequested
723 // Default: "<EMPTY>" if not available.
724 optional string system_reason = 2;
725
726 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800727 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800728
729 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800730 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800731
732 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800733 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800734
735 // Time since last boot in ms. Default: 0 if not available.
736 optional int64 time_since_last_boot = 6;
737}
738
Tej Singhc477d9c2018-02-05 18:31:39 -0800739
740/**
741 * Logs call state and disconnect cause (if applicable).
742 *
743 * Logged from:
744 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
745 */
746message CallStateChanged {
747 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
748 // From frameworks/base/core/proto/android/telecomm/enums.proto.
749 optional android.telecom.CallStateEnum call_state = 1;
750
751 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
752 // This value is only applicable when the call_state is DISCONNECTED, and
753 // should always be UNKNOWN if the call_state is not DISCONNECTED.
754 // From frameworks/base/core/proto/android/telecomm/enums.proto.
755 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
756
757 // True if the call is self-managed, which are apps that use the
758 // telecom infrastructure to make their own calls.
759 optional bool self_managed = 3;
760
761 // True if call is external. External calls are calls on connected Wear
762 // devices but show up in Telecom so the user can pull them onto the device.
763 optional bool external_call = 4;
764}
765
Tej Singh1ea42892018-01-19 09:27:00 -0800766/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800767 * Logs keyguard state. The keyguard is the lock screen.
768 *
769 * Logged from:
770 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
771 */
772message KeyguardStateChanged {
773 enum State {
774 UNKNOWN = 0;
775 // The keyguard is hidden when the phone is unlocked.
776 HIDDEN = 1;
777 // The keyguard is shown when the phone is locked (screen turns off).
778 SHOWN= 2;
779 // The keyguard is occluded when something is overlaying the keyguard.
780 // Eg. Opening the camera while on the lock screen.
781 OCCLUDED = 3;
782 }
783 optional State state = 1;
784}
785
786/**
787 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
788 * prompts the user to enter a password (pattern, pin, etc).
789 *
790 * Logged from:
791 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
792 */
793
794message KeyguardBouncerStateChanged {
795 enum State {
796 UNKNOWN = 0;
797 // Bouncer is hidden, either as a result of successfully entering the
798 // password, screen timing out, or user going back to lock screen.
799 HIDDEN = 1;
800 // This is when the user is being prompted to enter the password.
801 SHOWN = 2;
802 }
803 optional State state = 1;
804}
805
806/**
807 * Logs the result of entering a password into the keyguard bouncer.
808 *
809 * Logged from:
810 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
811 */
812message KeyguardBouncerPasswordEntered {
813 enum BouncerResult {
814 UNKNOWN = 0;
815 // The password entered was incorrect.
816 FAILURE = 1;
817 // The password entered was correct.
818 SUCCESS = 2;
819 }
820 optional BouncerResult result = 1;
821}
822
Tej Singha883b372018-02-15 11:30:01 -0800823/*
824 * Logs changes to the configuration of the device. The configuration is defined
825 * in frameworks/base/core/java/android/content/res/Configuration.java
826 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
827 * Please go there to interpret the possible values each field can be.
828 *
829 * Logged from:
830 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
831 */
832message ResourceConfigurationChanged {
833 // Bit mask of color capabilities of the screen.
834 // Contains information about the color gamut and hdr mode of the screen.
835 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
836 optional int32 colorMode = 1;
837
838 // The target screen density being rendered to.
839 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
840 optional int32 densityDpi = 2;
841
842 // Current user preference for the scaling factor for fonts,
843 // relative to the base density scaling.
844 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
845 optional float fontScale = 3;
846
847 // Flag indicating whether the hard keyboard is hidden.
848 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
849 optional int32 hardKeyboardHidden = 4;
850
851 // The type of keyboard attached to the device.
852 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
853 optional int32 keyboard = 5;
854
855 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
856 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
857 optional int32 keyboardHideen = 6;
858
859 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
860 // 0 if undefined.
861 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
862 optional int32 mcc = 7;
863
864 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
865 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
866 // MNC_ZERO symbol defined in Configuration.java.
867 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
868 optional int32 mnc = 8;
869
870 // The kind of navigation available on the device.
871 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
872 optional int32 navigation = 9;
873
874 // Flag indicating whether the navigation is available.
875 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
876 optional int32 navigationHidden = 10;
877
878 // Overall orientation of the screen.
879 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
880 optional int32 orientation = 11;
881
882 // The current height of the available screen space, in dp units.
883 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
884 optional int32 screenHeightDp = 12;
885
886 // Bit mask of overall layout of the screen.
887 // Contains information about screen size, whether the screen is wider/taller
888 // than normal, whether the screen layout is right-tl-left or left-to-right,
889 // and whether the screen has a rounded shape.
890 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
891 optional int32 screenLayout = 13;
892
893 // Current width of the available screen space, in dp units.
894 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
895 optional int32 screenWidthDp = 14;
896
897 // The smallest screen size an application will see in normal operation.
898 // This is the smallest value of both screenWidthDp and screenHeightDp
899 // in portrait and landscape.
900 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
901 optional int32 smallestScreenWidthDp = 15;
902
903 // The type of touch screen attached to the device.
904 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
905 optional int32 touchscreen = 16;
906
907 // Bit mask of the ui mode.
908 // Contains information about the overall ui mode of the device.
909 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
910 // Also contains information about whether the device is in night mode.
911 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
912 optional int32 uiMode = 17;
913}
914
Tej Singhdd7bd352018-02-09 19:33:15 -0800915/**
Tej Singh5d991e12018-03-09 19:48:11 -0800916 * Logs when Bluetooth is enabled and disabled.
917 *
918 * Logged from:
919 * services/core/java/com/android/server/BluetoothManagerService.java
920 */
921message BluetoothEnabledStateChanged {
922 repeated AttributionNode attribution_node = 1;
923 // Whether or not bluetooth is enabled on the device.
924 enum State {
925 UNKNOWN = 0;
926 ENABLED = 1;
927 DISABLED = 2;
928 }
929 optional State state = 2;
930 // The reason for being enabled/disabled.
931 // Eg. Airplane mode, crash, application request.
932 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
933 // If the reason is an application request, this will be the package name.
934 optional string pkgName = 4;
935}
936
937/**
938 * Logs when a Bluetooth device connects and disconnects.
939 *
940 * Logged from:
941 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
942 */
943message BluetoothConnectionStateChanged {
944 // The state of the connection.
945 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
946 optional android.bluetooth.ConnectionStateEnum state = 1;
947 // An identifier that can be used to match connect and disconnect events.
948 // Currently is last two bytes of a hash of a device level ID and
949 // the mac address of the bluetooth device that is connected.
950 optional int32 obfuscated_id = 2;
951 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
952 // From android.bluetooth.BluetoothAdapter.java
953 optional int32 bt_profile = 3;
954}
955
956/**
957 * Logs when Bluetooth A2dp audio streaming state changes.
958 *
959 * Logged from:
960 * TODO(b/73971848)
961 */
962message BluetoothA2dpAudioStateChanged {
963 // Whether or not audio is being played using Bluetooth A2dp.
964 enum State {
965 UNKNOWN = 0;
966 PLAY = 1;
967 STOP = 2;
968 }
969 optional State state = 1;
970}
971
972/**
Andrew Chant28d627e2018-02-22 15:17:05 -0800973 * Logs when something is plugged into or removed from the USB-C connector.
974 *
975 * Logged from:
976 * Vendor USB HAL.
977 */
978message UsbConnectorStateChanged {
979 enum State {
980 DISCONNECTED = 0;
981 CONNECTED = 1;
982 }
983 optional State state = 1;
984}
985
986/**
987 * Logs the reported speaker impedance.
988 *
989 * Logged from:
990 * Vendor audio implementation.
991 */
992message SpeakerImpedanceReported {
993 optional int32 speaker_location = 1;
994 optional int32 impedance = 2;
995}
996
997/**
998 * Logs the report of a failed hardware.
999 *
1000 * Logged from:
1001 * Vendor HALs.
1002 *
1003 */
1004message HardwareFailed {
1005 enum HardwareType {
1006 HARDWARE_FAILED_UNKNOWN = 0;
1007 HARDWARE_FAILED_MICROPHONE = 1;
1008 HARDWARE_FAILED_CODEC = 2;
1009 HARDWARE_FAILED_SPEAKER = 3;
1010 HARDWARE_FAILED_FINGERPRINT = 4;
1011 }
1012 optional HardwareType hardware_type = 1;
1013
1014 /* hardware_location allows vendors to differentiate between multiple instances of
1015 * the same hardware_type. The specific locations are vendor defined integers,
1016 * referring to board-specific numbering schemes.
1017 */
1018 optional int32 hardware_location = 2;
1019
1020 /* failure_code is specific to the HardwareType of the failed hardware.
1021 * It should use the enum values defined below.
1022 */
1023 enum MicrophoneFailureCode {
1024 MICROPHONE_FAILURE_COMPLETE = 0;
1025 }
1026 enum CodecFailureCode {
1027 CODEC_FAILURE_COMPLETE = 0;
1028 }
1029 enum SpeakerFailureCode {
1030 SPEAKER_FAILURE_COMPLETE = 0;
1031 SPEAKER_FAILURE_HIGH_Z = 1;
1032 SPEAKER_FAILURE_SHORT = 2;
1033 }
1034 enum FingerprintFailureCode {
1035 FINGERPRINT_FAILURE_COMPLETE = 0;
1036 FINGERPRINT_SENSOR_BROKEN = 1;
1037 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1038 }
1039 optional int32 failure_code = 3;
1040}
1041
1042/**
1043 * Log an event when the device has been physically dropped.
1044 * Reported from the /vendor partition.
1045 */
1046message PhysicalDropDetected {
1047 // Confidence that the event was actually a drop, 0 -> 100
1048 optional int32 confidence_pctg = 1;
1049 // Peak acceleration of the drop, in 1/1000s of a g.
1050 optional int32 accel_peak_thousandths_g = 2;
1051}
1052
1053/**
1054 * Log bucketed battery charge cycles.
1055 *
1056 * Each bucket represents cycles of the battery past
1057 * a given charge point. For example, bucket 1 is the
1058 * lowest 1/8th of the battery, and bucket 8 is 100%.
1059 *
1060 * Logged from:
1061 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1062 */
1063message ChargeCyclesReported {
1064 optional int32 cycle_bucket_1 = 1;
1065 optional int32 cycle_bucket_2 = 2;
1066 optional int32 cycle_bucket_3 = 3;
1067 optional int32 cycle_bucket_4 = 4;
1068 optional int32 cycle_bucket_5 = 5;
1069 optional int32 cycle_bucket_6 = 6;
1070 optional int32 cycle_bucket_7 = 7;
1071 optional int32 cycle_bucket_8 = 8;
1072}
1073
1074/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001075 * Logs the duration of a davey (jank of >=700ms) when it occurs
1076 *
1077 * Logged from:
1078 * frameworks/base/libs/hwui/JankTracker.cpp
1079 */
1080message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001081 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001082 optional int32 uid = 1 [(is_uid) = true];
1083 ;
David Chen77ef6712018-02-23 18:23:42 -08001084
Tej Singhbb8554a2018-01-26 11:59:14 -08001085 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001086 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001087}
1088
1089/**
Bookatze5885242017-10-24 20:10:31 -07001090 * Logs phone signal strength changes.
1091 *
1092 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001093 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001094 */
1095message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001096 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1097 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001098}
1099
1100/**
1101 * Logs that a setting was updated.
1102 * Logged from:
1103 * frameworks/base/core/java/android/provider/Settings.java
1104 * The tag and is_default allow resetting of settings to default values based on the specified
1105 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1106 */
1107message SettingChanged {
1108 // The name of the setting.
1109 optional string setting = 1;
1110
1111 // The change being imposed on this setting. May represent a number, eg "3".
1112 optional string value = 2;
1113
1114 // The new value of this setting. For most settings, this is same as value. For some settings,
1115 // value is +X or -X where X represents an element in a set. For example, if the previous value
1116 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1117 // The +/- feature is currently only used for location_providers_allowed.
1118 optional string new_value = 3;
1119
1120 // The previous value of this setting.
1121 optional string prev_value = 4;
1122
1123 // The tag used with the is_default for resetting sets of settings. This is generally null.
1124 optional string tag = 5;
1125
Bookatz90867622018-01-31 15:05:57 -08001126 // True if this setting with tag should be resettable.
1127 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001128
1129 // The user ID associated. Defined in android/os/UserHandle.java
1130 optional int32 user = 7;
1131}
Chenjie Yub3dda412017-10-24 13:41:59 -07001132
Chenjie Yu05013b32017-11-21 10:21:41 -08001133/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001134 * Logs activity going to foreground or background
1135 *
1136 * Logged from:
1137 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1138 */
1139message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001140 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001141 optional string pkg_name = 2;
1142 optional string class_name = 3;
1143
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001144 enum Activity {
1145 MOVE_TO_BACKGROUND = 0;
1146 MOVE_TO_FOREGROUND = 1;
1147 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001148 optional Activity activity = 4;
1149}
David Chenc8a43242017-10-17 16:23:28 -07001150
1151/**
David Chen9e3808c2017-11-20 17:25:34 -08001152 * Logs when an error is written to dropbox.
1153 * Logged from:
1154 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1155 */
1156message DropboxErrorChanged {
1157 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001158 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001159
1160 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
1161 optional string tag = 2;
1162
1163 // The name of the process.
1164 optional string process_name = 3;
1165
1166 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001167 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -08001168
1169 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -08001170 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -08001171
1172 // The activity name if available.
1173 optional string activity_name = 6;
1174
David Chen6e3e6cb2018-01-03 16:14:06 -08001175 // The package name if available.
1176 optional string package_name = 7;
1177
David Chen9e3808c2017-11-20 17:25:34 -08001178 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001179 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001180}
1181
David Chen0a368b22017-12-06 16:28:16 -08001182/*
1183 * Allows other apps to push events into statsd.
1184 * Logged from:
1185 * frameworks/base/core/java/android/util/StatsLog.java
1186 */
David Chen0b5c90c2018-01-25 16:51:49 -08001187message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001188 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001189 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001190
1191 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1192 optional int32 label = 2;
1193
1194 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1195 // predicates for the metrics).
1196 enum State {
1197 UNKNOWN = 0;
1198 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1199 STOP = 2;
1200 START = 3;
1201 }
1202 optional State state = 3;
1203}
1204
David Chen9e3808c2017-11-20 17:25:34 -08001205/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001206 * Logs when statsd detects an anomaly.
1207 *
1208 * Logged from:
1209 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1210 */
1211message AnomalyDetected {
1212 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001213 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001214
Yangster-mac94e197c2018-01-02 16:03:03 -08001215 // Id of the config whose anomaly detection alert fired.
1216 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001217
Yangster-mac94e197c2018-01-02 16:03:03 -08001218 // Id of the alert (i.e. name of the anomaly that was detected).
1219 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001220}
1221
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001222message AppStartChanged {
1223 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001224 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001225
1226 // The app package name.
1227 optional string pkg_name = 2;
1228
1229 enum TransitionType {
1230 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1231 WARM = 1;
1232 HOT = 2;
1233 COLD = 3;
1234 }
1235 // The transition type.
1236 optional TransitionType type = 3;
1237
1238 // The activity name.
1239 optional string activity_name = 4;
1240
1241 // The name of the calling app. Empty if not set.
1242 optional string calling_pkg_name = 5;
1243
1244 // Whether the app is an instant app.
1245 optional bool is_instant_app = 6;
1246
1247 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001248 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001249
Bookatz80d11a02018-01-16 10:46:35 -08001250 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001251
David Chen0b5c90c2018-01-25 16:51:49 -08001252 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001253 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001254 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001255 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001256 optional int32 bind_application_delay_millis = 11;
1257 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001258
1259 // Empty if not set.
1260 optional string launch_token = 13;
1261
Calin Juravle759fbda2018-02-20 19:52:30 +00001262 // The compiler filter used when when the package was optimized.
1263 optional string package_optimization_compilation_filter = 14;
1264
1265 // The reason why the package was optimized.
1266 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001267}
1268
1269message AppStartCancelChanged {
1270 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001271 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001272
1273 // The app package name.
1274 optional string pkg_name = 2;
1275
1276 enum TransitionType {
1277 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1278 WARM = 1;
1279 HOT = 2;
1280 COLD = 3;
1281 }
1282 // The transition type.
1283 optional TransitionType type = 3;
1284
1285 // The activity name.
1286 optional string activity_name = 4;
1287}
1288
1289message AppStartFullyDrawnChanged {
1290 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001291 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001292
1293 // The app package name.
1294 optional string pkg_name = 2;
1295
1296 enum TransitionType {
1297 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1298 WITH_BUNDLE = 1;
1299 WITHOUT_BUNDLE = 2;
1300 }
1301 // The transition type.
1302 optional TransitionType type = 3;
1303
1304 // The activity name.
1305 optional string activity_name = 4;
1306
1307 optional bool transition_process_running = 5;
1308
1309 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001310 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001311}
1312
Bookatz8fcd09a2017-12-18 13:01:10 -08001313/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001314 * Logs a picture-in-picture action
1315 * Logged from:
1316 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1317 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1318 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1319 */
1320message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001321 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001322 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001323
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001324 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001325
Chenjie Yu52cacc62017-12-08 18:11:45 -08001326 enum State {
1327 ENTERED = 1;
1328 EXPANDED_TO_FULL_SCREEN = 2;
1329 MINIMIZED = 3;
1330 DISMISSED = 4;
1331 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001332 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001333}
1334
1335/**
Chenjie Yue8904192017-12-08 19:12:57 -08001336 * Logs overlay action
1337 * Logged from:
1338 * services/core/java/com/android/server/wm/Session.java
1339 */
1340message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001341 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001342
1343 optional string package_name = 2;
1344
1345 optional bool using_alert_window = 3;
1346
1347 enum State {
1348 ENTERED = 1;
1349 EXITED = 2;
1350 }
1351 optional State state = 4;
1352}
1353
Chenjie Yuccfe6452018-01-30 11:33:21 -08001354/*
1355 * Logs foreground service starts and stops.
1356 * Note that this is not when a service starts or stops, but when it is
1357 * considered foreground.
1358 * Logged from
1359 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1360 */
1361message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001362 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001363 // package_name + "/" + class_name
1364 optional string short_name = 2;
1365
1366 enum State {
1367 ENTER = 1;
1368 EXIT = 2;
1369 }
1370 optional State state = 3;
1371}
1372
Chenjie Yue8904192017-12-08 19:12:57 -08001373/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001374 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1375 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1376 * attributed back to the parent (host) uid. One example is Chrome.
1377 *
1378 * Logged from:
1379 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1380 */
1381message IsolatedUidChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001382 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001383 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1384 optional int32 parent_uid = 1;
1385
1386 optional int32 isolated_uid = 2;
1387
1388 // We expect an isolated uid to be removed before if it's used for another parent uid.
1389 enum Event {
1390 REMOVED = 0;
1391 CREATED = 1;
1392 }
1393 optional Event event = 3;
1394}
1395
1396/*
1397 * Logs the reception of an incoming network packet causing the main system to wake up for
1398 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1399 * and processed by WakeupController.cpp.
1400 */
1401message PacketWakeupOccurred {
1402 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1403 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001404 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001405 // The interface name on which the packet was received.
1406 optional string iface = 2;
1407 // The ethertype value of the packet.
1408 optional int32 ethertype = 3;
1409 // String representation of the destination MAC address of the packet.
1410 optional string destination_hardware_address = 4;
1411 // String representation of the source address of the packet if this was an IP packet.
1412 optional string source_ip = 5;
1413 // String representation of the destination address of the packet if this was an IP packet.
1414 optional string destination_ip = 6;
1415 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1416 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1417 // families.
1418 optional int32 ip_next_header = 7;
1419 // The source port if this was a TCP or UDP packet.
1420 optional int32 source_port = 8;
1421 // The destination port if this was a TCP or UDP packet.
1422 optional int32 destination_port = 9;
1423}
1424
1425/*
1426 * Logs the memory stats for an app on startup.
1427 * Logged from:
1428 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1429 */
1430message AppStartMemoryStateCaptured {
1431 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001432 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001433
1434 // The process name.
1435 optional string process_name = 2;
1436
1437 // The activity name.
1438 optional string activity_name = 3;
1439
1440 // # of page-faults
1441 optional int64 pgfault = 4;
1442
1443 // # of major page-faults
1444 optional int64 pgmajfault = 5;
1445
1446 // RSS
1447 optional int64 rss_in_bytes = 6;
1448
1449 // CACHE
1450 optional int64 cache_in_bytes = 7;
1451
1452 // SWAP
1453 optional int64 swap_in_bytes = 8;
1454}
1455
1456/*
1457 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1458 * for LMK event.
1459 * Logged from:
1460 * system/core/lmkd/lmkd.c
1461 */
1462message LmkStateChanged {
1463 enum State {
1464 UNKNOWN = 0;
1465 START = 1;
1466 STOP = 2;
1467 }
1468 optional State state = 1;
1469}
1470
1471/*
1472 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1473 * Logged from:
1474 * system/core/lmkd/lmkd.c
1475 */
1476message LmkKillOccurred {
1477 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001478 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001479
1480 // The process name.
1481 optional string process_name = 2;
1482
1483 // oom adj score.
1484 optional int32 oom_score = 3;
1485
1486 // # of page-faults
1487 optional int64 pgfault = 4;
1488
1489 // # of major page-faults
1490 optional int64 pgmajfault = 5;
1491
1492 // RSS
1493 optional int64 rss_in_bytes = 6;
1494
1495 // CACHE
1496 optional int64 cache_in_bytes = 7;
1497
1498 // SWAP
1499 optional int64 swap_in_bytes = 8;
1500}
1501
Rajeev Kumar51b54602018-03-01 12:18:26 -08001502/*
1503 * Logs when the ActivityManagerService detects that an app died.
1504 *
1505 * Logged from:
1506 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1507 */
1508message AppDied {
1509 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001510 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001511}
1512
Chenjie Yubbcbc602018-02-05 16:51:52 -08001513//////////////////////////////////////////////////////////////////////
1514// Pulled atoms below this line //
1515//////////////////////////////////////////////////////////////////////
1516
1517/**
David Chenc8a43242017-10-17 16:23:28 -07001518 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1519 *
1520 * Pulled from:
1521 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1522 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001523message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001524 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001525
1526 optional int64 rx_bytes = 2;
1527
1528 optional int64 rx_packets = 3;
1529
1530 optional int64 tx_bytes = 4;
1531
1532 optional int64 tx_packets = 5;
1533}
1534
1535/**
1536 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1537 *
1538 * Pulled from:
1539 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1540 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001541message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001542 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001543
Yao Chenc40a19d2018-03-15 16:48:25 -07001544 // 1 denotes foreground and 0 denotes background. This is called Set in
1545 // NetworkStats.
David Chenc8a43242017-10-17 16:23:28 -07001546 optional int32 is_foreground = 2;
1547
1548 optional int64 rx_bytes = 3;
1549
1550 optional int64 rx_packets = 4;
1551
1552 optional int64 tx_bytes = 5;
1553
1554 optional int64 tx_packets = 6;
1555}
1556
1557/**
1558 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1559 *
1560 * Pulled from:
1561 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1562 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001563message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001564 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001565
1566 optional int64 rx_bytes = 2;
1567
1568 optional int64 rx_packets = 3;
1569
1570 optional int64 tx_bytes = 4;
1571
1572 optional int64 tx_packets = 5;
1573}
1574
1575/**
1576 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1577 *
1578 * Pulled from:
1579 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1580 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001581message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001582 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001583
Yao Chenc40a19d2018-03-15 16:48:25 -07001584 // 1 denotes foreground and 0 denotes background. This is called Set in
1585 // NetworkStats.
David Chenc8a43242017-10-17 16:23:28 -07001586 optional int32 is_foreground = 2;
1587
1588 optional int64 rx_bytes = 3;
1589
1590 optional int64 rx_packets = 4;
1591
1592 optional int64 tx_bytes = 5;
1593
1594 optional int64 tx_packets = 6;
1595}
1596
1597/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001598 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1599 *
1600 * Pulled from:
1601 * StatsCompanionService
1602 */
1603message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001604 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001605
1606 optional int64 rx_bytes = 2;
1607
1608 optional int64 tx_bytes = 3;
1609}
1610
1611/**
David Chenc8a43242017-10-17 16:23:28 -07001612 * Pulls the kernel wakelock durations. This atom is adapted from
1613 * android/internal/os/KernelWakelockStats.java
1614 *
1615 * Pulled from:
1616 * StatsCompanionService using KernelWakelockReader.
1617 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001618message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001619 optional string name = 1;
1620
1621 optional int32 count = 2;
1622
1623 optional int32 version = 3;
1624
1625 optional int64 time = 4;
1626}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001627
Chenjie Yu05013b32017-11-21 10:21:41 -08001628/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001629 * Pulls low power state information. This includes platform and subsystem sleep state information,
1630 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001631 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001632 * hardware/interfaces/power/1.1/types.hal
1633 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001634message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001635 // Subsystem name
1636 optional string subsystem_name = 1;
1637 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1638 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1639 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001640 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001641 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001642 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001643 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001644}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001645
Chenjie Yu05013b32017-11-21 10:21:41 -08001646/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001647 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001648 * Pulls the time the cpu spend on the frequency index. Frequency index
1649 * starts from highest to lowest. The value should be monotonically
1650 * increasing since boot. However, if there is a cpu
1651 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001652 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001653message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001654 optional uint32 cluster = 1;
1655 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001656 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001657}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001658
Chenjie Yu05013b32017-11-21 10:21:41 -08001659/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001660 * Pulls Cpu Time Per Uid.
1661 * Note that isolated process uid time should be attributed to host uids.
1662 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001663message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001664 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001665 optional uint64 user_time_millis = 2;
1666 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001667}
1668
1669/**
1670 * Pulls Cpu Time Per Uid per frequency.
1671 * Note that isolated process uid time should be attributed to host uids.
1672 * For each uid, we order the time by descending frequencies.
1673 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001674message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001675 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001676 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001677 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001678}
Hugo Benichi884970e2017-11-14 22:42:46 +09001679
Chenjie Yu05013b32017-11-21 10:21:41 -08001680/**
1681 * Pulls Wifi Controller Activity Energy Info
1682 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001683message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001684 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001685 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001686 // stack reported state
1687 // TODO: replace this with proto enum
1688 optional int32 stack_state = 2;
1689 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001690 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001691 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001692 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001693 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001694 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001695 // product of current(mA), voltage(V) and time(ms)
1696 optional uint64 controller_energy_used = 6;
1697}
1698
1699/**
1700 * Pulls Modem Activity Energy Info
1701 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001702message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001703 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001704 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001705 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001706 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001707 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001708 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001709 /**
1710 * Tx power index
1711 * index 0 = tx_power < 0dBm
1712 * index 1 = 0dBm < tx_power < 5dBm
1713 * index 2 = 5dBm < tx_power < 15dBm
1714 * index 3 = 15dBm < tx_power < 20dBm
1715 * index 4 = tx_power > 20dBm
1716 */
1717 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001718 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001719 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001720 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001721 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001722 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001723 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001724 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001725 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001726 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001727 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001728 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001729 // product of current(mA), voltage(V) and time(ms)
1730 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001731}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001732
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001733/**
1734 * Pulls Bluetooth Activity Energy Info
1735 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1736 */
1737message BluetoothActivityInfo {
1738 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001739 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001740 // bluetooth stack state
1741 optional int32 bluetooth_stack_state = 2;
1742 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001743 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001744 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001745 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001746 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001747 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001748 // product of current(mA), voltage(V) and time(ms)
1749 optional uint64 energy_used = 6;
1750}
1751
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001752/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001753 * Logs the memory stats for a process.
1754 */
1755message ProcessMemoryState {
1756 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001757 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001758
1759 // The process name.
1760 optional string process_name = 2;
1761
1762 // oom adj score.
1763 optional int32 oom_score = 3;
1764
1765 // # of page-faults
1766 optional int64 pgfault = 4;
1767
1768 // # of major page-faults
1769 optional int64 pgmajfault = 5;
1770
Rajeev Kumar90235992018-01-29 11:06:48 -08001771 // RSS
1772 optional int64 rss_in_bytes = 6;
1773
1774 // CACHE
1775 optional int64 cache_in_bytes = 7;
1776
1777 // SWAP
1778 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001779}
1780
1781/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001782 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001783 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001784message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001785 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001786}
1787
1788/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001789 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001790 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001791message SystemUptime {
1792 // Milliseconds since the system was booted.
1793 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1794 // for external input).
1795 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001796 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001797}
1798
1799/*
1800 * Reads from /proc/uid_concurrent_active_time which has the format:
1801 * active: X (X is # cores)
1802 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1803 * [uid1]: [time-0] [time-1] [time-2] ... ...
1804 * ...
1805 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1806 * The file contains a monotonically increasing count of time for a single boot.
1807 */
1808message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001809 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001810 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001811}
1812
1813/**
1814 * Reads from /proc/uid_concurrent_policy_time which has the format:
1815 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1816 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1817 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1818 * ...
1819 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1820 * The file contains a monotonically increasing count of time for a single boot.
1821 */
1822message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001823 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001824 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001825 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001826}
1827
1828/*
1829 * Pulls free disk space, for data, system partition and temporary directory.
1830 */
1831message DiskSpace {
1832 // available bytes in data partition
1833 optional uint64 data_available_bytes = 1;
1834 // available bytes in system partition
1835 optional uint64 system_available_bytes = 2;
1836 // available bytes in download cache or temp directories
1837 optional uint64 temp_available_bytes = 3;
1838}
Tej Singhbf972d92018-01-10 20:51:13 -08001839
1840/**
1841 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001842 * Pulled from:
1843 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001844 */
1845message RemainingBatteryCapacity {
1846 optional int32 charge_uAh = 1;
1847}
1848
1849/**
1850 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001851 * Pulled from:
1852 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001853 */
1854message FullBatteryCapacity {
1855 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001856}
1857
1858/**
1859 * Pulls the temperature of various parts of the device, in Celsius.
1860 *
1861 * Pulled from:
1862 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1863 */
1864message Temperature {
1865 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1866 optional android.os.TemperatureTypeEnum sensor_location = 1;
1867
1868 // The name of the temperature source. Eg. CPU0
1869 optional string sensor_name = 2;
1870
1871 // Temperature in degrees C.
1872 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001873}