blob: 42a22fd726639fd5bc72b86165889c353adc71b6 [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";
Fan Zhangf837b8e2018-10-23 12:38:30 -070025import "frameworks/base/core/proto/android/app/settings_enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070026import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080027import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080028import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080029import "frameworks/base/core/proto/android/server/enums.proto";
Yangsteraf9aee72018-10-12 09:26:16 -070030import "frameworks/base/core/proto/android/service/procstats_enum.proto";
31import "frameworks/base/core/proto/android/stats/enums.proto";
Yao Chen8c433862018-10-24 14:09:20 -070032import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080033import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080034import "frameworks/base/core/proto/android/telephony/enums.proto";
35import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080036
Yao Chend54f9dd2017-10-17 17:37:48 +000037/**
Stefan Lafonae2df012017-11-14 09:17:21 -080038 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000039 * raw stats log events from the Android system, also known as "atoms."
40 *
41 * This field contains a single oneof with all of the available messages.
42 * The stats-log-api-gen tool runs as part of the Android build and
43 * generates the android.util.StatsLog class, which contains the constants
44 * and methods that Android uses to log.
45 *
Stefan Lafonae2df012017-11-14 09:17:21 -080046 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000047 * Instead, statsd on Android constructs these messages synthetically,
48 * in the format defined here and in stats_log.proto.
49 */
Stefan Lafonae2df012017-11-14 09:17:21 -080050message Atom {
51 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070052 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070053 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
54 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070055 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070056 BleScanResultReceived ble_scan_result_received = 4;
57 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080058 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070059 SyncStateChanged sync_state_changed = 7;
60 ScheduledJobStateChanged scheduled_job_state_changed = 8;
61 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070062 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080063 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
64 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
65 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070066 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
67 MemoryFactorStateChanged memory_factor_state_changed = 15;
68 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
69 CachedKillReported cached_kill_reported = 17;
70 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070071 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080072 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
73 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
74 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070075 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080076 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070077 CameraStateChanged camera_state_changed = 25;
78 FlashlightStateChanged flashlight_state_changed = 26;
79 UidProcessStateChanged uid_process_state_changed = 27;
80 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
81 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070082 BatteryLevelChanged battery_level_changed = 30;
83 ChargingStateChanged charging_state_changed = 31;
84 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070085 InteractiveStateChanged interactive_state_changed = 33;
86 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070087 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
88 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070089 WifiLockStateChanged wifi_lock_state_changed = 37;
90 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
91 WifiScanStateChanged wifi_scan_state_changed = 39;
92 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070093 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070094 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070095 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090096 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070097 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080098 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080099 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800100 AppStartOccurred app_start_occurred = 48;
101 AppStartCanceled app_start_canceled = 49;
102 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800103 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800104 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800105 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800106 LmkStateChanged lmk_state_changed = 54;
107 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800108 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800109 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800110 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800111 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800112 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800113 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800114 KeyguardStateChanged keyguard_state_changed = 62;
115 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
116 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800117 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800118 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800119 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
120 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700121 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700122 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800123 SpeakerImpedanceReported speaker_impedance_reported = 71;
124 HardwareFailed hardware_failed = 72;
125 PhysicalDropDetected physical_drop_detected = 73;
126 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800127 MobileConnectionStateChanged mobile_connection_state_changed = 75;
128 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700129 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800130 AppCrashOccurred app_crash_occurred = 78;
131 ANROccurred anr_occurred = 79;
132 WTFOccurred wtf_occurred = 80;
133 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700134 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700135 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700136 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700137 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700138 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700139 FingerprintAcquired fingerprint_acquired = 87;
140 FingerprintAuthenticated fingerprint_authenticated = 88;
141 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700142 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700143 BatteryHealthSnapshot battery_health_snapshot = 91;
144 SlowIo slow_io = 92;
145 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700146 PhoneServiceStateChanged phone_service_state_changed = 94;
147 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100148 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700149 SettingsUIChanged settings_ui_changed = 97;
Chenjie Yuae9dfac2018-10-25 16:06:56 -0700150 ConnectivityStateChanged connectivity_state_changed = 98;
Chenjie Yu75b3c492018-10-06 21:45:19 -0700151 // TODO: service state change is very noisy shortly after boot, as well
152 // as at other transitions - coming out of doze, device plugged in, etc.
153 // Consider removing this if it becomes a problem
154 ServiceStateChanged service_state_changed = 99;
155 ServiceLaunchReported service_launch_reported = 100;
Yangster-macb89807e2018-11-15 21:10:57 -0800156 PhenotypeFlagStateChanged phenotype_flag_state_changed = 101;
157 BinaryPushStateChanged binary_push_state_changed = 102;
Yao Chend54f9dd2017-10-17 17:37:48 +0000158 }
David Chenc8a43242017-10-17 16:23:28 -0700159
David Chen6e3e6cb2018-01-03 16:14:06 -0800160 // Pulled events will start at field 10000.
Misha Wagner5a51e002018-10-03 15:04:09 +0100161 // Next: 10038
David Chenc8a43242017-10-17 16:23:28 -0700162 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800163 WifiBytesTransfer wifi_bytes_transfer = 10000;
164 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
165 MobileBytesTransfer mobile_bytes_transfer = 10002;
166 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800167 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800168 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800169 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800170 CpuTimePerFreq cpu_time_per_freq = 10008;
171 CpuTimePerUid cpu_time_per_uid = 10009;
172 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800173 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800174 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800175 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800176 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800177 SystemElapsedRealtime system_elapsed_realtime = 10014;
178 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800179 CpuActiveTime cpu_active_time = 10016;
180 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000181 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800182 RemainingBatteryCapacity remaining_battery_capacity = 10019;
183 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800184 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100185 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100186 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100187 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000188 DiskStats disk_stats = 10025;
189 DirectoryUsage directory_usage = 10026;
190 AppSize app_size = 10027;
191 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700192 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700193 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700194 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700195 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700196 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700197 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700198 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100199 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100200 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700201 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800202 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
203 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
204 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
David Chenc8a43242017-10-17 16:23:28 -0700205 }
yroa1fe77c2018-02-26 14:22:54 -0800206
Bookatz76aafcf2018-09-17 16:17:10 -0700207 // DO NOT USE field numbers above 100,000 in AOSP.
208 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
209 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700210}
211
Yao Chend54f9dd2017-10-17 17:37:48 +0000212/**
Yangster-mac20877162017-12-22 17:19:39 -0800213 * This proto represents a node of an attribution chain.
214 * Note: All attribution chains are represented as a repeated field of type
215 * AttributionNode. It is understood that in such arrays, the order is that
216 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000217 */
Yangster-mac20877162017-12-22 17:19:39 -0800218message AttributionNode {
219 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800220 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800221
Yangster-mac20877162017-12-22 17:19:39 -0800222 // The (optional) string tag for an element in the attribution chain. If the
223 // element has no tag, it is encoded as an empty string.
224 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700225}
226
Yangster-mac48b3d622018-08-18 12:38:11 -0700227message KeyValuePair {
228 optional int32 key = 1;
229 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700230 int32 value_int = 2;
231 int64 value_long = 3;
232 string value_str = 4;
233 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700234 }
235}
236
237message KeyValuePairsAtom {
238 optional int32 uid = 1;
239 repeated KeyValuePair pairs = 2;
240}
241
Yao Chend54f9dd2017-10-17 17:37:48 +0000242/*
243 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800244 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000245 *
246 * RULES:
247 * - The field ids for each atom must start at 1, and count upwards by 1.
248 * Skipping field ids is not allowed.
249 * - These form an API, so renaming, renumbering or removing fields is
250 * not allowed between android releases. (This is not currently enforced,
251 * but there will be a tool to enforce this restriction).
252 * - The types must be built-in protocol buffer types, namely, no sub-messages
253 * are allowed (yet). The bytes type is also not allowed.
254 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800255 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000256 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800257 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000258 * - A field that is a uid should be a string field, tagged with the [xxx]
259 * annotation. The generated code on android will be represented by UIDs,
260 * and those UIDs will be translated in xxx to those strings.
261 *
262 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700263 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000264 * - If there is a UID, it goes first. Think in an object-oriented fashion.
265 * *****************************************************************************
266 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700267
Yao Chend54f9dd2017-10-17 17:37:48 +0000268/**
Yangster-mace16189a2018-08-26 12:20:16 -0700269 * Logs when the Thermal service HAL notifies the throttling start/stop events.
270 *
271 * Logged from:
272 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
273 */
274message ThermalThrottlingStateChanged {
275 optional android.os.TemperatureTypeEnum sensor_type = 1;
276
277 enum State {
278 UNKNOWN = 0;
279 START = 1;
280 STOP = 2;
281 }
282
283 optional State state = 2;
284
285 optional float temperature = 3;
286}
287
288/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000289 * Logs when the screen state changes.
290 *
291 * Logged from:
292 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
293 */
294message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800295 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700296 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700297}
Yao Chend54f9dd2017-10-17 17:37:48 +0000298
299/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700300 * Logs that the process state of the uid, as determined by ActivityManager
301 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000302 *
303 * Logged from:
304 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
305 */
Bookatzc1a050a2017-10-10 15:49:28 -0700306message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700307 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000308
Bookatzdb026a22018-01-10 19:01:56 -0800309 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700310 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000311}
312
313/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700314 * Logs process state change of a process, as per the activity manager.
315 *
316 * Logged from:
317 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
318 */
319message ProcessStateChanged {
320 optional int32 uid = 1;
321 optional string process_name = 2;
322 optional string package_name = 3;
323 // TODO: remove this when validation is done
324 optional int64 version = 5;
325 // The state, from frameworks/base/core/proto/android/app/enums.proto.
326 optional android.app.ProcessStateEnum state = 4;
327}
328
329/**
330 * Logs when ActivityManagerService sleep state is changed.
331 *
332 * Logged from:
333 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
334 */
335message ActivityManagerSleepStateChanged {
336 // TODO: import frameworks proto
337 enum State {
338 UNKNOWN = 0;
339 ASLEEP = 1;
340 AWAKE = 2;
341 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700342 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700343}
344
345/**
346 * Logs when system memory state changes.
347 *
348 * Logged from:
349 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
350 */
351message MemoryFactorStateChanged {
352 // TODO: import frameworks proto
353 enum State {
354 MEMORY_UNKNOWN = 0;
355 NORMAL = 1; // normal.
356 MODERATE = 2; // moderate memory pressure.
357 LOW = 3; // low memory.
358 CRITICAL = 4; // critical memory.
359
360 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700361 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700362}
363
364/**
365 * Logs when app is using too much cpu, according to ActivityManagerService.
366 *
367 * Logged from:
368 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
369 */
370message ExcessiveCpuUsageReported {
371 optional int32 uid = 1;
372 optional string process_name = 2;
373 optional string package_name = 3;
374 // package version. TODO: remove this when validation is done
375 optional int64 version = 4;
376}
377
378/**
379 * Logs when a cached process is killed, along with its pss.
380 *
381 * Logged from:
382 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
383 */
384message CachedKillReported {
385 optional int32 uid = 1;
386 optional string process_name = 2;
387 optional string package_name = 3;
388 // TODO: remove this when validation is done
389 optional int64 version = 5;
390 optional int64 pss = 4;
391}
392
393/**
394 * Logs when memory stats of a process is reported.
395 *
396 * Logged from:
397 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
398 */
399message ProcessMemoryStatReported {
400 optional int32 uid = 1;
401 optional string process_name = 2;
402 optional string package_name = 3;
403 //TODO: remove this when validation is done
404 optional int64 version = 9;
405 optional int64 pss = 4;
406 optional int64 uss = 5;
407 optional int64 rss = 6;
408 enum Type {
409 ADD_PSS_INTERNAL_SINGLE = 0;
410 ADD_PSS_INTERNAL_ALL_MEM = 1;
411 ADD_PSS_INTERNAL_ALL_POLL = 2;
412 ADD_PSS_EXTERNAL = 3;
413 ADD_PSS_EXTERNAL_SLOW = 4;
414 }
415 optional Type type = 7;
416 optional int64 duration = 8;
417}
418
419/**
Bookatzc1a050a2017-10-10 15:49:28 -0700420 * Logs that a process started, finished, crashed, or ANRed.
421 *
422 * Logged from:
423 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
424 */
425message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700426 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700427
David Chen0b5c90c2018-01-25 16:51:49 -0800428 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800429 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700430
Bookatzddccf0a2017-11-28 16:48:14 -0800431 // What lifecycle state the process changed to.
432 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800433 enum State {
434 FINISHED = 0;
435 STARTED = 1;
436 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800437 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800438 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700439}
440
Bookatzc1a050a2017-10-10 15:49:28 -0700441/**
442 * Logs when the ble scan state changes.
443 *
444 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700445 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700446 */
447message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800448 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700449
450 enum State {
451 OFF = 0;
452 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700453 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
454 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700455 }
456 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700457
Bookatze5ec0b42018-03-26 13:34:56 -0700458 // Does the scan have a filter.
459 optional bool is_filtered = 3;
460 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
461 optional bool is_first_match = 4;
462 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
463 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700464}
465
466/**
467 * Logs reporting of a ble scan finding results.
468 *
469 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700470 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700471 */
Bookatzae6738e2018-09-13 11:38:56 -0700472// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700473message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800474 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700475
476 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800477 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700478}
479
480/**
481 * Logs when a sensor state changes.
482 *
483 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700484 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700485 */
486message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800487 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700488
Bookatzc1a050a2017-10-10 15:49:28 -0700489 // The id (int) of the sensor.
490 optional int32 sensor_id = 2;
491
492 enum State {
493 OFF = 0;
494 ON = 1;
495 }
496 optional State state = 3;
497}
498
499
500/**
501 * Logs when GPS state changes.
502 *
503 * Logged from:
504 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
505 */
506message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800507 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700508
509 enum State {
510 OFF = 0;
511 ON = 1;
512 }
513 optional State state = 2;
514}
515
516
517/**
518 * Logs when a sync manager sync state changes.
519 *
520 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700521 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700522 */
523message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800524 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700525
David Chen0b5c90c2018-01-25 16:51:49 -0800526 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800527 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700528
529 enum State {
530 OFF = 0;
531 ON = 1;
532 }
533 optional State state = 3;
534}
535
Yangster-mac96353002018-09-05 11:18:55 -0700536/*
537 * Deferred job stats.
538 *
539 * Logged from:
540 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
541*/
542message DeferredJobStatsReported {
543 repeated AttributionNode attribution_node = 1;
544
545 // Number of jobs deferred.
546 optional int32 num_jobs_deferred = 2;
547
548 // Time since the last job runs.
549 optional int64 time_since_last_job_millis = 3;
550}
551
Bookatzc1a050a2017-10-10 15:49:28 -0700552/**
553 * Logs when a job scheduler job state changes.
554 *
555 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700556 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700557 */
558message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800559 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700560
561 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800562 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700563
564 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800565 FINISHED = 0;
566 STARTED = 1;
567 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700568 }
569 optional State state = 3;
570
Tej Singh33a412b2018-03-16 18:43:59 -0700571 // The reason a job has stopped.
572 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700573 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700574 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700575}
576
577/**
578 * Logs when the audio state changes.
579 *
580 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700581 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700582 */
583message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800584 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700585
586 enum State {
587 OFF = 0;
588 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700589 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
590 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700591 }
592 optional State state = 2;
593}
594
595/**
596 * Logs when the video codec state changes.
597 *
598 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700599 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700600 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800601message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800602 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700603
604 enum State {
605 OFF = 0;
606 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700607 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
608 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700609 }
610 optional State state = 2;
611}
612
613/**
614 * Logs when the flashlight state changes.
615 *
616 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700617 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700618 */
619message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800620 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700621
622 enum State {
623 OFF = 0;
624 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700625 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
626 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700627 }
628 optional State state = 2;
629}
630
631/**
632 * Logs when the camera state changes.
633 *
634 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700635 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700636 */
637message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800638 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700639
640 enum State {
641 OFF = 0;
642 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700643 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
644 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700645 }
646 optional State state = 2;
647}
648
649/**
650 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000651 *
652 * Logged from:
653 * TODO
654 */
Bookatzd6746242017-10-24 18:39:35 -0700655message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800656 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000657
Bookatz1a1b0462018-01-12 11:47:03 -0800658 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
659 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700660 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700661
662 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
663 optional string tag = 3;
664
665 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800666 RELEASE = 0;
667 ACQUIRE = 1;
668 CHANGE_RELEASE = 2;
669 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700670 }
671 optional State state = 4;
672}
673
674/**
Bookatzc1a050a2017-10-10 15:49:28 -0700675 * Logs when a partial wakelock is considered 'long' (over 1 min).
676 *
677 * Logged from:
678 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
679 */
680message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800681 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700682
Yao Chend54f9dd2017-10-17 17:37:48 +0000683 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
684 optional string tag = 2;
685
Bookatzc1a050a2017-10-10 15:49:28 -0700686 // TODO: I have no idea what this is.
687 optional string history_tag = 3;
688
689 enum State {
690 OFF = 0;
691 ON = 1;
692 }
693 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000694}
695
Bookatzc1a050a2017-10-10 15:49:28 -0700696/**
Bookatza66083f2018-09-20 17:24:00 -0700697 * Logs when the device is interactive, according to the PowerManager Notifier.
698 *
699 * Logged from:
700 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
701 */
702message InteractiveStateChanged {
703 enum State {
704 OFF = 0;
705 ON = 1;
706 }
707 optional State state = 1;
708}
709
710/**
Bookatzc1a050a2017-10-10 15:49:28 -0700711 * Logs Battery Saver state change.
712 *
713 * Logged from:
714 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
715 */
716message BatterySaverModeStateChanged {
717 enum State {
718 OFF = 0;
719 ON = 1;
720 }
721 optional State state = 1;
722}
723
724/**
725 * Logs Doze mode state change.
726 *
727 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800728 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700729 */
730message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800731 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800732}
733
734
735/**
736 * Logs state change of Doze mode including maintenance windows.
737 *
738 * Logged from:
739 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
740 */
741message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800742 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700743}
744
745/**
746 * Logs screen brightness level.
747 *
748 * Logged from:
749 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
750 */
751message ScreenBrightnessChanged {
752 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
753 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700754}
755
756/**
757 * Logs battery level (percent full, from 0 to 100).
758 *
759 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700760 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700761 */
762message BatteryLevelChanged {
763 // Battery level. Should be in [0, 100].
764 optional int32 battery_level = 1;
765}
766
767/**
768 * Logs change in charging status of the device.
769 *
770 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700771 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700772 */
773message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800774 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
775 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700776}
777
778/**
779 * Logs whether the device is plugged in, and what power source it is using.
780 *
781 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700782 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700783 */
784message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800785 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
786 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700787}
788
Bookatz8c6571b2017-10-24 15:04:41 -0700789/**
790 * Logs when an app's wakeup alarm fires.
791 *
792 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700793 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700794 */
795message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800796 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800797
798 // Name of the wakeup alarm.
799 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700800
801 // Name of source package (for historical reasons, since BatteryStats tracked it).
802 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800803}
804
805/**
806 * Logs when an an app causes the mobile radio to change state.
807 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
808 *
809 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700810 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800811 */
812message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800813 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800814
Bookatz1a1b0462018-01-12 11:47:03 -0800815 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
816 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800817}
818
819/**
820 * Logs when an an app causes the wifi radio to change state.
821 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
822 *
823 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700824 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800825 */
826message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800827 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800828
Bookatz1a1b0462018-01-12 11:47:03 -0800829 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
830 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700831}
832
833/**
834 * Logs kernel wakeup reasons and aborts.
835 *
836 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700837 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700838 */
839message KernelWakeupReported {
840 // Name of the kernel wakeup reason (or abort).
841 optional string wakeup_reason_name = 1;
842
843 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800844 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700845}
846
847/**
848 * Logs wifi locks held by an app.
849 *
850 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700851 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700852 */
853message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800854 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700855
856 enum State {
857 OFF = 0;
858 ON = 1;
859 }
860 optional State state = 2;
861}
862
863/**
864 * Logs wifi signal strength changes.
865 *
866 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700867 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700868 */
869message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800870 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
871 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700872}
873
874/**
875 * Logs wifi scans performed by an app.
876 *
877 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700878 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700879 */
880message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800881 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700882
883 enum State {
884 OFF = 0;
885 ON = 1;
886 }
887 optional State state = 2;
888}
889
890/**
Tej Singh4503e102018-01-04 14:35:01 -0800891 * Logs wifi multicast locks held by an app
892 *
893 * Logged from:
894 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
895 */
896message WifiMulticastLockStateChanged {
897 repeated AttributionNode attribution_node = 1;
898
899 enum State {
900 OFF = 0;
901 ON = 1;
902 }
903 optional State state = 2;
904}
905
906/**
Tej Singh1ea42892018-01-19 09:27:00 -0800907 * Logs shutdown reason and duration on next boot.
908 *
909 * Logged from:
910 * frameworks/base/core/java/com/android/server/BootReceiver.java
911 */
912message ShutdownSequenceReported {
913 // True if shutdown is for a reboot. Default: false if we do not know.
914 optional bool reboot = 1;
915
916 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
917 optional string reason = 2;
918
919 // Beginning of shutdown time in ms using wall clock time since unix epoch.
920 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800921 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800922
923 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800924 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800925}
926
Tej Singh6483ea42018-01-25 17:45:49 -0800927
928/**
929 * Logs boot reason and duration.
930 *
931 * Logged from:
932 * system/core/bootstat/bootstat.cpp
933 */
934message BootSequenceReported {
935 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
936 // Default: "<EMPTY>" if not available.
937 optional string bootloader_reason = 1;
938
939 // Reason for system boot. Eg. bootloader, reboot,userrequested
940 // Default: "<EMPTY>" if not available.
941 optional string system_reason = 2;
942
943 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800944 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800945
946 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800947 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800948
949 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800950 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800951
952 // Time since last boot in ms. Default: 0 if not available.
953 optional int64 time_since_last_boot = 6;
954}
955
Tej Singhc477d9c2018-02-05 18:31:39 -0800956
957/**
958 * Logs call state and disconnect cause (if applicable).
959 *
960 * Logged from:
961 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
962 */
963message CallStateChanged {
964 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
965 // From frameworks/base/core/proto/android/telecomm/enums.proto.
966 optional android.telecom.CallStateEnum call_state = 1;
967
968 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
969 // This value is only applicable when the call_state is DISCONNECTED, and
970 // should always be UNKNOWN if the call_state is not DISCONNECTED.
971 // From frameworks/base/core/proto/android/telecomm/enums.proto.
972 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
973
974 // True if the call is self-managed, which are apps that use the
975 // telecom infrastructure to make their own calls.
976 optional bool self_managed = 3;
977
978 // True if call is external. External calls are calls on connected Wear
979 // devices but show up in Telecom so the user can pull them onto the device.
980 optional bool external_call = 4;
981}
982
Tej Singh1ea42892018-01-19 09:27:00 -0800983/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800984 * Logs keyguard state. The keyguard is the lock screen.
985 *
986 * Logged from:
987 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
988 */
989message KeyguardStateChanged {
990 enum State {
991 UNKNOWN = 0;
992 // The keyguard is hidden when the phone is unlocked.
993 HIDDEN = 1;
994 // The keyguard is shown when the phone is locked (screen turns off).
995 SHOWN= 2;
996 // The keyguard is occluded when something is overlaying the keyguard.
997 // Eg. Opening the camera while on the lock screen.
998 OCCLUDED = 3;
999 }
1000 optional State state = 1;
1001}
1002
1003/**
1004 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1005 * prompts the user to enter a password (pattern, pin, etc).
1006 *
1007 * Logged from:
1008 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1009 */
1010
1011message KeyguardBouncerStateChanged {
1012 enum State {
1013 UNKNOWN = 0;
1014 // Bouncer is hidden, either as a result of successfully entering the
1015 // password, screen timing out, or user going back to lock screen.
1016 HIDDEN = 1;
1017 // This is when the user is being prompted to enter the password.
1018 SHOWN = 2;
1019 }
1020 optional State state = 1;
1021}
1022
1023/**
1024 * Logs the result of entering a password into the keyguard bouncer.
1025 *
1026 * Logged from:
1027 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1028 */
1029message KeyguardBouncerPasswordEntered {
1030 enum BouncerResult {
1031 UNKNOWN = 0;
1032 // The password entered was incorrect.
1033 FAILURE = 1;
1034 // The password entered was correct.
1035 SUCCESS = 2;
1036 }
1037 optional BouncerResult result = 1;
1038}
1039
Tej Singha883b372018-02-15 11:30:01 -08001040/*
1041 * Logs changes to the configuration of the device. The configuration is defined
1042 * in frameworks/base/core/java/android/content/res/Configuration.java
1043 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1044 * Please go there to interpret the possible values each field can be.
1045 *
1046 * Logged from:
1047 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1048 */
1049message ResourceConfigurationChanged {
1050 // Bit mask of color capabilities of the screen.
1051 // Contains information about the color gamut and hdr mode of the screen.
1052 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001053 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001054
1055 // The target screen density being rendered to.
1056 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001057 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001058
1059 // Current user preference for the scaling factor for fonts,
1060 // relative to the base density scaling.
1061 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001062 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001063
1064 // Flag indicating whether the hard keyboard is hidden.
1065 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001066 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001067
1068 // The type of keyboard attached to the device.
1069 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1070 optional int32 keyboard = 5;
1071
1072 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1073 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001074 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001075
1076 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1077 // 0 if undefined.
1078 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1079 optional int32 mcc = 7;
1080
1081 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1082 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1083 // MNC_ZERO symbol defined in Configuration.java.
1084 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1085 optional int32 mnc = 8;
1086
1087 // The kind of navigation available on the device.
1088 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1089 optional int32 navigation = 9;
1090
1091 // Flag indicating whether the navigation is available.
1092 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001093 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001094
1095 // Overall orientation of the screen.
1096 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1097 optional int32 orientation = 11;
1098
1099 // The current height of the available screen space, in dp units.
1100 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001101 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001102
1103 // Bit mask of overall layout of the screen.
1104 // Contains information about screen size, whether the screen is wider/taller
1105 // than normal, whether the screen layout is right-tl-left or left-to-right,
1106 // and whether the screen has a rounded shape.
1107 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001108 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001109
1110 // Current width of the available screen space, in dp units.
1111 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001112 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001113
1114 // The smallest screen size an application will see in normal operation.
1115 // This is the smallest value of both screenWidthDp and screenHeightDp
1116 // in portrait and landscape.
1117 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001118 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001119
1120 // The type of touch screen attached to the device.
1121 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1122 optional int32 touchscreen = 16;
1123
1124 // Bit mask of the ui mode.
1125 // Contains information about the overall ui mode of the device.
1126 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1127 // Also contains information about whether the device is in night mode.
1128 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001129 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001130}
1131
Tej Singheee317b2018-03-07 19:28:05 -08001132
1133/**
1134 * Logs changes in the connection state of the mobile radio.
1135 *
1136 * Logged from:
1137 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1138 */
1139message MobileConnectionStateChanged {
1140 // States are from the state machine DataConnection.java.
1141 enum State {
1142 UNKNOWN = 0;
1143 // The connection is inactive, or disconnected.
1144 INACTIVE = 1;
1145 // The connection is being activated, or connecting.
1146 ACTIVATING = 2;
1147 // The connection is active, or connected.
1148 ACTIVE = 3;
1149 // The connection is disconnecting.
1150 DISCONNECTING = 4;
1151 // The connection is disconnecting after creating a connection.
1152 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1153 }
1154 optional State state = 1;
1155 // For multi-sim phones, this distinguishes between the sim cards.
1156 optional int32 sim_slot_index = 2;
1157 // Used to identify the connection. Starts at 0 and increments by 1 for
1158 // every new network created. Resets whenever the device reboots.
1159 optional int32 data_connection_id = 3;
1160 // A bitmask for the capabilities of this connection.
1161 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1162 // Default value (if we have no information): 0
1163 optional int64 capabilities = 4;
1164 // If this connection has internet.
1165 // This just checks if the DEFAULT bit of capabilities is set.
1166 optional bool has_internet = 5;
1167}
1168
1169/**
1170 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1171 *
1172 * Logged from:
1173 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1174 */
1175message MobileRadioTechnologyChanged {
1176 optional android.telephony.NetworkTypeEnum state = 1;
1177 // For multi-sim phones, this distinguishes between the sim cards.
1178 optional int32 sim_slot_index = 2;
1179}
1180
Andrew Chantb56388b2018-03-22 21:07:33 -07001181/**
1182 * Logs the VID and PID of any connected USB devices.
1183 *
1184 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1185 *
1186 * Logged by Vendor.
1187 */
1188message UsbDeviceAttached {
1189 optional int32 vid = 1;
1190 optional int32 pid = 2;
1191 optional bool has_audio = 3;
1192 optional bool has_hid = 4;
1193 optional bool has_storage = 5;
1194}
1195
Tej Singheee317b2018-03-07 19:28:05 -08001196
Tej Singhdd7bd352018-02-09 19:33:15 -08001197/**
Tej Singh5d991e12018-03-09 19:48:11 -08001198 * Logs when Bluetooth is enabled and disabled.
1199 *
1200 * Logged from:
1201 * services/core/java/com/android/server/BluetoothManagerService.java
1202 */
1203message BluetoothEnabledStateChanged {
1204 repeated AttributionNode attribution_node = 1;
1205 // Whether or not bluetooth is enabled on the device.
1206 enum State {
1207 UNKNOWN = 0;
1208 ENABLED = 1;
1209 DISABLED = 2;
1210 }
1211 optional State state = 2;
1212 // The reason for being enabled/disabled.
1213 // Eg. Airplane mode, crash, application request.
1214 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1215 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001216 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001217}
1218
1219/**
1220 * Logs when a Bluetooth device connects and disconnects.
1221 *
1222 * Logged from:
1223 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1224 */
1225message BluetoothConnectionStateChanged {
1226 // The state of the connection.
1227 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1228 optional android.bluetooth.ConnectionStateEnum state = 1;
1229 // An identifier that can be used to match connect and disconnect events.
1230 // Currently is last two bytes of a hash of a device level ID and
1231 // the mac address of the bluetooth device that is connected.
1232 optional int32 obfuscated_id = 2;
1233 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1234 // From android.bluetooth.BluetoothAdapter.java
1235 optional int32 bt_profile = 3;
1236}
1237
1238/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001239 * Logs when something is plugged into or removed from the USB-C connector.
1240 *
1241 * Logged from:
1242 * Vendor USB HAL.
1243 */
1244message UsbConnectorStateChanged {
1245 enum State {
1246 DISCONNECTED = 0;
1247 CONNECTED = 1;
1248 }
1249 optional State state = 1;
1250}
1251
1252/**
1253 * Logs the reported speaker impedance.
1254 *
1255 * Logged from:
1256 * Vendor audio implementation.
1257 */
1258message SpeakerImpedanceReported {
1259 optional int32 speaker_location = 1;
1260 optional int32 impedance = 2;
1261}
1262
1263/**
1264 * Logs the report of a failed hardware.
1265 *
1266 * Logged from:
1267 * Vendor HALs.
1268 *
1269 */
1270message HardwareFailed {
1271 enum HardwareType {
1272 HARDWARE_FAILED_UNKNOWN = 0;
1273 HARDWARE_FAILED_MICROPHONE = 1;
1274 HARDWARE_FAILED_CODEC = 2;
1275 HARDWARE_FAILED_SPEAKER = 3;
1276 HARDWARE_FAILED_FINGERPRINT = 4;
1277 }
1278 optional HardwareType hardware_type = 1;
1279
1280 /* hardware_location allows vendors to differentiate between multiple instances of
1281 * the same hardware_type. The specific locations are vendor defined integers,
1282 * referring to board-specific numbering schemes.
1283 */
1284 optional int32 hardware_location = 2;
1285
1286 /* failure_code is specific to the HardwareType of the failed hardware.
1287 * It should use the enum values defined below.
1288 */
1289 enum MicrophoneFailureCode {
1290 MICROPHONE_FAILURE_COMPLETE = 0;
1291 }
1292 enum CodecFailureCode {
1293 CODEC_FAILURE_COMPLETE = 0;
1294 }
1295 enum SpeakerFailureCode {
1296 SPEAKER_FAILURE_COMPLETE = 0;
1297 SPEAKER_FAILURE_HIGH_Z = 1;
1298 SPEAKER_FAILURE_SHORT = 2;
1299 }
1300 enum FingerprintFailureCode {
1301 FINGERPRINT_FAILURE_COMPLETE = 0;
1302 FINGERPRINT_SENSOR_BROKEN = 1;
1303 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1304 }
1305 optional int32 failure_code = 3;
1306}
1307
1308/**
1309 * Log an event when the device has been physically dropped.
1310 * Reported from the /vendor partition.
1311 */
1312message PhysicalDropDetected {
1313 // Confidence that the event was actually a drop, 0 -> 100
1314 optional int32 confidence_pctg = 1;
1315 // Peak acceleration of the drop, in 1/1000s of a g.
1316 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001317 // Duration of freefall in ms
1318 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001319}
1320
1321/**
1322 * Log bucketed battery charge cycles.
1323 *
1324 * Each bucket represents cycles of the battery past
1325 * a given charge point. For example, bucket 1 is the
1326 * lowest 1/8th of the battery, and bucket 8 is 100%.
1327 *
1328 * Logged from:
1329 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1330 */
1331message ChargeCyclesReported {
1332 optional int32 cycle_bucket_1 = 1;
1333 optional int32 cycle_bucket_2 = 2;
1334 optional int32 cycle_bucket_3 = 3;
1335 optional int32 cycle_bucket_4 = 4;
1336 optional int32 cycle_bucket_5 = 5;
1337 optional int32 cycle_bucket_6 = 6;
1338 optional int32 cycle_bucket_7 = 7;
1339 optional int32 cycle_bucket_8 = 8;
1340}
1341
1342/**
Howard Roa46b6582018-09-18 16:45:02 -07001343 * Log battery health snapshot.
1344 *
1345 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1346 * are snapshotted periodically over 24hrs.
1347 */
1348message BatteryHealthSnapshot {
1349 enum BatterySnapshotType {
1350 UNKNOWN = 0;
1351 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1352 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1353 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1354 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1355 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1356 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1357 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1358 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1359 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1360 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1361 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1362 }
1363 optional BatterySnapshotType type = 1;
1364 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001365 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001366 // Voltage Battery Voltage, in microVolts.
1367 optional int32 voltage_micro_volt = 3;
1368 // Current Battery current, in microAmps.
1369 optional int32 current_micro_amps = 4;
1370 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1371 optional int32 open_circuit_micro_volt = 5;
1372 // Resistance Battery Resistance, in microOhms.
1373 optional int32 resistance_micro_ohm = 6;
1374 // Level Battery Level, as % of full.
1375 optional int32 level_percent = 7;
1376}
1377
1378/**
1379 * Log slow I/O operations on the primary storage.
1380 */
1381message SlowIo {
1382 // Classifications of IO Operations.
1383 enum IoOperation {
1384 UNKNOWN = 0;
1385 READ = 1;
1386 WRITE = 2;
1387 UNMAP = 3;
1388 SYNC = 4;
1389 }
1390 optional IoOperation operation = 1;
1391
1392 // The number of slow IO operations of this type over 24 hours.
1393 optional int32 count = 2;
1394}
1395
1396/**
1397 * Log battery caused shutdown with the last recorded voltage.
1398 */
1399message BatteryCausedShutdown {
1400 // The last recorded battery voltage prior to shutdown.
1401 optional int32 last_recorded_micro_volt = 1;
1402}
1403
1404/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001405 * Logs the duration of a davey (jank of >=700ms) when it occurs
1406 *
1407 * Logged from:
1408 * frameworks/base/libs/hwui/JankTracker.cpp
1409 */
1410message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001411 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001412 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001413
Tej Singhbb8554a2018-01-26 11:59:14 -08001414 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001415 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001416}
1417
1418/**
Bookatze5885242017-10-24 20:10:31 -07001419 * Logs phone signal strength changes.
1420 *
1421 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001422 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001423 */
1424message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001425 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1426 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001427}
1428
Yangster4ccebea2018-10-09 17:09:02 -07001429
1430/**
1431 * Logs when the phone state, sim state or signal strength changes
1432 *
1433 * Logged from:
1434 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1435 */
1436message PhoneServiceStateChanged {
1437 optional android.telephony.ServiceStateEnum state = 1;
1438 optional android.telephony.SimStateEnum sim_state = 2;
1439 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1440}
1441
1442/**
1443 * Logs when the phone becomes on or off.
1444 *
1445 * Logged from:
1446 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1447 */
1448message PhoneStateChanged {
1449 enum State {
1450 OFF = 0;
1451 ON = 1;
1452 }
1453 optional State state = 1;
1454}
1455
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001456message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001457 optional android.stats.launcher.LauncherAction action = 1;
1458 optional android.stats.launcher.LauncherState src_state = 2;
1459 optional android.stats.launcher.LauncherState dst_state = 3;
1460 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001461 optional bool is_swipe_up_enabled = 5;
1462}
1463
David Chenc28b2bb2017-10-24 12:52:52 -07001464/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001465 * Logs when Settings UI has changed.
1466 *
1467 * Logged from:
1468 * packages/apps/Settings
1469 */
1470message SettingsUIChanged {
1471 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001472 * Where this SettingsUIChange event comes from. For example, if
1473 * it's a PAGE_VISIBLE event, where the page is opened from.
1474 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001475 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001476
1477 /**
1478 * What the UI action is.
1479 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001480 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001481
1482 /**
1483 * Where the action is happening
1484 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001485 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001486
1487 /**
1488 * What preference changed in this event.
1489 */
1490 optional string changedPreferenceKey = 4;
1491
1492 /**
1493 * The new value of the changed preference.
1494 */
1495 optional int64 changedPreferenceIntValue = 5;
1496}
1497
1498/**
David Chenc28b2bb2017-10-24 12:52:52 -07001499 * Logs that a setting was updated.
1500 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001501 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001502 * The tag and is_default allow resetting of settings to default values based on the specified
1503 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1504 */
1505message SettingChanged {
1506 // The name of the setting.
1507 optional string setting = 1;
1508
1509 // The change being imposed on this setting. May represent a number, eg "3".
1510 optional string value = 2;
1511
1512 // The new value of this setting. For most settings, this is same as value. For some settings,
1513 // value is +X or -X where X represents an element in a set. For example, if the previous value
1514 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1515 // The +/- feature is currently only used for location_providers_allowed.
1516 optional string new_value = 3;
1517
1518 // The previous value of this setting.
1519 optional string prev_value = 4;
1520
1521 // The tag used with the is_default for resetting sets of settings. This is generally null.
1522 optional string tag = 5;
1523
Bookatz90867622018-01-31 15:05:57 -08001524 // True if this setting with tag should be resettable.
1525 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001526
David Chenbd789912018-03-16 17:19:55 -07001527 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001528 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001529
1530 enum ChangeReason {
1531 UPDATED = 1; // Updated can be an insertion or an update.
1532 DELETED = 2;
1533 }
1534 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001535}
Chenjie Yub3dda412017-10-24 13:41:59 -07001536
Chenjie Yu05013b32017-11-21 10:21:41 -08001537/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001538 * Logs activity going to foreground or background
1539 *
1540 * Logged from:
1541 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1542 */
1543message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001544 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001545 optional string pkg_name = 2;
1546 optional string class_name = 3;
1547
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001548 enum State {
1549 BACKGROUND = 0;
1550 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001551 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001552 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001553}
David Chenc8a43242017-10-17 16:23:28 -07001554
1555/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001556 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001557 * Logged from:
1558 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1559 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001560message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001561 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001562
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001563 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001564
1565 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001566 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001567 optional string process_name = 3;
1568
1569 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001570 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001571
1572 optional string package_name = 5;
1573
1574 enum InstantApp {
1575 UNAVAILABLE = 0;
1576 FALSE = 1;
1577 TRUE = 2;
1578 }
1579 optional InstantApp is_instant_app = 6;
1580
1581 enum ForegroundState {
1582 UNKNOWN = 0;
1583 BACKGROUND = 1;
1584 FOREGROUND = 2;
1585 }
1586 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001587}
David Chen9e3808c2017-11-20 17:25:34 -08001588
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001589/**
1590 * Logs when a WTF (What a Terrible Failure) happened.
1591 * Logged from:
1592 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1593 */
1594message WTFOccurred {
1595 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001596
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001597 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001598
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001599 // The name of the process.
1600 // system_server if it is not by an app
1601 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001602
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001603 // The pid if available. -1 means not available.
1604 optional sint32 pid = 4;
1605}
1606
1607/**
1608 * Logs when system server reports low memory.
1609 * Logged from:
1610 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1611 */
1612message LowMemReported {
1613}
1614
1615/**
1616 * Logs when an app ANR (App Not Responding) occurs.
1617 * Logged from:
1618 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1619 */
1620message ANROccurred {
1621 optional int32 uid = 1 [(is_uid) = true];
1622
1623 optional string process_name = 2;
1624
1625 optional string short_component_name = 3;
1626
1627 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001628
1629 enum InstantApp {
1630 UNAVAILABLE = 0;
1631 FALSE = 1;
1632 TRUE = 2;
1633 }
1634 optional InstantApp is_instant_app = 5;
1635
1636 enum ForegroundState {
1637 UNKNOWN = 0;
1638 BACKGROUND = 1;
1639 FOREGROUND = 2;
1640 }
1641 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001642}
1643
Bookatza7020bd2018-08-28 16:29:35 -07001644/**
1645 * Logs when the vibrator state changes.
1646 * Logged from:
1647 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1648 */
1649message VibratorStateChanged {
1650 repeated AttributionNode attribution_node = 1;
1651
1652 enum State {
1653 OFF = 0;
1654 ON = 1;
1655 }
1656 optional State state = 2;
1657
1658 // Duration (in milliseconds) requested to keep the vibrator on.
1659 // Only applicable for State == ON.
1660 optional int64 duration_millis = 3;
1661}
1662
David Chen0a368b22017-12-06 16:28:16 -08001663/*
1664 * Allows other apps to push events into statsd.
1665 * Logged from:
1666 * frameworks/base/core/java/android/util/StatsLog.java
1667 */
David Chen0b5c90c2018-01-25 16:51:49 -08001668message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001669 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001670 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001671
1672 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1673 optional int32 label = 2;
1674
1675 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1676 // predicates for the metrics).
1677 enum State {
1678 UNKNOWN = 0;
1679 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1680 STOP = 2;
1681 START = 3;
1682 }
1683 optional State state = 3;
1684}
1685
David Chen9e3808c2017-11-20 17:25:34 -08001686/**
Bookatz7948c872018-09-04 12:58:33 -07001687 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1688 * For example, this could be due to the user manually changing the time.
1689 *
1690 * Logged from:
1691 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1692 */
1693message WallClockTimeShifted {
1694 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1695 optional int64 wall_clock_timestamp_millis = 1;
1696}
1697
1698/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001699 * Logs when statsd detects an anomaly.
1700 *
1701 * Logged from:
1702 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1703 */
1704message AnomalyDetected {
1705 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001706 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001707
Yangster-mac94e197c2018-01-02 16:03:03 -08001708 // Id of the config whose anomaly detection alert fired.
1709 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001710
Yangster-mac94e197c2018-01-02 16:03:03 -08001711 // Id of the alert (i.e. name of the anomaly that was detected).
1712 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001713}
1714
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001715message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001716 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001717 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001718
1719 // The app package name.
1720 optional string pkg_name = 2;
1721
1722 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001723 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001724 WARM = 1;
1725 HOT = 2;
1726 COLD = 3;
1727 }
1728 // The transition type.
1729 optional TransitionType type = 3;
1730
1731 // The activity name.
1732 optional string activity_name = 4;
1733
1734 // The name of the calling app. Empty if not set.
1735 optional string calling_pkg_name = 5;
1736
1737 // Whether the app is an instant app.
1738 optional bool is_instant_app = 6;
1739
1740 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001741 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001742
Bookatz80d11a02018-01-16 10:46:35 -08001743 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001744
David Chen0b5c90c2018-01-25 16:51:49 -08001745 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001746 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001747 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001748 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001749 optional int32 bind_application_delay_millis = 11;
1750 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001751
1752 // Empty if not set.
1753 optional string launch_token = 13;
1754
Calin Juravle759fbda2018-02-20 19:52:30 +00001755 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001756 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001757
1758 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001759 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001760}
1761
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001762message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001763 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001764 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001765
1766 // The app package name.
1767 optional string pkg_name = 2;
1768
1769 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001770 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001771 WARM = 1;
1772 HOT = 2;
1773 COLD = 3;
1774 }
1775 // The transition type.
1776 optional TransitionType type = 3;
1777
1778 // The activity name.
1779 optional string activity_name = 4;
1780}
1781
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001782message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001783 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001784 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001785
1786 // The app package name.
1787 optional string pkg_name = 2;
1788
1789 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001790 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001791 WITH_BUNDLE = 1;
1792 WITHOUT_BUNDLE = 2;
1793 }
1794 // The transition type.
1795 optional TransitionType type = 3;
1796
1797 // The activity name.
1798 optional string activity_name = 4;
1799
1800 optional bool transition_process_running = 5;
1801
1802 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001803 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001804}
1805
Bookatz8fcd09a2017-12-18 13:01:10 -08001806/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001807 * Logs a picture-in-picture action
1808 * Logged from:
1809 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1810 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1811 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1812 */
1813message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001814 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001815 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001816
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001817 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001818
Chenjie Yu52cacc62017-12-08 18:11:45 -08001819 enum State {
1820 ENTERED = 1;
1821 EXPANDED_TO_FULL_SCREEN = 2;
1822 MINIMIZED = 3;
1823 DISMISSED = 4;
1824 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001825 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001826}
1827
1828/**
Chenjie Yue8904192017-12-08 19:12:57 -08001829 * Logs overlay action
1830 * Logged from:
1831 * services/core/java/com/android/server/wm/Session.java
1832 */
1833message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001834 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001835
1836 optional string package_name = 2;
1837
1838 optional bool using_alert_window = 3;
1839
1840 enum State {
1841 ENTERED = 1;
1842 EXITED = 2;
1843 }
1844 optional State state = 4;
1845}
1846
Chenjie Yuccfe6452018-01-30 11:33:21 -08001847/*
1848 * Logs foreground service starts and stops.
1849 * Note that this is not when a service starts or stops, but when it is
1850 * considered foreground.
1851 * Logged from
1852 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1853 */
1854message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001855 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001856 // package_name + "/" + class_name
1857 optional string short_name = 2;
1858
1859 enum State {
1860 ENTER = 1;
1861 EXIT = 2;
1862 }
1863 optional State state = 3;
1864}
1865
Chenjie Yue8904192017-12-08 19:12:57 -08001866/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001867 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1868 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1869 * attributed back to the parent (host) uid. One example is Chrome.
1870 *
1871 * Logged from:
1872 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1873 */
1874message IsolatedUidChanged {
1875 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001876 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001877 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001878 optional int32 parent_uid = 1;
1879
1880 optional int32 isolated_uid = 2;
1881
1882 // We expect an isolated uid to be removed before if it's used for another parent uid.
1883 enum Event {
1884 REMOVED = 0;
1885 CREATED = 1;
1886 }
1887 optional Event event = 3;
1888}
1889
1890/*
1891 * Logs the reception of an incoming network packet causing the main system to wake up for
1892 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1893 * and processed by WakeupController.cpp.
1894 */
1895message PacketWakeupOccurred {
1896 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1897 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001898 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001899 // The interface name on which the packet was received.
1900 optional string iface = 2;
1901 // The ethertype value of the packet.
1902 optional int32 ethertype = 3;
1903 // String representation of the destination MAC address of the packet.
1904 optional string destination_hardware_address = 4;
1905 // String representation of the source address of the packet if this was an IP packet.
1906 optional string source_ip = 5;
1907 // String representation of the destination address of the packet if this was an IP packet.
1908 optional string destination_ip = 6;
1909 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1910 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1911 // families.
1912 optional int32 ip_next_header = 7;
1913 // The source port if this was a TCP or UDP packet.
1914 optional int32 source_port = 8;
1915 // The destination port if this was a TCP or UDP packet.
1916 optional int32 destination_port = 9;
1917}
1918
1919/*
1920 * Logs the memory stats for an app on startup.
1921 * Logged from:
1922 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1923 */
1924message AppStartMemoryStateCaptured {
1925 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001926 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001927
1928 // The process name.
1929 optional string process_name = 2;
1930
1931 // The activity name.
1932 optional string activity_name = 3;
1933
1934 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001935 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001936
1937 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001938 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001939
1940 // RSS
1941 optional int64 rss_in_bytes = 6;
1942
1943 // CACHE
1944 optional int64 cache_in_bytes = 7;
1945
1946 // SWAP
1947 optional int64 swap_in_bytes = 8;
1948}
1949
1950/*
1951 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1952 * for LMK event.
1953 * Logged from:
1954 * system/core/lmkd/lmkd.c
1955 */
1956message LmkStateChanged {
1957 enum State {
1958 UNKNOWN = 0;
1959 START = 1;
1960 STOP = 2;
1961 }
1962 optional State state = 1;
1963}
1964
1965/*
1966 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1967 * Logged from:
1968 * system/core/lmkd/lmkd.c
1969 */
1970message LmkKillOccurred {
1971 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001972 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001973
1974 // The process name.
1975 optional string process_name = 2;
1976
1977 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07001978 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001979
1980 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001981 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001982
1983 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001984 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001985
1986 // RSS
1987 optional int64 rss_in_bytes = 6;
1988
1989 // CACHE
1990 optional int64 cache_in_bytes = 7;
1991
1992 // SWAP
1993 optional int64 swap_in_bytes = 8;
1994}
1995
Rajeev Kumar51b54602018-03-01 12:18:26 -08001996/*
1997 * Logs when the ActivityManagerService detects that an app died.
1998 *
1999 * Logged from:
2000 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2001 */
2002message AppDied {
2003 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002004 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002005}
2006
Howard Ro21a039c2018-08-06 14:55:47 -07002007/**
2008 * An atom for generic metrics logging. Available from Android Q.
2009 */
2010message GenericAtom {
2011 // The uid of the application that sent this custom atom.
2012 optional int32 uid = 1 [(is_uid) = true];
2013
2014 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002015 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002016}
2017
Tej Singhd6d6d772018-09-05 17:41:25 -07002018/**
2019 * Logs when a fingerprint acquire event occurs.
2020 *
2021 * Logged from:
2022 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2023 */
2024message FingerprintAcquired {
2025 // The associated user. Eg: 0 for owners, 10+ for others.
2026 // Defined in android/os/UserHandle.java
2027 optional int32 user = 1;
2028 // If this acquire is for a crypto fingerprint.
2029 // e.g. Secure purchases, unlock password storage.
2030 optional bool is_crypto = 2;
2031}
2032
2033/**
2034 * Logs when a fingerprint authentication event occurs.
2035 *
2036 * Logged from:
2037 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2038 */
2039message FingerprintAuthenticated {
2040 // The associated user. Eg: 0 for owners, 10+ for others.
2041 // Defined in android/os/UserHandle.java
2042 optional int32 user = 1;
2043 // If this authentication is for a crypto fingerprint.
2044 // e.g. Secure purchases, unlock password storage.
2045 optional bool is_crypto = 2;
2046 // Whether or not this authentication was successful.
2047 optional bool is_authenticated = 3;
2048}
2049
2050/**
2051 * Logs when a fingerprint error occurs.
2052 *
2053 * Logged from:
2054 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2055 */
2056message FingerprintErrorOccurred {
2057 // The associated user. Eg: 0 for owners, 10+ for others.
2058 // Defined in android/os/UserHandle.java
2059 optional int32 user = 1;
2060 // If this error is for a crypto fingerprint.
2061 // e.g. Secure purchases, unlock password storage.
2062 optional bool is_crypto = 2;
2063
2064 enum Error {
2065 UNKNOWN = 0;
2066 LOCKOUT = 1;
2067 PERMANENT_LOCKOUT = 2;
2068 }
2069 // The type of error.
2070 optional Error error = 3;
2071}
Howard Ro688ae182018-09-25 00:09:36 -07002072
2073message Notification {
2074
2075 // Type of notification event.
2076 enum Type {
2077 TYPE_UNKNOWN = 0;
2078 // Notification became visible to the user.
2079 TYPE_OPEN = 1;
2080 // Notification became hidden.
2081 TYPE_CLOSE = 2;
2082 // Notification switched to detail mode.
2083 TYPE_DETAIL = 3;
2084 // Notification was clicked.
2085 TYPE_ACTION = 4;
2086 // Notification was dismissed.
2087 TYPE_DISMISS = 5;
2088 // Notification switched to summary mode. The enum value of 14 is to
2089 // match that of metrics_constants.
2090 TYPE_COLLAPSE = 14;
2091 }
2092 optional Type type = 1;
2093
2094 // Package name associated with the notification.
2095 optional string package_name = 2;
2096
2097 // Tag associated with notification.
2098 optional string tag = 3;
2099
2100 // Application-supplied ID associated with the notification.
2101 optional int32 id = 4;
2102
2103 // Index of notification in the notification panel.
2104 optional int32 shade_index = 5;
2105
2106 // The number of notifications in the notification panel.
2107 optional int32 shade_count = 6;
2108
2109 // Importance for the notification.
2110 optional int32 importance = 7;
2111
2112 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002113 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002114
2115 // Importance for the notification channel.
2116 optional int32 channel_importance = 9;
2117
Howard Ro183c2bd2018-10-18 13:52:10 -07002118 // Application-supplied ID associated with the notifications group.
2119 optional string group_id = 10;
2120
Howard Ro688ae182018-09-25 00:09:36 -07002121 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002122 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002123
Howard Ro183c2bd2018-10-18 13:52:10 -07002124 // Reason for dismissal of a notification. This field is only meaningful for
2125 // TYPE_DISMISS events.
2126 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002127
Howard Ro183c2bd2018-10-18 13:52:10 -07002128 // The first post time of notification, stable across updates.
2129 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002130
Howard Ro183c2bd2018-10-18 13:52:10 -07002131 // The most recent interruption time, or the creation time if no updates.
2132 // Differs from update_millis because updates are filtered based on whether
2133 // they actually interrupted the user.
2134 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002135
Howard Ro183c2bd2018-10-18 13:52:10 -07002136 // The most recent update time, or the creation time if no updates.
2137 optional int64 update_millis = 15;
2138
2139 // The most recent visibility event.
2140 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002141}
2142
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002143/*
Yangster-macb89807e2018-11-15 21:10:57 -08002144 * Logs when a flag flip state changes.
2145 * Logged in P/h.
2146 */
2147message PhenotypeFlagStateChanged {
2148 // Mendel configuration name.
2149 optional string mendel_config_name = 1;
2150 // State
2151 enum State {
2152 STATE_UNKNOWN = 0;
2153 COMMITTED = 1;
2154 }
2155 optional State state = 2;
2156}
2157
2158/*
2159 * Logs when a binary push state changes.
2160 * Logged in Play store
2161 */
2162message BinaryPushStateChanged {
2163 // Binary package name.
2164 optional string binary_name = 1;
2165 // Version code.
2166 optional int64 version = 2;
2167 // State
2168 enum State {
2169 STATE_UNKNOWN = 0;
2170 DOWNLOAD_START = 1;
2171 DOWNLOAD_DONE = 2;
2172 INSTALL_START = 3;
2173 INSTALL_DONE = 4;
2174 REBOOT_START = 5;
2175 REBOOT_DONE = 6;
2176 }
2177 optional State state = 3;
2178}
2179
2180/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002181 * Logs when a connection becomes available and lost.
2182 * Logged in StatsCompanionService.java
2183 */
2184message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002185 // Id of the network.
2186 optional int32 net_id = 1;
2187
2188 enum State {
2189 UNKNOWN = 0;
2190 CONNECTED = 1;
2191 DISCONNECTED = 2;
2192 }
2193 // Connected state of a network.
2194 optional State state = 2;
2195}
2196
2197/**
2198 * Logs when a service starts and stops.
2199 * Logged from:
2200 * services/core/java/com/android/server/am/ActiveServices.java
2201 */
2202message ServiceStateChanged {
2203
2204 optional int32 uid = 1 [(is_uid) = true];
2205
2206 optional string package_name = 2;
2207
2208 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002209
2210 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002211 START = 1;
2212 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002213 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002214
2215 optional State state = 4;
2216}
2217
2218/**
2219 * Logs when a service is launched.
2220 * Logged from:
2221 * services/core/java/com/android/server/am/ActiveServices.java
2222 */
2223message ServiceLaunchReported {
2224
2225 optional int32 uid = 1 [(is_uid) = true];
2226
2227 optional string package_name = 2;
2228
2229 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002230}
Howard Ro688ae182018-09-25 00:09:36 -07002231
Chenjie Yubbcbc602018-02-05 16:51:52 -08002232//////////////////////////////////////////////////////////////////////
2233// Pulled atoms below this line //
2234//////////////////////////////////////////////////////////////////////
2235
2236/**
David Chenc8a43242017-10-17 16:23:28 -07002237 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2238 *
2239 * Pulled from:
2240 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2241 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002242message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002243 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002244
2245 optional int64 rx_bytes = 2;
2246
2247 optional int64 rx_packets = 3;
2248
2249 optional int64 tx_bytes = 4;
2250
2251 optional int64 tx_packets = 5;
2252}
2253
2254/**
2255 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2256 *
2257 * Pulled from:
2258 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2259 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002260message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002261 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002262
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002263 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2264 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002265
2266 optional int64 rx_bytes = 3;
2267
2268 optional int64 rx_packets = 4;
2269
2270 optional int64 tx_bytes = 5;
2271
2272 optional int64 tx_packets = 6;
2273}
2274
2275/**
2276 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2277 *
2278 * Pulled from:
2279 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2280 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002281message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002282 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002283
2284 optional int64 rx_bytes = 2;
2285
2286 optional int64 rx_packets = 3;
2287
2288 optional int64 tx_bytes = 4;
2289
2290 optional int64 tx_packets = 5;
2291}
2292
2293/**
2294 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2295 *
2296 * Pulled from:
2297 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2298 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002299message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002300 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002301
Yao Chenc40a19d2018-03-15 16:48:25 -07002302 // 1 denotes foreground and 0 denotes background. This is called Set in
2303 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002304 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002305
2306 optional int64 rx_bytes = 3;
2307
2308 optional int64 rx_packets = 4;
2309
2310 optional int64 tx_bytes = 5;
2311
2312 optional int64 tx_packets = 6;
2313}
2314
2315/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002316 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2317 *
2318 * Pulled from:
2319 * StatsCompanionService
2320 */
2321message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002322 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002323
2324 optional int64 rx_bytes = 2;
2325
2326 optional int64 tx_bytes = 3;
2327}
2328
2329/**
David Chenc8a43242017-10-17 16:23:28 -07002330 * Pulls the kernel wakelock durations. This atom is adapted from
2331 * android/internal/os/KernelWakelockStats.java
2332 *
2333 * Pulled from:
2334 * StatsCompanionService using KernelWakelockReader.
2335 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002336message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002337 optional string name = 1;
2338
2339 optional int32 count = 2;
2340
2341 optional int32 version = 3;
2342
Yangster-maca8a30442018-10-13 23:46:34 -07002343 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002344}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002345
Chenjie Yu05013b32017-11-21 10:21:41 -08002346/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002347 * Pulls low power state information. This includes platform and subsystem sleep state information,
2348 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002349 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002350 * hardware/interfaces/power/1.1/types.hal
2351 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002352message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002353 // Subsystem name
2354 optional string subsystem_name = 1;
2355 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2356 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2357 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002358 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002359 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002360 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002361 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002362}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002363
Chenjie Yu05013b32017-11-21 10:21:41 -08002364/**
Bookatz92da2832018-11-01 18:10:03 -07002365 * Pulls on-device power measurement information.
2366 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2367 * Pulled from:
2368 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2369 */
2370message OnDevicePowerMeasurement {
2371 // Name of the subsystem (to which the rail belongs).
2372 optional string subsystem_name = 1;
2373
2374 // Rail name. The rail lies within the subsystem.
2375 optional string rail_name = 2;
2376
2377 // Time (in ms since boot) at which the rail energy value was measured.
2378 // This may differ slightly from the time that statsd logs this information.
2379 optional uint64 measurement_timestamp_millis = 3;
2380
2381 // Accumulated energy used via the rail since device boot in uWs.
2382 optional uint64 energy_microwatt_secs = 4;
2383}
2384
2385/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002386 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002387 * Pulls the time the cpu spend on the frequency index. Frequency index
2388 * starts from highest to lowest. The value should be monotonically
2389 * increasing since boot. However, if there is a cpu
2390 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002391 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002392message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002393 optional uint32 cluster = 1;
2394 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002395 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002396}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002397
Chenjie Yu05013b32017-11-21 10:21:41 -08002398/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002399 * Pulls Cpu Time Per Uid.
2400 * Note that isolated process uid time should be attributed to host uids.
2401 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002402message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002403 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002404 optional uint64 user_time_millis = 2;
2405 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002406}
2407
2408/**
2409 * Pulls Cpu Time Per Uid per frequency.
2410 * Note that isolated process uid time should be attributed to host uids.
2411 * For each uid, we order the time by descending frequencies.
2412 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002413message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002414 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002415 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002416 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002417}
Hugo Benichi884970e2017-11-14 22:42:46 +09002418
Chenjie Yu05013b32017-11-21 10:21:41 -08002419/**
2420 * Pulls Wifi Controller Activity Energy Info
2421 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002422message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002423 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002424 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002425 // stack reported state
2426 // TODO: replace this with proto enum
2427 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002428 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002429 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002430 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002431 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002432 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002433 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002434 // product of current(mA), voltage(V) and time(ms)
2435 optional uint64 controller_energy_used = 6;
2436}
2437
2438/**
2439 * Pulls Modem Activity Energy Info
2440 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002441message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002442 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002443 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002444 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002445 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002446 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002447 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002448 /**
2449 * Tx power index
2450 * index 0 = tx_power < 0dBm
2451 * index 1 = 0dBm < tx_power < 5dBm
2452 * index 2 = 5dBm < tx_power < 15dBm
2453 * index 3 = 15dBm < tx_power < 20dBm
2454 * index 4 = tx_power > 20dBm
2455 */
2456 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002457 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002458 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002459 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002460 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002461 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002462 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002463 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002464 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002465 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002466 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002467 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002468 // product of current(mA), voltage(V) and time(ms)
2469 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002470}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002471
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002472/**
2473 * Pulls Bluetooth Activity Energy Info
2474 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2475 */
2476message BluetoothActivityInfo {
2477 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002478 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002479 // bluetooth stack state
2480 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002481 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002482 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002483 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002484 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002485 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002486 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002487 // product of current(mA), voltage(V) and time(ms)
2488 optional uint64 energy_used = 6;
2489}
2490
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002491/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002492 * Logs the memory stats for a process.
2493 */
2494message ProcessMemoryState {
2495 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002496 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002497
2498 // The process name.
2499 optional string process_name = 2;
2500
2501 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002502 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002503
2504 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002505 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002506
2507 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002508 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002509
Rajeev Kumar90235992018-01-29 11:06:48 -08002510 // RSS
2511 optional int64 rss_in_bytes = 6;
2512
2513 // CACHE
2514 optional int64 cache_in_bytes = 7;
2515
2516 // SWAP
2517 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002518
2519 // RSS high watermark.
2520 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2521 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2522 optional int64 rss_high_watermark_in_bytes = 9;
Rafal Slawik272a8162018-11-01 15:12:28 +00002523
2524 // Elapsed real time when the process started.
2525 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2526 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002527}
2528
2529/*
Rafal Slawik08621582018-10-15 14:53:07 +01002530 * Logs the memory stats for a native process (from procfs).
2531 */
2532message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002533 // The uid if available. -1 means not available.
2534 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002535
Rafal Slawikbf67d072018-10-23 11:07:54 +01002536 // The process name.
2537 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002538
Rafal Slawikbf67d072018-10-23 11:07:54 +01002539 // # of page-faults
2540 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002541
Rafal Slawikbf67d072018-10-23 11:07:54 +01002542 // # of major page-faults
2543 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002544
Rafal Slawikbf67d072018-10-23 11:07:54 +01002545 // RSS
2546 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002547
Rafal Slawikbf67d072018-10-23 11:07:54 +01002548 // RSS high watermark.
2549 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
2550 optional int64 rss_high_watermark_in_bytes = 6;
2551
2552 // Elapsed real time when the process started.
2553 // Value is read from /proc/PID/stat, field 22.
2554 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002555}
2556
2557/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002558 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002559 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002560message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002561 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002562}
2563
2564/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002565 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002566 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002567message SystemUptime {
2568 // Milliseconds since the system was booted.
2569 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2570 // for external input).
2571 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002572 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002573}
2574
2575/*
2576 * Reads from /proc/uid_concurrent_active_time which has the format:
2577 * active: X (X is # cores)
2578 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2579 * [uid1]: [time-0] [time-1] [time-2] ... ...
2580 * ...
2581 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2582 * The file contains a monotonically increasing count of time for a single boot.
2583 */
2584message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002585 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002586 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002587}
2588
2589/**
2590 * Reads from /proc/uid_concurrent_policy_time which has the format:
2591 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2592 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2593 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2594 * ...
2595 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2596 * The file contains a monotonically increasing count of time for a single boot.
2597 */
2598message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002599 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002600 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002601 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002602}
2603
2604/*
2605 * Pulls free disk space, for data, system partition and temporary directory.
2606 */
2607message DiskSpace {
2608 // available bytes in data partition
2609 optional uint64 data_available_bytes = 1;
2610 // available bytes in system partition
2611 optional uint64 system_available_bytes = 2;
2612 // available bytes in download cache or temp directories
2613 optional uint64 temp_available_bytes = 3;
2614}
Tej Singhbf972d92018-01-10 20:51:13 -08002615
2616/**
2617 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002618 * Pulled from:
2619 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002620 */
2621message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002622 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002623}
2624
2625/**
2626 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002627 * Pulled from:
2628 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002629 */
2630message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002631 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002632}
2633
2634/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002635 * Pulls battery voltage.
2636 * Pulled from:
2637 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2638 */
2639message BatteryVoltage {
2640 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002641 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002642}
2643
2644/**
Tej Singhd89137e2018-03-26 14:51:40 -07002645 * Pulls the temperature of various parts of the device.
2646 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002647 *
2648 * Pulled from:
2649 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2650 */
2651message Temperature {
2652 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2653 optional android.os.TemperatureTypeEnum sensor_location = 1;
2654
2655 // The name of the temperature source. Eg. CPU0
2656 optional string sensor_name = 2;
2657
Tej Singhd89137e2018-03-26 14:51:40 -07002658 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002659 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002660}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002661
2662/**
2663 * Pulls the statistics of calls to Binder.
2664 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002665 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2666 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002667 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002668 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002669 */
2670message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002671 // UID of the process responsible for the binder transaction. It will be set if the process
2672 // executing the binder transaction attribute the transaction to another uid using
2673 // Binder.setThreadWorkSource().
2674 //
2675 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002676 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002677 // UID of the process executing the binder transaction.
2678 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002679 // Fully qualified class name of the API call.
2680 //
2681 // This is a system server class name.
2682 //
2683 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2684 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2685 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2686 // commonly used APIs.
2687 optional string service_class_name = 2;
2688 // Method name of the API call. It can also be a transaction code if we cannot
2689 // resolve it to a name. See Binder#getTransactionName.
2690 //
2691 // This is a system server method name.
2692 optional string service_method_name = 3;
2693 // Total number of API calls.
2694 optional int64 call_count = 4;
2695 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2696 optional bool screen_interactive = 13;
2697 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2698 // call_count will be equal to recorded_call_count.
2699 //
2700 // If recorded_call_count is different than call_count, it means data collection has been
2701 // sampled. All the fields below will be sampled in this case.
2702 optional int64 recorded_call_count = 12;
2703 // Number of exceptions thrown by the API.
2704 optional int64 recorded_exception_count = 5;
2705 // Total latency of all API calls.
2706 // Average can be computed using total_latency_micros / recorded_call_count.
2707 optional int64 recorded_total_latency_micros = 6;
2708 // Maximum latency of one API call.
2709 optional int64 recorded_max_latency_micros = 7;
2710 // Total CPU usage of all API calls.
2711 // Average can be computed using total_cpu_micros / recorded_call_count.
2712 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2713 optional int64 recorded_total_cpu_micros = 8;
2714 // Maximum CPU usage of one API call.
2715 optional int64 recorded_max_cpu_micros = 9;
2716 // Maximum parcel reply size of one API call.
2717 optional int64 recorded_max_reply_size_bytes = 10;
2718 // Maximum parcel request size of one API call.
2719 optional int64 recorded_max_request_size_bytes = 11;
2720}
2721
2722/**
2723 * Pulls the statistics of exceptions during calls to Binder.
2724 *
2725 * Binder stats are cumulative from boot unless somebody reset the data using
2726 * > adb shell dumpsys binder_calls_stats --reset
2727 */
2728message BinderCallsExceptions {
2729 // Exception class name, e.g. java.lang.IllegalArgumentException.
2730 //
2731 // This is an exception class name thrown by the system server.
2732 optional string exception_class_name = 1;
2733 // Total number of exceptions.
2734 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002735}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002736
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002737/**
2738 * Pulls the statistics of message dispatching on HandlerThreads.
2739 *
2740 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2741 * config on the device.
2742 *
2743 * Next tag: 11
2744 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002745message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002746 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002747 optional int32 uid = 1 [(is_uid) = true];
2748
2749 // Fully qualified class name of the handler target class.
2750 //
2751 // This field does not contain PII. This is a system server class name.
2752 optional string handler_class_name = 2;
2753
2754 // The name of the thread that runs the Looper.
2755 //
2756 // This field does not contain PII. This is a system server thread name.
2757 optional string looper_thread_name = 3;
2758
2759 // The name of the dispatched message.
2760 //
2761 // This field does not contain PII. This is a system server constant or class
2762 // name.
2763 optional string message_name = 4;
2764
2765 // Total number of successfully dispatched messages.
2766 optional int64 message_count = 5;
2767
2768 // Total number of messages that failed dispatching.
2769 optional int64 exception_count = 6;
2770
2771 // Total number of processed messages we have data recorded for. If we
2772 // collected data for all the messages, message_count will be equal to
2773 // recorded_message_count.
2774 //
2775 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002776 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002777 optional int64 recorded_message_count = 7;
2778
2779 // Total latency of all processed messages.
2780 // Average can be computed using recorded_total_latency_micros /
2781 // recorded_message_count.
2782 optional int64 recorded_total_latency_micros = 8;
2783
2784 // Total CPU usage of all processed message.
2785 // Average can be computed using recorded_total_cpu_micros /
2786 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002787 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002788 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002789
2790 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2791 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002792
2793 // Max recorded CPU usage of all processed messages.
2794 optional int64 recorded_max_cpu_micros = 11;
2795
2796 // Max recorded latency of all processed messages.
2797 optional int64 recorded_max_latency_micros = 12;
2798
2799 // Total number of messages we tracked the dispatching delay for. If we
2800 // collected data for all the messages, message_count will be equal to
2801 // recorded_delay_message_count.
2802 //
2803 // If recorded_delay_message_count is different than message_count, it means data
2804 // collection has been sampled or/and not all messages specified the target dispatch time.
2805 // The fields below will be sampled in this case.
2806 optional int64 recorded_delay_message_count = 13;
2807
2808 // Total dispatching delay of all processed messages.
2809 // Calculated as a difference between the target dispatching time (Message.when)
2810 // and the actual dispatching time.
2811 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2812 optional int64 recorded_total_delay_millis = 14;
2813
2814 // Max dispatching delay of all processed messages.
2815 // Calculated as a difference between the target dispatching time (Message.when)
2816 // and the actual dispatching time.
2817 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002818}
Tej Singh86dc9db2018-09-06 00:39:57 +00002819
2820/**
2821 * Pulls disk information, such as write speed and latency.
2822 */
2823message DiskStats {
2824 // Time taken to open, write 512B to, and close a file.
2825 // -1 if error performing the check.
2826 optional int64 data_write_latency_millis = 1;
2827
2828 optional bool file_based_encryption = 2;
2829
2830 // Recent disk write speed in kB/s.
2831 // -1 if error querying storageed.
2832 // 0 if data is unavailable.
2833 optional int32 recent_disk_write_speed = 3;
2834}
2835
2836
2837/**
2838 * Free and total bytes of the Data, Cache, and System partition.
2839 */
2840message DirectoryUsage {
2841 enum Directory {
2842 UNKNOWN = 0;
2843 DATA = 1;
2844 CACHE = 2;
2845 SYSTEM = 3;
2846 }
2847 optional Directory directory = 1;
2848 optional int64 free_bytes = 2;
2849 optional int64 total_bytes = 3;
2850}
2851
2852
2853/**
2854 * Size of an application: apk size, data size, and cache size.
2855 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2856 * Information is only reported for apps with the primary user (user 0).
2857 * Sizes are aggregated by package name.
2858 */
2859message AppSize {
2860 // Including uids will involve modifying diskstats logic.
2861 optional string package_name = 1;
2862 // App size in bytes. -1 if unavailable.
2863 optional int64 app_size_bytes = 2;
2864 // App data size in bytes. -1 if unavailable.
2865 optional int64 app_data_size_bytes = 3;
2866 // App cache size in bytes. -1 if unavailable.
2867 optional int64 app_cache_size_bytes = 4;
2868 // Time that the cache file was produced.
2869 // Uses System.currentTimeMillis(), which is wall clock time.
2870 optional int64 cache_time_millis = 5;
2871}
2872
2873
2874/**
2875 * Size of a particular category. Eg: photos, videos.
2876 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2877 */
2878message CategorySize {
2879 enum Category {
2880 UNKNOWN = 0;
2881 APP_SIZE = 1;
2882 APP_DATA_SIZE = 2;
2883 APP_CACHE_SIZE = 3;
2884 PHOTOS = 4;
2885 VIDEOS = 5;
2886 AUDIO = 6;
2887 DOWNLOADS = 7;
2888 SYSTEM = 8;
2889 OTHER = 9;
2890 }
2891 optional Category category = 1;
2892 // Category size in bytes.
2893 optional int64 size_bytes = 2;
2894 // Time that the cache file was produced.
2895 // Uses System.currentTimeMillis(), which is wall clock time.
2896 optional int64 cache_time_millis = 3;
2897}
Tej Singhd6d6d772018-09-05 17:41:25 -07002898
2899/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002900 * Pulls per uid I/O stats. The stats are cumulative since boot.
2901 *
2902 * Read/write bytes are I/O events from a storage device
2903 * Read/write chars are data requested by read/write syscalls, and can be
2904 * satisfied by caching.
2905 *
2906 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2907 */
2908message DiskIo {
2909 optional int32 uid = 1 [(is_uid) = true];
2910 optional int64 fg_chars_read = 2;
2911 optional int64 fg_chars_write = 3;
2912 optional int64 fg_bytes_read = 4;
2913 optional int64 fg_bytes_write = 5;
2914 optional int64 bg_chars_read = 6;
2915 optional int64 bg_chars_write = 7;
2916 optional int64 bg_bytes_read = 8;
2917 optional int64 bg_bytes_write = 9;
2918 optional int64 fg_fsync = 10;
2919 optional int64 bg_fsync= 11;
2920}
2921
2922
2923/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002924 * Pulls the number of fingerprints for each user.
2925 *
2926 * Pulled from StatsCompanionService, which queries FingerprintManager.
2927 */
2928message NumFingerprints {
2929 // The associated user. Eg: 0 for owners, 10+ for others.
2930 // Defined in android/os/UserHandle.java
2931 optional int32 user = 1;
2932 // Number of fingerprints registered to that user.
2933 optional int32 num_fingerprints = 2;
2934}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002935
Yangsteraf9aee72018-10-12 09:26:16 -07002936message AggStats {
2937 optional int64 min = 1;
2938
2939 optional int64 average = 2;
2940
2941 optional int64 max = 3;
2942}
2943
2944message ProcessStatsStateProto {
2945 optional android.service.procstats.ScreenState screen_state = 1;
2946
2947 optional android.service.procstats.MemoryState memory_state = 2;
2948
2949 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2950 // and not frameworks/base/core/java/android/app/ActivityManager.java
2951 optional android.service.procstats.ProcessState process_state = 3;
2952
2953 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002954 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002955
2956 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002957 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07002958
2959 // # of samples taken
2960 optional int32 sample_size = 5;
2961
2962 // PSS is memory reserved for this process
2963 optional AggStats pss = 6;
2964
2965 // USS is memory shared between processes, divided evenly for accounting
2966 optional AggStats uss = 7;
2967
2968 // RSS is memory resident for this process
2969 optional AggStats rss = 8;
2970}
2971
2972// Next Tag: 7
2973message ProcessStatsProto {
2974 // Name of process.
2975 optional string process = 1;
2976
2977 // Uid of the process.
2978 optional int32 uid = 2;
2979
2980 // Information about how often kills occurred
2981 message Kill {
2982 // Count of excessive CPU kills
2983 optional int32 cpu = 1;
2984
2985 // Count of kills when cached
2986 optional int32 cached = 2;
2987
2988 // PSS stats during cached kill
2989 optional AggStats cached_pss = 3;
2990 }
2991 optional Kill kill = 3;
2992
2993 // Time and memory spent in various states.
2994 repeated ProcessStatsStateProto states = 5;
2995
2996 // Total time process has been running... screen_state, memory_state, and process_state
2997 // will not be set.
2998 optional ProcessStatsStateProto total_running_state = 6;
2999}
3000
3001message PackageServiceOperationStatsProto {
3002 // Operate enum: Started, Foreground, Bound, Executing
3003 optional android.service.procstats.ServiceOperationState operation = 1;
3004
3005 // Number of times the service was in this operation.
3006 optional int32 count = 2;
3007
3008 // Information about a state the service can be in.
3009 message StateStats {
3010 // Screen state enum.
3011 optional android.service.procstats.ScreenState screen_state = 1;
3012 // Memory state enum.
3013 optional android.service.procstats.MemoryState memory_state = 2;
3014
3015 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003016 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003017 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003018 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003019 }
3020 repeated StateStats state_stats = 3;
3021}
3022
3023message PackageServiceStatsProto {
3024 // Name of service component.
3025 optional string service_name = 1;
3026
3027 // The operation stats.
3028 // The package_name, package_uid, package_version, service_name will not be set to save space.
3029 repeated PackageServiceOperationStatsProto operation_stats = 2;
3030}
3031
3032message PackageAssociationSourceProcessStatsProto {
3033 // Uid of the process.
3034 optional int32 process_uid = 1;
3035 // Process name.
3036 optional string process_name = 2;
3037
3038 // Total count of the times this association appeared.
3039 optional int32 total_count = 3;
3040
3041 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003042 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003043
3044 // Total count of the times this association became actively impacting its target process.
3045 optional int32 active_count = 5;
3046
3047 // Information on one source in this association.
3048 message StateStats {
3049 // Process state enum.
3050 optional android.service.procstats.ProcessState process_state = 1;
3051 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003052 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003053 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003054 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003055 }
3056 repeated StateStats active_state_stats = 6;
3057}
3058
3059message PackageAssociationProcessStatsProto {
3060 // Name of the target component.
3061 optional string component_name = 1;
3062 // Information on one source in this association.
3063 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3064}
3065
3066
3067message ProcessStatsPackageProto {
3068 // Name of package.
3069 optional string package = 1;
3070
3071 // Uid of the package.
3072 optional int32 uid = 2;
3073
3074 // Version of the package.
3075 optional int64 version = 3;
3076
3077 // Stats for each process running with the package loaded in to it.
3078 repeated ProcessStatsProto process_stats = 4;
3079
3080 // Stats for each of the package's services.
3081 repeated PackageServiceStatsProto service_stats = 5;
3082
3083 // Stats for each association with the package.
3084 repeated PackageAssociationProcessStatsProto association_stats = 6;
3085}
3086
3087message ProcessStatsSectionProto {
3088 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003089 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003090
3091 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003092 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003093
3094 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003095 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003096
3097 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003098 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003099
3100 // System runtime library. e.g. "libdvm.so", "libart.so".
3101 optional string runtime = 5;
3102
3103 // whether kernel reports swapped pss.
3104 optional bool has_swapped_pss = 6;
3105
3106 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3107 enum Status {
3108 STATUS_UNKNOWN = 0;
3109 STATUS_COMPLETE = 1;
3110 STATUS_PARTIAL = 2;
3111 STATUS_SHUTDOWN = 3;
3112 STATUS_SYSPROPS = 4;
3113 }
3114 repeated Status status = 7;
3115
3116 // Stats for each process.
3117 repeated ProcessStatsProto process_stats = 8;
3118
3119 // Stats for each package.
3120 repeated ProcessStatsPackageProto package_stats = 9;
3121}
3122
Chenjie Yu12e5e672018-09-14 15:54:59 -07003123/**
3124 * Pulled from ProcessStatsService.java
3125 */
3126message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003127 optional ProcessStatsSectionProto proc_stats_section = 1;
3128}
3129
3130message PowerProfileProto {
3131 optional double cpu_suspend = 1;
3132
3133 optional double cpu_idle = 2;
3134
3135 optional double cpu_active = 3;
3136
3137 message CpuCluster {
3138 optional int32 id = 1;
3139 optional double cluster_power = 2;
3140 optional int32 cores = 3;
3141 repeated int64 speed = 4;
3142 repeated double core_power = 5;
3143 }
3144
3145 repeated CpuCluster cpu_cluster = 40;
3146
3147 optional double wifi_scan = 4;
3148
3149 optional double wifi_on = 5;
3150
3151 optional double wifi_active = 6;
3152
3153 optional double wifi_controller_idle = 7;
3154
3155 optional double wifi_controller_rx = 8;
3156
3157 optional double wifi_controller_tx = 9;
3158
3159 repeated double wifi_controller_tx_levels = 10;
3160
3161 optional double wifi_controller_operating_voltage = 11;
3162
3163 optional double bluetooth_controller_idle = 12;
3164
3165 optional double bluetooth_controller_rx = 13;
3166
3167 optional double bluetooth_controller_tx = 14;
3168
3169 optional double bluetooth_controller_operating_voltage = 15;
3170
3171 optional double modem_controller_sleep = 16;
3172
3173 optional double modem_controller_idle = 17;
3174
3175 optional double modem_controller_rx = 18;
3176
3177 repeated double modem_controller_tx = 19;
3178
3179 optional double modem_controller_operating_voltage = 20;
3180
3181 optional double gps_on = 21;
3182
3183 repeated double gps_signal_quality_based = 22;
3184
3185 optional double gps_operating_voltage = 23;
3186
3187 optional double bluetooth_on = 24;
3188
3189 optional double bluetooth_active = 25;
3190
3191 optional double bluetooth_at_cmd = 26;
3192
3193 optional double ambient_display = 27;
3194
3195 optional double screen_on = 28;
3196
3197 optional double radio_on = 29;
3198
3199 optional double radio_scanning = 30;
3200
3201 optional double radio_active = 31;
3202
3203 optional double screen_full = 32;
3204
3205 optional double audio = 33;
3206
3207 optional double video = 34;
3208
3209 optional double flashlight = 35;
3210
3211 optional double memory = 36;
3212
3213 optional double camera = 37;
3214
3215 optional double wifi_batched_scan = 38;
3216
3217 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003218}
Chenjie Yuab530202018-09-26 12:39:20 -07003219
3220/**
3221 * power_profile.xml and other constants for power model calculations.
3222 * Pulled from PowerProfile.java
3223 */
3224message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003225 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003226}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003227
3228/**
arangelovd5db50e2018-10-12 20:24:39 +01003229 * Logs when a user restriction was added or removed.
3230 *
3231 * Logged from:
3232 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3233 */
3234message UserRestrictionChanged {
3235 // The raw string of the user restriction as defined in UserManager.
3236 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3237 optional string restriction = 1;
3238 // Whether the restriction is enabled or disabled.
3239 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003240}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003241
3242/**
3243 * Pulls process user time and system time. Puller takes a snapshot of all pids
3244 * in the system and returns cpu stats for those that are working at the time.
3245 * Dead pids will be dropped. Kernel processes are excluded.
3246 * Min cool-down is 5 sec.
3247 */
3248message ProcessCpuTime {
3249 optional int32 uid = 1 [(is_uid) = true];
3250
3251 optional string process_name = 2;
3252 // Process cpu time in user space, cumulative from boot/process start
3253 optional int64 user_time_millis = 3;
3254 // Process cpu time in system space, cumulative from boot/process start
3255 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003256}
Misha Wagner5a51e002018-10-03 15:04:09 +01003257
3258/**
3259 * Pulls the CPU usage for each thread.
3260 *
3261 * Read from /proc/$PID/task/$TID/time_in_state files.
3262 *
3263 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3264 * time_in_state files not being present on some phones, have not been addressed. These should be
3265 * considered before a public release.
3266 */
3267message CpuTimePerThreadFreq {
3268 // UID that owns the process.
3269 optional int32 uid = 1 [(is_uid) = true];
3270 // ID of the process.
3271 optional uint32 process_id = 2;
3272 // ID of the thread.
3273 optional uint32 thread_id = 3;
3274 // Name of the process taken from `/proc/$PID/cmdline`.
3275 optional string process_name = 4;
3276 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3277 optional string thread_name = 5;
3278 // What frequency the CPU was running at, in KHz
3279 optional uint32 frequency_khz = 6;
3280 // Time spent in frequency in milliseconds, since thread start.
3281 optional uint32 time_millis = 7;
3282}
Bookatz75ee6042018-11-09 12:27:37 -08003283
3284/**
3285 * Pulls on-device BatteryStats power use calculations for the overall device.
3286 */
3287message DeviceCalculatedPowerUse {
3288 // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset
3289 // (i.e. roughly since device was last significantly charged).
3290 // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3291 optional float computed_power_milli_amp_hours = 1;
3292}
3293
3294/**
3295 * Pulls on-device BatteryStats power use calculations broken down by uid.
3296 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3297 * that is attributed to non-uid items. They must all be included to get the total power use.
3298 */
3299message DeviceCalculatedPowerBlameUid {
3300 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3301 optional int32 uid = 1 [(is_uid) = true];
3302
3303 // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset
3304 // (i.e. roughly since device was last significantly charged).
3305 optional float power_milli_amp_hours = 2;
3306}
3307
3308/**
3309 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3310 * drain type.
3311 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3312 * is attributed uids. They must all be included to get the total power use.
3313 */
3314message DeviceCalculatedPowerBlameOther {
3315 // The type of item whose power use is being reported.
3316 enum DrainType {
3317 AMBIENT_DISPLAY = 0;
3318 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3319 BLUETOOTH = 2;
3320 CAMERA = 3;
3321 // Cell-standby
3322 CELL = 4;
3323 FLASHLIGHT = 5;
3324 IDLE = 6;
3325 MEMORY = 7;
3326 // Amount that total computed drain exceeded the drain estimated using the
3327 // battery level changes and capacity.
3328 OVERCOUNTED = 8;
3329 PHONE = 9;
3330 SCREEN = 10;
3331 // Amount that total computed drain was below the drain estimated using the
3332 // battery level changes and capacity.
3333 UNACCOUNTED = 11;
3334 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3335 WIFI = 13;
3336 }
3337 optional DrainType drain_type = 1;
3338
3339 // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset
3340 // (i.e. roughly since device was last significantly charged).
3341 optional float power_milli_amp_hours = 2;
3342}