blob: f5ddbbac61f21bddfef7d9e780e14c50ea7014dd [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";
Jack He52260142018-12-18 15:43:27 -080027import "frameworks/base/core/proto/android/bluetooth/hci/enums.proto";
Chiachang Wang67f24472019-01-15 15:14:00 +080028import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080029import "frameworks/base/core/proto/android/os/enums.proto";
Chiachang Wang67f24472019-01-15 15:14:00 +080030import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080031import "frameworks/base/core/proto/android/server/enums.proto";
Yao Chen046b5122018-10-24 14:09:20 -070032import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080033import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080034import "frameworks/base/core/proto/android/telephony/enums.proto";
35import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080036
Yao Chend54f9dd2017-10-17 17:37:48 +000037/**
Stefan Lafonae2df012017-11-14 09:17:21 -080038 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000039 * raw stats log events from the Android system, also known as "atoms."
40 *
41 * This field contains a single oneof with all of the available messages.
42 * The stats-log-api-gen tool runs as part of the Android build and
43 * generates the android.util.StatsLog class, which contains the constants
44 * and methods that Android uses to log.
45 *
Stefan Lafonae2df012017-11-14 09:17:21 -080046 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000047 * Instead, statsd on Android constructs these messages synthetically,
48 * in the format defined here and in stats_log.proto.
49 */
Stefan Lafonae2df012017-11-14 09:17:21 -080050message Atom {
51 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070052 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070053 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
54 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080055 // 3 is available for use
Bookatzc1a050a2017-10-10 15:49:28 -070056 BleScanResultReceived ble_scan_result_received = 4;
57 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080058 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070059 SyncStateChanged sync_state_changed = 7;
60 ScheduledJobStateChanged scheduled_job_state_changed = 8;
61 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070062 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080063 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
64 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
65 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Hyunyoung Songcc651c12018-10-17 13:35:32 -070066 // 14 - 18 are available
67 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080068 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
69 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
70 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070071 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080072 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070073 CameraStateChanged camera_state_changed = 25;
74 FlashlightStateChanged flashlight_state_changed = 26;
75 UidProcessStateChanged uid_process_state_changed = 27;
76 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
77 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070078 BatteryLevelChanged battery_level_changed = 30;
79 ChargingStateChanged charging_state_changed = 31;
80 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080081 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070082 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
83 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070084 WifiLockStateChanged wifi_lock_state_changed = 37;
85 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
86 WifiScanStateChanged wifi_scan_state_changed = 39;
87 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070088 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070089 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070090 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090091 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080092 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080093 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080094 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080095 AppStartOccurred app_start_occurred = 48;
96 AppStartCanceled app_start_canceled = 49;
97 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080098 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080099 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800100 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800101 LmkStateChanged lmk_state_changed = 54;
102 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800103 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800104 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800105 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800106 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800107 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800108 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800109 KeyguardStateChanged keyguard_state_changed = 62;
110 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
111 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800112 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800113 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800114 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
115 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700116 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700117 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800118 SpeakerImpedanceReported speaker_impedance_reported = 71;
119 HardwareFailed hardware_failed = 72;
120 PhysicalDropDetected physical_drop_detected = 73;
121 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800122 MobileConnectionStateChanged mobile_connection_state_changed = 75;
123 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700124 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800125 AppCrashOccurred app_crash_occurred = 78;
126 ANROccurred anr_occurred = 79;
127 WTFOccurred wtf_occurred = 80;
Yangster4ccebea2018-10-09 17:09:02 -0700128 PhoneServiceStateChanged phone_service_state_changed = 94;
129 PhoneStateChanged phone_state_changed = 95;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800130 LowMemReported low_mem_reported = 81;
lifr35a7cf02018-12-12 16:38:04 +0800131 NetworkDnsEventReported network_dns_event_reported = 116;
Chiachang Wang67f24472019-01-15 15:14:00 +0800132 DataStallEvent data_stall_event = 121;
Jack He52260142018-12-18 15:43:27 -0800133 BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event = 125;
Yao Chend54f9dd2017-10-17 17:37:48 +0000134 }
David Chenc8a43242017-10-17 16:23:28 -0700135
David Chen6e3e6cb2018-01-03 16:14:06 -0800136 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800137 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700138 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800139 WifiBytesTransfer wifi_bytes_transfer = 10000;
140 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
141 MobileBytesTransfer mobile_bytes_transfer = 10002;
142 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800143 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800144 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800145 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800146 CpuTimePerFreq cpu_time_per_freq = 10008;
147 CpuTimePerUid cpu_time_per_uid = 10009;
148 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800149 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800150 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800151 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800152 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800153 SystemElapsedRealtime system_elapsed_realtime = 10014;
154 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800155 CpuActiveTime cpu_active_time = 10016;
156 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800157 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800158 RemainingBatteryCapacity remaining_battery_capacity = 10019;
159 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800160 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700161 }
yroa1fe77c2018-02-26 14:22:54 -0800162
Bookatz76aafcf2018-09-17 16:17:10 -0700163 // DO NOT USE field numbers above 100,000 in AOSP.
164 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
165 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700166}
167
Yao Chend54f9dd2017-10-17 17:37:48 +0000168/**
Yangster-mac20877162017-12-22 17:19:39 -0800169 * This proto represents a node of an attribution chain.
170 * Note: All attribution chains are represented as a repeated field of type
171 * AttributionNode. It is understood that in such arrays, the order is that
172 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000173 */
Yangster-mac20877162017-12-22 17:19:39 -0800174message AttributionNode {
175 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800176 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800177
Yangster-mac20877162017-12-22 17:19:39 -0800178 // The (optional) string tag for an element in the attribution chain. If the
179 // element has no tag, it is encoded as an empty string.
180 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700181}
182
Yao Chend54f9dd2017-10-17 17:37:48 +0000183/*
184 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800185 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000186 *
187 * RULES:
188 * - The field ids for each atom must start at 1, and count upwards by 1.
189 * Skipping field ids is not allowed.
190 * - These form an API, so renaming, renumbering or removing fields is
191 * not allowed between android releases. (This is not currently enforced,
192 * but there will be a tool to enforce this restriction).
193 * - The types must be built-in protocol buffer types, namely, no sub-messages
194 * are allowed (yet). The bytes type is also not allowed.
195 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800196 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000197 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800198 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000199 * - A field that is a uid should be a string field, tagged with the [xxx]
200 * annotation. The generated code on android will be represented by UIDs,
201 * and those UIDs will be translated in xxx to those strings.
202 *
203 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700204 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000205 * - If there is a UID, it goes first. Think in an object-oriented fashion.
206 * *****************************************************************************
207 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700208
Yao Chend54f9dd2017-10-17 17:37:48 +0000209/**
210 * Logs when the screen state changes.
211 *
212 * Logged from:
213 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
214 */
215message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800216 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800217 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700218}
Yao Chend54f9dd2017-10-17 17:37:48 +0000219
220/**
Bookatzc1a050a2017-10-10 15:49:28 -0700221 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000222 *
223 * Logged from:
224 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
225 */
Bookatzc1a050a2017-10-10 15:49:28 -0700226message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700227 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000228
Bookatzdb026a22018-01-10 19:01:56 -0800229 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800230 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000231}
232
233/**
Bookatzc1a050a2017-10-10 15:49:28 -0700234 * Logs that a process started, finished, crashed, or ANRed.
235 *
236 * Logged from:
237 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
238 */
239message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700240 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700241
David Chen0b5c90c2018-01-25 16:51:49 -0800242 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800243 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700244
Bookatzddccf0a2017-11-28 16:48:14 -0800245 // What lifecycle state the process changed to.
246 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800247 enum State {
248 FINISHED = 0;
249 STARTED = 1;
250 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800251 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800252 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700253}
254
Bookatzc1a050a2017-10-10 15:49:28 -0700255/**
256 * Logs when the ble scan state changes.
257 *
258 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700259 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700260 */
261message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800262 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700263
264 enum State {
265 OFF = 0;
266 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700267 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
268 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700269 }
270 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700271
Bookatze5ec0b42018-03-26 13:34:56 -0700272 // Does the scan have a filter.
273 optional bool is_filtered = 3;
274 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
275 optional bool is_first_match = 4;
276 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
277 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700278}
279
280/**
281 * Logs reporting of a ble scan finding results.
282 *
283 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700284 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700285 */
Bookatzae6738e2018-09-13 11:38:56 -0700286// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700287message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800288 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700289
290 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800291 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700292}
293
294/**
295 * Logs when a sensor state changes.
296 *
297 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700298 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700299 */
300message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800301 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700302
Bookatzc1a050a2017-10-10 15:49:28 -0700303 // The id (int) of the sensor.
304 optional int32 sensor_id = 2;
305
306 enum State {
307 OFF = 0;
308 ON = 1;
309 }
310 optional State state = 3;
311}
312
313
314/**
315 * Logs when GPS state changes.
316 *
317 * Logged from:
318 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
319 */
320message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800321 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700322
323 enum State {
324 OFF = 0;
325 ON = 1;
326 }
327 optional State state = 2;
328}
329
330
331/**
332 * Logs when a sync manager sync state changes.
333 *
334 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700335 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700336 */
337message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800338 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700339
David Chen0b5c90c2018-01-25 16:51:49 -0800340 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800341 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700342
343 enum State {
344 OFF = 0;
345 ON = 1;
346 }
347 optional State state = 3;
348}
349
350/**
351 * Logs when a job scheduler job state changes.
352 *
353 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700354 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700355 */
356message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800357 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700358
359 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800360 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700361
362 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800363 FINISHED = 0;
364 STARTED = 1;
365 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700366 }
367 optional State state = 3;
368
Tej Singh33a412b2018-03-16 18:43:59 -0700369 // The reason a job has stopped.
370 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700371 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700372 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700373}
374
375/**
376 * Logs when the audio state changes.
377 *
378 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700379 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700380 */
381message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800382 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700383
384 enum State {
385 OFF = 0;
386 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700387 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
388 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700389 }
390 optional State state = 2;
391}
392
393/**
394 * Logs when the video codec state changes.
395 *
396 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700397 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700398 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800399message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800400 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700401
402 enum State {
403 OFF = 0;
404 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700405 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
406 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700407 }
408 optional State state = 2;
409}
410
411/**
412 * Logs when the flashlight state changes.
413 *
414 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700415 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700416 */
417message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800418 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700419
420 enum State {
421 OFF = 0;
422 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700423 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
424 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700425 }
426 optional State state = 2;
427}
428
429/**
430 * Logs when the camera state changes.
431 *
432 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700433 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700434 */
435message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800436 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700437
438 enum State {
439 OFF = 0;
440 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700441 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
442 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700443 }
444 optional State state = 2;
445}
446
447/**
448 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000449 *
450 * Logged from:
451 * TODO
452 */
Bookatzd6746242017-10-24 18:39:35 -0700453message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800454 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000455
Bookatz1a1b0462018-01-12 11:47:03 -0800456 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
457 // From frameworks/base/core/proto/android/os/enums.proto.
458 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700459
460 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
461 optional string tag = 3;
462
463 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800464 RELEASE = 0;
465 ACQUIRE = 1;
466 CHANGE_RELEASE = 2;
467 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700468 }
469 optional State state = 4;
470}
471
472/**
Bookatzc1a050a2017-10-10 15:49:28 -0700473 * Logs when a partial wakelock is considered 'long' (over 1 min).
474 *
475 * Logged from:
476 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
477 */
478message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800479 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700480
Yao Chend54f9dd2017-10-17 17:37:48 +0000481 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
482 optional string tag = 2;
483
Bookatzc1a050a2017-10-10 15:49:28 -0700484 // TODO: I have no idea what this is.
485 optional string history_tag = 3;
486
487 enum State {
488 OFF = 0;
489 ON = 1;
490 }
491 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000492}
493
Bookatzc1a050a2017-10-10 15:49:28 -0700494/**
495 * Logs Battery Saver state change.
496 *
497 * Logged from:
498 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
499 */
500message BatterySaverModeStateChanged {
501 enum State {
502 OFF = 0;
503 ON = 1;
504 }
505 optional State state = 1;
506}
507
508/**
509 * Logs Doze mode state change.
510 *
511 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800512 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700513 */
514message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800515 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800516}
517
518
519/**
520 * Logs state change of Doze mode including maintenance windows.
521 *
522 * Logged from:
523 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
524 */
525message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800526 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700527}
528
529/**
530 * Logs screen brightness level.
531 *
532 * Logged from:
533 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
534 */
535message ScreenBrightnessChanged {
536 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
537 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700538}
539
540/**
541 * Logs battery level (percent full, from 0 to 100).
542 *
543 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700544 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700545 */
546message BatteryLevelChanged {
547 // Battery level. Should be in [0, 100].
548 optional int32 battery_level = 1;
549}
550
551/**
552 * Logs change in charging status of the device.
553 *
554 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700555 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700556 */
557message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800558 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
559 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700560}
561
562/**
563 * Logs whether the device is plugged in, and what power source it is using.
564 *
565 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700566 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700567 */
568message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800569 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
570 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700571}
572
Bookatz8c6571b2017-10-24 15:04:41 -0700573/**
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 {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800594 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800595
Bookatz1a1b0462018-01-12 11:47:03 -0800596 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
597 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800598}
599
600/**
601 * Logs when an an app causes the wifi radio to change state.
602 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
603 *
604 * Logged from:
605 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
606 */
607message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800608 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800609
Bookatz1a1b0462018-01-12 11:47:03 -0800610 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
611 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700612}
613
614/**
615 * Logs kernel wakeup reasons and aborts.
616 *
617 * Logged from:
618 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
619 */
620message KernelWakeupReported {
621 // Name of the kernel wakeup reason (or abort).
622 optional string wakeup_reason_name = 1;
623
624 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800625 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700626}
627
628/**
629 * Logs wifi locks held by an app.
630 *
631 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700632 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700633 */
634message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800635 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700636
637 enum State {
638 OFF = 0;
639 ON = 1;
640 }
641 optional State state = 2;
642}
643
644/**
645 * Logs wifi signal strength changes.
646 *
647 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700648 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700649 */
650message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800651 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
652 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700653}
654
655/**
656 * Logs wifi scans performed by an app.
657 *
658 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700659 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700660 */
661message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800662 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700663
664 enum State {
665 OFF = 0;
666 ON = 1;
667 }
668 optional State state = 2;
669}
670
671/**
Tej Singh4503e102018-01-04 14:35:01 -0800672 * Logs wifi multicast locks held by an app
673 *
674 * Logged from:
675 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
676 */
677message WifiMulticastLockStateChanged {
678 repeated AttributionNode attribution_node = 1;
679
680 enum State {
681 OFF = 0;
682 ON = 1;
683 }
684 optional State state = 2;
685}
686
687/**
Tej Singh1ea42892018-01-19 09:27:00 -0800688 * Logs shutdown reason and duration on next boot.
689 *
690 * Logged from:
691 * frameworks/base/core/java/com/android/server/BootReceiver.java
692 */
693message ShutdownSequenceReported {
694 // True if shutdown is for a reboot. Default: false if we do not know.
695 optional bool reboot = 1;
696
697 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
698 optional string reason = 2;
699
700 // Beginning of shutdown time in ms using wall clock time since unix epoch.
701 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800702 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800703
704 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800705 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800706}
707
Tej Singh6483ea42018-01-25 17:45:49 -0800708
709/**
710 * Logs boot reason and duration.
711 *
712 * Logged from:
713 * system/core/bootstat/bootstat.cpp
714 */
715message BootSequenceReported {
716 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
717 // Default: "<EMPTY>" if not available.
718 optional string bootloader_reason = 1;
719
720 // Reason for system boot. Eg. bootloader, reboot,userrequested
721 // Default: "<EMPTY>" if not available.
722 optional string system_reason = 2;
723
724 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800725 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800726
727 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800728 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800729
730 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800731 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800732
733 // Time since last boot in ms. Default: 0 if not available.
734 optional int64 time_since_last_boot = 6;
735}
736
Tej Singhc477d9c2018-02-05 18:31:39 -0800737
738/**
739 * Logs call state and disconnect cause (if applicable).
740 *
741 * Logged from:
742 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
743 */
744message CallStateChanged {
745 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
746 // From frameworks/base/core/proto/android/telecomm/enums.proto.
747 optional android.telecom.CallStateEnum call_state = 1;
748
749 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
750 // This value is only applicable when the call_state is DISCONNECTED, and
751 // should always be UNKNOWN if the call_state is not DISCONNECTED.
752 // From frameworks/base/core/proto/android/telecomm/enums.proto.
753 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
754
755 // True if the call is self-managed, which are apps that use the
756 // telecom infrastructure to make their own calls.
757 optional bool self_managed = 3;
758
759 // True if call is external. External calls are calls on connected Wear
760 // devices but show up in Telecom so the user can pull them onto the device.
761 optional bool external_call = 4;
762}
763
Tej Singh1ea42892018-01-19 09:27:00 -0800764/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800765 * Logs keyguard state. The keyguard is the lock screen.
766 *
767 * Logged from:
768 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
769 */
770message KeyguardStateChanged {
771 enum State {
772 UNKNOWN = 0;
773 // The keyguard is hidden when the phone is unlocked.
774 HIDDEN = 1;
775 // The keyguard is shown when the phone is locked (screen turns off).
776 SHOWN= 2;
777 // The keyguard is occluded when something is overlaying the keyguard.
778 // Eg. Opening the camera while on the lock screen.
779 OCCLUDED = 3;
780 }
781 optional State state = 1;
782}
783
784/**
785 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
786 * prompts the user to enter a password (pattern, pin, etc).
787 *
788 * Logged from:
789 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
790 */
791
792message KeyguardBouncerStateChanged {
793 enum State {
794 UNKNOWN = 0;
795 // Bouncer is hidden, either as a result of successfully entering the
796 // password, screen timing out, or user going back to lock screen.
797 HIDDEN = 1;
798 // This is when the user is being prompted to enter the password.
799 SHOWN = 2;
800 }
801 optional State state = 1;
802}
803
804/**
805 * Logs the result of entering a password into the keyguard bouncer.
806 *
807 * Logged from:
808 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
809 */
810message KeyguardBouncerPasswordEntered {
811 enum BouncerResult {
812 UNKNOWN = 0;
813 // The password entered was incorrect.
814 FAILURE = 1;
815 // The password entered was correct.
816 SUCCESS = 2;
817 }
818 optional BouncerResult result = 1;
819}
820
Tej Singha883b372018-02-15 11:30:01 -0800821/*
822 * Logs changes to the configuration of the device. The configuration is defined
823 * in frameworks/base/core/java/android/content/res/Configuration.java
824 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
825 * Please go there to interpret the possible values each field can be.
826 *
827 * Logged from:
828 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
829 */
830message ResourceConfigurationChanged {
831 // Bit mask of color capabilities of the screen.
832 // Contains information about the color gamut and hdr mode of the screen.
833 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
834 optional int32 colorMode = 1;
835
836 // The target screen density being rendered to.
837 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
838 optional int32 densityDpi = 2;
839
840 // Current user preference for the scaling factor for fonts,
841 // relative to the base density scaling.
842 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
843 optional float fontScale = 3;
844
845 // Flag indicating whether the hard keyboard is hidden.
846 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
847 optional int32 hardKeyboardHidden = 4;
848
849 // The type of keyboard attached to the device.
850 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
851 optional int32 keyboard = 5;
852
853 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
854 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
855 optional int32 keyboardHideen = 6;
856
857 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
858 // 0 if undefined.
859 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
860 optional int32 mcc = 7;
861
862 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
863 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
864 // MNC_ZERO symbol defined in Configuration.java.
865 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
866 optional int32 mnc = 8;
867
868 // The kind of navigation available on the device.
869 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
870 optional int32 navigation = 9;
871
872 // Flag indicating whether the navigation is available.
873 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
874 optional int32 navigationHidden = 10;
875
876 // Overall orientation of the screen.
877 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
878 optional int32 orientation = 11;
879
880 // The current height of the available screen space, in dp units.
881 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
882 optional int32 screenHeightDp = 12;
883
884 // Bit mask of overall layout of the screen.
885 // Contains information about screen size, whether the screen is wider/taller
886 // than normal, whether the screen layout is right-tl-left or left-to-right,
887 // and whether the screen has a rounded shape.
888 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
889 optional int32 screenLayout = 13;
890
891 // Current width of the available screen space, in dp units.
892 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
893 optional int32 screenWidthDp = 14;
894
895 // The smallest screen size an application will see in normal operation.
896 // This is the smallest value of both screenWidthDp and screenHeightDp
897 // in portrait and landscape.
898 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
899 optional int32 smallestScreenWidthDp = 15;
900
901 // The type of touch screen attached to the device.
902 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
903 optional int32 touchscreen = 16;
904
905 // Bit mask of the ui mode.
906 // Contains information about the overall ui mode of the device.
907 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
908 // Also contains information about whether the device is in night mode.
909 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
910 optional int32 uiMode = 17;
911}
912
Tej Singheee317b2018-03-07 19:28:05 -0800913
914/**
915 * Logs changes in the connection state of the mobile radio.
916 *
917 * Logged from:
918 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
919 */
920message MobileConnectionStateChanged {
921 // States are from the state machine DataConnection.java.
922 enum State {
923 UNKNOWN = 0;
924 // The connection is inactive, or disconnected.
925 INACTIVE = 1;
926 // The connection is being activated, or connecting.
927 ACTIVATING = 2;
928 // The connection is active, or connected.
929 ACTIVE = 3;
930 // The connection is disconnecting.
931 DISCONNECTING = 4;
932 // The connection is disconnecting after creating a connection.
933 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
934 }
935 optional State state = 1;
936 // For multi-sim phones, this distinguishes between the sim cards.
937 optional int32 sim_slot_index = 2;
938 // Used to identify the connection. Starts at 0 and increments by 1 for
939 // every new network created. Resets whenever the device reboots.
940 optional int32 data_connection_id = 3;
941 // A bitmask for the capabilities of this connection.
942 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
943 // Default value (if we have no information): 0
944 optional int64 capabilities = 4;
945 // If this connection has internet.
946 // This just checks if the DEFAULT bit of capabilities is set.
947 optional bool has_internet = 5;
948}
949
950/**
951 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
952 *
953 * Logged from:
954 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
955 */
956message MobileRadioTechnologyChanged {
957 optional android.telephony.NetworkTypeEnum state = 1;
958 // For multi-sim phones, this distinguishes between the sim cards.
959 optional int32 sim_slot_index = 2;
960}
961
Andrew Chantb56388b2018-03-22 21:07:33 -0700962/**
963 * Logs the VID and PID of any connected USB devices.
964 *
965 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
966 *
967 * Logged by Vendor.
968 */
969message UsbDeviceAttached {
970 optional int32 vid = 1;
971 optional int32 pid = 2;
972 optional bool has_audio = 3;
973 optional bool has_hid = 4;
974 optional bool has_storage = 5;
975}
976
Tej Singheee317b2018-03-07 19:28:05 -0800977
Tej Singhdd7bd352018-02-09 19:33:15 -0800978/**
Tej Singh5d991e12018-03-09 19:48:11 -0800979 * Logs when Bluetooth is enabled and disabled.
980 *
981 * Logged from:
982 * services/core/java/com/android/server/BluetoothManagerService.java
983 */
984message BluetoothEnabledStateChanged {
985 repeated AttributionNode attribution_node = 1;
986 // Whether or not bluetooth is enabled on the device.
987 enum State {
988 UNKNOWN = 0;
989 ENABLED = 1;
990 DISABLED = 2;
991 }
992 optional State state = 2;
993 // The reason for being enabled/disabled.
994 // Eg. Airplane mode, crash, application request.
995 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
996 // If the reason is an application request, this will be the package name.
997 optional string pkgName = 4;
998}
999
1000/**
1001 * Logs when a Bluetooth device connects and disconnects.
1002 *
1003 * Logged from:
1004 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1005 */
1006message BluetoothConnectionStateChanged {
1007 // The state of the connection.
1008 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1009 optional android.bluetooth.ConnectionStateEnum state = 1;
1010 // An identifier that can be used to match connect and disconnect events.
1011 // Currently is last two bytes of a hash of a device level ID and
1012 // the mac address of the bluetooth device that is connected.
1013 optional int32 obfuscated_id = 2;
1014 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1015 // From android.bluetooth.BluetoothAdapter.java
1016 optional int32 bt_profile = 3;
1017}
1018
Jack He52260142018-12-18 15:43:27 -08001019// Logs when there is an event affecting Bluetooth device's link layer connection.
1020// - This event is triggered when there is a related HCI command or event
1021// - Users of this metrics can deduce Bluetooth device's connection state from these events
1022// - HCI commands are logged before the command is sent, after receiving command status, and after
1023// receiving command complete
1024// - HCI events are logged when they arrive
1025//
1026// Low level log from system/bt
1027//
1028// Bluetooth classic commands:
1029// - CMD_CREATE_CONNECTION
1030// - CMD_DISCONNECT
1031// - CMD_CREATE_CONNECTION_CANCEL
1032// - CMD_ACCEPT_CONNECTION_REQUEST
1033// - CMD_REJECT_CONNECTION_REQUEST
1034// - CMD_SETUP_ESCO_CONNECTION
1035// - CMD_ACCEPT_ESCO_CONNECTION
1036// - CMD_REJECT_ESCO_CONNECTION
1037// - CMD_ENH_SETUP_ESCO_CONNECTION
1038// - CMD_ENH_ACCEPT_ESCO_CONNECTION
1039//
1040// Bluetooth low energy commands:
1041// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
1042// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
1043// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
1044// - CMD_BLE_CLEAR_WHITE_LIST
1045// - CMD_BLE_ADD_WHITE_LIST
1046// - CMD_BLE_REMOVE_WHITE_LIST
1047//
1048// Bluetooth classic events:
1049// - EVT_CONNECTION_COMP
1050// - EVT_CONNECTION_REQUEST
1051// - EVT_DISCONNECTION_COMP
1052// - EVT_ESCO_CONNECTION_COMP
1053// - EVT_ESCO_CONNECTION_CHANGED
1054//
1055// Bluetooth low energy meta events:
1056// - BLE_EVT_CONN_COMPLETE_EVT
1057// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
1058//
1059// Next tag: 10
1060message BluetoothLinkLayerConnectionEvent {
1061 // An identifier that can be used to match events for this device.
1062 // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1063 // Salt: Randomly generated 256 bit value
1064 // Hash algorithm: HMAC-SHA256
1065 // Size: 32 byte
1066 // Default: null or empty if the device identifier is not known
1067 optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1068 // Connection handle of this connection if available
1069 // Range: 0x0000 - 0x0EFF (12 bits)
1070 // Default: 0xFFFF if the handle is unknown
1071 optional int32 connection_handle = 2;
1072 // Direction of the link
1073 // Default: DIRECTION_UNKNOWN
1074 optional android.bluetooth.DirectionEnum direction = 3;
1075 // Type of this link
1076 // Default: LINK_TYPE_UNKNOWN
1077 optional android.bluetooth.LinkTypeEnum type = 4;
1078
1079 // Reason metadata for this link layer connection event, rules for interpretation:
1080 // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
1081 // EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
1082 // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
1083 // set and valid, ignore hci_ble_event
1084
1085 // HCI command associated with this event
1086 // Default: CMD_UNKNOWN
1087 optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
1088 // HCI event associated with this event
1089 // Default: EVT_UNKNOWN
1090 optional android.bluetooth.hci.EventEnum hci_event = 6;
1091 // HCI BLE meta event associated with this event
1092 // Default: BLE_EVT_UNKNOWN
1093 optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
1094 // HCI command status code if this is triggerred by hci_cmd
1095 // Default: STATUS_UNKNOWN
1096 optional android.bluetooth.hci.StatusEnum cmd_status = 8;
1097 // HCI reason code associated with this event
1098 // Default: STATUS_UNKNOWN
1099 optional android.bluetooth.hci.StatusEnum reason_code = 9;
1100}
1101
1102
Tej Singh5d991e12018-03-09 19:48:11 -08001103/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001104 * Logs when something is plugged into or removed from the USB-C connector.
1105 *
1106 * Logged from:
1107 * Vendor USB HAL.
1108 */
1109message UsbConnectorStateChanged {
1110 enum State {
1111 DISCONNECTED = 0;
1112 CONNECTED = 1;
1113 }
1114 optional State state = 1;
1115}
1116
1117/**
1118 * Logs the reported speaker impedance.
1119 *
1120 * Logged from:
1121 * Vendor audio implementation.
1122 */
1123message SpeakerImpedanceReported {
1124 optional int32 speaker_location = 1;
1125 optional int32 impedance = 2;
1126}
1127
1128/**
1129 * Logs the report of a failed hardware.
1130 *
1131 * Logged from:
1132 * Vendor HALs.
1133 *
1134 */
1135message HardwareFailed {
1136 enum HardwareType {
1137 HARDWARE_FAILED_UNKNOWN = 0;
1138 HARDWARE_FAILED_MICROPHONE = 1;
1139 HARDWARE_FAILED_CODEC = 2;
1140 HARDWARE_FAILED_SPEAKER = 3;
1141 HARDWARE_FAILED_FINGERPRINT = 4;
1142 }
1143 optional HardwareType hardware_type = 1;
1144
1145 /* hardware_location allows vendors to differentiate between multiple instances of
1146 * the same hardware_type. The specific locations are vendor defined integers,
1147 * referring to board-specific numbering schemes.
1148 */
1149 optional int32 hardware_location = 2;
1150
1151 /* failure_code is specific to the HardwareType of the failed hardware.
1152 * It should use the enum values defined below.
1153 */
1154 enum MicrophoneFailureCode {
1155 MICROPHONE_FAILURE_COMPLETE = 0;
1156 }
1157 enum CodecFailureCode {
1158 CODEC_FAILURE_COMPLETE = 0;
1159 }
1160 enum SpeakerFailureCode {
1161 SPEAKER_FAILURE_COMPLETE = 0;
1162 SPEAKER_FAILURE_HIGH_Z = 1;
1163 SPEAKER_FAILURE_SHORT = 2;
1164 }
1165 enum FingerprintFailureCode {
1166 FINGERPRINT_FAILURE_COMPLETE = 0;
1167 FINGERPRINT_SENSOR_BROKEN = 1;
1168 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1169 }
1170 optional int32 failure_code = 3;
1171}
1172
1173/**
1174 * Log an event when the device has been physically dropped.
1175 * Reported from the /vendor partition.
1176 */
1177message PhysicalDropDetected {
1178 // Confidence that the event was actually a drop, 0 -> 100
1179 optional int32 confidence_pctg = 1;
1180 // Peak acceleration of the drop, in 1/1000s of a g.
1181 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001182 // Duration of freefall in ms
1183 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001184}
1185
1186/**
1187 * Log bucketed battery charge cycles.
1188 *
1189 * Each bucket represents cycles of the battery past
1190 * a given charge point. For example, bucket 1 is the
1191 * lowest 1/8th of the battery, and bucket 8 is 100%.
1192 *
1193 * Logged from:
1194 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1195 */
1196message ChargeCyclesReported {
1197 optional int32 cycle_bucket_1 = 1;
1198 optional int32 cycle_bucket_2 = 2;
1199 optional int32 cycle_bucket_3 = 3;
1200 optional int32 cycle_bucket_4 = 4;
1201 optional int32 cycle_bucket_5 = 5;
1202 optional int32 cycle_bucket_6 = 6;
1203 optional int32 cycle_bucket_7 = 7;
1204 optional int32 cycle_bucket_8 = 8;
1205}
1206
1207/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001208 * Logs the duration of a davey (jank of >=700ms) when it occurs
1209 *
1210 * Logged from:
1211 * frameworks/base/libs/hwui/JankTracker.cpp
1212 */
1213message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001214 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001215 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001216
Tej Singhbb8554a2018-01-26 11:59:14 -08001217 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001218 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001219}
1220
1221/**
Bookatze5885242017-10-24 20:10:31 -07001222 * Logs phone signal strength changes.
1223 *
1224 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001225 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001226 */
1227message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001228 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1229 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001230}
1231
Yangster4ccebea2018-10-09 17:09:02 -07001232
1233/**
1234 * Logs when the phone state, sim state or signal strength changes
1235 *
1236 * Logged from:
1237 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1238 */
1239message PhoneServiceStateChanged {
1240 optional android.telephony.ServiceStateEnum state = 1;
1241 optional android.telephony.SimStateEnum sim_state = 2;
1242 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1243}
1244
1245/**
1246 * Logs when the phone becomes on or off.
1247 *
1248 * Logged from:
1249 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1250 */
1251message PhoneStateChanged {
1252 enum State {
1253 OFF = 0;
1254 ON = 1;
1255 }
1256 optional State state = 1;
1257}
1258
Hyunyoung Songcc651c12018-10-17 13:35:32 -07001259message LauncherUIChanged {
Yao Chen046b5122018-10-24 14:09:20 -07001260 optional android.stats.launcher.LauncherAction action = 1;
1261 optional android.stats.launcher.LauncherState src_state = 2;
1262 optional android.stats.launcher.LauncherState dst_state = 3;
1263 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songcc651c12018-10-17 13:35:32 -07001264 optional bool is_swipe_up_enabled = 5;
1265}
1266
David Chenc28b2bb2017-10-24 12:52:52 -07001267/**
1268 * Logs that a setting was updated.
1269 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001270 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001271 * The tag and is_default allow resetting of settings to default values based on the specified
1272 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1273 */
1274message SettingChanged {
1275 // The name of the setting.
1276 optional string setting = 1;
1277
1278 // The change being imposed on this setting. May represent a number, eg "3".
1279 optional string value = 2;
1280
1281 // The new value of this setting. For most settings, this is same as value. For some settings,
1282 // value is +X or -X where X represents an element in a set. For example, if the previous value
1283 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1284 // The +/- feature is currently only used for location_providers_allowed.
1285 optional string new_value = 3;
1286
1287 // The previous value of this setting.
1288 optional string prev_value = 4;
1289
1290 // The tag used with the is_default for resetting sets of settings. This is generally null.
1291 optional string tag = 5;
1292
Bookatz90867622018-01-31 15:05:57 -08001293 // True if this setting with tag should be resettable.
1294 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001295
David Chenbd789912018-03-16 17:19:55 -07001296 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001297 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001298
1299 enum ChangeReason {
1300 UPDATED = 1; // Updated can be an insertion or an update.
1301 DELETED = 2;
1302 }
1303 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001304}
Chenjie Yub3dda412017-10-24 13:41:59 -07001305
Chenjie Yu05013b32017-11-21 10:21:41 -08001306/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001307 * Logs activity going to foreground or background
1308 *
1309 * Logged from:
1310 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1311 */
1312message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001313 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001314 optional string pkg_name = 2;
1315 optional string class_name = 3;
1316
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001317 enum State {
1318 BACKGROUND = 0;
1319 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001320 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001321 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001322}
David Chenc8a43242017-10-17 16:23:28 -07001323
1324/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001325 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001326 * Logged from:
1327 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1328 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001329message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001330 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001331
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001332 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001333
1334 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001335 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001336 optional string process_name = 3;
1337
1338 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001339 optional sint32 pid = 4;
Chenjie Yuf17bf62f2018-04-02 14:22:19 -07001340
1341 optional string package_name = 5;
1342
1343 enum InstantApp {
1344 UNAVAILABLE = 0;
1345 FALSE = 1;
1346 TRUE = 2;
1347 }
1348 optional InstantApp is_instant_app = 6;
1349
1350 enum ForegroundState {
1351 UNKNOWN = 0;
1352 BACKGROUND = 1;
1353 FOREGROUND = 2;
1354 }
1355 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001356}
David Chen9e3808c2017-11-20 17:25:34 -08001357
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001358/**
1359 * Logs when a WTF (What a Terrible Failure) happened.
1360 * Logged from:
1361 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1362 */
1363message WTFOccurred {
1364 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001365
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001366 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001367
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001368 // The name of the process.
1369 // system_server if it is not by an app
1370 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001371
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001372 // The pid if available. -1 means not available.
1373 optional sint32 pid = 4;
1374}
1375
1376/**
1377 * Logs when system server reports low memory.
1378 * Logged from:
1379 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1380 */
1381message LowMemReported {
1382}
1383
1384/**
1385 * Logs when an app ANR (App Not Responding) occurs.
1386 * Logged from:
1387 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1388 */
1389message ANROccurred {
1390 optional int32 uid = 1 [(is_uid) = true];
1391
1392 optional string process_name = 2;
1393
1394 optional string short_component_name = 3;
1395
1396 optional string reason = 4;
Chenjie Yuf17bf62f2018-04-02 14:22:19 -07001397
1398 enum InstantApp {
1399 UNAVAILABLE = 0;
1400 FALSE = 1;
1401 TRUE = 2;
1402 }
1403 optional InstantApp is_instant_app = 5;
1404
1405 enum ForegroundState {
1406 UNKNOWN = 0;
1407 BACKGROUND = 1;
1408 FOREGROUND = 2;
1409 }
1410 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001411}
1412
David Chen0a368b22017-12-06 16:28:16 -08001413/*
1414 * Allows other apps to push events into statsd.
1415 * Logged from:
1416 * frameworks/base/core/java/android/util/StatsLog.java
1417 */
David Chen0b5c90c2018-01-25 16:51:49 -08001418message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001419 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001420 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001421
1422 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1423 optional int32 label = 2;
1424
1425 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1426 // predicates for the metrics).
1427 enum State {
1428 UNKNOWN = 0;
1429 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1430 STOP = 2;
1431 START = 3;
1432 }
1433 optional State state = 3;
1434}
1435
David Chen9e3808c2017-11-20 17:25:34 -08001436/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001437 * Logs when statsd detects an anomaly.
1438 *
1439 * Logged from:
1440 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1441 */
1442message AnomalyDetected {
1443 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001444 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001445
Yangster-mac94e197c2018-01-02 16:03:03 -08001446 // Id of the config whose anomaly detection alert fired.
1447 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001448
Yangster-mac94e197c2018-01-02 16:03:03 -08001449 // Id of the alert (i.e. name of the anomaly that was detected).
1450 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001451}
1452
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001453message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001454 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001455 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001456
1457 // The app package name.
1458 optional string pkg_name = 2;
1459
1460 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001461 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001462 WARM = 1;
1463 HOT = 2;
1464 COLD = 3;
1465 }
1466 // The transition type.
1467 optional TransitionType type = 3;
1468
1469 // The activity name.
1470 optional string activity_name = 4;
1471
1472 // The name of the calling app. Empty if not set.
1473 optional string calling_pkg_name = 5;
1474
1475 // Whether the app is an instant app.
1476 optional bool is_instant_app = 6;
1477
1478 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001479 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001480
Bookatz80d11a02018-01-16 10:46:35 -08001481 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001482
David Chen0b5c90c2018-01-25 16:51:49 -08001483 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001484 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001485 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001486 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001487 optional int32 bind_application_delay_millis = 11;
1488 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001489
1490 // Empty if not set.
1491 optional string launch_token = 13;
1492
Calin Juravle759fbda2018-02-20 19:52:30 +00001493 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001494 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001495
1496 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001497 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001498}
1499
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001500message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001501 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001502 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001503
1504 // The app package name.
1505 optional string pkg_name = 2;
1506
1507 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001508 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001509 WARM = 1;
1510 HOT = 2;
1511 COLD = 3;
1512 }
1513 // The transition type.
1514 optional TransitionType type = 3;
1515
1516 // The activity name.
1517 optional string activity_name = 4;
1518}
1519
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001520message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001521 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001522 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001523
1524 // The app package name.
1525 optional string pkg_name = 2;
1526
1527 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001528 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001529 WITH_BUNDLE = 1;
1530 WITHOUT_BUNDLE = 2;
1531 }
1532 // The transition type.
1533 optional TransitionType type = 3;
1534
1535 // The activity name.
1536 optional string activity_name = 4;
1537
1538 optional bool transition_process_running = 5;
1539
1540 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001541 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001542}
1543
Bookatz8fcd09a2017-12-18 13:01:10 -08001544/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001545 * Logs a picture-in-picture action
1546 * Logged from:
1547 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1548 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1549 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1550 */
1551message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001552 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001553 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001554
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001555 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001556
Chenjie Yu52cacc62017-12-08 18:11:45 -08001557 enum State {
1558 ENTERED = 1;
1559 EXPANDED_TO_FULL_SCREEN = 2;
1560 MINIMIZED = 3;
1561 DISMISSED = 4;
1562 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001563 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001564}
1565
1566/**
Chenjie Yue8904192017-12-08 19:12:57 -08001567 * Logs overlay action
1568 * Logged from:
1569 * services/core/java/com/android/server/wm/Session.java
1570 */
1571message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001572 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001573
1574 optional string package_name = 2;
1575
1576 optional bool using_alert_window = 3;
1577
1578 enum State {
1579 ENTERED = 1;
1580 EXITED = 2;
1581 }
1582 optional State state = 4;
1583}
1584
Chenjie Yuccfe6452018-01-30 11:33:21 -08001585/*
1586 * Logs foreground service starts and stops.
1587 * Note that this is not when a service starts or stops, but when it is
1588 * considered foreground.
1589 * Logged from
1590 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1591 */
1592message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001593 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001594 // package_name + "/" + class_name
1595 optional string short_name = 2;
1596
1597 enum State {
1598 ENTER = 1;
1599 EXIT = 2;
1600 }
1601 optional State state = 3;
1602}
1603
Chenjie Yue8904192017-12-08 19:12:57 -08001604/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001605 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1606 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1607 * attributed back to the parent (host) uid. One example is Chrome.
1608 *
1609 * Logged from:
1610 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1611 */
1612message IsolatedUidChanged {
1613 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001614 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001615 optional int32 parent_uid = 1;
1616
1617 optional int32 isolated_uid = 2;
1618
1619 // We expect an isolated uid to be removed before if it's used for another parent uid.
1620 enum Event {
1621 REMOVED = 0;
1622 CREATED = 1;
1623 }
1624 optional Event event = 3;
1625}
1626
1627/*
1628 * Logs the reception of an incoming network packet causing the main system to wake up for
1629 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1630 * and processed by WakeupController.cpp.
1631 */
1632message PacketWakeupOccurred {
1633 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1634 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001635 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001636 // The interface name on which the packet was received.
1637 optional string iface = 2;
1638 // The ethertype value of the packet.
1639 optional int32 ethertype = 3;
1640 // String representation of the destination MAC address of the packet.
1641 optional string destination_hardware_address = 4;
1642 // String representation of the source address of the packet if this was an IP packet.
1643 optional string source_ip = 5;
1644 // String representation of the destination address of the packet if this was an IP packet.
1645 optional string destination_ip = 6;
1646 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1647 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1648 // families.
1649 optional int32 ip_next_header = 7;
1650 // The source port if this was a TCP or UDP packet.
1651 optional int32 source_port = 8;
1652 // The destination port if this was a TCP or UDP packet.
1653 optional int32 destination_port = 9;
1654}
1655
1656/*
1657 * Logs the memory stats for an app on startup.
1658 * Logged from:
1659 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1660 */
1661message AppStartMemoryStateCaptured {
1662 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001663 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001664
1665 // The process name.
1666 optional string process_name = 2;
1667
1668 // The activity name.
1669 optional string activity_name = 3;
1670
1671 // # of page-faults
1672 optional int64 pgfault = 4;
1673
1674 // # of major page-faults
1675 optional int64 pgmajfault = 5;
1676
1677 // RSS
1678 optional int64 rss_in_bytes = 6;
1679
1680 // CACHE
1681 optional int64 cache_in_bytes = 7;
1682
1683 // SWAP
1684 optional int64 swap_in_bytes = 8;
1685}
1686
1687/*
1688 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1689 * for LMK event.
1690 * Logged from:
1691 * system/core/lmkd/lmkd.c
1692 */
1693message LmkStateChanged {
1694 enum State {
1695 UNKNOWN = 0;
1696 START = 1;
1697 STOP = 2;
1698 }
1699 optional State state = 1;
1700}
1701
1702/*
1703 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1704 * Logged from:
1705 * system/core/lmkd/lmkd.c
1706 */
1707message LmkKillOccurred {
1708 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001709 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001710
1711 // The process name.
1712 optional string process_name = 2;
1713
1714 // oom adj score.
1715 optional int32 oom_score = 3;
1716
1717 // # of page-faults
1718 optional int64 pgfault = 4;
1719
1720 // # of major page-faults
1721 optional int64 pgmajfault = 5;
1722
1723 // RSS
1724 optional int64 rss_in_bytes = 6;
1725
1726 // CACHE
1727 optional int64 cache_in_bytes = 7;
1728
1729 // SWAP
1730 optional int64 swap_in_bytes = 8;
Jim Blackler972a5c52018-11-21 15:24:48 +00001731
1732 // The elapsed real time of start of the process.
1733 optional int64 process_start_time_nanos = 9;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001734}
1735
Rajeev Kumar51b54602018-03-01 12:18:26 -08001736/*
1737 * Logs when the ActivityManagerService detects that an app died.
1738 *
1739 * Logged from:
1740 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1741 */
1742message AppDied {
1743 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001744 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001745}
1746
Chenjie Yubbcbc602018-02-05 16:51:52 -08001747//////////////////////////////////////////////////////////////////////
1748// Pulled atoms below this line //
1749//////////////////////////////////////////////////////////////////////
1750
1751/**
David Chenc8a43242017-10-17 16:23:28 -07001752 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1753 *
1754 * Pulled from:
1755 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1756 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001757message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001758 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001759
1760 optional int64 rx_bytes = 2;
1761
1762 optional int64 rx_packets = 3;
1763
1764 optional int64 tx_bytes = 4;
1765
1766 optional int64 tx_packets = 5;
1767}
1768
1769/**
1770 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1771 *
1772 * Pulled from:
1773 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1774 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001775message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001776 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001777
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001778 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1779 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001780
1781 optional int64 rx_bytes = 3;
1782
1783 optional int64 rx_packets = 4;
1784
1785 optional int64 tx_bytes = 5;
1786
1787 optional int64 tx_packets = 6;
1788}
1789
1790/**
1791 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1792 *
1793 * Pulled from:
1794 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1795 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001796message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001797 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001798
1799 optional int64 rx_bytes = 2;
1800
1801 optional int64 rx_packets = 3;
1802
1803 optional int64 tx_bytes = 4;
1804
1805 optional int64 tx_packets = 5;
1806}
1807
1808/**
1809 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1810 *
1811 * Pulled from:
1812 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1813 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001814message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001815 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001816
Yao Chenc40a19d2018-03-15 16:48:25 -07001817 // 1 denotes foreground and 0 denotes background. This is called Set in
1818 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001819 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001820
1821 optional int64 rx_bytes = 3;
1822
1823 optional int64 rx_packets = 4;
1824
1825 optional int64 tx_bytes = 5;
1826
1827 optional int64 tx_packets = 6;
1828}
1829
1830/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001831 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1832 *
1833 * Pulled from:
1834 * StatsCompanionService
1835 */
1836message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001837 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001838
1839 optional int64 rx_bytes = 2;
1840
1841 optional int64 tx_bytes = 3;
1842}
1843
1844/**
David Chenc8a43242017-10-17 16:23:28 -07001845 * Pulls the kernel wakelock durations. This atom is adapted from
1846 * android/internal/os/KernelWakelockStats.java
1847 *
1848 * Pulled from:
1849 * StatsCompanionService using KernelWakelockReader.
1850 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001851message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001852 optional string name = 1;
1853
1854 optional int32 count = 2;
1855
1856 optional int32 version = 3;
1857
1858 optional int64 time = 4;
1859}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001860
Chenjie Yu05013b32017-11-21 10:21:41 -08001861/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001862 * Pulls low power state information. This includes platform and subsystem sleep state information,
1863 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001864 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001865 * hardware/interfaces/power/1.1/types.hal
1866 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001867message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001868 // Subsystem name
1869 optional string subsystem_name = 1;
1870 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1871 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1872 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001873 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001874 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001875 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001876 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001877}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001878
Chenjie Yu05013b32017-11-21 10:21:41 -08001879/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001880 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001881 * Pulls the time the cpu spend on the frequency index. Frequency index
1882 * starts from highest to lowest. The value should be monotonically
1883 * increasing since boot. However, if there is a cpu
1884 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001885 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001886message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001887 optional uint32 cluster = 1;
1888 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001889 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001890}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001891
Chenjie Yu05013b32017-11-21 10:21:41 -08001892/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001893 * Pulls Cpu Time Per Uid.
1894 * Note that isolated process uid time should be attributed to host uids.
1895 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001896message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001897 optional int32 uid = 1 [(is_uid) = true];
Misha Wagner6bc6c912018-11-16 13:19:54 +00001898 optional uint64 user_time_micros = 2;
1899 optional uint64 sys_time_micros = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001900}
1901
1902/**
1903 * Pulls Cpu Time Per Uid per frequency.
1904 * Note that isolated process uid time should be attributed to host uids.
1905 * For each uid, we order the time by descending frequencies.
1906 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001907message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001908 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001909 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001910 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001911}
Hugo Benichi884970e2017-11-14 22:42:46 +09001912
Chenjie Yu05013b32017-11-21 10:21:41 -08001913/**
1914 * Pulls Wifi Controller Activity Energy Info
1915 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001916message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001917 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001918 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001919 // stack reported state
1920 // TODO: replace this with proto enum
1921 optional int32 stack_state = 2;
1922 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001923 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001924 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001925 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001926 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001927 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001928 // product of current(mA), voltage(V) and time(ms)
1929 optional uint64 controller_energy_used = 6;
1930}
1931
1932/**
1933 * Pulls Modem Activity Energy Info
1934 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001935message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001936 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001937 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001938 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001939 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001940 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001941 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001942 /**
1943 * Tx power index
1944 * index 0 = tx_power < 0dBm
1945 * index 1 = 0dBm < tx_power < 5dBm
1946 * index 2 = 5dBm < tx_power < 15dBm
1947 * index 3 = 15dBm < tx_power < 20dBm
1948 * index 4 = tx_power > 20dBm
1949 */
1950 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001951 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001952 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001953 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001954 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001955 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001956 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001957 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001958 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001959 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001960 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001961 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001962 // product of current(mA), voltage(V) and time(ms)
1963 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001964}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001965
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001966/**
1967 * Pulls Bluetooth Activity Energy Info
1968 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1969 */
1970message BluetoothActivityInfo {
1971 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001972 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001973 // bluetooth stack state
1974 optional int32 bluetooth_stack_state = 2;
1975 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001976 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001977 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001978 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001979 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001980 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001981 // product of current(mA), voltage(V) and time(ms)
1982 optional uint64 energy_used = 6;
1983}
1984
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001985/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001986 * Logs the memory stats for a process.
1987 */
1988message ProcessMemoryState {
1989 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001990 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001991
1992 // The process name.
1993 optional string process_name = 2;
1994
1995 // oom adj score.
1996 optional int32 oom_score = 3;
1997
1998 // # of page-faults
1999 optional int64 pgfault = 4;
2000
2001 // # of major page-faults
2002 optional int64 pgmajfault = 5;
2003
Rajeev Kumar90235992018-01-29 11:06:48 -08002004 // RSS
2005 optional int64 rss_in_bytes = 6;
2006
2007 // CACHE
2008 optional int64 cache_in_bytes = 7;
2009
2010 // SWAP
2011 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002012}
2013
2014/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002015 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002016 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002017message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002018 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002019}
2020
2021/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002022 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002023 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002024message SystemUptime {
2025 // Milliseconds since the system was booted.
2026 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2027 // for external input).
2028 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002029 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002030}
2031
2032/*
2033 * Reads from /proc/uid_concurrent_active_time which has the format:
2034 * active: X (X is # cores)
2035 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2036 * [uid1]: [time-0] [time-1] [time-2] ... ...
2037 * ...
2038 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2039 * The file contains a monotonically increasing count of time for a single boot.
2040 */
2041message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002042 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002043 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002044}
2045
2046/**
2047 * Reads from /proc/uid_concurrent_policy_time which has the format:
2048 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2049 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2050 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2051 * ...
2052 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2053 * The file contains a monotonically increasing count of time for a single boot.
2054 */
2055message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002056 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002057 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002058 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002059}
2060
2061/*
2062 * Pulls free disk space, for data, system partition and temporary directory.
2063 */
2064message DiskSpace {
2065 // available bytes in data partition
2066 optional uint64 data_available_bytes = 1;
2067 // available bytes in system partition
2068 optional uint64 system_available_bytes = 2;
2069 // available bytes in download cache or temp directories
2070 optional uint64 temp_available_bytes = 3;
2071}
Tej Singhbf972d92018-01-10 20:51:13 -08002072
2073/**
2074 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002075 * Pulled from:
2076 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002077 */
2078message RemainingBatteryCapacity {
2079 optional int32 charge_uAh = 1;
2080}
2081
2082/**
2083 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002084 * Pulled from:
2085 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002086 */
2087message FullBatteryCapacity {
2088 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002089}
2090
2091/**
Tej Singhd89137e2018-03-26 14:51:40 -07002092 * Pulls the temperature of various parts of the device.
2093 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002094 *
2095 * Pulled from:
2096 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2097 */
2098message Temperature {
2099 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2100 optional android.os.TemperatureTypeEnum sensor_location = 1;
2101
2102 // The name of the temperature source. Eg. CPU0
2103 optional string sensor_name = 2;
2104
Tej Singhd89137e2018-03-26 14:51:40 -07002105 // Temperature in tenths of a degree C.
2106 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002107}
lifr35a7cf02018-12-12 16:38:04 +08002108
2109/**
2110 * Logs the latency period(in microseconds) and the return code of
2111 * the DNS(Domain Name System) lookups.
2112 * These 4 methods(GETADDRINFO,GETHOSTBYNAME,GETHOSTBYADDR,RES_NSEND)
2113 * to get info(address or hostname) from DNS server(or DNS cache).
2114 * Logged from:
2115 * /system/netd/server/DnsProxyListener.cpp
2116 */
2117message NetworkDnsEventReported {
2118 // The types of the DNS lookups, as defined in
2119 //system/netd/server/binder/android/net/metrics/INetdEventListener.aidl
2120 enum EventType {
2121 EVENT_UNKNOWN = 0;
2122 EVENT_GETADDRINFO = 1;
2123 EVENT_GETHOSTBYNAME = 2;
2124 EVENT_GETHOSTBYADDR = 3;
2125 EVENT_RES_NSEND = 4;
2126 }
2127 optional EventType event_type = 1;
2128
2129 // The return value of the DNS resolver for each DNS lookups.
2130 //bionic/libc/include/netdb.h
2131 //system/netd/resolv/include/netd_resolv/resolv.h
2132 enum ReturnCode {
2133 EAI_NO_ERROR = 0;
2134 EAI_ADDRFAMILY = 1;
2135 EAI_AGAIN = 2;
2136 EAI_BADFLAGS = 3;
2137 EAI_FAIL = 4;
2138 EAI_FAMILY = 5;
2139 EAI_MEMORY = 6;
2140 EAI_NODATA = 7;
2141 EAI_NONAME = 8;
2142 EAI_SERVICE = 9;
2143 EAI_SOCKTYPE = 10;
2144 EAI_SYSTEM = 11;
2145 EAI_BADHINTS = 12;
2146 EAI_PROTOCOL = 13;
2147 EAI_OVERFLOW = 14;
2148 RESOLV_TIMEOUT = 255;
2149 EAI_MAX = 256;
2150 }
2151 optional ReturnCode return_code = 2;
2152
2153 // The latency period(in microseconds) it took for this DNS lookup to complete.
2154 optional int32 latency_micros = 3;
2155}
2156
Chiachang Wang67f24472019-01-15 15:14:00 +08002157/**
2158 * Logs when a data stall event occurs.
2159 *
2160 * Log from:
2161 * frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2162 */
2163message DataStallEvent {
2164 // Data stall evaluation type.
2165 // See frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2166 // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
2167 optional int32 evaluation_type = 1;
2168 // See definition in data_stall_event.proto.
2169 optional com.android.server.connectivity.ProbeResult validation_result = 2;
2170 // See definition in data_stall_event.proto.
2171 optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
2172 // See definition in data_stall_event.proto.
2173 optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
2174 // See definition in data_stall_event.proto.
2175 optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
2176 // See definition in data_stall_event.proto.
2177 optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
2178}