blob: 38130c89ce5ad2ce37e2d7af9d4df158d214a1f2 [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";
Jack He22e4a1d2019-01-09 01:19:13 -080028import "frameworks/base/core/proto/android/bluetooth/hfp/enums.proto";
Chiachang Wang67f24472019-01-15 15:14:00 +080029import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/os/enums.proto";
Chiachang Wang67f24472019-01-15 15:14:00 +080031import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080032import "frameworks/base/core/proto/android/server/enums.proto";
Yao Chen046b5122018-10-24 14:09:20 -070033import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080034import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080035import "frameworks/base/core/proto/android/telephony/enums.proto";
36import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080037
Yao Chend54f9dd2017-10-17 17:37:48 +000038/**
Stefan Lafonae2df012017-11-14 09:17:21 -080039 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000040 * raw stats log events from the Android system, also known as "atoms."
41 *
42 * This field contains a single oneof with all of the available messages.
43 * The stats-log-api-gen tool runs as part of the Android build and
44 * generates the android.util.StatsLog class, which contains the constants
45 * and methods that Android uses to log.
46 *
Stefan Lafonae2df012017-11-14 09:17:21 -080047 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000048 * Instead, statsd on Android constructs these messages synthetically,
49 * in the format defined here and in stats_log.proto.
50 */
Stefan Lafonae2df012017-11-14 09:17:21 -080051message Atom {
52 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070053 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070054 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
55 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080056 // 3 is available for use
Bookatzc1a050a2017-10-10 15:49:28 -070057 BleScanResultReceived ble_scan_result_received = 4;
58 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080059 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070060 SyncStateChanged sync_state_changed = 7;
61 ScheduledJobStateChanged scheduled_job_state_changed = 8;
62 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070063 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080064 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
65 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
66 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Hyunyoung Songcc651c12018-10-17 13:35:32 -070067 // 14 - 18 are available
68 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080069 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
70 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
71 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070072 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080073 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070074 CameraStateChanged camera_state_changed = 25;
75 FlashlightStateChanged flashlight_state_changed = 26;
76 UidProcessStateChanged uid_process_state_changed = 27;
77 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
78 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070079 BatteryLevelChanged battery_level_changed = 30;
80 ChargingStateChanged charging_state_changed = 31;
81 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080082 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070083 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
84 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070085 WifiLockStateChanged wifi_lock_state_changed = 37;
86 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
87 WifiScanStateChanged wifi_scan_state_changed = 39;
88 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070089 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070090 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070091 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090092 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080093 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080094 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080095 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080096 AppStartOccurred app_start_occurred = 48;
97 AppStartCanceled app_start_canceled = 49;
98 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080099 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800100 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800101 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800102 LmkStateChanged lmk_state_changed = 54;
103 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800104 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800105 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800106 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800107 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800108 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800109 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800110 KeyguardStateChanged keyguard_state_changed = 62;
111 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
112 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800113 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800114 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800115 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
116 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700117 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700118 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800119 SpeakerImpedanceReported speaker_impedance_reported = 71;
120 HardwareFailed hardware_failed = 72;
121 PhysicalDropDetected physical_drop_detected = 73;
122 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800123 MobileConnectionStateChanged mobile_connection_state_changed = 75;
124 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700125 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800126 AppCrashOccurred app_crash_occurred = 78;
127 ANROccurred anr_occurred = 79;
128 WTFOccurred wtf_occurred = 80;
Yangster4ccebea2018-10-09 17:09:02 -0700129 PhoneServiceStateChanged phone_service_state_changed = 94;
130 PhoneStateChanged phone_state_changed = 95;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800131 LowMemReported low_mem_reported = 81;
lifr35a7cf02018-12-12 16:38:04 +0800132 NetworkDnsEventReported network_dns_event_reported = 116;
Chiachang Wang67f24472019-01-15 15:14:00 +0800133 DataStallEvent data_stall_event = 121;
Jack He52260142018-12-18 15:43:27 -0800134 BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event = 125;
Jack He22e4a1d2019-01-09 01:19:13 -0800135 BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed = 126;
136 BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed = 127;
Yao Chend54f9dd2017-10-17 17:37:48 +0000137 }
David Chenc8a43242017-10-17 16:23:28 -0700138
David Chen6e3e6cb2018-01-03 16:14:06 -0800139 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800140 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700141 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800142 WifiBytesTransfer wifi_bytes_transfer = 10000;
143 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
144 MobileBytesTransfer mobile_bytes_transfer = 10002;
145 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800146 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800147 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800148 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800149 CpuTimePerFreq cpu_time_per_freq = 10008;
150 CpuTimePerUid cpu_time_per_uid = 10009;
151 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800152 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800153 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800154 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800155 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800156 SystemElapsedRealtime system_elapsed_realtime = 10014;
157 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800158 CpuActiveTime cpu_active_time = 10016;
159 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800160 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800161 RemainingBatteryCapacity remaining_battery_capacity = 10019;
162 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800163 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700164 }
yroa1fe77c2018-02-26 14:22:54 -0800165
Bookatz76aafcf2018-09-17 16:17:10 -0700166 // DO NOT USE field numbers above 100,000 in AOSP.
167 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
168 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700169}
170
Yao Chend54f9dd2017-10-17 17:37:48 +0000171/**
Yangster-mac20877162017-12-22 17:19:39 -0800172 * This proto represents a node of an attribution chain.
173 * Note: All attribution chains are represented as a repeated field of type
174 * AttributionNode. It is understood that in such arrays, the order is that
175 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000176 */
Yangster-mac20877162017-12-22 17:19:39 -0800177message AttributionNode {
178 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800179 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800180
Yangster-mac20877162017-12-22 17:19:39 -0800181 // The (optional) string tag for an element in the attribution chain. If the
182 // element has no tag, it is encoded as an empty string.
183 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700184}
185
Yao Chend54f9dd2017-10-17 17:37:48 +0000186/*
187 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800188 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000189 *
190 * RULES:
191 * - The field ids for each atom must start at 1, and count upwards by 1.
192 * Skipping field ids is not allowed.
193 * - These form an API, so renaming, renumbering or removing fields is
194 * not allowed between android releases. (This is not currently enforced,
195 * but there will be a tool to enforce this restriction).
196 * - The types must be built-in protocol buffer types, namely, no sub-messages
197 * are allowed (yet). The bytes type is also not allowed.
198 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800199 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000200 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800201 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000202 * - A field that is a uid should be a string field, tagged with the [xxx]
203 * annotation. The generated code on android will be represented by UIDs,
204 * and those UIDs will be translated in xxx to those strings.
205 *
206 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700207 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000208 * - If there is a UID, it goes first. Think in an object-oriented fashion.
209 * *****************************************************************************
210 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700211
Yao Chend54f9dd2017-10-17 17:37:48 +0000212/**
213 * Logs when the screen state changes.
214 *
215 * Logged from:
216 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
217 */
218message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800219 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800220 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700221}
Yao Chend54f9dd2017-10-17 17:37:48 +0000222
223/**
Bookatzc1a050a2017-10-10 15:49:28 -0700224 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000225 *
226 * Logged from:
227 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
228 */
Bookatzc1a050a2017-10-10 15:49:28 -0700229message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700230 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000231
Bookatzdb026a22018-01-10 19:01:56 -0800232 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800233 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000234}
235
236/**
Bookatzc1a050a2017-10-10 15:49:28 -0700237 * Logs that a process started, finished, crashed, or ANRed.
238 *
239 * Logged from:
240 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
241 */
242message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700243 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700244
David Chen0b5c90c2018-01-25 16:51:49 -0800245 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800246 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700247
Bookatzddccf0a2017-11-28 16:48:14 -0800248 // What lifecycle state the process changed to.
249 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800250 enum State {
251 FINISHED = 0;
252 STARTED = 1;
253 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800254 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800255 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700256}
257
Bookatzc1a050a2017-10-10 15:49:28 -0700258/**
259 * Logs when the ble scan state changes.
260 *
261 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700262 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700263 */
264message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800265 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700266
267 enum State {
268 OFF = 0;
269 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700270 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
271 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700272 }
273 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700274
Bookatze5ec0b42018-03-26 13:34:56 -0700275 // Does the scan have a filter.
276 optional bool is_filtered = 3;
277 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
278 optional bool is_first_match = 4;
279 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
280 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700281}
282
283/**
284 * Logs reporting of a ble scan finding results.
285 *
286 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700287 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700288 */
Bookatzae6738e2018-09-13 11:38:56 -0700289// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700290message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800291 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700292
293 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800294 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700295}
296
297/**
298 * Logs when a sensor state changes.
299 *
300 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700301 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700302 */
303message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800304 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700305
Bookatzc1a050a2017-10-10 15:49:28 -0700306 // The id (int) of the sensor.
307 optional int32 sensor_id = 2;
308
309 enum State {
310 OFF = 0;
311 ON = 1;
312 }
313 optional State state = 3;
314}
315
316
317/**
318 * Logs when GPS state changes.
319 *
320 * Logged from:
321 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
322 */
323message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800324 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700325
326 enum State {
327 OFF = 0;
328 ON = 1;
329 }
330 optional State state = 2;
331}
332
333
334/**
335 * Logs when a sync manager sync state changes.
336 *
337 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700338 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700339 */
340message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800341 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700342
David Chen0b5c90c2018-01-25 16:51:49 -0800343 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800344 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700345
346 enum State {
347 OFF = 0;
348 ON = 1;
349 }
350 optional State state = 3;
351}
352
353/**
354 * Logs when a job scheduler job state changes.
355 *
356 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700357 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700358 */
359message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800360 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700361
362 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800363 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700364
365 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800366 FINISHED = 0;
367 STARTED = 1;
368 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700369 }
370 optional State state = 3;
371
Tej Singh33a412b2018-03-16 18:43:59 -0700372 // The reason a job has stopped.
373 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700374 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700375 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700376}
377
378/**
379 * Logs when the audio state changes.
380 *
381 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700382 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700383 */
384message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800385 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700386
387 enum State {
388 OFF = 0;
389 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700390 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
391 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700392 }
393 optional State state = 2;
394}
395
396/**
397 * Logs when the video codec state changes.
398 *
399 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700400 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700401 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800402message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800403 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700404
405 enum State {
406 OFF = 0;
407 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700408 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
409 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700410 }
411 optional State state = 2;
412}
413
414/**
415 * Logs when the flashlight state changes.
416 *
417 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700418 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700419 */
420message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800421 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700422
423 enum State {
424 OFF = 0;
425 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700426 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
427 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700428 }
429 optional State state = 2;
430}
431
432/**
433 * Logs when the camera state changes.
434 *
435 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700436 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700437 */
438message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800439 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700440
441 enum State {
442 OFF = 0;
443 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700444 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
445 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700446 }
447 optional State state = 2;
448}
449
450/**
451 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000452 *
453 * Logged from:
454 * TODO
455 */
Bookatzd6746242017-10-24 18:39:35 -0700456message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800457 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000458
Bookatz1a1b0462018-01-12 11:47:03 -0800459 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
460 // From frameworks/base/core/proto/android/os/enums.proto.
461 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700462
463 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
464 optional string tag = 3;
465
466 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800467 RELEASE = 0;
468 ACQUIRE = 1;
469 CHANGE_RELEASE = 2;
470 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700471 }
472 optional State state = 4;
473}
474
475/**
Bookatzc1a050a2017-10-10 15:49:28 -0700476 * Logs when a partial wakelock is considered 'long' (over 1 min).
477 *
478 * Logged from:
479 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
480 */
481message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800482 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700483
Yao Chend54f9dd2017-10-17 17:37:48 +0000484 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
485 optional string tag = 2;
486
Bookatzc1a050a2017-10-10 15:49:28 -0700487 // TODO: I have no idea what this is.
488 optional string history_tag = 3;
489
490 enum State {
491 OFF = 0;
492 ON = 1;
493 }
494 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000495}
496
Bookatzc1a050a2017-10-10 15:49:28 -0700497/**
498 * Logs Battery Saver state change.
499 *
500 * Logged from:
501 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
502 */
503message BatterySaverModeStateChanged {
504 enum State {
505 OFF = 0;
506 ON = 1;
507 }
508 optional State state = 1;
509}
510
511/**
512 * Logs Doze mode state change.
513 *
514 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800515 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700516 */
517message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800518 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800519}
520
521
522/**
523 * Logs state change of Doze mode including maintenance windows.
524 *
525 * Logged from:
526 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
527 */
528message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800529 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700530}
531
532/**
533 * Logs screen brightness level.
534 *
535 * Logged from:
536 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
537 */
538message ScreenBrightnessChanged {
539 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
540 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700541}
542
543/**
544 * Logs battery level (percent full, from 0 to 100).
545 *
546 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700547 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700548 */
549message BatteryLevelChanged {
550 // Battery level. Should be in [0, 100].
551 optional int32 battery_level = 1;
552}
553
554/**
555 * Logs change in charging status of the device.
556 *
557 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700558 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700559 */
560message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800561 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
562 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700563}
564
565/**
566 * Logs whether the device is plugged in, and what power source it is using.
567 *
568 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700569 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700570 */
571message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800572 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
573 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700574}
575
Bookatz8c6571b2017-10-24 15:04:41 -0700576/**
577 * Logs when an app's wakeup alarm fires.
578 *
579 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700580 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700581 */
582message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800583 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800584
585 // Name of the wakeup alarm.
586 optional string tag = 2;
587}
588
589/**
590 * Logs when an an app causes the mobile radio to change state.
591 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
592 *
593 * Logged from:
594 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
595 */
596message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800597 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800598
Bookatz1a1b0462018-01-12 11:47:03 -0800599 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
600 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800601}
602
603/**
604 * Logs when an an app causes the wifi radio to change state.
605 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
606 *
607 * Logged from:
608 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
609 */
610message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800611 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800612
Bookatz1a1b0462018-01-12 11:47:03 -0800613 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
614 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700615}
616
617/**
618 * Logs kernel wakeup reasons and aborts.
619 *
620 * Logged from:
621 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
622 */
623message KernelWakeupReported {
624 // Name of the kernel wakeup reason (or abort).
625 optional string wakeup_reason_name = 1;
626
627 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800628 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700629}
630
631/**
632 * Logs wifi locks held by an app.
633 *
634 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700635 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700636 */
637message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800638 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700639
640 enum State {
641 OFF = 0;
642 ON = 1;
643 }
644 optional State state = 2;
645}
646
647/**
648 * Logs wifi signal strength changes.
649 *
650 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700651 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700652 */
653message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800654 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
655 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700656}
657
658/**
659 * Logs wifi scans performed by an app.
660 *
661 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700662 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700663 */
664message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800665 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700666
667 enum State {
668 OFF = 0;
669 ON = 1;
670 }
671 optional State state = 2;
672}
673
674/**
Tej Singh4503e102018-01-04 14:35:01 -0800675 * Logs wifi multicast locks held by an app
676 *
677 * Logged from:
678 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
679 */
680message WifiMulticastLockStateChanged {
681 repeated AttributionNode attribution_node = 1;
682
683 enum State {
684 OFF = 0;
685 ON = 1;
686 }
687 optional State state = 2;
688}
689
690/**
Tej Singh1ea42892018-01-19 09:27:00 -0800691 * Logs shutdown reason and duration on next boot.
692 *
693 * Logged from:
694 * frameworks/base/core/java/com/android/server/BootReceiver.java
695 */
696message ShutdownSequenceReported {
697 // True if shutdown is for a reboot. Default: false if we do not know.
698 optional bool reboot = 1;
699
700 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
701 optional string reason = 2;
702
703 // Beginning of shutdown time in ms using wall clock time since unix epoch.
704 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800705 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800706
707 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800708 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800709}
710
Tej Singh6483ea42018-01-25 17:45:49 -0800711
712/**
713 * Logs boot reason and duration.
714 *
715 * Logged from:
716 * system/core/bootstat/bootstat.cpp
717 */
718message BootSequenceReported {
719 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
720 // Default: "<EMPTY>" if not available.
721 optional string bootloader_reason = 1;
722
723 // Reason for system boot. Eg. bootloader, reboot,userrequested
724 // Default: "<EMPTY>" if not available.
725 optional string system_reason = 2;
726
727 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800728 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800729
730 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800731 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800732
733 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800734 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800735
736 // Time since last boot in ms. Default: 0 if not available.
737 optional int64 time_since_last_boot = 6;
738}
739
Tej Singhc477d9c2018-02-05 18:31:39 -0800740
741/**
742 * Logs call state and disconnect cause (if applicable).
743 *
744 * Logged from:
745 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
746 */
747message CallStateChanged {
748 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
749 // From frameworks/base/core/proto/android/telecomm/enums.proto.
750 optional android.telecom.CallStateEnum call_state = 1;
751
752 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
753 // This value is only applicable when the call_state is DISCONNECTED, and
754 // should always be UNKNOWN if the call_state is not DISCONNECTED.
755 // From frameworks/base/core/proto/android/telecomm/enums.proto.
756 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
757
758 // True if the call is self-managed, which are apps that use the
759 // telecom infrastructure to make their own calls.
760 optional bool self_managed = 3;
761
762 // True if call is external. External calls are calls on connected Wear
763 // devices but show up in Telecom so the user can pull them onto the device.
764 optional bool external_call = 4;
765}
766
Tej Singh1ea42892018-01-19 09:27:00 -0800767/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800768 * Logs keyguard state. The keyguard is the lock screen.
769 *
770 * Logged from:
771 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
772 */
773message KeyguardStateChanged {
774 enum State {
775 UNKNOWN = 0;
776 // The keyguard is hidden when the phone is unlocked.
777 HIDDEN = 1;
778 // The keyguard is shown when the phone is locked (screen turns off).
779 SHOWN= 2;
780 // The keyguard is occluded when something is overlaying the keyguard.
781 // Eg. Opening the camera while on the lock screen.
782 OCCLUDED = 3;
783 }
784 optional State state = 1;
785}
786
787/**
788 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
789 * prompts the user to enter a password (pattern, pin, etc).
790 *
791 * Logged from:
792 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
793 */
794
795message KeyguardBouncerStateChanged {
796 enum State {
797 UNKNOWN = 0;
798 // Bouncer is hidden, either as a result of successfully entering the
799 // password, screen timing out, or user going back to lock screen.
800 HIDDEN = 1;
801 // This is when the user is being prompted to enter the password.
802 SHOWN = 2;
803 }
804 optional State state = 1;
805}
806
807/**
808 * Logs the result of entering a password into the keyguard bouncer.
809 *
810 * Logged from:
811 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
812 */
813message KeyguardBouncerPasswordEntered {
814 enum BouncerResult {
815 UNKNOWN = 0;
816 // The password entered was incorrect.
817 FAILURE = 1;
818 // The password entered was correct.
819 SUCCESS = 2;
820 }
821 optional BouncerResult result = 1;
822}
823
Tej Singha883b372018-02-15 11:30:01 -0800824/*
825 * Logs changes to the configuration of the device. The configuration is defined
826 * in frameworks/base/core/java/android/content/res/Configuration.java
827 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
828 * Please go there to interpret the possible values each field can be.
829 *
830 * Logged from:
831 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
832 */
833message ResourceConfigurationChanged {
834 // Bit mask of color capabilities of the screen.
835 // Contains information about the color gamut and hdr mode of the screen.
836 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
837 optional int32 colorMode = 1;
838
839 // The target screen density being rendered to.
840 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
841 optional int32 densityDpi = 2;
842
843 // Current user preference for the scaling factor for fonts,
844 // relative to the base density scaling.
845 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
846 optional float fontScale = 3;
847
848 // Flag indicating whether the hard keyboard is hidden.
849 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
850 optional int32 hardKeyboardHidden = 4;
851
852 // The type of keyboard attached to the device.
853 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
854 optional int32 keyboard = 5;
855
856 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
857 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
858 optional int32 keyboardHideen = 6;
859
860 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
861 // 0 if undefined.
862 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
863 optional int32 mcc = 7;
864
865 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
866 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
867 // MNC_ZERO symbol defined in Configuration.java.
868 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
869 optional int32 mnc = 8;
870
871 // The kind of navigation available on the device.
872 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
873 optional int32 navigation = 9;
874
875 // Flag indicating whether the navigation is available.
876 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
877 optional int32 navigationHidden = 10;
878
879 // Overall orientation of the screen.
880 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
881 optional int32 orientation = 11;
882
883 // The current height of the available screen space, in dp units.
884 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
885 optional int32 screenHeightDp = 12;
886
887 // Bit mask of overall layout of the screen.
888 // Contains information about screen size, whether the screen is wider/taller
889 // than normal, whether the screen layout is right-tl-left or left-to-right,
890 // and whether the screen has a rounded shape.
891 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
892 optional int32 screenLayout = 13;
893
894 // Current width of the available screen space, in dp units.
895 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
896 optional int32 screenWidthDp = 14;
897
898 // The smallest screen size an application will see in normal operation.
899 // This is the smallest value of both screenWidthDp and screenHeightDp
900 // in portrait and landscape.
901 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
902 optional int32 smallestScreenWidthDp = 15;
903
904 // The type of touch screen attached to the device.
905 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
906 optional int32 touchscreen = 16;
907
908 // Bit mask of the ui mode.
909 // Contains information about the overall ui mode of the device.
910 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
911 // Also contains information about whether the device is in night mode.
912 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
913 optional int32 uiMode = 17;
914}
915
Tej Singheee317b2018-03-07 19:28:05 -0800916
917/**
918 * Logs changes in the connection state of the mobile radio.
919 *
920 * Logged from:
921 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
922 */
923message MobileConnectionStateChanged {
924 // States are from the state machine DataConnection.java.
925 enum State {
926 UNKNOWN = 0;
927 // The connection is inactive, or disconnected.
928 INACTIVE = 1;
929 // The connection is being activated, or connecting.
930 ACTIVATING = 2;
931 // The connection is active, or connected.
932 ACTIVE = 3;
933 // The connection is disconnecting.
934 DISCONNECTING = 4;
935 // The connection is disconnecting after creating a connection.
936 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
937 }
938 optional State state = 1;
939 // For multi-sim phones, this distinguishes between the sim cards.
940 optional int32 sim_slot_index = 2;
941 // Used to identify the connection. Starts at 0 and increments by 1 for
942 // every new network created. Resets whenever the device reboots.
943 optional int32 data_connection_id = 3;
944 // A bitmask for the capabilities of this connection.
945 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
946 // Default value (if we have no information): 0
947 optional int64 capabilities = 4;
948 // If this connection has internet.
949 // This just checks if the DEFAULT bit of capabilities is set.
950 optional bool has_internet = 5;
951}
952
953/**
954 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
955 *
956 * Logged from:
957 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
958 */
959message MobileRadioTechnologyChanged {
960 optional android.telephony.NetworkTypeEnum state = 1;
961 // For multi-sim phones, this distinguishes between the sim cards.
962 optional int32 sim_slot_index = 2;
963}
964
Andrew Chantb56388b2018-03-22 21:07:33 -0700965/**
966 * Logs the VID and PID of any connected USB devices.
967 *
968 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
969 *
970 * Logged by Vendor.
971 */
972message UsbDeviceAttached {
973 optional int32 vid = 1;
974 optional int32 pid = 2;
975 optional bool has_audio = 3;
976 optional bool has_hid = 4;
977 optional bool has_storage = 5;
978}
979
Tej Singheee317b2018-03-07 19:28:05 -0800980
Tej Singhdd7bd352018-02-09 19:33:15 -0800981/**
Tej Singh5d991e12018-03-09 19:48:11 -0800982 * Logs when Bluetooth is enabled and disabled.
983 *
984 * Logged from:
985 * services/core/java/com/android/server/BluetoothManagerService.java
986 */
987message BluetoothEnabledStateChanged {
988 repeated AttributionNode attribution_node = 1;
989 // Whether or not bluetooth is enabled on the device.
990 enum State {
991 UNKNOWN = 0;
992 ENABLED = 1;
993 DISABLED = 2;
994 }
995 optional State state = 2;
996 // The reason for being enabled/disabled.
997 // Eg. Airplane mode, crash, application request.
998 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
999 // If the reason is an application request, this will be the package name.
1000 optional string pkgName = 4;
1001}
1002
1003/**
Jack He22e4a1d2019-01-09 01:19:13 -08001004 * Logs when profiles on a Bluetooth device connects and disconnects.
Tej Singh5d991e12018-03-09 19:48:11 -08001005 *
1006 * Logged from:
Jack He22e4a1d2019-01-09 01:19:13 -08001007 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
1008 *
1009 * Next Tag: 5
Tej Singh5d991e12018-03-09 19:48:11 -08001010 */
1011message BluetoothConnectionStateChanged {
1012 // The state of the connection.
1013 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1014 optional android.bluetooth.ConnectionStateEnum state = 1;
1015 // An identifier that can be used to match connect and disconnect events.
1016 // Currently is last two bytes of a hash of a device level ID and
1017 // the mac address of the bluetooth device that is connected.
Jack He22e4a1d2019-01-09 01:19:13 -08001018 // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
1019 optional int32 OBSOLETE_obfuscated_id = 2 [deprecated = true];
Tej Singh5d991e12018-03-09 19:48:11 -08001020 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1021 // From android.bluetooth.BluetoothAdapter.java
Jack He22e4a1d2019-01-09 01:19:13 -08001022 // Default: 0 when not used
Tej Singh5d991e12018-03-09 19:48:11 -08001023 optional int32 bt_profile = 3;
Jack He22e4a1d2019-01-09 01:19:13 -08001024 // An identifier that can be used to match events for this device.
1025 // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1026 // Salt: Randomly generated 256 bit value
1027 // Hash algorithm: HMAC-SHA256
1028 // Size: 32 byte
1029 // Default: null or empty if the device identifier is not known
1030 optional bytes obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
1031}
1032
1033/**
1034 * Logs when a Bluetooth device connects and disconnects over ACL
1035 *
1036 * Logged from:
1037 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1038 *
1039 * Next Tag: 3
1040 */
1041message BluetoothAclConnectionStateChanged {
1042 // An identifier that can be used to match events for this device.
1043 // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1044 // Salt: Randomly generated 256 bit value
1045 // Hash algorithm: HMAC-SHA256
1046 // Size: 32 byte
1047 // Default: null or empty if the device identifier is not known
1048 optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1049 // The state of the connection.
1050 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1051 optional android.bluetooth.ConnectionStateEnum state = 2;
1052}
1053
1054/**
1055 * Logs when a Bluetooth device connects and disconnects over SCO
1056 *
1057 * Logged from:
1058 * packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
1059 * packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
1060 *
1061 * Next Tag: 4
1062 */
1063message BluetoothScoConnectionStateChanged {
1064 // An identifier that can be used to match events for this device.
1065 // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1066 // Salt: Randomly generated 256 bit value
1067 // Hash algorithm: HMAC-SHA256
1068 // Size: 32 byte
1069 // Default: null or empty if the device identifier is not known
1070 optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1071 // The state of the connection.
1072 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1073 optional android.bluetooth.ConnectionStateEnum state = 2;
1074 // Codec used for this SCO connection
1075 // Default: UNKNOWN
1076 optional android.bluetooth.hfp.ScoCodec codec = 3;
Tej Singh5d991e12018-03-09 19:48:11 -08001077}
1078
Jack He52260142018-12-18 15:43:27 -08001079// Logs when there is an event affecting Bluetooth device's link layer connection.
1080// - This event is triggered when there is a related HCI command or event
1081// - Users of this metrics can deduce Bluetooth device's connection state from these events
1082// - HCI commands are logged before the command is sent, after receiving command status, and after
1083// receiving command complete
1084// - HCI events are logged when they arrive
1085//
1086// Low level log from system/bt
1087//
1088// Bluetooth classic commands:
1089// - CMD_CREATE_CONNECTION
1090// - CMD_DISCONNECT
1091// - CMD_CREATE_CONNECTION_CANCEL
1092// - CMD_ACCEPT_CONNECTION_REQUEST
1093// - CMD_REJECT_CONNECTION_REQUEST
1094// - CMD_SETUP_ESCO_CONNECTION
1095// - CMD_ACCEPT_ESCO_CONNECTION
1096// - CMD_REJECT_ESCO_CONNECTION
1097// - CMD_ENH_SETUP_ESCO_CONNECTION
1098// - CMD_ENH_ACCEPT_ESCO_CONNECTION
1099//
1100// Bluetooth low energy commands:
1101// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
1102// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
1103// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
1104// - CMD_BLE_CLEAR_WHITE_LIST
1105// - CMD_BLE_ADD_WHITE_LIST
1106// - CMD_BLE_REMOVE_WHITE_LIST
1107//
1108// Bluetooth classic events:
1109// - EVT_CONNECTION_COMP
1110// - EVT_CONNECTION_REQUEST
1111// - EVT_DISCONNECTION_COMP
1112// - EVT_ESCO_CONNECTION_COMP
1113// - EVT_ESCO_CONNECTION_CHANGED
1114//
1115// Bluetooth low energy meta events:
1116// - BLE_EVT_CONN_COMPLETE_EVT
1117// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
1118//
1119// Next tag: 10
1120message BluetoothLinkLayerConnectionEvent {
1121 // An identifier that can be used to match events for this device.
1122 // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1123 // Salt: Randomly generated 256 bit value
1124 // Hash algorithm: HMAC-SHA256
1125 // Size: 32 byte
1126 // Default: null or empty if the device identifier is not known
1127 optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1128 // Connection handle of this connection if available
1129 // Range: 0x0000 - 0x0EFF (12 bits)
1130 // Default: 0xFFFF if the handle is unknown
1131 optional int32 connection_handle = 2;
1132 // Direction of the link
1133 // Default: DIRECTION_UNKNOWN
1134 optional android.bluetooth.DirectionEnum direction = 3;
1135 // Type of this link
1136 // Default: LINK_TYPE_UNKNOWN
1137 optional android.bluetooth.LinkTypeEnum type = 4;
1138
1139 // Reason metadata for this link layer connection event, rules for interpretation:
1140 // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
1141 // EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
1142 // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
1143 // set and valid, ignore hci_ble_event
1144
1145 // HCI command associated with this event
1146 // Default: CMD_UNKNOWN
1147 optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
1148 // HCI event associated with this event
1149 // Default: EVT_UNKNOWN
1150 optional android.bluetooth.hci.EventEnum hci_event = 6;
1151 // HCI BLE meta event associated with this event
1152 // Default: BLE_EVT_UNKNOWN
1153 optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
1154 // HCI command status code if this is triggerred by hci_cmd
1155 // Default: STATUS_UNKNOWN
1156 optional android.bluetooth.hci.StatusEnum cmd_status = 8;
1157 // HCI reason code associated with this event
1158 // Default: STATUS_UNKNOWN
1159 optional android.bluetooth.hci.StatusEnum reason_code = 9;
1160}
1161
1162
Tej Singh5d991e12018-03-09 19:48:11 -08001163/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001164 * Logs when something is plugged into or removed from the USB-C connector.
1165 *
1166 * Logged from:
1167 * Vendor USB HAL.
1168 */
1169message UsbConnectorStateChanged {
1170 enum State {
1171 DISCONNECTED = 0;
1172 CONNECTED = 1;
1173 }
1174 optional State state = 1;
1175}
1176
1177/**
1178 * Logs the reported speaker impedance.
1179 *
1180 * Logged from:
1181 * Vendor audio implementation.
1182 */
1183message SpeakerImpedanceReported {
1184 optional int32 speaker_location = 1;
1185 optional int32 impedance = 2;
1186}
1187
1188/**
1189 * Logs the report of a failed hardware.
1190 *
1191 * Logged from:
1192 * Vendor HALs.
1193 *
1194 */
1195message HardwareFailed {
1196 enum HardwareType {
1197 HARDWARE_FAILED_UNKNOWN = 0;
1198 HARDWARE_FAILED_MICROPHONE = 1;
1199 HARDWARE_FAILED_CODEC = 2;
1200 HARDWARE_FAILED_SPEAKER = 3;
1201 HARDWARE_FAILED_FINGERPRINT = 4;
1202 }
1203 optional HardwareType hardware_type = 1;
1204
1205 /* hardware_location allows vendors to differentiate between multiple instances of
1206 * the same hardware_type. The specific locations are vendor defined integers,
1207 * referring to board-specific numbering schemes.
1208 */
1209 optional int32 hardware_location = 2;
1210
1211 /* failure_code is specific to the HardwareType of the failed hardware.
1212 * It should use the enum values defined below.
1213 */
1214 enum MicrophoneFailureCode {
1215 MICROPHONE_FAILURE_COMPLETE = 0;
1216 }
1217 enum CodecFailureCode {
1218 CODEC_FAILURE_COMPLETE = 0;
1219 }
1220 enum SpeakerFailureCode {
1221 SPEAKER_FAILURE_COMPLETE = 0;
1222 SPEAKER_FAILURE_HIGH_Z = 1;
1223 SPEAKER_FAILURE_SHORT = 2;
1224 }
1225 enum FingerprintFailureCode {
1226 FINGERPRINT_FAILURE_COMPLETE = 0;
1227 FINGERPRINT_SENSOR_BROKEN = 1;
1228 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1229 }
1230 optional int32 failure_code = 3;
1231}
1232
1233/**
1234 * Log an event when the device has been physically dropped.
1235 * Reported from the /vendor partition.
1236 */
1237message PhysicalDropDetected {
1238 // Confidence that the event was actually a drop, 0 -> 100
1239 optional int32 confidence_pctg = 1;
1240 // Peak acceleration of the drop, in 1/1000s of a g.
1241 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001242 // Duration of freefall in ms
1243 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001244}
1245
1246/**
1247 * Log bucketed battery charge cycles.
1248 *
1249 * Each bucket represents cycles of the battery past
1250 * a given charge point. For example, bucket 1 is the
1251 * lowest 1/8th of the battery, and bucket 8 is 100%.
1252 *
1253 * Logged from:
1254 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1255 */
1256message ChargeCyclesReported {
1257 optional int32 cycle_bucket_1 = 1;
1258 optional int32 cycle_bucket_2 = 2;
1259 optional int32 cycle_bucket_3 = 3;
1260 optional int32 cycle_bucket_4 = 4;
1261 optional int32 cycle_bucket_5 = 5;
1262 optional int32 cycle_bucket_6 = 6;
1263 optional int32 cycle_bucket_7 = 7;
1264 optional int32 cycle_bucket_8 = 8;
1265}
1266
1267/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001268 * Logs the duration of a davey (jank of >=700ms) when it occurs
1269 *
1270 * Logged from:
1271 * frameworks/base/libs/hwui/JankTracker.cpp
1272 */
1273message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001274 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001275 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001276
Tej Singhbb8554a2018-01-26 11:59:14 -08001277 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001278 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001279}
1280
1281/**
Bookatze5885242017-10-24 20:10:31 -07001282 * Logs phone signal strength changes.
1283 *
1284 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001285 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001286 */
1287message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001288 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1289 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001290}
1291
Yangster4ccebea2018-10-09 17:09:02 -07001292
1293/**
1294 * Logs when the phone state, sim state or signal strength changes
1295 *
1296 * Logged from:
1297 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1298 */
1299message PhoneServiceStateChanged {
1300 optional android.telephony.ServiceStateEnum state = 1;
1301 optional android.telephony.SimStateEnum sim_state = 2;
1302 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1303}
1304
1305/**
1306 * Logs when the phone becomes on or off.
1307 *
1308 * Logged from:
1309 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1310 */
1311message PhoneStateChanged {
1312 enum State {
1313 OFF = 0;
1314 ON = 1;
1315 }
1316 optional State state = 1;
1317}
1318
Hyunyoung Songcc651c12018-10-17 13:35:32 -07001319message LauncherUIChanged {
Yao Chen046b5122018-10-24 14:09:20 -07001320 optional android.stats.launcher.LauncherAction action = 1;
1321 optional android.stats.launcher.LauncherState src_state = 2;
1322 optional android.stats.launcher.LauncherState dst_state = 3;
1323 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songcc651c12018-10-17 13:35:32 -07001324 optional bool is_swipe_up_enabled = 5;
1325}
1326
David Chenc28b2bb2017-10-24 12:52:52 -07001327/**
1328 * Logs that a setting was updated.
1329 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001330 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001331 * The tag and is_default allow resetting of settings to default values based on the specified
1332 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1333 */
1334message SettingChanged {
1335 // The name of the setting.
1336 optional string setting = 1;
1337
1338 // The change being imposed on this setting. May represent a number, eg "3".
1339 optional string value = 2;
1340
1341 // The new value of this setting. For most settings, this is same as value. For some settings,
1342 // value is +X or -X where X represents an element in a set. For example, if the previous value
1343 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1344 // The +/- feature is currently only used for location_providers_allowed.
1345 optional string new_value = 3;
1346
1347 // The previous value of this setting.
1348 optional string prev_value = 4;
1349
1350 // The tag used with the is_default for resetting sets of settings. This is generally null.
1351 optional string tag = 5;
1352
Bookatz90867622018-01-31 15:05:57 -08001353 // True if this setting with tag should be resettable.
1354 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001355
David Chenbd789912018-03-16 17:19:55 -07001356 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001357 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001358
1359 enum ChangeReason {
1360 UPDATED = 1; // Updated can be an insertion or an update.
1361 DELETED = 2;
1362 }
1363 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001364}
Chenjie Yub3dda412017-10-24 13:41:59 -07001365
Chenjie Yu05013b32017-11-21 10:21:41 -08001366/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001367 * Logs activity going to foreground or background
1368 *
1369 * Logged from:
1370 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1371 */
1372message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001373 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001374 optional string pkg_name = 2;
1375 optional string class_name = 3;
1376
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001377 enum State {
1378 BACKGROUND = 0;
1379 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001380 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001381 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001382}
David Chenc8a43242017-10-17 16:23:28 -07001383
1384/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001385 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001386 * Logged from:
1387 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1388 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001389message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001390 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001391
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001392 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001393
1394 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001395 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001396 optional string process_name = 3;
1397
1398 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001399 optional sint32 pid = 4;
Chenjie Yuf17bf62f2018-04-02 14:22:19 -07001400
1401 optional string package_name = 5;
1402
1403 enum InstantApp {
1404 UNAVAILABLE = 0;
1405 FALSE = 1;
1406 TRUE = 2;
1407 }
1408 optional InstantApp is_instant_app = 6;
1409
1410 enum ForegroundState {
1411 UNKNOWN = 0;
1412 BACKGROUND = 1;
1413 FOREGROUND = 2;
1414 }
1415 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001416}
David Chen9e3808c2017-11-20 17:25:34 -08001417
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001418/**
1419 * Logs when a WTF (What a Terrible Failure) happened.
1420 * Logged from:
1421 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1422 */
1423message WTFOccurred {
1424 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001425
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001426 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001427
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001428 // The name of the process.
1429 // system_server if it is not by an app
1430 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001431
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001432 // The pid if available. -1 means not available.
1433 optional sint32 pid = 4;
1434}
1435
1436/**
1437 * Logs when system server reports low memory.
1438 * Logged from:
1439 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1440 */
1441message LowMemReported {
1442}
1443
1444/**
1445 * Logs when an app ANR (App Not Responding) occurs.
1446 * Logged from:
1447 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1448 */
1449message ANROccurred {
1450 optional int32 uid = 1 [(is_uid) = true];
1451
1452 optional string process_name = 2;
1453
1454 optional string short_component_name = 3;
1455
1456 optional string reason = 4;
Chenjie Yuf17bf62f2018-04-02 14:22:19 -07001457
1458 enum InstantApp {
1459 UNAVAILABLE = 0;
1460 FALSE = 1;
1461 TRUE = 2;
1462 }
1463 optional InstantApp is_instant_app = 5;
1464
1465 enum ForegroundState {
1466 UNKNOWN = 0;
1467 BACKGROUND = 1;
1468 FOREGROUND = 2;
1469 }
1470 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001471}
1472
David Chen0a368b22017-12-06 16:28:16 -08001473/*
1474 * Allows other apps to push events into statsd.
1475 * Logged from:
1476 * frameworks/base/core/java/android/util/StatsLog.java
1477 */
David Chen0b5c90c2018-01-25 16:51:49 -08001478message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001479 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001480 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001481
1482 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1483 optional int32 label = 2;
1484
1485 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1486 // predicates for the metrics).
1487 enum State {
1488 UNKNOWN = 0;
1489 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1490 STOP = 2;
1491 START = 3;
1492 }
1493 optional State state = 3;
1494}
1495
David Chen9e3808c2017-11-20 17:25:34 -08001496/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001497 * Logs when statsd detects an anomaly.
1498 *
1499 * Logged from:
1500 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1501 */
1502message AnomalyDetected {
1503 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001504 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001505
Yangster-mac94e197c2018-01-02 16:03:03 -08001506 // Id of the config whose anomaly detection alert fired.
1507 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001508
Yangster-mac94e197c2018-01-02 16:03:03 -08001509 // Id of the alert (i.e. name of the anomaly that was detected).
1510 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001511}
1512
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001513message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001514 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001515 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001516
1517 // The app package name.
1518 optional string pkg_name = 2;
1519
1520 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001521 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001522 WARM = 1;
1523 HOT = 2;
1524 COLD = 3;
1525 }
1526 // The transition type.
1527 optional TransitionType type = 3;
1528
1529 // The activity name.
1530 optional string activity_name = 4;
1531
1532 // The name of the calling app. Empty if not set.
1533 optional string calling_pkg_name = 5;
1534
1535 // Whether the app is an instant app.
1536 optional bool is_instant_app = 6;
1537
1538 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001539 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001540
Bookatz80d11a02018-01-16 10:46:35 -08001541 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001542
David Chen0b5c90c2018-01-25 16:51:49 -08001543 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001544 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001545 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001546 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001547 optional int32 bind_application_delay_millis = 11;
1548 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001549
1550 // Empty if not set.
1551 optional string launch_token = 13;
1552
Calin Juravle759fbda2018-02-20 19:52:30 +00001553 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001554 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001555
1556 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001557 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001558}
1559
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001560message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001561 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001562 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001563
1564 // The app package name.
1565 optional string pkg_name = 2;
1566
1567 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001568 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001569 WARM = 1;
1570 HOT = 2;
1571 COLD = 3;
1572 }
1573 // The transition type.
1574 optional TransitionType type = 3;
1575
1576 // The activity name.
1577 optional string activity_name = 4;
1578}
1579
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001580message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001581 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001582 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001583
1584 // The app package name.
1585 optional string pkg_name = 2;
1586
1587 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001588 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001589 WITH_BUNDLE = 1;
1590 WITHOUT_BUNDLE = 2;
1591 }
1592 // The transition type.
1593 optional TransitionType type = 3;
1594
1595 // The activity name.
1596 optional string activity_name = 4;
1597
1598 optional bool transition_process_running = 5;
1599
1600 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001601 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001602}
1603
Bookatz8fcd09a2017-12-18 13:01:10 -08001604/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001605 * Logs a picture-in-picture action
1606 * Logged from:
1607 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1608 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1609 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1610 */
1611message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001612 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001613 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001614
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001615 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001616
Chenjie Yu52cacc62017-12-08 18:11:45 -08001617 enum State {
1618 ENTERED = 1;
1619 EXPANDED_TO_FULL_SCREEN = 2;
1620 MINIMIZED = 3;
1621 DISMISSED = 4;
1622 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001623 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001624}
1625
1626/**
Chenjie Yue8904192017-12-08 19:12:57 -08001627 * Logs overlay action
1628 * Logged from:
1629 * services/core/java/com/android/server/wm/Session.java
1630 */
1631message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001632 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001633
1634 optional string package_name = 2;
1635
1636 optional bool using_alert_window = 3;
1637
1638 enum State {
1639 ENTERED = 1;
1640 EXITED = 2;
1641 }
1642 optional State state = 4;
1643}
1644
Chenjie Yuccfe6452018-01-30 11:33:21 -08001645/*
1646 * Logs foreground service starts and stops.
1647 * Note that this is not when a service starts or stops, but when it is
1648 * considered foreground.
1649 * Logged from
1650 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1651 */
1652message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001653 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001654 // package_name + "/" + class_name
1655 optional string short_name = 2;
1656
1657 enum State {
1658 ENTER = 1;
1659 EXIT = 2;
1660 }
1661 optional State state = 3;
1662}
1663
Chenjie Yue8904192017-12-08 19:12:57 -08001664/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001665 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1666 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1667 * attributed back to the parent (host) uid. One example is Chrome.
1668 *
1669 * Logged from:
1670 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1671 */
1672message IsolatedUidChanged {
1673 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001674 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001675 optional int32 parent_uid = 1;
1676
1677 optional int32 isolated_uid = 2;
1678
1679 // We expect an isolated uid to be removed before if it's used for another parent uid.
1680 enum Event {
1681 REMOVED = 0;
1682 CREATED = 1;
1683 }
1684 optional Event event = 3;
1685}
1686
1687/*
1688 * Logs the reception of an incoming network packet causing the main system to wake up for
1689 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1690 * and processed by WakeupController.cpp.
1691 */
1692message PacketWakeupOccurred {
1693 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1694 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001695 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001696 // The interface name on which the packet was received.
1697 optional string iface = 2;
1698 // The ethertype value of the packet.
1699 optional int32 ethertype = 3;
1700 // String representation of the destination MAC address of the packet.
1701 optional string destination_hardware_address = 4;
1702 // String representation of the source address of the packet if this was an IP packet.
1703 optional string source_ip = 5;
1704 // String representation of the destination address of the packet if this was an IP packet.
1705 optional string destination_ip = 6;
1706 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1707 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1708 // families.
1709 optional int32 ip_next_header = 7;
1710 // The source port if this was a TCP or UDP packet.
1711 optional int32 source_port = 8;
1712 // The destination port if this was a TCP or UDP packet.
1713 optional int32 destination_port = 9;
1714}
1715
1716/*
1717 * Logs the memory stats for an app on startup.
1718 * Logged from:
1719 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1720 */
1721message AppStartMemoryStateCaptured {
1722 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001723 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001724
1725 // The process name.
1726 optional string process_name = 2;
1727
1728 // The activity name.
1729 optional string activity_name = 3;
1730
1731 // # of page-faults
1732 optional int64 pgfault = 4;
1733
1734 // # of major page-faults
1735 optional int64 pgmajfault = 5;
1736
1737 // RSS
1738 optional int64 rss_in_bytes = 6;
1739
1740 // CACHE
1741 optional int64 cache_in_bytes = 7;
1742
1743 // SWAP
1744 optional int64 swap_in_bytes = 8;
1745}
1746
1747/*
1748 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1749 * for LMK event.
1750 * Logged from:
1751 * system/core/lmkd/lmkd.c
1752 */
1753message LmkStateChanged {
1754 enum State {
1755 UNKNOWN = 0;
1756 START = 1;
1757 STOP = 2;
1758 }
1759 optional State state = 1;
1760}
1761
1762/*
1763 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1764 * Logged from:
1765 * system/core/lmkd/lmkd.c
1766 */
1767message LmkKillOccurred {
1768 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001769 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001770
1771 // The process name.
1772 optional string process_name = 2;
1773
1774 // oom adj score.
1775 optional int32 oom_score = 3;
1776
1777 // # of page-faults
1778 optional int64 pgfault = 4;
1779
1780 // # of major page-faults
1781 optional int64 pgmajfault = 5;
1782
1783 // RSS
1784 optional int64 rss_in_bytes = 6;
1785
1786 // CACHE
1787 optional int64 cache_in_bytes = 7;
1788
1789 // SWAP
1790 optional int64 swap_in_bytes = 8;
Jim Blackler972a5c52018-11-21 15:24:48 +00001791
1792 // The elapsed real time of start of the process.
1793 optional int64 process_start_time_nanos = 9;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001794}
1795
Rajeev Kumar51b54602018-03-01 12:18:26 -08001796/*
1797 * Logs when the ActivityManagerService detects that an app died.
1798 *
1799 * Logged from:
1800 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1801 */
1802message AppDied {
1803 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001804 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001805}
1806
Chenjie Yubbcbc602018-02-05 16:51:52 -08001807//////////////////////////////////////////////////////////////////////
1808// Pulled atoms below this line //
1809//////////////////////////////////////////////////////////////////////
1810
1811/**
David Chenc8a43242017-10-17 16:23:28 -07001812 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1813 *
1814 * Pulled from:
1815 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1816 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001817message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001818 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001819
1820 optional int64 rx_bytes = 2;
1821
1822 optional int64 rx_packets = 3;
1823
1824 optional int64 tx_bytes = 4;
1825
1826 optional int64 tx_packets = 5;
1827}
1828
1829/**
1830 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1831 *
1832 * Pulled from:
1833 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1834 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001835message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001836 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001837
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001838 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1839 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001840
1841 optional int64 rx_bytes = 3;
1842
1843 optional int64 rx_packets = 4;
1844
1845 optional int64 tx_bytes = 5;
1846
1847 optional int64 tx_packets = 6;
1848}
1849
1850/**
1851 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1852 *
1853 * Pulled from:
1854 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1855 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001856message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001857 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001858
1859 optional int64 rx_bytes = 2;
1860
1861 optional int64 rx_packets = 3;
1862
1863 optional int64 tx_bytes = 4;
1864
1865 optional int64 tx_packets = 5;
1866}
1867
1868/**
1869 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1870 *
1871 * Pulled from:
1872 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1873 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001874message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001875 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001876
Yao Chenc40a19d2018-03-15 16:48:25 -07001877 // 1 denotes foreground and 0 denotes background. This is called Set in
1878 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001879 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001880
1881 optional int64 rx_bytes = 3;
1882
1883 optional int64 rx_packets = 4;
1884
1885 optional int64 tx_bytes = 5;
1886
1887 optional int64 tx_packets = 6;
1888}
1889
1890/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001891 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1892 *
1893 * Pulled from:
1894 * StatsCompanionService
1895 */
1896message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001897 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001898
1899 optional int64 rx_bytes = 2;
1900
1901 optional int64 tx_bytes = 3;
1902}
1903
1904/**
David Chenc8a43242017-10-17 16:23:28 -07001905 * Pulls the kernel wakelock durations. This atom is adapted from
1906 * android/internal/os/KernelWakelockStats.java
1907 *
1908 * Pulled from:
1909 * StatsCompanionService using KernelWakelockReader.
1910 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001911message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001912 optional string name = 1;
1913
1914 optional int32 count = 2;
1915
1916 optional int32 version = 3;
1917
1918 optional int64 time = 4;
1919}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001920
Chenjie Yu05013b32017-11-21 10:21:41 -08001921/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001922 * Pulls low power state information. This includes platform and subsystem sleep state information,
1923 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001924 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001925 * hardware/interfaces/power/1.1/types.hal
1926 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001927message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001928 // Subsystem name
1929 optional string subsystem_name = 1;
1930 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1931 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1932 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001933 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001934 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001935 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001936 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001937}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001938
Chenjie Yu05013b32017-11-21 10:21:41 -08001939/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001940 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001941 * Pulls the time the cpu spend on the frequency index. Frequency index
1942 * starts from highest to lowest. The value should be monotonically
1943 * increasing since boot. However, if there is a cpu
1944 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001945 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001946message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001947 optional uint32 cluster = 1;
1948 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001949 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001950}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001951
Chenjie Yu05013b32017-11-21 10:21:41 -08001952/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001953 * Pulls Cpu Time Per Uid.
1954 * Note that isolated process uid time should be attributed to host uids.
1955 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001956message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001957 optional int32 uid = 1 [(is_uid) = true];
Misha Wagner6bc6c912018-11-16 13:19:54 +00001958 optional uint64 user_time_micros = 2;
1959 optional uint64 sys_time_micros = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001960}
1961
1962/**
1963 * Pulls Cpu Time Per Uid per frequency.
1964 * Note that isolated process uid time should be attributed to host uids.
1965 * For each uid, we order the time by descending frequencies.
1966 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001967message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001968 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001969 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001970 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001971}
Hugo Benichi884970e2017-11-14 22:42:46 +09001972
Chenjie Yu05013b32017-11-21 10:21:41 -08001973/**
1974 * Pulls Wifi Controller Activity Energy Info
1975 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001976message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001977 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001978 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001979 // stack reported state
1980 // TODO: replace this with proto enum
1981 optional int32 stack_state = 2;
1982 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001983 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001984 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001985 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001986 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001987 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001988 // product of current(mA), voltage(V) and time(ms)
1989 optional uint64 controller_energy_used = 6;
1990}
1991
1992/**
1993 * Pulls Modem Activity Energy Info
1994 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001995message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001996 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001997 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001998 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001999 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08002000 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002001 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002002 /**
2003 * Tx power index
2004 * index 0 = tx_power < 0dBm
2005 * index 1 = 0dBm < tx_power < 5dBm
2006 * index 2 = 5dBm < tx_power < 15dBm
2007 * index 3 = 15dBm < tx_power < 20dBm
2008 * index 4 = tx_power > 20dBm
2009 */
2010 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002011 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002012 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002013 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002014 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002015 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002016 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002017 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002018 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002019 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002020 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002021 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002022 // product of current(mA), voltage(V) and time(ms)
2023 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002024}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002025
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002026/**
2027 * Pulls Bluetooth Activity Energy Info
2028 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2029 */
2030message BluetoothActivityInfo {
2031 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002032 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002033 // bluetooth stack state
2034 optional int32 bluetooth_stack_state = 2;
2035 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002036 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002037 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002038 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002039 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002040 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002041 // product of current(mA), voltage(V) and time(ms)
2042 optional uint64 energy_used = 6;
2043}
2044
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002045/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002046 * Logs the memory stats for a process.
2047 */
2048message ProcessMemoryState {
2049 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002050 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002051
2052 // The process name.
2053 optional string process_name = 2;
2054
2055 // oom adj score.
2056 optional int32 oom_score = 3;
2057
2058 // # of page-faults
2059 optional int64 pgfault = 4;
2060
2061 // # of major page-faults
2062 optional int64 pgmajfault = 5;
2063
Rajeev Kumar90235992018-01-29 11:06:48 -08002064 // RSS
2065 optional int64 rss_in_bytes = 6;
2066
2067 // CACHE
2068 optional int64 cache_in_bytes = 7;
2069
2070 // SWAP
2071 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002072}
2073
2074/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002075 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002076 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002077message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002078 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002079}
2080
2081/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002082 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002083 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002084message SystemUptime {
2085 // Milliseconds since the system was booted.
2086 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2087 // for external input).
2088 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002089 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002090}
2091
2092/*
2093 * Reads from /proc/uid_concurrent_active_time which has the format:
2094 * active: X (X is # cores)
2095 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2096 * [uid1]: [time-0] [time-1] [time-2] ... ...
2097 * ...
2098 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2099 * The file contains a monotonically increasing count of time for a single boot.
2100 */
2101message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002102 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002103 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002104}
2105
2106/**
2107 * Reads from /proc/uid_concurrent_policy_time which has the format:
2108 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2109 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2110 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2111 * ...
2112 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2113 * The file contains a monotonically increasing count of time for a single boot.
2114 */
2115message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002116 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002117 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002118 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002119}
2120
2121/*
2122 * Pulls free disk space, for data, system partition and temporary directory.
2123 */
2124message DiskSpace {
2125 // available bytes in data partition
2126 optional uint64 data_available_bytes = 1;
2127 // available bytes in system partition
2128 optional uint64 system_available_bytes = 2;
2129 // available bytes in download cache or temp directories
2130 optional uint64 temp_available_bytes = 3;
2131}
Tej Singhbf972d92018-01-10 20:51:13 -08002132
2133/**
2134 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002135 * Pulled from:
2136 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002137 */
2138message RemainingBatteryCapacity {
2139 optional int32 charge_uAh = 1;
2140}
2141
2142/**
2143 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002144 * Pulled from:
2145 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002146 */
2147message FullBatteryCapacity {
2148 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002149}
2150
2151/**
Tej Singhd89137e2018-03-26 14:51:40 -07002152 * Pulls the temperature of various parts of the device.
2153 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002154 *
2155 * Pulled from:
2156 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2157 */
2158message Temperature {
2159 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2160 optional android.os.TemperatureTypeEnum sensor_location = 1;
2161
2162 // The name of the temperature source. Eg. CPU0
2163 optional string sensor_name = 2;
2164
Tej Singhd89137e2018-03-26 14:51:40 -07002165 // Temperature in tenths of a degree C.
2166 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002167}
lifr35a7cf02018-12-12 16:38:04 +08002168
2169/**
2170 * Logs the latency period(in microseconds) and the return code of
2171 * the DNS(Domain Name System) lookups.
2172 * These 4 methods(GETADDRINFO,GETHOSTBYNAME,GETHOSTBYADDR,RES_NSEND)
2173 * to get info(address or hostname) from DNS server(or DNS cache).
2174 * Logged from:
2175 * /system/netd/server/DnsProxyListener.cpp
2176 */
2177message NetworkDnsEventReported {
2178 // The types of the DNS lookups, as defined in
2179 //system/netd/server/binder/android/net/metrics/INetdEventListener.aidl
2180 enum EventType {
2181 EVENT_UNKNOWN = 0;
2182 EVENT_GETADDRINFO = 1;
2183 EVENT_GETHOSTBYNAME = 2;
2184 EVENT_GETHOSTBYADDR = 3;
2185 EVENT_RES_NSEND = 4;
2186 }
2187 optional EventType event_type = 1;
2188
2189 // The return value of the DNS resolver for each DNS lookups.
2190 //bionic/libc/include/netdb.h
2191 //system/netd/resolv/include/netd_resolv/resolv.h
2192 enum ReturnCode {
2193 EAI_NO_ERROR = 0;
2194 EAI_ADDRFAMILY = 1;
2195 EAI_AGAIN = 2;
2196 EAI_BADFLAGS = 3;
2197 EAI_FAIL = 4;
2198 EAI_FAMILY = 5;
2199 EAI_MEMORY = 6;
2200 EAI_NODATA = 7;
2201 EAI_NONAME = 8;
2202 EAI_SERVICE = 9;
2203 EAI_SOCKTYPE = 10;
2204 EAI_SYSTEM = 11;
2205 EAI_BADHINTS = 12;
2206 EAI_PROTOCOL = 13;
2207 EAI_OVERFLOW = 14;
2208 RESOLV_TIMEOUT = 255;
2209 EAI_MAX = 256;
2210 }
2211 optional ReturnCode return_code = 2;
2212
2213 // The latency period(in microseconds) it took for this DNS lookup to complete.
2214 optional int32 latency_micros = 3;
2215}
2216
Chiachang Wang67f24472019-01-15 15:14:00 +08002217/**
2218 * Logs when a data stall event occurs.
2219 *
2220 * Log from:
2221 * frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2222 */
2223message DataStallEvent {
2224 // Data stall evaluation type.
2225 // See frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2226 // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
2227 optional int32 evaluation_type = 1;
2228 // See definition in data_stall_event.proto.
2229 optional com.android.server.connectivity.ProbeResult validation_result = 2;
2230 // See definition in data_stall_event.proto.
2231 optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
2232 // See definition in data_stall_event.proto.
2233 optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
2234 // See definition in data_stall_event.proto.
2235 optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
2236 // See definition in data_stall_event.proto.
2237 optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
2238}