blob: 281f900d9cb94e87f030dfec0af20f2b9842f46f [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
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070025import "frameworks/base/core/proto/android/app/job/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;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080051 // 3 is available for use
Bookatzc1a050a2017-10-10 15:49:28 -070052 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;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080062 // 14 - 19 are available
Bookatzddccf0a2017-11-28 16:48:14 -080063 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;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080067 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070068 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;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080076 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070077 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
78 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070079 WifiLockStateChanged wifi_lock_state_changed = 37;
80 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
81 WifiScanStateChanged wifi_scan_state_changed = 39;
82 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070083 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070084 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070085 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090086 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080087 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080088 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080089 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080090 AppStartOccurred app_start_occurred = 48;
91 AppStartCanceled app_start_canceled = 49;
92 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080093 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080094 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080095 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080096 LmkStateChanged lmk_state_changed = 54;
97 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080098 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -080099 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800100 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800101 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800102 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800103 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800104 KeyguardStateChanged keyguard_state_changed = 62;
105 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
106 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800107 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800108 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800109 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
110 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700111 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700112 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800113 SpeakerImpedanceReported speaker_impedance_reported = 71;
114 HardwareFailed hardware_failed = 72;
115 PhysicalDropDetected physical_drop_detected = 73;
116 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800117 MobileConnectionStateChanged mobile_connection_state_changed = 75;
118 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700119 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800120 AppCrashOccurred app_crash_occurred = 78;
121 ANROccurred anr_occurred = 79;
122 WTFOccurred wtf_occurred = 80;
Yangster4ccebea2018-10-09 17:09:02 -0700123 PhoneServiceStateChanged phone_service_state_changed = 94;
124 PhoneStateChanged phone_state_changed = 95;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800125 LowMemReported low_mem_reported = 81;
126
127
Yao Chend54f9dd2017-10-17 17:37:48 +0000128 }
David Chenc8a43242017-10-17 16:23:28 -0700129
David Chen6e3e6cb2018-01-03 16:14:06 -0800130 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800131 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700132 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800133 WifiBytesTransfer wifi_bytes_transfer = 10000;
134 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
135 MobileBytesTransfer mobile_bytes_transfer = 10002;
136 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800137 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800138 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800139 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800140 CpuTimePerFreq cpu_time_per_freq = 10008;
141 CpuTimePerUid cpu_time_per_uid = 10009;
142 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800143 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800144 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800145 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800146 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800147 SystemElapsedRealtime system_elapsed_realtime = 10014;
148 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800149 CpuActiveTime cpu_active_time = 10016;
150 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800151 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800152 RemainingBatteryCapacity remaining_battery_capacity = 10019;
153 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800154 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700155 }
yroa1fe77c2018-02-26 14:22:54 -0800156
Bookatz76aafcf2018-09-17 16:17:10 -0700157 // DO NOT USE field numbers above 100,000 in AOSP.
158 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
159 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700160}
161
Yao Chend54f9dd2017-10-17 17:37:48 +0000162/**
Yangster-mac20877162017-12-22 17:19:39 -0800163 * This proto represents a node of an attribution chain.
164 * Note: All attribution chains are represented as a repeated field of type
165 * AttributionNode. It is understood that in such arrays, the order is that
166 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000167 */
Yangster-mac20877162017-12-22 17:19:39 -0800168message AttributionNode {
169 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800170 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800171
Yangster-mac20877162017-12-22 17:19:39 -0800172 // The (optional) string tag for an element in the attribution chain. If the
173 // element has no tag, it is encoded as an empty string.
174 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700175}
176
Yao Chend54f9dd2017-10-17 17:37:48 +0000177/*
178 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800179 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 *
181 * RULES:
182 * - The field ids for each atom must start at 1, and count upwards by 1.
183 * Skipping field ids is not allowed.
184 * - These form an API, so renaming, renumbering or removing fields is
185 * not allowed between android releases. (This is not currently enforced,
186 * but there will be a tool to enforce this restriction).
187 * - The types must be built-in protocol buffer types, namely, no sub-messages
188 * are allowed (yet). The bytes type is also not allowed.
189 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800190 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000191 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800192 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000193 * - A field that is a uid should be a string field, tagged with the [xxx]
194 * annotation. The generated code on android will be represented by UIDs,
195 * and those UIDs will be translated in xxx to those strings.
196 *
197 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700198 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000199 * - If there is a UID, it goes first. Think in an object-oriented fashion.
200 * *****************************************************************************
201 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700202
Yao Chend54f9dd2017-10-17 17:37:48 +0000203/**
204 * Logs when the screen state changes.
205 *
206 * Logged from:
207 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
208 */
209message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800210 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800211 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700212}
Yao Chend54f9dd2017-10-17 17:37:48 +0000213
214/**
Bookatzc1a050a2017-10-10 15:49:28 -0700215 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000216 *
217 * Logged from:
218 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
219 */
Bookatzc1a050a2017-10-10 15:49:28 -0700220message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700221 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000222
Bookatzdb026a22018-01-10 19:01:56 -0800223 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800224 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000225}
226
227/**
Bookatzc1a050a2017-10-10 15:49:28 -0700228 * Logs that a process started, finished, crashed, or ANRed.
229 *
230 * Logged from:
231 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
232 */
233message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700234 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700235
David Chen0b5c90c2018-01-25 16:51:49 -0800236 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800237 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700238
Bookatzddccf0a2017-11-28 16:48:14 -0800239 // What lifecycle state the process changed to.
240 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800241 enum State {
242 FINISHED = 0;
243 STARTED = 1;
244 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800245 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800246 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700247}
248
Bookatzc1a050a2017-10-10 15:49:28 -0700249/**
250 * Logs when the ble scan state changes.
251 *
252 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700253 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700254 */
255message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800256 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700257
258 enum State {
259 OFF = 0;
260 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700261 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
262 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700263 }
264 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700265
Bookatze5ec0b42018-03-26 13:34:56 -0700266 // Does the scan have a filter.
267 optional bool is_filtered = 3;
268 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
269 optional bool is_first_match = 4;
270 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
271 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700272}
273
274/**
275 * Logs reporting of a ble scan finding results.
276 *
277 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700278 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700279 */
Bookatzae6738e2018-09-13 11:38:56 -0700280// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700281message 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.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800285 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700286}
287
288/**
289 * Logs when a sensor state changes.
290 *
291 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700292 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700293 */
294message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800295 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700296
Bookatzc1a050a2017-10-10 15:49:28 -0700297 // The id (int) of the sensor.
298 optional int32 sensor_id = 2;
299
300 enum State {
301 OFF = 0;
302 ON = 1;
303 }
304 optional State state = 3;
305}
306
307
308/**
309 * Logs when GPS state changes.
310 *
311 * Logged from:
312 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
313 */
314message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800315 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700316
317 enum State {
318 OFF = 0;
319 ON = 1;
320 }
321 optional State state = 2;
322}
323
324
325/**
326 * Logs when a sync manager sync state changes.
327 *
328 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700329 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700330 */
331message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800332 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700333
David Chen0b5c90c2018-01-25 16:51:49 -0800334 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800335 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700336
337 enum State {
338 OFF = 0;
339 ON = 1;
340 }
341 optional State state = 3;
342}
343
344/**
345 * Logs when a job scheduler job state changes.
346 *
347 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700348 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700349 */
350message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800351 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700352
353 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800354 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700355
356 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800357 FINISHED = 0;
358 STARTED = 1;
359 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700360 }
361 optional State state = 3;
362
Tej Singh33a412b2018-03-16 18:43:59 -0700363 // The reason a job has stopped.
364 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700365 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700366 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700367}
368
369/**
370 * Logs when the audio state changes.
371 *
372 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700373 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700374 */
375message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800376 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700377
378 enum State {
379 OFF = 0;
380 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700381 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
382 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700383 }
384 optional State state = 2;
385}
386
387/**
388 * Logs when the video codec state changes.
389 *
390 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700391 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700392 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800393message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800394 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700395
396 enum State {
397 OFF = 0;
398 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700399 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
400 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700401 }
402 optional State state = 2;
403}
404
405/**
406 * Logs when the flashlight state changes.
407 *
408 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700409 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700410 */
411message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800412 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700413
414 enum State {
415 OFF = 0;
416 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700417 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
418 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700419 }
420 optional State state = 2;
421}
422
423/**
424 * Logs when the camera state changes.
425 *
426 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700427 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700428 */
429message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800430 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700431
432 enum State {
433 OFF = 0;
434 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700435 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
436 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700437 }
438 optional State state = 2;
439}
440
441/**
442 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000443 *
444 * Logged from:
445 * TODO
446 */
Bookatzd6746242017-10-24 18:39:35 -0700447message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800448 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000449
Bookatz1a1b0462018-01-12 11:47:03 -0800450 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
451 // From frameworks/base/core/proto/android/os/enums.proto.
452 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700453
454 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
455 optional string tag = 3;
456
457 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800458 RELEASE = 0;
459 ACQUIRE = 1;
460 CHANGE_RELEASE = 2;
461 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700462 }
463 optional State state = 4;
464}
465
466/**
Bookatzc1a050a2017-10-10 15:49:28 -0700467 * Logs when a partial wakelock is considered 'long' (over 1 min).
468 *
469 * Logged from:
470 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
471 */
472message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800473 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700474
Yao Chend54f9dd2017-10-17 17:37:48 +0000475 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
476 optional string tag = 2;
477
Bookatzc1a050a2017-10-10 15:49:28 -0700478 // TODO: I have no idea what this is.
479 optional string history_tag = 3;
480
481 enum State {
482 OFF = 0;
483 ON = 1;
484 }
485 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000486}
487
Bookatzc1a050a2017-10-10 15:49:28 -0700488/**
489 * Logs Battery Saver state change.
490 *
491 * Logged from:
492 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
493 */
494message BatterySaverModeStateChanged {
495 enum State {
496 OFF = 0;
497 ON = 1;
498 }
499 optional State state = 1;
500}
501
502/**
503 * Logs Doze mode state change.
504 *
505 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800506 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700507 */
508message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800509 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800510}
511
512
513/**
514 * Logs state change of Doze mode including maintenance windows.
515 *
516 * Logged from:
517 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
518 */
519message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800520 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700521}
522
523/**
524 * Logs screen brightness level.
525 *
526 * Logged from:
527 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
528 */
529message ScreenBrightnessChanged {
530 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
531 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700532}
533
534/**
535 * Logs battery level (percent full, from 0 to 100).
536 *
537 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700538 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700539 */
540message BatteryLevelChanged {
541 // Battery level. Should be in [0, 100].
542 optional int32 battery_level = 1;
543}
544
545/**
546 * Logs change in charging status of the device.
547 *
548 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700549 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700550 */
551message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800552 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
553 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700554}
555
556/**
557 * Logs whether the device is plugged in, and what power source it is using.
558 *
559 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700560 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700561 */
562message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800563 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
564 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700565}
566
Bookatz8c6571b2017-10-24 15:04:41 -0700567/**
568 * Logs when an app's wakeup alarm fires.
569 *
570 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700571 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700572 */
573message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800574 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800575
576 // Name of the wakeup alarm.
577 optional string tag = 2;
578}
579
580/**
581 * Logs when an an app causes the mobile radio to change state.
582 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
583 *
584 * Logged from:
585 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
586 */
587message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800588 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800589
Bookatz1a1b0462018-01-12 11:47:03 -0800590 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
591 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800592}
593
594/**
595 * Logs when an an app causes the wifi radio to change state.
596 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
597 *
598 * Logged from:
599 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
600 */
601message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800602 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800603
Bookatz1a1b0462018-01-12 11:47:03 -0800604 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
605 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700606}
607
608/**
609 * Logs kernel wakeup reasons and aborts.
610 *
611 * Logged from:
612 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
613 */
614message KernelWakeupReported {
615 // Name of the kernel wakeup reason (or abort).
616 optional string wakeup_reason_name = 1;
617
618 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800619 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700620}
621
622/**
623 * Logs wifi locks held by an app.
624 *
625 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700626 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700627 */
628message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800629 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700630
631 enum State {
632 OFF = 0;
633 ON = 1;
634 }
635 optional State state = 2;
636}
637
638/**
639 * Logs wifi signal strength changes.
640 *
641 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700642 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700643 */
644message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800645 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
646 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700647}
648
649/**
650 * Logs wifi scans performed by an app.
651 *
652 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700653 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700654 */
655message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800656 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700657
658 enum State {
659 OFF = 0;
660 ON = 1;
661 }
662 optional State state = 2;
663}
664
665/**
Tej Singh4503e102018-01-04 14:35:01 -0800666 * Logs wifi multicast locks held by an app
667 *
668 * Logged from:
669 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
670 */
671message WifiMulticastLockStateChanged {
672 repeated AttributionNode attribution_node = 1;
673
674 enum State {
675 OFF = 0;
676 ON = 1;
677 }
678 optional State state = 2;
679}
680
681/**
Tej Singh1ea42892018-01-19 09:27:00 -0800682 * Logs shutdown reason and duration on next boot.
683 *
684 * Logged from:
685 * frameworks/base/core/java/com/android/server/BootReceiver.java
686 */
687message ShutdownSequenceReported {
688 // True if shutdown is for a reboot. Default: false if we do not know.
689 optional bool reboot = 1;
690
691 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
692 optional string reason = 2;
693
694 // Beginning of shutdown time in ms using wall clock time since unix epoch.
695 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800696 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800697
698 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800699 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800700}
701
Tej Singh6483ea42018-01-25 17:45:49 -0800702
703/**
704 * Logs boot reason and duration.
705 *
706 * Logged from:
707 * system/core/bootstat/bootstat.cpp
708 */
709message BootSequenceReported {
710 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
711 // Default: "<EMPTY>" if not available.
712 optional string bootloader_reason = 1;
713
714 // Reason for system boot. Eg. bootloader, reboot,userrequested
715 // Default: "<EMPTY>" if not available.
716 optional string system_reason = 2;
717
718 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800719 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800720
721 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800722 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800723
724 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800725 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800726
727 // Time since last boot in ms. Default: 0 if not available.
728 optional int64 time_since_last_boot = 6;
729}
730
Tej Singhc477d9c2018-02-05 18:31:39 -0800731
732/**
733 * Logs call state and disconnect cause (if applicable).
734 *
735 * Logged from:
736 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
737 */
738message CallStateChanged {
739 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
740 // From frameworks/base/core/proto/android/telecomm/enums.proto.
741 optional android.telecom.CallStateEnum call_state = 1;
742
743 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
744 // This value is only applicable when the call_state is DISCONNECTED, and
745 // should always be UNKNOWN if the call_state is not DISCONNECTED.
746 // From frameworks/base/core/proto/android/telecomm/enums.proto.
747 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
748
749 // True if the call is self-managed, which are apps that use the
750 // telecom infrastructure to make their own calls.
751 optional bool self_managed = 3;
752
753 // True if call is external. External calls are calls on connected Wear
754 // devices but show up in Telecom so the user can pull them onto the device.
755 optional bool external_call = 4;
756}
757
Tej Singh1ea42892018-01-19 09:27:00 -0800758/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800759 * Logs keyguard state. The keyguard is the lock screen.
760 *
761 * Logged from:
762 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
763 */
764message KeyguardStateChanged {
765 enum State {
766 UNKNOWN = 0;
767 // The keyguard is hidden when the phone is unlocked.
768 HIDDEN = 1;
769 // The keyguard is shown when the phone is locked (screen turns off).
770 SHOWN= 2;
771 // The keyguard is occluded when something is overlaying the keyguard.
772 // Eg. Opening the camera while on the lock screen.
773 OCCLUDED = 3;
774 }
775 optional State state = 1;
776}
777
778/**
779 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
780 * prompts the user to enter a password (pattern, pin, etc).
781 *
782 * Logged from:
783 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
784 */
785
786message KeyguardBouncerStateChanged {
787 enum State {
788 UNKNOWN = 0;
789 // Bouncer is hidden, either as a result of successfully entering the
790 // password, screen timing out, or user going back to lock screen.
791 HIDDEN = 1;
792 // This is when the user is being prompted to enter the password.
793 SHOWN = 2;
794 }
795 optional State state = 1;
796}
797
798/**
799 * Logs the result of entering a password into the keyguard bouncer.
800 *
801 * Logged from:
802 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
803 */
804message KeyguardBouncerPasswordEntered {
805 enum BouncerResult {
806 UNKNOWN = 0;
807 // The password entered was incorrect.
808 FAILURE = 1;
809 // The password entered was correct.
810 SUCCESS = 2;
811 }
812 optional BouncerResult result = 1;
813}
814
Tej Singha883b372018-02-15 11:30:01 -0800815/*
816 * Logs changes to the configuration of the device. The configuration is defined
817 * in frameworks/base/core/java/android/content/res/Configuration.java
818 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
819 * Please go there to interpret the possible values each field can be.
820 *
821 * Logged from:
822 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
823 */
824message ResourceConfigurationChanged {
825 // Bit mask of color capabilities of the screen.
826 // Contains information about the color gamut and hdr mode of the screen.
827 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
828 optional int32 colorMode = 1;
829
830 // The target screen density being rendered to.
831 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
832 optional int32 densityDpi = 2;
833
834 // Current user preference for the scaling factor for fonts,
835 // relative to the base density scaling.
836 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
837 optional float fontScale = 3;
838
839 // Flag indicating whether the hard keyboard is hidden.
840 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
841 optional int32 hardKeyboardHidden = 4;
842
843 // The type of keyboard attached to the device.
844 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
845 optional int32 keyboard = 5;
846
847 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
848 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
849 optional int32 keyboardHideen = 6;
850
851 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
852 // 0 if undefined.
853 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
854 optional int32 mcc = 7;
855
856 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
857 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
858 // MNC_ZERO symbol defined in Configuration.java.
859 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
860 optional int32 mnc = 8;
861
862 // The kind of navigation available on the device.
863 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
864 optional int32 navigation = 9;
865
866 // Flag indicating whether the navigation is available.
867 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
868 optional int32 navigationHidden = 10;
869
870 // Overall orientation of the screen.
871 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
872 optional int32 orientation = 11;
873
874 // The current height of the available screen space, in dp units.
875 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
876 optional int32 screenHeightDp = 12;
877
878 // Bit mask of overall layout of the screen.
879 // Contains information about screen size, whether the screen is wider/taller
880 // than normal, whether the screen layout is right-tl-left or left-to-right,
881 // and whether the screen has a rounded shape.
882 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
883 optional int32 screenLayout = 13;
884
885 // Current width of the available screen space, in dp units.
886 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
887 optional int32 screenWidthDp = 14;
888
889 // The smallest screen size an application will see in normal operation.
890 // This is the smallest value of both screenWidthDp and screenHeightDp
891 // in portrait and landscape.
892 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
893 optional int32 smallestScreenWidthDp = 15;
894
895 // The type of touch screen attached to the device.
896 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
897 optional int32 touchscreen = 16;
898
899 // Bit mask of the ui mode.
900 // Contains information about the overall ui mode of the device.
901 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
902 // Also contains information about whether the device is in night mode.
903 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
904 optional int32 uiMode = 17;
905}
906
Tej Singheee317b2018-03-07 19:28:05 -0800907
908/**
909 * Logs changes in the connection state of the mobile radio.
910 *
911 * Logged from:
912 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
913 */
914message MobileConnectionStateChanged {
915 // States are from the state machine DataConnection.java.
916 enum State {
917 UNKNOWN = 0;
918 // The connection is inactive, or disconnected.
919 INACTIVE = 1;
920 // The connection is being activated, or connecting.
921 ACTIVATING = 2;
922 // The connection is active, or connected.
923 ACTIVE = 3;
924 // The connection is disconnecting.
925 DISCONNECTING = 4;
926 // The connection is disconnecting after creating a connection.
927 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
928 }
929 optional State state = 1;
930 // For multi-sim phones, this distinguishes between the sim cards.
931 optional int32 sim_slot_index = 2;
932 // Used to identify the connection. Starts at 0 and increments by 1 for
933 // every new network created. Resets whenever the device reboots.
934 optional int32 data_connection_id = 3;
935 // A bitmask for the capabilities of this connection.
936 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
937 // Default value (if we have no information): 0
938 optional int64 capabilities = 4;
939 // If this connection has internet.
940 // This just checks if the DEFAULT bit of capabilities is set.
941 optional bool has_internet = 5;
942}
943
944/**
945 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
946 *
947 * Logged from:
948 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
949 */
950message MobileRadioTechnologyChanged {
951 optional android.telephony.NetworkTypeEnum state = 1;
952 // For multi-sim phones, this distinguishes between the sim cards.
953 optional int32 sim_slot_index = 2;
954}
955
Andrew Chantb56388b2018-03-22 21:07:33 -0700956/**
957 * Logs the VID and PID of any connected USB devices.
958 *
959 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
960 *
961 * Logged by Vendor.
962 */
963message UsbDeviceAttached {
964 optional int32 vid = 1;
965 optional int32 pid = 2;
966 optional bool has_audio = 3;
967 optional bool has_hid = 4;
968 optional bool has_storage = 5;
969}
970
Tej Singheee317b2018-03-07 19:28:05 -0800971
Tej Singhdd7bd352018-02-09 19:33:15 -0800972/**
Tej Singh5d991e12018-03-09 19:48:11 -0800973 * Logs when Bluetooth is enabled and disabled.
974 *
975 * Logged from:
976 * services/core/java/com/android/server/BluetoothManagerService.java
977 */
978message BluetoothEnabledStateChanged {
979 repeated AttributionNode attribution_node = 1;
980 // Whether or not bluetooth is enabled on the device.
981 enum State {
982 UNKNOWN = 0;
983 ENABLED = 1;
984 DISABLED = 2;
985 }
986 optional State state = 2;
987 // The reason for being enabled/disabled.
988 // Eg. Airplane mode, crash, application request.
989 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
990 // If the reason is an application request, this will be the package name.
991 optional string pkgName = 4;
992}
993
994/**
995 * Logs when a Bluetooth device connects and disconnects.
996 *
997 * Logged from:
998 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
999 */
1000message BluetoothConnectionStateChanged {
1001 // The state of the connection.
1002 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1003 optional android.bluetooth.ConnectionStateEnum state = 1;
1004 // An identifier that can be used to match connect and disconnect events.
1005 // Currently is last two bytes of a hash of a device level ID and
1006 // the mac address of the bluetooth device that is connected.
1007 optional int32 obfuscated_id = 2;
1008 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1009 // From android.bluetooth.BluetoothAdapter.java
1010 optional int32 bt_profile = 3;
1011}
1012
1013/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001014 * Logs when something is plugged into or removed from the USB-C connector.
1015 *
1016 * Logged from:
1017 * Vendor USB HAL.
1018 */
1019message UsbConnectorStateChanged {
1020 enum State {
1021 DISCONNECTED = 0;
1022 CONNECTED = 1;
1023 }
1024 optional State state = 1;
1025}
1026
1027/**
1028 * Logs the reported speaker impedance.
1029 *
1030 * Logged from:
1031 * Vendor audio implementation.
1032 */
1033message SpeakerImpedanceReported {
1034 optional int32 speaker_location = 1;
1035 optional int32 impedance = 2;
1036}
1037
1038/**
1039 * Logs the report of a failed hardware.
1040 *
1041 * Logged from:
1042 * Vendor HALs.
1043 *
1044 */
1045message HardwareFailed {
1046 enum HardwareType {
1047 HARDWARE_FAILED_UNKNOWN = 0;
1048 HARDWARE_FAILED_MICROPHONE = 1;
1049 HARDWARE_FAILED_CODEC = 2;
1050 HARDWARE_FAILED_SPEAKER = 3;
1051 HARDWARE_FAILED_FINGERPRINT = 4;
1052 }
1053 optional HardwareType hardware_type = 1;
1054
1055 /* hardware_location allows vendors to differentiate between multiple instances of
1056 * the same hardware_type. The specific locations are vendor defined integers,
1057 * referring to board-specific numbering schemes.
1058 */
1059 optional int32 hardware_location = 2;
1060
1061 /* failure_code is specific to the HardwareType of the failed hardware.
1062 * It should use the enum values defined below.
1063 */
1064 enum MicrophoneFailureCode {
1065 MICROPHONE_FAILURE_COMPLETE = 0;
1066 }
1067 enum CodecFailureCode {
1068 CODEC_FAILURE_COMPLETE = 0;
1069 }
1070 enum SpeakerFailureCode {
1071 SPEAKER_FAILURE_COMPLETE = 0;
1072 SPEAKER_FAILURE_HIGH_Z = 1;
1073 SPEAKER_FAILURE_SHORT = 2;
1074 }
1075 enum FingerprintFailureCode {
1076 FINGERPRINT_FAILURE_COMPLETE = 0;
1077 FINGERPRINT_SENSOR_BROKEN = 1;
1078 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1079 }
1080 optional int32 failure_code = 3;
1081}
1082
1083/**
1084 * Log an event when the device has been physically dropped.
1085 * Reported from the /vendor partition.
1086 */
1087message PhysicalDropDetected {
1088 // Confidence that the event was actually a drop, 0 -> 100
1089 optional int32 confidence_pctg = 1;
1090 // Peak acceleration of the drop, in 1/1000s of a g.
1091 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001092 // Duration of freefall in ms
1093 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001094}
1095
1096/**
1097 * Log bucketed battery charge cycles.
1098 *
1099 * Each bucket represents cycles of the battery past
1100 * a given charge point. For example, bucket 1 is the
1101 * lowest 1/8th of the battery, and bucket 8 is 100%.
1102 *
1103 * Logged from:
1104 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1105 */
1106message ChargeCyclesReported {
1107 optional int32 cycle_bucket_1 = 1;
1108 optional int32 cycle_bucket_2 = 2;
1109 optional int32 cycle_bucket_3 = 3;
1110 optional int32 cycle_bucket_4 = 4;
1111 optional int32 cycle_bucket_5 = 5;
1112 optional int32 cycle_bucket_6 = 6;
1113 optional int32 cycle_bucket_7 = 7;
1114 optional int32 cycle_bucket_8 = 8;
1115}
1116
1117/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001118 * Logs the duration of a davey (jank of >=700ms) when it occurs
1119 *
1120 * Logged from:
1121 * frameworks/base/libs/hwui/JankTracker.cpp
1122 */
1123message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001124 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001125 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001126
Tej Singhbb8554a2018-01-26 11:59:14 -08001127 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001128 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001129}
1130
1131/**
Bookatze5885242017-10-24 20:10:31 -07001132 * Logs phone signal strength changes.
1133 *
1134 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001135 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001136 */
1137message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001138 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1139 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001140}
1141
Yangster4ccebea2018-10-09 17:09:02 -07001142
1143/**
1144 * Logs when the phone state, sim state or signal strength changes
1145 *
1146 * Logged from:
1147 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1148 */
1149message PhoneServiceStateChanged {
1150 optional android.telephony.ServiceStateEnum state = 1;
1151 optional android.telephony.SimStateEnum sim_state = 2;
1152 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1153}
1154
1155/**
1156 * Logs when the phone becomes on or off.
1157 *
1158 * Logged from:
1159 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1160 */
1161message PhoneStateChanged {
1162 enum State {
1163 OFF = 0;
1164 ON = 1;
1165 }
1166 optional State state = 1;
1167}
1168
David Chenc28b2bb2017-10-24 12:52:52 -07001169/**
1170 * Logs that a setting was updated.
1171 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001172 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001173 * The tag and is_default allow resetting of settings to default values based on the specified
1174 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1175 */
1176message SettingChanged {
1177 // The name of the setting.
1178 optional string setting = 1;
1179
1180 // The change being imposed on this setting. May represent a number, eg "3".
1181 optional string value = 2;
1182
1183 // The new value of this setting. For most settings, this is same as value. For some settings,
1184 // value is +X or -X where X represents an element in a set. For example, if the previous value
1185 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1186 // The +/- feature is currently only used for location_providers_allowed.
1187 optional string new_value = 3;
1188
1189 // The previous value of this setting.
1190 optional string prev_value = 4;
1191
1192 // The tag used with the is_default for resetting sets of settings. This is generally null.
1193 optional string tag = 5;
1194
Bookatz90867622018-01-31 15:05:57 -08001195 // True if this setting with tag should be resettable.
1196 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001197
David Chenbd789912018-03-16 17:19:55 -07001198 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001199 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001200
1201 enum ChangeReason {
1202 UPDATED = 1; // Updated can be an insertion or an update.
1203 DELETED = 2;
1204 }
1205 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001206}
Chenjie Yub3dda412017-10-24 13:41:59 -07001207
Chenjie Yu05013b32017-11-21 10:21:41 -08001208/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001209 * Logs activity going to foreground or background
1210 *
1211 * Logged from:
1212 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1213 */
1214message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001215 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001216 optional string pkg_name = 2;
1217 optional string class_name = 3;
1218
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001219 enum State {
1220 BACKGROUND = 0;
1221 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001222 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001223 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001224}
David Chenc8a43242017-10-17 16:23:28 -07001225
1226/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001227 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001228 * Logged from:
1229 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1230 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001231message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001232 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001233
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001234 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001235
1236 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001237 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001238 optional string process_name = 3;
1239
1240 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001241 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001242
1243 optional string package_name = 5;
1244
1245 enum InstantApp {
1246 UNAVAILABLE = 0;
1247 FALSE = 1;
1248 TRUE = 2;
1249 }
1250 optional InstantApp is_instant_app = 6;
1251
1252 enum ForegroundState {
1253 UNKNOWN = 0;
1254 BACKGROUND = 1;
1255 FOREGROUND = 2;
1256 }
1257 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001258}
David Chen9e3808c2017-11-20 17:25:34 -08001259
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001260/**
1261 * Logs when a WTF (What a Terrible Failure) happened.
1262 * Logged from:
1263 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1264 */
1265message WTFOccurred {
1266 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001267
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001268 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001269
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001270 // The name of the process.
1271 // system_server if it is not by an app
1272 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001273
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001274 // The pid if available. -1 means not available.
1275 optional sint32 pid = 4;
1276}
1277
1278/**
1279 * Logs when system server reports low memory.
1280 * Logged from:
1281 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1282 */
1283message LowMemReported {
1284}
1285
1286/**
1287 * Logs when an app ANR (App Not Responding) occurs.
1288 * Logged from:
1289 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1290 */
1291message ANROccurred {
1292 optional int32 uid = 1 [(is_uid) = true];
1293
1294 optional string process_name = 2;
1295
1296 optional string short_component_name = 3;
1297
1298 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001299
1300 enum InstantApp {
1301 UNAVAILABLE = 0;
1302 FALSE = 1;
1303 TRUE = 2;
1304 }
1305 optional InstantApp is_instant_app = 5;
1306
1307 enum ForegroundState {
1308 UNKNOWN = 0;
1309 BACKGROUND = 1;
1310 FOREGROUND = 2;
1311 }
1312 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001313}
1314
David Chen0a368b22017-12-06 16:28:16 -08001315/*
1316 * Allows other apps to push events into statsd.
1317 * Logged from:
1318 * frameworks/base/core/java/android/util/StatsLog.java
1319 */
David Chen0b5c90c2018-01-25 16:51:49 -08001320message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001321 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001322 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001323
1324 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1325 optional int32 label = 2;
1326
1327 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1328 // predicates for the metrics).
1329 enum State {
1330 UNKNOWN = 0;
1331 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1332 STOP = 2;
1333 START = 3;
1334 }
1335 optional State state = 3;
1336}
1337
David Chen9e3808c2017-11-20 17:25:34 -08001338/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001339 * Logs when statsd detects an anomaly.
1340 *
1341 * Logged from:
1342 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1343 */
1344message AnomalyDetected {
1345 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001346 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001347
Yangster-mac94e197c2018-01-02 16:03:03 -08001348 // Id of the config whose anomaly detection alert fired.
1349 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001350
Yangster-mac94e197c2018-01-02 16:03:03 -08001351 // Id of the alert (i.e. name of the anomaly that was detected).
1352 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001353}
1354
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001355message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001356 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001357 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001358
1359 // The app package name.
1360 optional string pkg_name = 2;
1361
1362 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001363 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001364 WARM = 1;
1365 HOT = 2;
1366 COLD = 3;
1367 }
1368 // The transition type.
1369 optional TransitionType type = 3;
1370
1371 // The activity name.
1372 optional string activity_name = 4;
1373
1374 // The name of the calling app. Empty if not set.
1375 optional string calling_pkg_name = 5;
1376
1377 // Whether the app is an instant app.
1378 optional bool is_instant_app = 6;
1379
1380 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001381 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001382
Bookatz80d11a02018-01-16 10:46:35 -08001383 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001384
David Chen0b5c90c2018-01-25 16:51:49 -08001385 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001386 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001387 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001388 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001389 optional int32 bind_application_delay_millis = 11;
1390 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001391
1392 // Empty if not set.
1393 optional string launch_token = 13;
1394
Calin Juravle759fbda2018-02-20 19:52:30 +00001395 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001396 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001397
1398 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001399 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001400}
1401
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001402message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001403 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001404 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001405
1406 // The app package name.
1407 optional string pkg_name = 2;
1408
1409 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001410 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001411 WARM = 1;
1412 HOT = 2;
1413 COLD = 3;
1414 }
1415 // The transition type.
1416 optional TransitionType type = 3;
1417
1418 // The activity name.
1419 optional string activity_name = 4;
1420}
1421
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001422message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001423 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001424 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001425
1426 // The app package name.
1427 optional string pkg_name = 2;
1428
1429 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001430 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001431 WITH_BUNDLE = 1;
1432 WITHOUT_BUNDLE = 2;
1433 }
1434 // The transition type.
1435 optional TransitionType type = 3;
1436
1437 // The activity name.
1438 optional string activity_name = 4;
1439
1440 optional bool transition_process_running = 5;
1441
1442 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001443 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001444}
1445
Bookatz8fcd09a2017-12-18 13:01:10 -08001446/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001447 * Logs a picture-in-picture action
1448 * Logged from:
1449 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1450 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1451 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1452 */
1453message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001454 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001455 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001456
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001457 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001458
Chenjie Yu52cacc62017-12-08 18:11:45 -08001459 enum State {
1460 ENTERED = 1;
1461 EXPANDED_TO_FULL_SCREEN = 2;
1462 MINIMIZED = 3;
1463 DISMISSED = 4;
1464 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001465 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001466}
1467
1468/**
Chenjie Yue8904192017-12-08 19:12:57 -08001469 * Logs overlay action
1470 * Logged from:
1471 * services/core/java/com/android/server/wm/Session.java
1472 */
1473message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001474 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001475
1476 optional string package_name = 2;
1477
1478 optional bool using_alert_window = 3;
1479
1480 enum State {
1481 ENTERED = 1;
1482 EXITED = 2;
1483 }
1484 optional State state = 4;
1485}
1486
Chenjie Yuccfe6452018-01-30 11:33:21 -08001487/*
1488 * Logs foreground service starts and stops.
1489 * Note that this is not when a service starts or stops, but when it is
1490 * considered foreground.
1491 * Logged from
1492 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1493 */
1494message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001495 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001496 // package_name + "/" + class_name
1497 optional string short_name = 2;
1498
1499 enum State {
1500 ENTER = 1;
1501 EXIT = 2;
1502 }
1503 optional State state = 3;
1504}
1505
Chenjie Yue8904192017-12-08 19:12:57 -08001506/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001507 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1508 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1509 * attributed back to the parent (host) uid. One example is Chrome.
1510 *
1511 * Logged from:
1512 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1513 */
1514message IsolatedUidChanged {
1515 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001516 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001517 optional int32 parent_uid = 1;
1518
1519 optional int32 isolated_uid = 2;
1520
1521 // We expect an isolated uid to be removed before if it's used for another parent uid.
1522 enum Event {
1523 REMOVED = 0;
1524 CREATED = 1;
1525 }
1526 optional Event event = 3;
1527}
1528
1529/*
1530 * Logs the reception of an incoming network packet causing the main system to wake up for
1531 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1532 * and processed by WakeupController.cpp.
1533 */
1534message PacketWakeupOccurred {
1535 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1536 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001537 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001538 // The interface name on which the packet was received.
1539 optional string iface = 2;
1540 // The ethertype value of the packet.
1541 optional int32 ethertype = 3;
1542 // String representation of the destination MAC address of the packet.
1543 optional string destination_hardware_address = 4;
1544 // String representation of the source address of the packet if this was an IP packet.
1545 optional string source_ip = 5;
1546 // String representation of the destination address of the packet if this was an IP packet.
1547 optional string destination_ip = 6;
1548 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1549 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1550 // families.
1551 optional int32 ip_next_header = 7;
1552 // The source port if this was a TCP or UDP packet.
1553 optional int32 source_port = 8;
1554 // The destination port if this was a TCP or UDP packet.
1555 optional int32 destination_port = 9;
1556}
1557
1558/*
1559 * Logs the memory stats for an app on startup.
1560 * Logged from:
1561 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1562 */
1563message AppStartMemoryStateCaptured {
1564 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001565 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001566
1567 // The process name.
1568 optional string process_name = 2;
1569
1570 // The activity name.
1571 optional string activity_name = 3;
1572
1573 // # of page-faults
1574 optional int64 pgfault = 4;
1575
1576 // # of major page-faults
1577 optional int64 pgmajfault = 5;
1578
1579 // RSS
1580 optional int64 rss_in_bytes = 6;
1581
1582 // CACHE
1583 optional int64 cache_in_bytes = 7;
1584
1585 // SWAP
1586 optional int64 swap_in_bytes = 8;
1587}
1588
1589/*
1590 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1591 * for LMK event.
1592 * Logged from:
1593 * system/core/lmkd/lmkd.c
1594 */
1595message LmkStateChanged {
1596 enum State {
1597 UNKNOWN = 0;
1598 START = 1;
1599 STOP = 2;
1600 }
1601 optional State state = 1;
1602}
1603
1604/*
1605 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1606 * Logged from:
1607 * system/core/lmkd/lmkd.c
1608 */
1609message LmkKillOccurred {
1610 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001611 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001612
1613 // The process name.
1614 optional string process_name = 2;
1615
1616 // oom adj score.
1617 optional int32 oom_score = 3;
1618
1619 // # of page-faults
1620 optional int64 pgfault = 4;
1621
1622 // # of major page-faults
1623 optional int64 pgmajfault = 5;
1624
1625 // RSS
1626 optional int64 rss_in_bytes = 6;
1627
1628 // CACHE
1629 optional int64 cache_in_bytes = 7;
1630
1631 // SWAP
1632 optional int64 swap_in_bytes = 8;
1633}
1634
Rajeev Kumar51b54602018-03-01 12:18:26 -08001635/*
1636 * Logs when the ActivityManagerService detects that an app died.
1637 *
1638 * Logged from:
1639 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1640 */
1641message AppDied {
1642 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001643 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001644}
1645
Chenjie Yubbcbc602018-02-05 16:51:52 -08001646//////////////////////////////////////////////////////////////////////
1647// Pulled atoms below this line //
1648//////////////////////////////////////////////////////////////////////
1649
1650/**
David Chenc8a43242017-10-17 16:23:28 -07001651 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1652 *
1653 * Pulled from:
1654 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1655 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001656message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001657 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001658
1659 optional int64 rx_bytes = 2;
1660
1661 optional int64 rx_packets = 3;
1662
1663 optional int64 tx_bytes = 4;
1664
1665 optional int64 tx_packets = 5;
1666}
1667
1668/**
1669 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1670 *
1671 * Pulled from:
1672 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1673 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001674message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001675 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001676
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001677 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1678 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001679
1680 optional int64 rx_bytes = 3;
1681
1682 optional int64 rx_packets = 4;
1683
1684 optional int64 tx_bytes = 5;
1685
1686 optional int64 tx_packets = 6;
1687}
1688
1689/**
1690 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1691 *
1692 * Pulled from:
1693 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1694 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001695message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001696 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001697
1698 optional int64 rx_bytes = 2;
1699
1700 optional int64 rx_packets = 3;
1701
1702 optional int64 tx_bytes = 4;
1703
1704 optional int64 tx_packets = 5;
1705}
1706
1707/**
1708 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1709 *
1710 * Pulled from:
1711 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1712 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001713message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001714 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001715
Yao Chenc40a19d2018-03-15 16:48:25 -07001716 // 1 denotes foreground and 0 denotes background. This is called Set in
1717 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001718 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001719
1720 optional int64 rx_bytes = 3;
1721
1722 optional int64 rx_packets = 4;
1723
1724 optional int64 tx_bytes = 5;
1725
1726 optional int64 tx_packets = 6;
1727}
1728
1729/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001730 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1731 *
1732 * Pulled from:
1733 * StatsCompanionService
1734 */
1735message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001736 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001737
1738 optional int64 rx_bytes = 2;
1739
1740 optional int64 tx_bytes = 3;
1741}
1742
1743/**
David Chenc8a43242017-10-17 16:23:28 -07001744 * Pulls the kernel wakelock durations. This atom is adapted from
1745 * android/internal/os/KernelWakelockStats.java
1746 *
1747 * Pulled from:
1748 * StatsCompanionService using KernelWakelockReader.
1749 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001750message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001751 optional string name = 1;
1752
1753 optional int32 count = 2;
1754
1755 optional int32 version = 3;
1756
1757 optional int64 time = 4;
1758}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001759
Chenjie Yu05013b32017-11-21 10:21:41 -08001760/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001761 * Pulls low power state information. This includes platform and subsystem sleep state information,
1762 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001763 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001764 * hardware/interfaces/power/1.1/types.hal
1765 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001766message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001767 // Subsystem name
1768 optional string subsystem_name = 1;
1769 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1770 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1771 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001772 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001773 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001774 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001775 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001776}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001777
Chenjie Yu05013b32017-11-21 10:21:41 -08001778/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001779 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001780 * Pulls the time the cpu spend on the frequency index. Frequency index
1781 * starts from highest to lowest. The value should be monotonically
1782 * increasing since boot. However, if there is a cpu
1783 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001784 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001785message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001786 optional uint32 cluster = 1;
1787 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001788 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001789}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001790
Chenjie Yu05013b32017-11-21 10:21:41 -08001791/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001792 * Pulls Cpu Time Per Uid.
1793 * Note that isolated process uid time should be attributed to host uids.
1794 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001795message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001796 optional int32 uid = 1 [(is_uid) = true];
Misha Wagner6bc6c912018-11-16 13:19:54 +00001797 optional uint64 user_time_micros = 2;
1798 optional uint64 sys_time_micros = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001799}
1800
1801/**
1802 * Pulls Cpu Time Per Uid per frequency.
1803 * Note that isolated process uid time should be attributed to host uids.
1804 * For each uid, we order the time by descending frequencies.
1805 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001806message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001807 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001808 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001809 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001810}
Hugo Benichi884970e2017-11-14 22:42:46 +09001811
Chenjie Yu05013b32017-11-21 10:21:41 -08001812/**
1813 * Pulls Wifi Controller Activity Energy Info
1814 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001815message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001816 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001817 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001818 // stack reported state
1819 // TODO: replace this with proto enum
1820 optional int32 stack_state = 2;
1821 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001822 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001823 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001824 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001825 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001826 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001827 // product of current(mA), voltage(V) and time(ms)
1828 optional uint64 controller_energy_used = 6;
1829}
1830
1831/**
1832 * Pulls Modem Activity Energy Info
1833 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001834message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001835 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001836 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001837 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001838 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001839 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001840 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001841 /**
1842 * Tx power index
1843 * index 0 = tx_power < 0dBm
1844 * index 1 = 0dBm < tx_power < 5dBm
1845 * index 2 = 5dBm < tx_power < 15dBm
1846 * index 3 = 15dBm < tx_power < 20dBm
1847 * index 4 = tx_power > 20dBm
1848 */
1849 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001850 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001851 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001852 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001853 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001854 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001855 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001856 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001857 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001858 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001859 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001860 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001861 // product of current(mA), voltage(V) and time(ms)
1862 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001863}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001864
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001865/**
1866 * Pulls Bluetooth Activity Energy Info
1867 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1868 */
1869message BluetoothActivityInfo {
1870 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001871 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001872 // bluetooth stack state
1873 optional int32 bluetooth_stack_state = 2;
1874 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001875 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001876 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001877 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001878 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001879 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001880 // product of current(mA), voltage(V) and time(ms)
1881 optional uint64 energy_used = 6;
1882}
1883
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001884/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001885 * Logs the memory stats for a process.
1886 */
1887message ProcessMemoryState {
1888 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001889 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001890
1891 // The process name.
1892 optional string process_name = 2;
1893
1894 // oom adj score.
1895 optional int32 oom_score = 3;
1896
1897 // # of page-faults
1898 optional int64 pgfault = 4;
1899
1900 // # of major page-faults
1901 optional int64 pgmajfault = 5;
1902
Rajeev Kumar90235992018-01-29 11:06:48 -08001903 // RSS
1904 optional int64 rss_in_bytes = 6;
1905
1906 // CACHE
1907 optional int64 cache_in_bytes = 7;
1908
1909 // SWAP
1910 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001911}
1912
1913/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001914 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001915 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001916message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001917 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001918}
1919
1920/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001921 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001922 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001923message SystemUptime {
1924 // Milliseconds since the system was booted.
1925 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1926 // for external input).
1927 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001928 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001929}
1930
1931/*
1932 * Reads from /proc/uid_concurrent_active_time which has the format:
1933 * active: X (X is # cores)
1934 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1935 * [uid1]: [time-0] [time-1] [time-2] ... ...
1936 * ...
1937 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1938 * The file contains a monotonically increasing count of time for a single boot.
1939 */
1940message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001941 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001942 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001943}
1944
1945/**
1946 * Reads from /proc/uid_concurrent_policy_time which has the format:
1947 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1948 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1949 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1950 * ...
1951 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1952 * The file contains a monotonically increasing count of time for a single boot.
1953 */
1954message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001955 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001956 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001957 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001958}
1959
1960/*
1961 * Pulls free disk space, for data, system partition and temporary directory.
1962 */
1963message DiskSpace {
1964 // available bytes in data partition
1965 optional uint64 data_available_bytes = 1;
1966 // available bytes in system partition
1967 optional uint64 system_available_bytes = 2;
1968 // available bytes in download cache or temp directories
1969 optional uint64 temp_available_bytes = 3;
1970}
Tej Singhbf972d92018-01-10 20:51:13 -08001971
1972/**
1973 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001974 * Pulled from:
1975 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001976 */
1977message RemainingBatteryCapacity {
1978 optional int32 charge_uAh = 1;
1979}
1980
1981/**
1982 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001983 * Pulled from:
1984 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001985 */
1986message FullBatteryCapacity {
1987 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001988}
1989
1990/**
Tej Singhd89137e2018-03-26 14:51:40 -07001991 * Pulls the temperature of various parts of the device.
1992 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08001993 *
1994 * Pulled from:
1995 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1996 */
1997message Temperature {
1998 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1999 optional android.os.TemperatureTypeEnum sensor_location = 1;
2000
2001 // The name of the temperature source. Eg. CPU0
2002 optional string sensor_name = 2;
2003
Tej Singhd89137e2018-03-26 14:51:40 -07002004 // Temperature in tenths of a degree C.
2005 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002006}