blob: 19c7adf4143e5e5ec33850b91afe11527685c870 [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";
Bookatz48d362e2018-11-06 15:49:08 -080030import "frameworks/base/core/proto/android/server/location/enums.proto";
Yangsteraf9aee72018-10-12 09:26:16 -070031import "frameworks/base/core/proto/android/service/procstats_enum.proto";
32import "frameworks/base/core/proto/android/stats/enums.proto";
Yao Chen8c433862018-10-24 14:09:20 -070033import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080034import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080035import "frameworks/base/core/proto/android/telephony/enums.proto";
36import "frameworks/base/core/proto/android/view/enums.proto";
arangelov4e994062018-11-13 16:12:38 +000037import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
38import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080039
Yao Chend54f9dd2017-10-17 17:37:48 +000040/**
Stefan Lafonae2df012017-11-14 09:17:21 -080041 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000042 * raw stats log events from the Android system, also known as "atoms."
43 *
44 * This field contains a single oneof with all of the available messages.
45 * The stats-log-api-gen tool runs as part of the Android build and
46 * generates the android.util.StatsLog class, which contains the constants
47 * and methods that Android uses to log.
48 *
Stefan Lafonae2df012017-11-14 09:17:21 -080049 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000050 * Instead, statsd on Android constructs these messages synthetically,
51 * in the format defined here and in stats_log.proto.
52 */
Stefan Lafonae2df012017-11-14 09:17:21 -080053message Atom {
54 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070055 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070056 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
57 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070058 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070059 BleScanResultReceived ble_scan_result_received = 4;
60 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080061 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070062 SyncStateChanged sync_state_changed = 7;
63 ScheduledJobStateChanged scheduled_job_state_changed = 8;
64 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070065 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080066 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
67 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
68 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070069 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
70 MemoryFactorStateChanged memory_factor_state_changed = 15;
71 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
72 CachedKillReported cached_kill_reported = 17;
73 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070074 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080075 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
76 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
77 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070078 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080079 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070080 CameraStateChanged camera_state_changed = 25;
81 FlashlightStateChanged flashlight_state_changed = 26;
82 UidProcessStateChanged uid_process_state_changed = 27;
83 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
84 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070085 BatteryLevelChanged battery_level_changed = 30;
86 ChargingStateChanged charging_state_changed = 31;
87 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070088 InteractiveStateChanged interactive_state_changed = 33;
89 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070090 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
91 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070092 WifiLockStateChanged wifi_lock_state_changed = 37;
93 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
94 WifiScanStateChanged wifi_scan_state_changed = 39;
95 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070096 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070097 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070098 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090099 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -0700100 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -0800101 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -0800102 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800103 AppStartOccurred app_start_occurred = 48;
104 AppStartCanceled app_start_canceled = 49;
105 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800106 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800107 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800108 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800109 LmkStateChanged lmk_state_changed = 54;
110 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800111 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800112 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800113 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800114 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800115 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800116 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800117 KeyguardStateChanged keyguard_state_changed = 62;
118 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
119 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800120 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800121 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800122 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
123 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Bookatz48d362e2018-11-06 15:49:08 -0800124 GpsSignalQualityChanged gps_signal_quality_changed = 69;
Andrew Chantb56388b2018-03-22 21:07:33 -0700125 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800126 SpeakerImpedanceReported speaker_impedance_reported = 71;
127 HardwareFailed hardware_failed = 72;
128 PhysicalDropDetected physical_drop_detected = 73;
129 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800130 MobileConnectionStateChanged mobile_connection_state_changed = 75;
131 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700132 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800133 AppCrashOccurred app_crash_occurred = 78;
134 ANROccurred anr_occurred = 79;
135 WTFOccurred wtf_occurred = 80;
136 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700137 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700138 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700139 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700140 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700141 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700142 FingerprintAcquired fingerprint_acquired = 87;
143 FingerprintAuthenticated fingerprint_authenticated = 88;
144 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700145 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700146 BatteryHealthSnapshot battery_health_snapshot = 91;
147 SlowIo slow_io = 92;
148 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700149 PhoneServiceStateChanged phone_service_state_changed = 94;
150 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100151 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700152 SettingsUIChanged settings_ui_changed = 97;
Chenjie Yuae9dfac2018-10-25 16:06:56 -0700153 ConnectivityStateChanged connectivity_state_changed = 98;
Chenjie Yu75b3c492018-10-06 21:45:19 -0700154 // TODO: service state change is very noisy shortly after boot, as well
155 // as at other transitions - coming out of doze, device plugged in, etc.
156 // Consider removing this if it becomes a problem
157 ServiceStateChanged service_state_changed = 99;
158 ServiceLaunchReported service_launch_reported = 100;
Yangster-macb89807e2018-11-15 21:10:57 -0800159 PhenotypeFlagStateChanged phenotype_flag_state_changed = 101;
160 BinaryPushStateChanged binary_push_state_changed = 102;
arangelov4e994062018-11-13 16:12:38 +0000161 DevicePolicyEvent device_policy_event = 103;
Yao Chend54f9dd2017-10-17 17:37:48 +0000162 }
David Chenc8a43242017-10-17 16:23:28 -0700163
David Chen6e3e6cb2018-01-03 16:14:06 -0800164 // Pulled events will start at field 10000.
Rafal Slawik3bea8952018-11-15 12:39:33 +0000165 // Next: 10043
David Chenc8a43242017-10-17 16:23:28 -0700166 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800167 WifiBytesTransfer wifi_bytes_transfer = 10000;
168 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
169 MobileBytesTransfer mobile_bytes_transfer = 10002;
170 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800171 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800172 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800173 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800174 CpuTimePerFreq cpu_time_per_freq = 10008;
175 CpuTimePerUid cpu_time_per_uid = 10009;
176 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800177 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800178 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800179 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800180 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800181 SystemElapsedRealtime system_elapsed_realtime = 10014;
182 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800183 CpuActiveTime cpu_active_time = 10016;
184 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000185 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800186 RemainingBatteryCapacity remaining_battery_capacity = 10019;
187 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800188 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100189 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100190 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100191 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000192 DiskStats disk_stats = 10025;
193 DirectoryUsage directory_usage = 10026;
194 AppSize app_size = 10027;
195 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700196 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700197 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700198 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700199 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700200 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700201 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700202 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100203 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100204 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700205 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800206 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
207 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
208 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
Rafal Slawik3bea8952018-11-15 12:39:33 +0000209 ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
Tej Singhb1dbc8b2018-11-19 15:49:47 -0800210 BatteryLevel battery_level = 10043;
David Chenc8a43242017-10-17 16:23:28 -0700211 }
yroa1fe77c2018-02-26 14:22:54 -0800212
Bookatz76aafcf2018-09-17 16:17:10 -0700213 // DO NOT USE field numbers above 100,000 in AOSP.
214 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
215 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700216}
217
Yao Chend54f9dd2017-10-17 17:37:48 +0000218/**
Yangster-mac20877162017-12-22 17:19:39 -0800219 * This proto represents a node of an attribution chain.
220 * Note: All attribution chains are represented as a repeated field of type
221 * AttributionNode. It is understood that in such arrays, the order is that
222 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000223 */
Yangster-mac20877162017-12-22 17:19:39 -0800224message AttributionNode {
225 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800226 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800227
Yangster-mac20877162017-12-22 17:19:39 -0800228 // The (optional) string tag for an element in the attribution chain. If the
229 // element has no tag, it is encoded as an empty string.
230 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700231}
232
Yangster-mac48b3d622018-08-18 12:38:11 -0700233message KeyValuePair {
234 optional int32 key = 1;
235 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700236 int32 value_int = 2;
237 int64 value_long = 3;
238 string value_str = 4;
239 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700240 }
241}
242
243message KeyValuePairsAtom {
244 optional int32 uid = 1;
245 repeated KeyValuePair pairs = 2;
246}
247
Yao Chend54f9dd2017-10-17 17:37:48 +0000248/*
249 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800250 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000251 *
252 * RULES:
253 * - The field ids for each atom must start at 1, and count upwards by 1.
254 * Skipping field ids is not allowed.
255 * - These form an API, so renaming, renumbering or removing fields is
256 * not allowed between android releases. (This is not currently enforced,
257 * but there will be a tool to enforce this restriction).
258 * - The types must be built-in protocol buffer types, namely, no sub-messages
259 * are allowed (yet). The bytes type is also not allowed.
260 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800261 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000262 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800263 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000264 * - A field that is a uid should be a string field, tagged with the [xxx]
265 * annotation. The generated code on android will be represented by UIDs,
266 * and those UIDs will be translated in xxx to those strings.
267 *
268 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700269 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000270 * - If there is a UID, it goes first. Think in an object-oriented fashion.
271 * *****************************************************************************
272 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700273
Yao Chend54f9dd2017-10-17 17:37:48 +0000274/**
Yangster-mace16189a2018-08-26 12:20:16 -0700275 * Logs when the Thermal service HAL notifies the throttling start/stop events.
276 *
277 * Logged from:
278 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
279 */
280message ThermalThrottlingStateChanged {
281 optional android.os.TemperatureTypeEnum sensor_type = 1;
282
283 enum State {
284 UNKNOWN = 0;
285 START = 1;
286 STOP = 2;
287 }
288
289 optional State state = 2;
290
291 optional float temperature = 3;
292}
293
294/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000295 * Logs when the screen state changes.
296 *
297 * Logged from:
298 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
299 */
300message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800301 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700302 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700303}
Yao Chend54f9dd2017-10-17 17:37:48 +0000304
305/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700306 * Logs that the process state of the uid, as determined by ActivityManager
307 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000308 *
309 * Logged from:
310 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
311 */
Bookatzc1a050a2017-10-10 15:49:28 -0700312message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700313 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000314
Bookatzdb026a22018-01-10 19:01:56 -0800315 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700316 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000317}
318
319/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700320 * Logs process state change of a process, as per the activity manager.
321 *
322 * Logged from:
323 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
324 */
325message ProcessStateChanged {
326 optional int32 uid = 1;
327 optional string process_name = 2;
328 optional string package_name = 3;
329 // TODO: remove this when validation is done
330 optional int64 version = 5;
331 // The state, from frameworks/base/core/proto/android/app/enums.proto.
332 optional android.app.ProcessStateEnum state = 4;
333}
334
335/**
336 * Logs when ActivityManagerService sleep state is changed.
337 *
338 * Logged from:
339 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
340 */
341message ActivityManagerSleepStateChanged {
342 // TODO: import frameworks proto
343 enum State {
344 UNKNOWN = 0;
345 ASLEEP = 1;
346 AWAKE = 2;
347 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700348 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700349}
350
351/**
352 * Logs when system memory state changes.
353 *
354 * Logged from:
355 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
356 */
357message MemoryFactorStateChanged {
358 // TODO: import frameworks proto
359 enum State {
360 MEMORY_UNKNOWN = 0;
361 NORMAL = 1; // normal.
362 MODERATE = 2; // moderate memory pressure.
363 LOW = 3; // low memory.
364 CRITICAL = 4; // critical memory.
365
366 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700367 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700368}
369
370/**
371 * Logs when app is using too much cpu, according to ActivityManagerService.
372 *
373 * Logged from:
374 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
375 */
376message ExcessiveCpuUsageReported {
377 optional int32 uid = 1;
378 optional string process_name = 2;
379 optional string package_name = 3;
380 // package version. TODO: remove this when validation is done
381 optional int64 version = 4;
382}
383
384/**
385 * Logs when a cached process is killed, along with its pss.
386 *
387 * Logged from:
388 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
389 */
390message CachedKillReported {
391 optional int32 uid = 1;
392 optional string process_name = 2;
393 optional string package_name = 3;
394 // TODO: remove this when validation is done
395 optional int64 version = 5;
396 optional int64 pss = 4;
397}
398
399/**
400 * Logs when memory stats of a process is reported.
401 *
402 * Logged from:
403 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
404 */
405message ProcessMemoryStatReported {
406 optional int32 uid = 1;
407 optional string process_name = 2;
408 optional string package_name = 3;
409 //TODO: remove this when validation is done
410 optional int64 version = 9;
411 optional int64 pss = 4;
412 optional int64 uss = 5;
413 optional int64 rss = 6;
414 enum Type {
415 ADD_PSS_INTERNAL_SINGLE = 0;
416 ADD_PSS_INTERNAL_ALL_MEM = 1;
417 ADD_PSS_INTERNAL_ALL_POLL = 2;
418 ADD_PSS_EXTERNAL = 3;
419 ADD_PSS_EXTERNAL_SLOW = 4;
420 }
421 optional Type type = 7;
422 optional int64 duration = 8;
423}
424
425/**
Bookatzc1a050a2017-10-10 15:49:28 -0700426 * Logs that a process started, finished, crashed, or ANRed.
427 *
428 * Logged from:
429 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
430 */
431message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700432 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700433
David Chen0b5c90c2018-01-25 16:51:49 -0800434 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800435 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700436
Bookatzddccf0a2017-11-28 16:48:14 -0800437 // What lifecycle state the process changed to.
438 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800439 enum State {
440 FINISHED = 0;
441 STARTED = 1;
442 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800443 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800444 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700445}
446
Bookatzc1a050a2017-10-10 15:49:28 -0700447/**
448 * Logs when the ble scan state changes.
449 *
450 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700451 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700452 */
453message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800454 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700455
456 enum State {
457 OFF = 0;
458 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700459 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
460 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700461 }
462 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700463
Bookatze5ec0b42018-03-26 13:34:56 -0700464 // Does the scan have a filter.
465 optional bool is_filtered = 3;
466 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
467 optional bool is_first_match = 4;
468 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
469 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700470}
471
472/**
473 * Logs reporting of a ble scan finding results.
474 *
475 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700476 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700477 */
Bookatzae6738e2018-09-13 11:38:56 -0700478// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700479message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800480 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700481
482 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800483 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700484}
485
486/**
487 * Logs when a sensor state changes.
488 *
489 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700490 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700491 */
492message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800493 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700494
Bookatzc1a050a2017-10-10 15:49:28 -0700495 // The id (int) of the sensor.
496 optional int32 sensor_id = 2;
497
498 enum State {
499 OFF = 0;
500 ON = 1;
501 }
502 optional State state = 3;
503}
504
Bookatzc1a050a2017-10-10 15:49:28 -0700505/**
506 * Logs when GPS state changes.
507 *
508 * Logged from:
509 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
510 */
511message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800512 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700513
514 enum State {
515 OFF = 0;
516 ON = 1;
517 }
518 optional State state = 2;
519}
520
Bookatz48d362e2018-11-06 15:49:08 -0800521/**
522 * Logs when GPS signal quality.
523 *
524 * Logged from:
525 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
526 */
527message GpsSignalQualityChanged {
528 optional android.server.location.GpsSignalQualityEnum level = 1;
529}
530
Bookatzc1a050a2017-10-10 15:49:28 -0700531
532/**
533 * Logs when a sync manager sync state changes.
534 *
535 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700536 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700537 */
538message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800539 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700540
David Chen0b5c90c2018-01-25 16:51:49 -0800541 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800542 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700543
544 enum State {
545 OFF = 0;
546 ON = 1;
547 }
548 optional State state = 3;
549}
550
Yangster-mac96353002018-09-05 11:18:55 -0700551/*
552 * Deferred job stats.
553 *
554 * Logged from:
555 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
556*/
557message DeferredJobStatsReported {
558 repeated AttributionNode attribution_node = 1;
559
560 // Number of jobs deferred.
561 optional int32 num_jobs_deferred = 2;
562
563 // Time since the last job runs.
564 optional int64 time_since_last_job_millis = 3;
565}
566
Bookatzc1a050a2017-10-10 15:49:28 -0700567/**
568 * Logs when a job scheduler job state changes.
569 *
570 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700571 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700572 */
573message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800574 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700575
576 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800577 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700578
579 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800580 FINISHED = 0;
581 STARTED = 1;
582 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700583 }
584 optional State state = 3;
585
Tej Singh33a412b2018-03-16 18:43:59 -0700586 // The reason a job has stopped.
587 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700588 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700589 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700590}
591
592/**
593 * Logs when the audio state changes.
594 *
595 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700596 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700597 */
598message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800599 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700600
601 enum State {
602 OFF = 0;
603 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700604 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
605 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700606 }
607 optional State state = 2;
608}
609
610/**
611 * Logs when the video codec state changes.
612 *
613 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700614 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700615 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800616message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800617 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700618
619 enum State {
620 OFF = 0;
621 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700622 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
623 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700624 }
625 optional State state = 2;
626}
627
628/**
629 * Logs when the flashlight state changes.
630 *
631 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700632 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700633 */
634message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800635 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700636
637 enum State {
638 OFF = 0;
639 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700640 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
641 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700642 }
643 optional State state = 2;
644}
645
646/**
647 * Logs when the camera state changes.
648 *
649 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700650 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700651 */
652message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800653 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700654
655 enum State {
656 OFF = 0;
657 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700658 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
659 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700660 }
661 optional State state = 2;
662}
663
664/**
665 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000666 *
667 * Logged from:
668 * TODO
669 */
Bookatzd6746242017-10-24 18:39:35 -0700670message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800671 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000672
Bookatz1a1b0462018-01-12 11:47:03 -0800673 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
674 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700675 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700676
677 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
678 optional string tag = 3;
679
680 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800681 RELEASE = 0;
682 ACQUIRE = 1;
683 CHANGE_RELEASE = 2;
684 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700685 }
686 optional State state = 4;
687}
688
689/**
Bookatzc1a050a2017-10-10 15:49:28 -0700690 * Logs when a partial wakelock is considered 'long' (over 1 min).
691 *
692 * Logged from:
693 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
694 */
695message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800696 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700697
Yao Chend54f9dd2017-10-17 17:37:48 +0000698 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
699 optional string tag = 2;
700
Bookatzc1a050a2017-10-10 15:49:28 -0700701 // TODO: I have no idea what this is.
702 optional string history_tag = 3;
703
704 enum State {
705 OFF = 0;
706 ON = 1;
707 }
708 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000709}
710
Bookatzc1a050a2017-10-10 15:49:28 -0700711/**
Bookatza66083f2018-09-20 17:24:00 -0700712 * Logs when the device is interactive, according to the PowerManager Notifier.
713 *
714 * Logged from:
715 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
716 */
717message InteractiveStateChanged {
718 enum State {
719 OFF = 0;
720 ON = 1;
721 }
722 optional State state = 1;
723}
724
725/**
Bookatzc1a050a2017-10-10 15:49:28 -0700726 * Logs Battery Saver state change.
727 *
728 * Logged from:
729 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
730 */
731message BatterySaverModeStateChanged {
732 enum State {
733 OFF = 0;
734 ON = 1;
735 }
736 optional State state = 1;
737}
738
739/**
740 * Logs Doze mode state change.
741 *
742 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800743 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700744 */
745message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800746 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800747}
748
749
750/**
751 * Logs state change of Doze mode including maintenance windows.
752 *
753 * Logged from:
754 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
755 */
756message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800757 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700758}
759
760/**
761 * Logs screen brightness level.
762 *
763 * Logged from:
764 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
765 */
766message ScreenBrightnessChanged {
767 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
768 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700769}
770
771/**
772 * Logs battery level (percent full, from 0 to 100).
773 *
774 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700775 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700776 */
777message BatteryLevelChanged {
778 // Battery level. Should be in [0, 100].
779 optional int32 battery_level = 1;
780}
781
782/**
783 * Logs change in charging status of the device.
784 *
785 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700786 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700787 */
788message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800789 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
790 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700791}
792
793/**
794 * Logs whether the device is plugged in, and what power source it is using.
795 *
796 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700797 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700798 */
799message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800800 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
801 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700802}
803
Bookatz8c6571b2017-10-24 15:04:41 -0700804/**
805 * Logs when an app's wakeup alarm fires.
806 *
807 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700808 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700809 */
810message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800811 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800812
813 // Name of the wakeup alarm.
814 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700815
816 // Name of source package (for historical reasons, since BatteryStats tracked it).
817 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800818}
819
820/**
821 * Logs when an an app causes the mobile radio to change state.
822 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
823 *
824 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700825 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800826 */
827message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800828 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800829
Bookatz1a1b0462018-01-12 11:47:03 -0800830 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
831 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800832}
833
834/**
835 * Logs when an an app causes the wifi radio to change state.
836 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
837 *
838 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700839 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800840 */
841message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800842 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800843
Bookatz1a1b0462018-01-12 11:47:03 -0800844 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
845 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700846}
847
848/**
849 * Logs kernel wakeup reasons and aborts.
850 *
851 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700852 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700853 */
854message KernelWakeupReported {
855 // Name of the kernel wakeup reason (or abort).
856 optional string wakeup_reason_name = 1;
857
858 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800859 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700860}
861
862/**
863 * Logs wifi locks held by an app.
864 *
865 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700866 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700867 */
868message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800869 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700870
871 enum State {
872 OFF = 0;
873 ON = 1;
874 }
875 optional State state = 2;
876}
877
878/**
879 * Logs wifi signal strength changes.
880 *
881 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700882 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700883 */
884message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800885 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
886 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700887}
888
889/**
890 * Logs wifi scans performed by an app.
891 *
892 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700893 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700894 */
895message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800896 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700897
898 enum State {
899 OFF = 0;
900 ON = 1;
901 }
902 optional State state = 2;
903}
904
905/**
Tej Singh4503e102018-01-04 14:35:01 -0800906 * Logs wifi multicast locks held by an app
907 *
908 * Logged from:
909 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
910 */
911message WifiMulticastLockStateChanged {
912 repeated AttributionNode attribution_node = 1;
913
914 enum State {
915 OFF = 0;
916 ON = 1;
917 }
918 optional State state = 2;
919}
920
921/**
Tej Singh1ea42892018-01-19 09:27:00 -0800922 * Logs shutdown reason and duration on next boot.
923 *
924 * Logged from:
925 * frameworks/base/core/java/com/android/server/BootReceiver.java
926 */
927message ShutdownSequenceReported {
928 // True if shutdown is for a reboot. Default: false if we do not know.
929 optional bool reboot = 1;
930
931 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
932 optional string reason = 2;
933
934 // Beginning of shutdown time in ms using wall clock time since unix epoch.
935 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800936 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800937
938 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800939 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800940}
941
Tej Singh6483ea42018-01-25 17:45:49 -0800942
943/**
944 * Logs boot reason and duration.
945 *
946 * Logged from:
947 * system/core/bootstat/bootstat.cpp
948 */
949message BootSequenceReported {
950 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
951 // Default: "<EMPTY>" if not available.
952 optional string bootloader_reason = 1;
953
954 // Reason for system boot. Eg. bootloader, reboot,userrequested
955 // Default: "<EMPTY>" if not available.
956 optional string system_reason = 2;
957
958 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800959 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800960
961 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800962 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800963
964 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800965 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800966
967 // Time since last boot in ms. Default: 0 if not available.
968 optional int64 time_since_last_boot = 6;
969}
970
Tej Singhc477d9c2018-02-05 18:31:39 -0800971
972/**
973 * Logs call state and disconnect cause (if applicable).
974 *
975 * Logged from:
976 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
977 */
978message CallStateChanged {
979 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
980 // From frameworks/base/core/proto/android/telecomm/enums.proto.
981 optional android.telecom.CallStateEnum call_state = 1;
982
983 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
984 // This value is only applicable when the call_state is DISCONNECTED, and
985 // should always be UNKNOWN if the call_state is not DISCONNECTED.
986 // From frameworks/base/core/proto/android/telecomm/enums.proto.
987 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
988
989 // True if the call is self-managed, which are apps that use the
990 // telecom infrastructure to make their own calls.
991 optional bool self_managed = 3;
992
993 // True if call is external. External calls are calls on connected Wear
994 // devices but show up in Telecom so the user can pull them onto the device.
995 optional bool external_call = 4;
996}
997
Tej Singh1ea42892018-01-19 09:27:00 -0800998/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800999 * Logs keyguard state. The keyguard is the lock screen.
1000 *
1001 * Logged from:
1002 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1003 */
1004message KeyguardStateChanged {
1005 enum State {
1006 UNKNOWN = 0;
1007 // The keyguard is hidden when the phone is unlocked.
1008 HIDDEN = 1;
1009 // The keyguard is shown when the phone is locked (screen turns off).
1010 SHOWN= 2;
1011 // The keyguard is occluded when something is overlaying the keyguard.
1012 // Eg. Opening the camera while on the lock screen.
1013 OCCLUDED = 3;
1014 }
1015 optional State state = 1;
1016}
1017
1018/**
1019 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1020 * prompts the user to enter a password (pattern, pin, etc).
1021 *
1022 * Logged from:
1023 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1024 */
1025
1026message KeyguardBouncerStateChanged {
1027 enum State {
1028 UNKNOWN = 0;
1029 // Bouncer is hidden, either as a result of successfully entering the
1030 // password, screen timing out, or user going back to lock screen.
1031 HIDDEN = 1;
1032 // This is when the user is being prompted to enter the password.
1033 SHOWN = 2;
1034 }
1035 optional State state = 1;
1036}
1037
1038/**
1039 * Logs the result of entering a password into the keyguard bouncer.
1040 *
1041 * Logged from:
1042 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1043 */
1044message KeyguardBouncerPasswordEntered {
1045 enum BouncerResult {
1046 UNKNOWN = 0;
1047 // The password entered was incorrect.
1048 FAILURE = 1;
1049 // The password entered was correct.
1050 SUCCESS = 2;
1051 }
1052 optional BouncerResult result = 1;
1053}
1054
Tej Singha883b372018-02-15 11:30:01 -08001055/*
1056 * Logs changes to the configuration of the device. The configuration is defined
1057 * in frameworks/base/core/java/android/content/res/Configuration.java
1058 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1059 * Please go there to interpret the possible values each field can be.
1060 *
1061 * Logged from:
1062 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1063 */
1064message ResourceConfigurationChanged {
1065 // Bit mask of color capabilities of the screen.
1066 // Contains information about the color gamut and hdr mode of the screen.
1067 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001068 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001069
1070 // The target screen density being rendered to.
1071 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001072 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001073
1074 // Current user preference for the scaling factor for fonts,
1075 // relative to the base density scaling.
1076 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001077 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001078
1079 // Flag indicating whether the hard keyboard is hidden.
1080 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001081 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001082
1083 // The type of keyboard attached to the device.
1084 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1085 optional int32 keyboard = 5;
1086
1087 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1088 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001089 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001090
1091 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1092 // 0 if undefined.
1093 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1094 optional int32 mcc = 7;
1095
1096 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1097 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1098 // MNC_ZERO symbol defined in Configuration.java.
1099 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1100 optional int32 mnc = 8;
1101
1102 // The kind of navigation available on the device.
1103 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1104 optional int32 navigation = 9;
1105
1106 // Flag indicating whether the navigation is available.
1107 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001108 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001109
1110 // Overall orientation of the screen.
1111 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1112 optional int32 orientation = 11;
1113
1114 // The current height of the available screen space, in dp units.
1115 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001116 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001117
1118 // Bit mask of overall layout of the screen.
1119 // Contains information about screen size, whether the screen is wider/taller
1120 // than normal, whether the screen layout is right-tl-left or left-to-right,
1121 // and whether the screen has a rounded shape.
1122 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001123 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001124
1125 // Current width of the available screen space, in dp units.
1126 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001127 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001128
1129 // The smallest screen size an application will see in normal operation.
1130 // This is the smallest value of both screenWidthDp and screenHeightDp
1131 // in portrait and landscape.
1132 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001133 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001134
1135 // The type of touch screen attached to the device.
1136 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1137 optional int32 touchscreen = 16;
1138
1139 // Bit mask of the ui mode.
1140 // Contains information about the overall ui mode of the device.
1141 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1142 // Also contains information about whether the device is in night mode.
1143 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001144 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001145}
1146
Tej Singheee317b2018-03-07 19:28:05 -08001147
1148/**
1149 * Logs changes in the connection state of the mobile radio.
1150 *
1151 * Logged from:
1152 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1153 */
1154message MobileConnectionStateChanged {
1155 // States are from the state machine DataConnection.java.
1156 enum State {
1157 UNKNOWN = 0;
1158 // The connection is inactive, or disconnected.
1159 INACTIVE = 1;
1160 // The connection is being activated, or connecting.
1161 ACTIVATING = 2;
1162 // The connection is active, or connected.
1163 ACTIVE = 3;
1164 // The connection is disconnecting.
1165 DISCONNECTING = 4;
1166 // The connection is disconnecting after creating a connection.
1167 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1168 }
1169 optional State state = 1;
1170 // For multi-sim phones, this distinguishes between the sim cards.
1171 optional int32 sim_slot_index = 2;
1172 // Used to identify the connection. Starts at 0 and increments by 1 for
1173 // every new network created. Resets whenever the device reboots.
1174 optional int32 data_connection_id = 3;
1175 // A bitmask for the capabilities of this connection.
1176 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1177 // Default value (if we have no information): 0
1178 optional int64 capabilities = 4;
1179 // If this connection has internet.
1180 // This just checks if the DEFAULT bit of capabilities is set.
1181 optional bool has_internet = 5;
1182}
1183
1184/**
1185 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1186 *
1187 * Logged from:
1188 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1189 */
1190message MobileRadioTechnologyChanged {
1191 optional android.telephony.NetworkTypeEnum state = 1;
1192 // For multi-sim phones, this distinguishes between the sim cards.
1193 optional int32 sim_slot_index = 2;
1194}
1195
Andrew Chantb56388b2018-03-22 21:07:33 -07001196/**
1197 * Logs the VID and PID of any connected USB devices.
1198 *
1199 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1200 *
1201 * Logged by Vendor.
1202 */
1203message UsbDeviceAttached {
1204 optional int32 vid = 1;
1205 optional int32 pid = 2;
1206 optional bool has_audio = 3;
1207 optional bool has_hid = 4;
1208 optional bool has_storage = 5;
1209}
1210
Tej Singheee317b2018-03-07 19:28:05 -08001211
Tej Singhdd7bd352018-02-09 19:33:15 -08001212/**
Tej Singh5d991e12018-03-09 19:48:11 -08001213 * Logs when Bluetooth is enabled and disabled.
1214 *
1215 * Logged from:
1216 * services/core/java/com/android/server/BluetoothManagerService.java
1217 */
1218message BluetoothEnabledStateChanged {
1219 repeated AttributionNode attribution_node = 1;
1220 // Whether or not bluetooth is enabled on the device.
1221 enum State {
1222 UNKNOWN = 0;
1223 ENABLED = 1;
1224 DISABLED = 2;
1225 }
1226 optional State state = 2;
1227 // The reason for being enabled/disabled.
1228 // Eg. Airplane mode, crash, application request.
1229 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1230 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001231 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001232}
1233
1234/**
1235 * Logs when a Bluetooth device connects and disconnects.
1236 *
1237 * Logged from:
1238 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1239 */
1240message BluetoothConnectionStateChanged {
1241 // The state of the connection.
1242 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1243 optional android.bluetooth.ConnectionStateEnum state = 1;
1244 // An identifier that can be used to match connect and disconnect events.
1245 // Currently is last two bytes of a hash of a device level ID and
1246 // the mac address of the bluetooth device that is connected.
1247 optional int32 obfuscated_id = 2;
1248 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1249 // From android.bluetooth.BluetoothAdapter.java
1250 optional int32 bt_profile = 3;
1251}
1252
1253/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001254 * Logs when something is plugged into or removed from the USB-C connector.
1255 *
1256 * Logged from:
1257 * Vendor USB HAL.
1258 */
1259message UsbConnectorStateChanged {
1260 enum State {
1261 DISCONNECTED = 0;
1262 CONNECTED = 1;
1263 }
1264 optional State state = 1;
1265}
1266
1267/**
1268 * Logs the reported speaker impedance.
1269 *
1270 * Logged from:
1271 * Vendor audio implementation.
1272 */
1273message SpeakerImpedanceReported {
1274 optional int32 speaker_location = 1;
1275 optional int32 impedance = 2;
1276}
1277
1278/**
1279 * Logs the report of a failed hardware.
1280 *
1281 * Logged from:
1282 * Vendor HALs.
1283 *
1284 */
1285message HardwareFailed {
1286 enum HardwareType {
1287 HARDWARE_FAILED_UNKNOWN = 0;
1288 HARDWARE_FAILED_MICROPHONE = 1;
1289 HARDWARE_FAILED_CODEC = 2;
1290 HARDWARE_FAILED_SPEAKER = 3;
1291 HARDWARE_FAILED_FINGERPRINT = 4;
1292 }
1293 optional HardwareType hardware_type = 1;
1294
1295 /* hardware_location allows vendors to differentiate between multiple instances of
1296 * the same hardware_type. The specific locations are vendor defined integers,
1297 * referring to board-specific numbering schemes.
1298 */
1299 optional int32 hardware_location = 2;
1300
1301 /* failure_code is specific to the HardwareType of the failed hardware.
1302 * It should use the enum values defined below.
1303 */
1304 enum MicrophoneFailureCode {
1305 MICROPHONE_FAILURE_COMPLETE = 0;
1306 }
1307 enum CodecFailureCode {
1308 CODEC_FAILURE_COMPLETE = 0;
1309 }
1310 enum SpeakerFailureCode {
1311 SPEAKER_FAILURE_COMPLETE = 0;
1312 SPEAKER_FAILURE_HIGH_Z = 1;
1313 SPEAKER_FAILURE_SHORT = 2;
1314 }
1315 enum FingerprintFailureCode {
1316 FINGERPRINT_FAILURE_COMPLETE = 0;
1317 FINGERPRINT_SENSOR_BROKEN = 1;
1318 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1319 }
1320 optional int32 failure_code = 3;
1321}
1322
1323/**
1324 * Log an event when the device has been physically dropped.
1325 * Reported from the /vendor partition.
1326 */
1327message PhysicalDropDetected {
1328 // Confidence that the event was actually a drop, 0 -> 100
1329 optional int32 confidence_pctg = 1;
1330 // Peak acceleration of the drop, in 1/1000s of a g.
1331 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001332 // Duration of freefall in ms
1333 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001334}
1335
1336/**
1337 * Log bucketed battery charge cycles.
1338 *
1339 * Each bucket represents cycles of the battery past
1340 * a given charge point. For example, bucket 1 is the
1341 * lowest 1/8th of the battery, and bucket 8 is 100%.
1342 *
1343 * Logged from:
1344 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1345 */
1346message ChargeCyclesReported {
1347 optional int32 cycle_bucket_1 = 1;
1348 optional int32 cycle_bucket_2 = 2;
1349 optional int32 cycle_bucket_3 = 3;
1350 optional int32 cycle_bucket_4 = 4;
1351 optional int32 cycle_bucket_5 = 5;
1352 optional int32 cycle_bucket_6 = 6;
1353 optional int32 cycle_bucket_7 = 7;
1354 optional int32 cycle_bucket_8 = 8;
1355}
1356
1357/**
Howard Roa46b6582018-09-18 16:45:02 -07001358 * Log battery health snapshot.
1359 *
1360 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1361 * are snapshotted periodically over 24hrs.
1362 */
1363message BatteryHealthSnapshot {
1364 enum BatterySnapshotType {
1365 UNKNOWN = 0;
1366 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1367 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1368 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1369 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1370 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1371 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1372 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1373 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1374 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1375 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1376 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1377 }
1378 optional BatterySnapshotType type = 1;
1379 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001380 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001381 // Voltage Battery Voltage, in microVolts.
1382 optional int32 voltage_micro_volt = 3;
1383 // Current Battery current, in microAmps.
1384 optional int32 current_micro_amps = 4;
1385 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1386 optional int32 open_circuit_micro_volt = 5;
1387 // Resistance Battery Resistance, in microOhms.
1388 optional int32 resistance_micro_ohm = 6;
1389 // Level Battery Level, as % of full.
1390 optional int32 level_percent = 7;
1391}
1392
1393/**
1394 * Log slow I/O operations on the primary storage.
1395 */
1396message SlowIo {
1397 // Classifications of IO Operations.
1398 enum IoOperation {
1399 UNKNOWN = 0;
1400 READ = 1;
1401 WRITE = 2;
1402 UNMAP = 3;
1403 SYNC = 4;
1404 }
1405 optional IoOperation operation = 1;
1406
1407 // The number of slow IO operations of this type over 24 hours.
1408 optional int32 count = 2;
1409}
1410
1411/**
1412 * Log battery caused shutdown with the last recorded voltage.
1413 */
1414message BatteryCausedShutdown {
1415 // The last recorded battery voltage prior to shutdown.
1416 optional int32 last_recorded_micro_volt = 1;
1417}
1418
1419/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001420 * Logs the duration of a davey (jank of >=700ms) when it occurs
1421 *
1422 * Logged from:
1423 * frameworks/base/libs/hwui/JankTracker.cpp
1424 */
1425message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001426 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001427 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001428
Tej Singhbb8554a2018-01-26 11:59:14 -08001429 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001430 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001431}
1432
1433/**
Bookatze5885242017-10-24 20:10:31 -07001434 * Logs phone signal strength changes.
1435 *
1436 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001437 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001438 */
1439message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001440 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1441 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001442}
1443
Yangster4ccebea2018-10-09 17:09:02 -07001444
1445/**
1446 * Logs when the phone state, sim state or signal strength changes
1447 *
1448 * Logged from:
1449 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1450 */
1451message PhoneServiceStateChanged {
1452 optional android.telephony.ServiceStateEnum state = 1;
1453 optional android.telephony.SimStateEnum sim_state = 2;
1454 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1455}
1456
1457/**
1458 * Logs when the phone becomes on or off.
1459 *
1460 * Logged from:
1461 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1462 */
1463message PhoneStateChanged {
1464 enum State {
1465 OFF = 0;
1466 ON = 1;
1467 }
1468 optional State state = 1;
1469}
1470
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001471message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001472 optional android.stats.launcher.LauncherAction action = 1;
1473 optional android.stats.launcher.LauncherState src_state = 2;
1474 optional android.stats.launcher.LauncherState dst_state = 3;
1475 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001476 optional bool is_swipe_up_enabled = 5;
1477}
1478
David Chenc28b2bb2017-10-24 12:52:52 -07001479/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001480 * Logs when Settings UI has changed.
1481 *
1482 * Logged from:
1483 * packages/apps/Settings
1484 */
1485message SettingsUIChanged {
1486 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001487 * Where this SettingsUIChange event comes from. For example, if
1488 * it's a PAGE_VISIBLE event, where the page is opened from.
1489 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001490 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001491
1492 /**
1493 * What the UI action is.
1494 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001495 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001496
1497 /**
1498 * Where the action is happening
1499 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001500 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001501
1502 /**
1503 * What preference changed in this event.
1504 */
1505 optional string changedPreferenceKey = 4;
1506
1507 /**
1508 * The new value of the changed preference.
1509 */
1510 optional int64 changedPreferenceIntValue = 5;
1511}
1512
1513/**
David Chenc28b2bb2017-10-24 12:52:52 -07001514 * Logs that a setting was updated.
1515 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001516 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001517 * The tag and is_default allow resetting of settings to default values based on the specified
1518 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1519 */
1520message SettingChanged {
1521 // The name of the setting.
1522 optional string setting = 1;
1523
1524 // The change being imposed on this setting. May represent a number, eg "3".
1525 optional string value = 2;
1526
1527 // The new value of this setting. For most settings, this is same as value. For some settings,
1528 // value is +X or -X where X represents an element in a set. For example, if the previous value
1529 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1530 // The +/- feature is currently only used for location_providers_allowed.
1531 optional string new_value = 3;
1532
1533 // The previous value of this setting.
1534 optional string prev_value = 4;
1535
1536 // The tag used with the is_default for resetting sets of settings. This is generally null.
1537 optional string tag = 5;
1538
Bookatz90867622018-01-31 15:05:57 -08001539 // True if this setting with tag should be resettable.
1540 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001541
David Chenbd789912018-03-16 17:19:55 -07001542 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001543 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001544
1545 enum ChangeReason {
1546 UPDATED = 1; // Updated can be an insertion or an update.
1547 DELETED = 2;
1548 }
1549 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001550}
Chenjie Yub3dda412017-10-24 13:41:59 -07001551
Chenjie Yu05013b32017-11-21 10:21:41 -08001552/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001553 * Logs activity going to foreground or background
1554 *
1555 * Logged from:
1556 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1557 */
1558message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001559 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001560 optional string pkg_name = 2;
1561 optional string class_name = 3;
1562
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001563 enum State {
1564 BACKGROUND = 0;
1565 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001566 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001567 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001568}
David Chenc8a43242017-10-17 16:23:28 -07001569
1570/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001571 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001572 * Logged from:
1573 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1574 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001575message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001576 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001577
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001578 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001579
1580 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001581 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001582 optional string process_name = 3;
1583
1584 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001585 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001586
1587 optional string package_name = 5;
1588
1589 enum InstantApp {
1590 UNAVAILABLE = 0;
1591 FALSE = 1;
1592 TRUE = 2;
1593 }
1594 optional InstantApp is_instant_app = 6;
1595
1596 enum ForegroundState {
1597 UNKNOWN = 0;
1598 BACKGROUND = 1;
1599 FOREGROUND = 2;
1600 }
1601 optional ForegroundState foreground_state = 7;
Yang Lu732d6382018-11-05 07:53:12 -08001602
1603 optional android.server.ErrorSource error_source = 8;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001604}
David Chen9e3808c2017-11-20 17:25:34 -08001605
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001606/**
1607 * Logs when a WTF (What a Terrible Failure) happened.
1608 * Logged from:
1609 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1610 */
1611message WTFOccurred {
1612 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001613
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001614 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001615
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001616 // The name of the process.
1617 // system_server if it is not by an app
1618 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001619
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001620 // The pid if available. -1 means not available.
1621 optional sint32 pid = 4;
Yang Lu732d6382018-11-05 07:53:12 -08001622
1623 optional android.server.ErrorSource error_source = 5;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001624}
1625
1626/**
1627 * Logs when system server reports low memory.
1628 * Logged from:
1629 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1630 */
1631message LowMemReported {
1632}
1633
1634/**
1635 * Logs when an app ANR (App Not Responding) occurs.
1636 * Logged from:
1637 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1638 */
1639message ANROccurred {
1640 optional int32 uid = 1 [(is_uid) = true];
1641
1642 optional string process_name = 2;
1643
1644 optional string short_component_name = 3;
1645
1646 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001647
1648 enum InstantApp {
1649 UNAVAILABLE = 0;
1650 FALSE = 1;
1651 TRUE = 2;
1652 }
1653 optional InstantApp is_instant_app = 5;
1654
1655 enum ForegroundState {
1656 UNKNOWN = 0;
1657 BACKGROUND = 1;
1658 FOREGROUND = 2;
1659 }
1660 optional ForegroundState foreground_state = 6;
Yang Lu732d6382018-11-05 07:53:12 -08001661
1662 optional android.server.ErrorSource error_source = 7;
1663
1664 optional string package_name = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001665}
1666
Bookatza7020bd2018-08-28 16:29:35 -07001667/**
1668 * Logs when the vibrator state changes.
1669 * Logged from:
1670 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1671 */
1672message VibratorStateChanged {
1673 repeated AttributionNode attribution_node = 1;
1674
1675 enum State {
1676 OFF = 0;
1677 ON = 1;
1678 }
1679 optional State state = 2;
1680
1681 // Duration (in milliseconds) requested to keep the vibrator on.
1682 // Only applicable for State == ON.
1683 optional int64 duration_millis = 3;
1684}
1685
David Chen0a368b22017-12-06 16:28:16 -08001686/*
1687 * Allows other apps to push events into statsd.
1688 * Logged from:
1689 * frameworks/base/core/java/android/util/StatsLog.java
1690 */
David Chen0b5c90c2018-01-25 16:51:49 -08001691message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001692 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001693 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001694
1695 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1696 optional int32 label = 2;
1697
1698 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1699 // predicates for the metrics).
1700 enum State {
1701 UNKNOWN = 0;
1702 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1703 STOP = 2;
1704 START = 3;
1705 }
1706 optional State state = 3;
1707}
1708
David Chen9e3808c2017-11-20 17:25:34 -08001709/**
Bookatz7948c872018-09-04 12:58:33 -07001710 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1711 * For example, this could be due to the user manually changing the time.
1712 *
1713 * Logged from:
1714 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1715 */
1716message WallClockTimeShifted {
1717 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1718 optional int64 wall_clock_timestamp_millis = 1;
1719}
1720
1721/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001722 * Logs when statsd detects an anomaly.
1723 *
1724 * Logged from:
1725 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1726 */
1727message AnomalyDetected {
1728 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001729 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001730
Yangster-mac94e197c2018-01-02 16:03:03 -08001731 // Id of the config whose anomaly detection alert fired.
1732 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001733
Yangster-mac94e197c2018-01-02 16:03:03 -08001734 // Id of the alert (i.e. name of the anomaly that was detected).
1735 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001736}
1737
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001738message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001739 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001740 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001741
1742 // The app package name.
1743 optional string pkg_name = 2;
1744
1745 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001746 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001747 WARM = 1;
1748 HOT = 2;
1749 COLD = 3;
1750 }
1751 // The transition type.
1752 optional TransitionType type = 3;
1753
1754 // The activity name.
1755 optional string activity_name = 4;
1756
1757 // The name of the calling app. Empty if not set.
1758 optional string calling_pkg_name = 5;
1759
1760 // Whether the app is an instant app.
1761 optional bool is_instant_app = 6;
1762
1763 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001764 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001765
Bookatz80d11a02018-01-16 10:46:35 -08001766 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001767
David Chen0b5c90c2018-01-25 16:51:49 -08001768 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001769 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001770 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001771 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001772 optional int32 bind_application_delay_millis = 11;
1773 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001774
1775 // Empty if not set.
1776 optional string launch_token = 13;
1777
Calin Juravle759fbda2018-02-20 19:52:30 +00001778 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001779 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001780
1781 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001782 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001783}
1784
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001785message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001786 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001787 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001788
1789 // The app package name.
1790 optional string pkg_name = 2;
1791
1792 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001793 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001794 WARM = 1;
1795 HOT = 2;
1796 COLD = 3;
1797 }
1798 // The transition type.
1799 optional TransitionType type = 3;
1800
1801 // The activity name.
1802 optional string activity_name = 4;
1803}
1804
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001805message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001806 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001807 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001808
1809 // The app package name.
1810 optional string pkg_name = 2;
1811
1812 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001813 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001814 WITH_BUNDLE = 1;
1815 WITHOUT_BUNDLE = 2;
1816 }
1817 // The transition type.
1818 optional TransitionType type = 3;
1819
1820 // The activity name.
1821 optional string activity_name = 4;
1822
1823 optional bool transition_process_running = 5;
1824
1825 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001826 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001827}
1828
Bookatz8fcd09a2017-12-18 13:01:10 -08001829/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001830 * Logs a picture-in-picture action
1831 * Logged from:
1832 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1833 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1834 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1835 */
1836message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001837 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001838 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001839
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001840 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001841
Chenjie Yu52cacc62017-12-08 18:11:45 -08001842 enum State {
1843 ENTERED = 1;
1844 EXPANDED_TO_FULL_SCREEN = 2;
1845 MINIMIZED = 3;
1846 DISMISSED = 4;
1847 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001848 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001849}
1850
1851/**
Chenjie Yue8904192017-12-08 19:12:57 -08001852 * Logs overlay action
1853 * Logged from:
1854 * services/core/java/com/android/server/wm/Session.java
1855 */
1856message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001857 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001858
1859 optional string package_name = 2;
1860
1861 optional bool using_alert_window = 3;
1862
1863 enum State {
1864 ENTERED = 1;
1865 EXITED = 2;
1866 }
1867 optional State state = 4;
1868}
1869
Chenjie Yuccfe6452018-01-30 11:33:21 -08001870/*
1871 * Logs foreground service starts and stops.
1872 * Note that this is not when a service starts or stops, but when it is
1873 * considered foreground.
1874 * Logged from
1875 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1876 */
1877message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001878 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001879 // package_name + "/" + class_name
1880 optional string short_name = 2;
1881
1882 enum State {
1883 ENTER = 1;
1884 EXIT = 2;
1885 }
1886 optional State state = 3;
1887}
1888
Chenjie Yue8904192017-12-08 19:12:57 -08001889/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001890 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1891 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1892 * attributed back to the parent (host) uid. One example is Chrome.
1893 *
1894 * Logged from:
1895 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1896 */
1897message IsolatedUidChanged {
1898 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001899 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001900 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001901 optional int32 parent_uid = 1;
1902
1903 optional int32 isolated_uid = 2;
1904
1905 // We expect an isolated uid to be removed before if it's used for another parent uid.
1906 enum Event {
1907 REMOVED = 0;
1908 CREATED = 1;
1909 }
1910 optional Event event = 3;
1911}
1912
1913/*
1914 * Logs the reception of an incoming network packet causing the main system to wake up for
1915 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1916 * and processed by WakeupController.cpp.
1917 */
1918message PacketWakeupOccurred {
1919 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1920 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001921 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001922 // The interface name on which the packet was received.
1923 optional string iface = 2;
1924 // The ethertype value of the packet.
1925 optional int32 ethertype = 3;
1926 // String representation of the destination MAC address of the packet.
1927 optional string destination_hardware_address = 4;
1928 // String representation of the source address of the packet if this was an IP packet.
1929 optional string source_ip = 5;
1930 // String representation of the destination address of the packet if this was an IP packet.
1931 optional string destination_ip = 6;
1932 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1933 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1934 // families.
1935 optional int32 ip_next_header = 7;
1936 // The source port if this was a TCP or UDP packet.
1937 optional int32 source_port = 8;
1938 // The destination port if this was a TCP or UDP packet.
1939 optional int32 destination_port = 9;
1940}
1941
1942/*
1943 * Logs the memory stats for an app on startup.
1944 * Logged from:
1945 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1946 */
1947message AppStartMemoryStateCaptured {
1948 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001949 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001950
1951 // The process name.
1952 optional string process_name = 2;
1953
1954 // The activity name.
1955 optional string activity_name = 3;
1956
1957 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001958 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001959
1960 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001961 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001962
1963 // RSS
1964 optional int64 rss_in_bytes = 6;
1965
1966 // CACHE
1967 optional int64 cache_in_bytes = 7;
1968
1969 // SWAP
1970 optional int64 swap_in_bytes = 8;
1971}
1972
1973/*
1974 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1975 * for LMK event.
1976 * Logged from:
1977 * system/core/lmkd/lmkd.c
1978 */
1979message LmkStateChanged {
1980 enum State {
1981 UNKNOWN = 0;
1982 START = 1;
1983 STOP = 2;
1984 }
1985 optional State state = 1;
1986}
1987
1988/*
1989 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1990 * Logged from:
1991 * system/core/lmkd/lmkd.c
1992 */
1993message LmkKillOccurred {
1994 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001995 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001996
1997 // The process name.
1998 optional string process_name = 2;
1999
2000 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002001 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002002
2003 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002004 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002005
2006 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002007 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002008
2009 // RSS
2010 optional int64 rss_in_bytes = 6;
2011
2012 // CACHE
2013 optional int64 cache_in_bytes = 7;
2014
2015 // SWAP
2016 optional int64 swap_in_bytes = 8;
2017}
2018
Rajeev Kumar51b54602018-03-01 12:18:26 -08002019/*
2020 * Logs when the ActivityManagerService detects that an app died.
2021 *
2022 * Logged from:
2023 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2024 */
2025message AppDied {
2026 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002027 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002028}
2029
Howard Ro21a039c2018-08-06 14:55:47 -07002030/**
2031 * An atom for generic metrics logging. Available from Android Q.
2032 */
2033message GenericAtom {
2034 // The uid of the application that sent this custom atom.
2035 optional int32 uid = 1 [(is_uid) = true];
2036
2037 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002038 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002039}
2040
Tej Singhd6d6d772018-09-05 17:41:25 -07002041/**
2042 * Logs when a fingerprint acquire event occurs.
2043 *
2044 * Logged from:
2045 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2046 */
2047message FingerprintAcquired {
2048 // The associated user. Eg: 0 for owners, 10+ for others.
2049 // Defined in android/os/UserHandle.java
2050 optional int32 user = 1;
2051 // If this acquire is for a crypto fingerprint.
2052 // e.g. Secure purchases, unlock password storage.
2053 optional bool is_crypto = 2;
2054}
2055
2056/**
2057 * Logs when a fingerprint authentication event occurs.
2058 *
2059 * Logged from:
2060 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2061 */
2062message FingerprintAuthenticated {
2063 // The associated user. Eg: 0 for owners, 10+ for others.
2064 // Defined in android/os/UserHandle.java
2065 optional int32 user = 1;
2066 // If this authentication is for a crypto fingerprint.
2067 // e.g. Secure purchases, unlock password storage.
2068 optional bool is_crypto = 2;
2069 // Whether or not this authentication was successful.
2070 optional bool is_authenticated = 3;
2071}
2072
2073/**
2074 * Logs when a fingerprint error occurs.
2075 *
2076 * Logged from:
2077 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2078 */
2079message FingerprintErrorOccurred {
2080 // The associated user. Eg: 0 for owners, 10+ for others.
2081 // Defined in android/os/UserHandle.java
2082 optional int32 user = 1;
2083 // If this error is for a crypto fingerprint.
2084 // e.g. Secure purchases, unlock password storage.
2085 optional bool is_crypto = 2;
2086
2087 enum Error {
2088 UNKNOWN = 0;
2089 LOCKOUT = 1;
2090 PERMANENT_LOCKOUT = 2;
2091 }
2092 // The type of error.
2093 optional Error error = 3;
2094}
Howard Ro688ae182018-09-25 00:09:36 -07002095
2096message Notification {
2097
2098 // Type of notification event.
2099 enum Type {
2100 TYPE_UNKNOWN = 0;
2101 // Notification became visible to the user.
2102 TYPE_OPEN = 1;
2103 // Notification became hidden.
2104 TYPE_CLOSE = 2;
2105 // Notification switched to detail mode.
2106 TYPE_DETAIL = 3;
2107 // Notification was clicked.
2108 TYPE_ACTION = 4;
2109 // Notification was dismissed.
2110 TYPE_DISMISS = 5;
2111 // Notification switched to summary mode. The enum value of 14 is to
2112 // match that of metrics_constants.
2113 TYPE_COLLAPSE = 14;
2114 }
2115 optional Type type = 1;
2116
2117 // Package name associated with the notification.
2118 optional string package_name = 2;
2119
2120 // Tag associated with notification.
2121 optional string tag = 3;
2122
2123 // Application-supplied ID associated with the notification.
2124 optional int32 id = 4;
2125
2126 // Index of notification in the notification panel.
2127 optional int32 shade_index = 5;
2128
2129 // The number of notifications in the notification panel.
2130 optional int32 shade_count = 6;
2131
2132 // Importance for the notification.
2133 optional int32 importance = 7;
2134
2135 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002136 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002137
2138 // Importance for the notification channel.
2139 optional int32 channel_importance = 9;
2140
Howard Ro183c2bd2018-10-18 13:52:10 -07002141 // Application-supplied ID associated with the notifications group.
2142 optional string group_id = 10;
2143
Howard Ro688ae182018-09-25 00:09:36 -07002144 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002145 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002146
Howard Ro183c2bd2018-10-18 13:52:10 -07002147 // Reason for dismissal of a notification. This field is only meaningful for
2148 // TYPE_DISMISS events.
2149 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002150
Howard Ro183c2bd2018-10-18 13:52:10 -07002151 // The first post time of notification, stable across updates.
2152 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002153
Howard Ro183c2bd2018-10-18 13:52:10 -07002154 // The most recent interruption time, or the creation time if no updates.
2155 // Differs from update_millis because updates are filtered based on whether
2156 // they actually interrupted the user.
2157 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002158
Howard Ro183c2bd2018-10-18 13:52:10 -07002159 // The most recent update time, or the creation time if no updates.
2160 optional int64 update_millis = 15;
2161
2162 // The most recent visibility event.
2163 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002164}
2165
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002166/*
Yangster-macb89807e2018-11-15 21:10:57 -08002167 * Logs when a flag flip state changes.
2168 * Logged in P/h.
2169 */
2170message PhenotypeFlagStateChanged {
2171 // Mendel configuration name.
2172 optional string mendel_config_name = 1;
2173 // State
2174 enum State {
2175 STATE_UNKNOWN = 0;
2176 COMMITTED = 1;
2177 }
2178 optional State state = 2;
2179}
2180
2181/*
2182 * Logs when a binary push state changes.
2183 * Logged in Play store
2184 */
2185message BinaryPushStateChanged {
2186 // Binary package name.
2187 optional string binary_name = 1;
2188 // Version code.
2189 optional int64 version = 2;
2190 // State
2191 enum State {
2192 STATE_UNKNOWN = 0;
2193 DOWNLOAD_START = 1;
2194 DOWNLOAD_DONE = 2;
2195 INSTALL_START = 3;
2196 INSTALL_DONE = 4;
2197 REBOOT_START = 5;
2198 REBOOT_DONE = 6;
2199 }
2200 optional State state = 3;
2201}
2202
2203/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002204 * Logs when a connection becomes available and lost.
2205 * Logged in StatsCompanionService.java
2206 */
2207message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002208 // Id of the network.
2209 optional int32 net_id = 1;
2210
2211 enum State {
2212 UNKNOWN = 0;
2213 CONNECTED = 1;
2214 DISCONNECTED = 2;
2215 }
2216 // Connected state of a network.
2217 optional State state = 2;
2218}
2219
2220/**
2221 * Logs when a service starts and stops.
2222 * Logged from:
2223 * services/core/java/com/android/server/am/ActiveServices.java
2224 */
2225message ServiceStateChanged {
2226
2227 optional int32 uid = 1 [(is_uid) = true];
2228
2229 optional string package_name = 2;
2230
2231 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002232
2233 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002234 START = 1;
2235 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002236 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002237
2238 optional State state = 4;
2239}
2240
2241/**
2242 * Logs when a service is launched.
2243 * Logged from:
2244 * services/core/java/com/android/server/am/ActiveServices.java
2245 */
2246message ServiceLaunchReported {
2247
2248 optional int32 uid = 1 [(is_uid) = true];
2249
2250 optional string package_name = 2;
2251
2252 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002253}
Howard Ro688ae182018-09-25 00:09:36 -07002254
Chenjie Yubbcbc602018-02-05 16:51:52 -08002255//////////////////////////////////////////////////////////////////////
2256// Pulled atoms below this line //
2257//////////////////////////////////////////////////////////////////////
2258
2259/**
David Chenc8a43242017-10-17 16:23:28 -07002260 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2261 *
2262 * Pulled from:
2263 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2264 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002265message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002266 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002267
2268 optional int64 rx_bytes = 2;
2269
2270 optional int64 rx_packets = 3;
2271
2272 optional int64 tx_bytes = 4;
2273
2274 optional int64 tx_packets = 5;
2275}
2276
2277/**
2278 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2279 *
2280 * Pulled from:
2281 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2282 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002283message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002284 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002285
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002286 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2287 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002288
2289 optional int64 rx_bytes = 3;
2290
2291 optional int64 rx_packets = 4;
2292
2293 optional int64 tx_bytes = 5;
2294
2295 optional int64 tx_packets = 6;
2296}
2297
2298/**
2299 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2300 *
2301 * Pulled from:
2302 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2303 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002304message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002305 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002306
2307 optional int64 rx_bytes = 2;
2308
2309 optional int64 rx_packets = 3;
2310
2311 optional int64 tx_bytes = 4;
2312
2313 optional int64 tx_packets = 5;
2314}
2315
2316/**
2317 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2318 *
2319 * Pulled from:
2320 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2321 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002322message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002323 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002324
Yao Chenc40a19d2018-03-15 16:48:25 -07002325 // 1 denotes foreground and 0 denotes background. This is called Set in
2326 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002327 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002328
2329 optional int64 rx_bytes = 3;
2330
2331 optional int64 rx_packets = 4;
2332
2333 optional int64 tx_bytes = 5;
2334
2335 optional int64 tx_packets = 6;
2336}
2337
2338/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002339 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2340 *
2341 * Pulled from:
2342 * StatsCompanionService
2343 */
2344message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002345 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002346
2347 optional int64 rx_bytes = 2;
2348
2349 optional int64 tx_bytes = 3;
2350}
2351
2352/**
David Chenc8a43242017-10-17 16:23:28 -07002353 * Pulls the kernel wakelock durations. This atom is adapted from
2354 * android/internal/os/KernelWakelockStats.java
2355 *
2356 * Pulled from:
2357 * StatsCompanionService using KernelWakelockReader.
2358 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002359message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002360 optional string name = 1;
2361
2362 optional int32 count = 2;
2363
2364 optional int32 version = 3;
2365
Yangster-maca8a30442018-10-13 23:46:34 -07002366 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002367}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002368
Chenjie Yu05013b32017-11-21 10:21:41 -08002369/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002370 * Pulls low power state information. This includes platform and subsystem sleep state information,
2371 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002372 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002373 * hardware/interfaces/power/1.1/types.hal
2374 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002375message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002376 // Subsystem name
2377 optional string subsystem_name = 1;
2378 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2379 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2380 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002381 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002382 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002383 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002384 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002385}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002386
Chenjie Yu05013b32017-11-21 10:21:41 -08002387/**
Bookatz92da2832018-11-01 18:10:03 -07002388 * Pulls on-device power measurement information.
2389 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2390 * Pulled from:
2391 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2392 */
2393message OnDevicePowerMeasurement {
2394 // Name of the subsystem (to which the rail belongs).
2395 optional string subsystem_name = 1;
2396
2397 // Rail name. The rail lies within the subsystem.
2398 optional string rail_name = 2;
2399
2400 // Time (in ms since boot) at which the rail energy value was measured.
2401 // This may differ slightly from the time that statsd logs this information.
2402 optional uint64 measurement_timestamp_millis = 3;
2403
2404 // Accumulated energy used via the rail since device boot in uWs.
2405 optional uint64 energy_microwatt_secs = 4;
2406}
2407
2408/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002409 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002410 * Pulls the time the cpu spend on the frequency index. Frequency index
2411 * starts from highest to lowest. The value should be monotonically
2412 * increasing since boot. However, if there is a cpu
2413 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002414 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002415message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002416 optional uint32 cluster = 1;
2417 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002418 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002419}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002420
Chenjie Yu05013b32017-11-21 10:21:41 -08002421/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002422 * Pulls Cpu Time Per Uid.
2423 * Note that isolated process uid time should be attributed to host uids.
2424 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002425message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002426 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002427 optional uint64 user_time_millis = 2;
2428 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002429}
2430
2431/**
2432 * Pulls Cpu Time Per Uid per frequency.
2433 * Note that isolated process uid time should be attributed to host uids.
2434 * For each uid, we order the time by descending frequencies.
2435 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002436message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002437 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002438 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002439 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002440}
Hugo Benichi884970e2017-11-14 22:42:46 +09002441
Chenjie Yu05013b32017-11-21 10:21:41 -08002442/**
2443 * Pulls Wifi Controller Activity Energy Info
2444 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002445message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002446 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002447 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002448 // stack reported state
2449 // TODO: replace this with proto enum
2450 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002451 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002452 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002453 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002454 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002455 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002456 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002457 // product of current(mA), voltage(V) and time(ms)
2458 optional uint64 controller_energy_used = 6;
2459}
2460
2461/**
2462 * Pulls Modem Activity Energy Info
2463 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002464message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002465 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002466 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002467 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002468 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002469 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002470 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002471 /**
2472 * Tx power index
2473 * index 0 = tx_power < 0dBm
2474 * index 1 = 0dBm < tx_power < 5dBm
2475 * index 2 = 5dBm < tx_power < 15dBm
2476 * index 3 = 15dBm < tx_power < 20dBm
2477 * index 4 = tx_power > 20dBm
2478 */
2479 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002480 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002481 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002482 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002483 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002484 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002485 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002486 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002487 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002488 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002489 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002490 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002491 // product of current(mA), voltage(V) and time(ms)
2492 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002493}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002494
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002495/**
2496 * Pulls Bluetooth Activity Energy Info
2497 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2498 */
2499message BluetoothActivityInfo {
2500 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002501 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002502 // bluetooth stack state
2503 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002504 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002505 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002506 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002507 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002508 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002509 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002510 // product of current(mA), voltage(V) and time(ms)
2511 optional uint64 energy_used = 6;
2512}
2513
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002514/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002515 * Logs the memory stats for a process.
2516 */
2517message ProcessMemoryState {
2518 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002519 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002520
2521 // The process name.
2522 optional string process_name = 2;
2523
2524 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002525 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002526
2527 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002528 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002529
2530 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002531 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002532
Rajeev Kumar90235992018-01-29 11:06:48 -08002533 // RSS
2534 optional int64 rss_in_bytes = 6;
2535
2536 // CACHE
2537 optional int64 cache_in_bytes = 7;
2538
2539 // SWAP
2540 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002541
2542 // RSS high watermark.
2543 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2544 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002545 // Deprecated: use ProcessMemoryHighWaterMark atom instead.
2546 optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
Rafal Slawik272a8162018-11-01 15:12:28 +00002547
2548 // Elapsed real time when the process started.
2549 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2550 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002551}
2552
2553/*
Rafal Slawik08621582018-10-15 14:53:07 +01002554 * Logs the memory stats for a native process (from procfs).
2555 */
2556message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002557 // The uid if available. -1 means not available.
2558 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002559
Rafal Slawikbf67d072018-10-23 11:07:54 +01002560 // The process name.
2561 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002562
Rafal Slawikbf67d072018-10-23 11:07:54 +01002563 // # of page-faults
2564 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002565
Rafal Slawikbf67d072018-10-23 11:07:54 +01002566 // # of major page-faults
2567 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002568
Rafal Slawikbf67d072018-10-23 11:07:54 +01002569 // RSS
2570 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002571
Rafal Slawikbf67d072018-10-23 11:07:54 +01002572 // RSS high watermark.
2573 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002574 // Deprecated: use ProcessMemoryHighWaterMark atom instead.
2575 optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
Rafal Slawikbf67d072018-10-23 11:07:54 +01002576
2577 // Elapsed real time when the process started.
2578 // Value is read from /proc/PID/stat, field 22.
2579 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002580}
2581
2582/*
Rafal Slawik3bea8952018-11-15 12:39:33 +00002583 * Logs the memory high-water mark for a process.
2584 * Recorded in ActivityManagerService.
2585 */
2586message ProcessMemoryHighWaterMark {
2587 // The uid if available. -1 means not available.
2588 optional int32 uid = 1 [(is_uid) = true];
2589
2590 // The process name. Provided by ActivityManagerService or read from /proc/PID/cmdline.
2591 optional string process_name = 2;
2592
2593 // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
2594 // /proc/PID/status.
2595 optional int64 rss_high_water_mark_in_bytes = 3;
2596}
2597
2598/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002599 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002600 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002601message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002602 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002603}
2604
2605/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002606 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002607 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002608message SystemUptime {
2609 // Milliseconds since the system was booted.
2610 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2611 // for external input).
2612 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002613 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002614}
2615
2616/*
2617 * Reads from /proc/uid_concurrent_active_time which has the format:
2618 * active: X (X is # cores)
2619 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2620 * [uid1]: [time-0] [time-1] [time-2] ... ...
2621 * ...
2622 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2623 * The file contains a monotonically increasing count of time for a single boot.
2624 */
2625message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002626 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002627 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002628}
2629
2630/**
2631 * Reads from /proc/uid_concurrent_policy_time which has the format:
2632 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2633 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2634 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2635 * ...
2636 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2637 * The file contains a monotonically increasing count of time for a single boot.
2638 */
2639message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002640 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002641 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002642 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002643}
2644
2645/*
2646 * Pulls free disk space, for data, system partition and temporary directory.
2647 */
2648message DiskSpace {
2649 // available bytes in data partition
2650 optional uint64 data_available_bytes = 1;
2651 // available bytes in system partition
2652 optional uint64 system_available_bytes = 2;
2653 // available bytes in download cache or temp directories
2654 optional uint64 temp_available_bytes = 3;
2655}
Tej Singhbf972d92018-01-10 20:51:13 -08002656
2657/**
2658 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002659 * Pulled from:
2660 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002661 */
2662message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002663 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002664}
2665
2666/**
2667 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002668 * Pulled from:
2669 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002670 */
2671message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002672 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002673}
2674
2675/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002676 * Pulls battery voltage.
2677 * Pulled from:
2678 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2679 */
2680message BatteryVoltage {
2681 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002682 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002683}
2684
2685/**
Tej Singhb1dbc8b2018-11-19 15:49:47 -08002686 * Pulls battery level (percent full, from 0 to 100).
2687 *
2688 * Pulled from:
2689 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2690 */
2691message BatteryLevel {
2692 // Battery level. Should be in [0, 100].
2693 optional int32 battery_level = 1;
2694}
2695
2696/**
Tej Singhd89137e2018-03-26 14:51:40 -07002697 * Pulls the temperature of various parts of the device.
2698 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002699 *
2700 * Pulled from:
2701 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2702 */
2703message Temperature {
2704 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2705 optional android.os.TemperatureTypeEnum sensor_location = 1;
2706
2707 // The name of the temperature source. Eg. CPU0
2708 optional string sensor_name = 2;
2709
Tej Singhd89137e2018-03-26 14:51:40 -07002710 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002711 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002712}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002713
2714/**
2715 * Pulls the statistics of calls to Binder.
2716 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002717 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2718 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002719 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002720 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002721 */
2722message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002723 // UID of the process responsible for the binder transaction. It will be set if the process
2724 // executing the binder transaction attribute the transaction to another uid using
2725 // Binder.setThreadWorkSource().
2726 //
2727 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002728 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002729 // UID of the process executing the binder transaction.
2730 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002731 // Fully qualified class name of the API call.
2732 //
2733 // This is a system server class name.
2734 //
2735 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2736 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2737 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2738 // commonly used APIs.
2739 optional string service_class_name = 2;
2740 // Method name of the API call. It can also be a transaction code if we cannot
2741 // resolve it to a name. See Binder#getTransactionName.
2742 //
2743 // This is a system server method name.
2744 optional string service_method_name = 3;
2745 // Total number of API calls.
2746 optional int64 call_count = 4;
2747 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2748 optional bool screen_interactive = 13;
2749 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2750 // call_count will be equal to recorded_call_count.
2751 //
2752 // If recorded_call_count is different than call_count, it means data collection has been
2753 // sampled. All the fields below will be sampled in this case.
2754 optional int64 recorded_call_count = 12;
2755 // Number of exceptions thrown by the API.
2756 optional int64 recorded_exception_count = 5;
2757 // Total latency of all API calls.
2758 // Average can be computed using total_latency_micros / recorded_call_count.
2759 optional int64 recorded_total_latency_micros = 6;
2760 // Maximum latency of one API call.
2761 optional int64 recorded_max_latency_micros = 7;
2762 // Total CPU usage of all API calls.
2763 // Average can be computed using total_cpu_micros / recorded_call_count.
2764 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2765 optional int64 recorded_total_cpu_micros = 8;
2766 // Maximum CPU usage of one API call.
2767 optional int64 recorded_max_cpu_micros = 9;
2768 // Maximum parcel reply size of one API call.
2769 optional int64 recorded_max_reply_size_bytes = 10;
2770 // Maximum parcel request size of one API call.
2771 optional int64 recorded_max_request_size_bytes = 11;
2772}
2773
2774/**
2775 * Pulls the statistics of exceptions during calls to Binder.
2776 *
2777 * Binder stats are cumulative from boot unless somebody reset the data using
2778 * > adb shell dumpsys binder_calls_stats --reset
2779 */
2780message BinderCallsExceptions {
2781 // Exception class name, e.g. java.lang.IllegalArgumentException.
2782 //
2783 // This is an exception class name thrown by the system server.
2784 optional string exception_class_name = 1;
2785 // Total number of exceptions.
2786 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002787}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002788
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002789/**
2790 * Pulls the statistics of message dispatching on HandlerThreads.
2791 *
2792 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2793 * config on the device.
2794 *
2795 * Next tag: 11
2796 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002797message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002798 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002799 optional int32 uid = 1 [(is_uid) = true];
2800
2801 // Fully qualified class name of the handler target class.
2802 //
2803 // This field does not contain PII. This is a system server class name.
2804 optional string handler_class_name = 2;
2805
2806 // The name of the thread that runs the Looper.
2807 //
2808 // This field does not contain PII. This is a system server thread name.
2809 optional string looper_thread_name = 3;
2810
2811 // The name of the dispatched message.
2812 //
2813 // This field does not contain PII. This is a system server constant or class
2814 // name.
2815 optional string message_name = 4;
2816
2817 // Total number of successfully dispatched messages.
2818 optional int64 message_count = 5;
2819
2820 // Total number of messages that failed dispatching.
2821 optional int64 exception_count = 6;
2822
2823 // Total number of processed messages we have data recorded for. If we
2824 // collected data for all the messages, message_count will be equal to
2825 // recorded_message_count.
2826 //
2827 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002828 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002829 optional int64 recorded_message_count = 7;
2830
2831 // Total latency of all processed messages.
2832 // Average can be computed using recorded_total_latency_micros /
2833 // recorded_message_count.
2834 optional int64 recorded_total_latency_micros = 8;
2835
2836 // Total CPU usage of all processed message.
2837 // Average can be computed using recorded_total_cpu_micros /
2838 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002839 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002840 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002841
2842 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2843 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002844
2845 // Max recorded CPU usage of all processed messages.
2846 optional int64 recorded_max_cpu_micros = 11;
2847
2848 // Max recorded latency of all processed messages.
2849 optional int64 recorded_max_latency_micros = 12;
2850
2851 // Total number of messages we tracked the dispatching delay for. If we
2852 // collected data for all the messages, message_count will be equal to
2853 // recorded_delay_message_count.
2854 //
2855 // If recorded_delay_message_count is different than message_count, it means data
2856 // collection has been sampled or/and not all messages specified the target dispatch time.
2857 // The fields below will be sampled in this case.
2858 optional int64 recorded_delay_message_count = 13;
2859
2860 // Total dispatching delay of all processed messages.
2861 // Calculated as a difference between the target dispatching time (Message.when)
2862 // and the actual dispatching time.
2863 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2864 optional int64 recorded_total_delay_millis = 14;
2865
2866 // Max dispatching delay of all processed messages.
2867 // Calculated as a difference between the target dispatching time (Message.when)
2868 // and the actual dispatching time.
2869 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002870}
Tej Singh86dc9db2018-09-06 00:39:57 +00002871
2872/**
2873 * Pulls disk information, such as write speed and latency.
2874 */
2875message DiskStats {
2876 // Time taken to open, write 512B to, and close a file.
2877 // -1 if error performing the check.
2878 optional int64 data_write_latency_millis = 1;
2879
2880 optional bool file_based_encryption = 2;
2881
2882 // Recent disk write speed in kB/s.
2883 // -1 if error querying storageed.
2884 // 0 if data is unavailable.
2885 optional int32 recent_disk_write_speed = 3;
2886}
2887
2888
2889/**
2890 * Free and total bytes of the Data, Cache, and System partition.
2891 */
2892message DirectoryUsage {
2893 enum Directory {
2894 UNKNOWN = 0;
2895 DATA = 1;
2896 CACHE = 2;
2897 SYSTEM = 3;
2898 }
2899 optional Directory directory = 1;
2900 optional int64 free_bytes = 2;
2901 optional int64 total_bytes = 3;
2902}
2903
2904
2905/**
2906 * Size of an application: apk size, data size, and cache size.
2907 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2908 * Information is only reported for apps with the primary user (user 0).
2909 * Sizes are aggregated by package name.
2910 */
2911message AppSize {
2912 // Including uids will involve modifying diskstats logic.
2913 optional string package_name = 1;
2914 // App size in bytes. -1 if unavailable.
2915 optional int64 app_size_bytes = 2;
2916 // App data size in bytes. -1 if unavailable.
2917 optional int64 app_data_size_bytes = 3;
2918 // App cache size in bytes. -1 if unavailable.
2919 optional int64 app_cache_size_bytes = 4;
2920 // Time that the cache file was produced.
2921 // Uses System.currentTimeMillis(), which is wall clock time.
2922 optional int64 cache_time_millis = 5;
2923}
2924
2925
2926/**
2927 * Size of a particular category. Eg: photos, videos.
2928 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2929 */
2930message CategorySize {
2931 enum Category {
2932 UNKNOWN = 0;
2933 APP_SIZE = 1;
2934 APP_DATA_SIZE = 2;
2935 APP_CACHE_SIZE = 3;
2936 PHOTOS = 4;
2937 VIDEOS = 5;
2938 AUDIO = 6;
2939 DOWNLOADS = 7;
2940 SYSTEM = 8;
2941 OTHER = 9;
2942 }
2943 optional Category category = 1;
2944 // Category size in bytes.
2945 optional int64 size_bytes = 2;
2946 // Time that the cache file was produced.
2947 // Uses System.currentTimeMillis(), which is wall clock time.
2948 optional int64 cache_time_millis = 3;
2949}
Tej Singhd6d6d772018-09-05 17:41:25 -07002950
2951/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002952 * Pulls per uid I/O stats. The stats are cumulative since boot.
2953 *
2954 * Read/write bytes are I/O events from a storage device
2955 * Read/write chars are data requested by read/write syscalls, and can be
2956 * satisfied by caching.
2957 *
2958 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2959 */
2960message DiskIo {
2961 optional int32 uid = 1 [(is_uid) = true];
2962 optional int64 fg_chars_read = 2;
2963 optional int64 fg_chars_write = 3;
2964 optional int64 fg_bytes_read = 4;
2965 optional int64 fg_bytes_write = 5;
2966 optional int64 bg_chars_read = 6;
2967 optional int64 bg_chars_write = 7;
2968 optional int64 bg_bytes_read = 8;
2969 optional int64 bg_bytes_write = 9;
2970 optional int64 fg_fsync = 10;
2971 optional int64 bg_fsync= 11;
2972}
2973
2974
2975/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002976 * Pulls the number of fingerprints for each user.
2977 *
2978 * Pulled from StatsCompanionService, which queries FingerprintManager.
2979 */
2980message NumFingerprints {
2981 // The associated user. Eg: 0 for owners, 10+ for others.
2982 // Defined in android/os/UserHandle.java
2983 optional int32 user = 1;
2984 // Number of fingerprints registered to that user.
2985 optional int32 num_fingerprints = 2;
2986}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002987
Yangsteraf9aee72018-10-12 09:26:16 -07002988message AggStats {
2989 optional int64 min = 1;
2990
2991 optional int64 average = 2;
2992
2993 optional int64 max = 3;
2994}
2995
2996message ProcessStatsStateProto {
2997 optional android.service.procstats.ScreenState screen_state = 1;
2998
2999 optional android.service.procstats.MemoryState memory_state = 2;
3000
3001 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
3002 // and not frameworks/base/core/java/android/app/ActivityManager.java
3003 optional android.service.procstats.ProcessState process_state = 3;
3004
3005 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003006 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003007
3008 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003009 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07003010
3011 // # of samples taken
3012 optional int32 sample_size = 5;
3013
3014 // PSS is memory reserved for this process
3015 optional AggStats pss = 6;
3016
3017 // USS is memory shared between processes, divided evenly for accounting
3018 optional AggStats uss = 7;
3019
3020 // RSS is memory resident for this process
3021 optional AggStats rss = 8;
3022}
3023
3024// Next Tag: 7
3025message ProcessStatsProto {
3026 // Name of process.
3027 optional string process = 1;
3028
3029 // Uid of the process.
3030 optional int32 uid = 2;
3031
3032 // Information about how often kills occurred
3033 message Kill {
3034 // Count of excessive CPU kills
3035 optional int32 cpu = 1;
3036
3037 // Count of kills when cached
3038 optional int32 cached = 2;
3039
3040 // PSS stats during cached kill
3041 optional AggStats cached_pss = 3;
3042 }
3043 optional Kill kill = 3;
3044
3045 // Time and memory spent in various states.
3046 repeated ProcessStatsStateProto states = 5;
3047
3048 // Total time process has been running... screen_state, memory_state, and process_state
3049 // will not be set.
3050 optional ProcessStatsStateProto total_running_state = 6;
3051}
3052
3053message PackageServiceOperationStatsProto {
3054 // Operate enum: Started, Foreground, Bound, Executing
3055 optional android.service.procstats.ServiceOperationState operation = 1;
3056
3057 // Number of times the service was in this operation.
3058 optional int32 count = 2;
3059
3060 // Information about a state the service can be in.
3061 message StateStats {
3062 // Screen state enum.
3063 optional android.service.procstats.ScreenState screen_state = 1;
3064 // Memory state enum.
3065 optional android.service.procstats.MemoryState memory_state = 2;
3066
3067 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003068 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003069 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003070 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003071 }
3072 repeated StateStats state_stats = 3;
3073}
3074
3075message PackageServiceStatsProto {
3076 // Name of service component.
3077 optional string service_name = 1;
3078
3079 // The operation stats.
3080 // The package_name, package_uid, package_version, service_name will not be set to save space.
3081 repeated PackageServiceOperationStatsProto operation_stats = 2;
3082}
3083
3084message PackageAssociationSourceProcessStatsProto {
3085 // Uid of the process.
3086 optional int32 process_uid = 1;
3087 // Process name.
3088 optional string process_name = 2;
3089
3090 // Total count of the times this association appeared.
3091 optional int32 total_count = 3;
3092
3093 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003094 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003095
3096 // Total count of the times this association became actively impacting its target process.
3097 optional int32 active_count = 5;
3098
3099 // Information on one source in this association.
3100 message StateStats {
3101 // Process state enum.
3102 optional android.service.procstats.ProcessState process_state = 1;
3103 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003104 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003105 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003106 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003107 }
3108 repeated StateStats active_state_stats = 6;
3109}
3110
3111message PackageAssociationProcessStatsProto {
3112 // Name of the target component.
3113 optional string component_name = 1;
3114 // Information on one source in this association.
3115 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3116}
3117
3118
3119message ProcessStatsPackageProto {
3120 // Name of package.
3121 optional string package = 1;
3122
3123 // Uid of the package.
3124 optional int32 uid = 2;
3125
3126 // Version of the package.
3127 optional int64 version = 3;
3128
3129 // Stats for each process running with the package loaded in to it.
3130 repeated ProcessStatsProto process_stats = 4;
3131
3132 // Stats for each of the package's services.
3133 repeated PackageServiceStatsProto service_stats = 5;
3134
3135 // Stats for each association with the package.
3136 repeated PackageAssociationProcessStatsProto association_stats = 6;
3137}
3138
3139message ProcessStatsSectionProto {
3140 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003141 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003142
3143 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003144 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003145
3146 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003147 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003148
3149 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003150 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003151
3152 // System runtime library. e.g. "libdvm.so", "libart.so".
3153 optional string runtime = 5;
3154
3155 // whether kernel reports swapped pss.
3156 optional bool has_swapped_pss = 6;
3157
3158 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3159 enum Status {
3160 STATUS_UNKNOWN = 0;
3161 STATUS_COMPLETE = 1;
3162 STATUS_PARTIAL = 2;
3163 STATUS_SHUTDOWN = 3;
3164 STATUS_SYSPROPS = 4;
3165 }
3166 repeated Status status = 7;
3167
3168 // Stats for each process.
3169 repeated ProcessStatsProto process_stats = 8;
3170
3171 // Stats for each package.
3172 repeated ProcessStatsPackageProto package_stats = 9;
3173}
3174
Chenjie Yu12e5e672018-09-14 15:54:59 -07003175/**
3176 * Pulled from ProcessStatsService.java
3177 */
3178message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003179 optional ProcessStatsSectionProto proc_stats_section = 1;
3180}
3181
3182message PowerProfileProto {
3183 optional double cpu_suspend = 1;
3184
3185 optional double cpu_idle = 2;
3186
3187 optional double cpu_active = 3;
3188
3189 message CpuCluster {
3190 optional int32 id = 1;
3191 optional double cluster_power = 2;
3192 optional int32 cores = 3;
3193 repeated int64 speed = 4;
3194 repeated double core_power = 5;
3195 }
3196
3197 repeated CpuCluster cpu_cluster = 40;
3198
3199 optional double wifi_scan = 4;
3200
3201 optional double wifi_on = 5;
3202
3203 optional double wifi_active = 6;
3204
3205 optional double wifi_controller_idle = 7;
3206
3207 optional double wifi_controller_rx = 8;
3208
3209 optional double wifi_controller_tx = 9;
3210
3211 repeated double wifi_controller_tx_levels = 10;
3212
3213 optional double wifi_controller_operating_voltage = 11;
3214
3215 optional double bluetooth_controller_idle = 12;
3216
3217 optional double bluetooth_controller_rx = 13;
3218
3219 optional double bluetooth_controller_tx = 14;
3220
3221 optional double bluetooth_controller_operating_voltage = 15;
3222
3223 optional double modem_controller_sleep = 16;
3224
3225 optional double modem_controller_idle = 17;
3226
3227 optional double modem_controller_rx = 18;
3228
3229 repeated double modem_controller_tx = 19;
3230
3231 optional double modem_controller_operating_voltage = 20;
3232
3233 optional double gps_on = 21;
3234
3235 repeated double gps_signal_quality_based = 22;
3236
3237 optional double gps_operating_voltage = 23;
3238
3239 optional double bluetooth_on = 24;
3240
3241 optional double bluetooth_active = 25;
3242
3243 optional double bluetooth_at_cmd = 26;
3244
3245 optional double ambient_display = 27;
3246
3247 optional double screen_on = 28;
3248
3249 optional double radio_on = 29;
3250
3251 optional double radio_scanning = 30;
3252
3253 optional double radio_active = 31;
3254
3255 optional double screen_full = 32;
3256
3257 optional double audio = 33;
3258
3259 optional double video = 34;
3260
3261 optional double flashlight = 35;
3262
3263 optional double memory = 36;
3264
3265 optional double camera = 37;
3266
3267 optional double wifi_batched_scan = 38;
3268
3269 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003270}
Chenjie Yuab530202018-09-26 12:39:20 -07003271
3272/**
3273 * power_profile.xml and other constants for power model calculations.
3274 * Pulled from PowerProfile.java
3275 */
3276message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003277 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003278}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003279
3280/**
arangelovd5db50e2018-10-12 20:24:39 +01003281 * Logs when a user restriction was added or removed.
3282 *
3283 * Logged from:
3284 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3285 */
3286message UserRestrictionChanged {
3287 // The raw string of the user restriction as defined in UserManager.
3288 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3289 optional string restriction = 1;
3290 // Whether the restriction is enabled or disabled.
3291 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003292}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003293
3294/**
3295 * Pulls process user time and system time. Puller takes a snapshot of all pids
3296 * in the system and returns cpu stats for those that are working at the time.
3297 * Dead pids will be dropped. Kernel processes are excluded.
3298 * Min cool-down is 5 sec.
3299 */
3300message ProcessCpuTime {
3301 optional int32 uid = 1 [(is_uid) = true];
3302
3303 optional string process_name = 2;
3304 // Process cpu time in user space, cumulative from boot/process start
3305 optional int64 user_time_millis = 3;
3306 // Process cpu time in system space, cumulative from boot/process start
3307 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003308}
Misha Wagner5a51e002018-10-03 15:04:09 +01003309
3310/**
3311 * Pulls the CPU usage for each thread.
3312 *
3313 * Read from /proc/$PID/task/$TID/time_in_state files.
3314 *
3315 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3316 * time_in_state files not being present on some phones, have not been addressed. These should be
3317 * considered before a public release.
3318 */
3319message CpuTimePerThreadFreq {
3320 // UID that owns the process.
3321 optional int32 uid = 1 [(is_uid) = true];
3322 // ID of the process.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003323 optional int32 process_id = 2;
Misha Wagner5a51e002018-10-03 15:04:09 +01003324 // ID of the thread.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003325 optional int32 thread_id = 3;
Misha Wagner5a51e002018-10-03 15:04:09 +01003326 // Name of the process taken from `/proc/$PID/cmdline`.
3327 optional string process_name = 4;
3328 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3329 optional string thread_name = 5;
3330 // What frequency the CPU was running at, in KHz
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003331 optional int32 frequency_khz = 6;
Misha Wagner5a51e002018-10-03 15:04:09 +01003332 // Time spent in frequency in milliseconds, since thread start.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003333 optional int32 time_millis = 7;
Misha Wagner5a51e002018-10-03 15:04:09 +01003334}
Bookatz75ee6042018-11-09 12:27:37 -08003335
3336/**
3337 * Pulls on-device BatteryStats power use calculations for the overall device.
3338 */
3339message DeviceCalculatedPowerUse {
3340 // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset
3341 // (i.e. roughly since device was last significantly charged).
3342 // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3343 optional float computed_power_milli_amp_hours = 1;
3344}
3345
3346/**
3347 * Pulls on-device BatteryStats power use calculations broken down by uid.
3348 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3349 * that is attributed to non-uid items. They must all be included to get the total power use.
3350 */
3351message DeviceCalculatedPowerBlameUid {
3352 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3353 optional int32 uid = 1 [(is_uid) = true];
3354
3355 // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset
3356 // (i.e. roughly since device was last significantly charged).
3357 optional float power_milli_amp_hours = 2;
3358}
3359
3360/**
3361 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3362 * drain type.
3363 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3364 * is attributed uids. They must all be included to get the total power use.
3365 */
3366message DeviceCalculatedPowerBlameOther {
3367 // The type of item whose power use is being reported.
3368 enum DrainType {
3369 AMBIENT_DISPLAY = 0;
3370 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3371 BLUETOOTH = 2;
3372 CAMERA = 3;
3373 // Cell-standby
3374 CELL = 4;
3375 FLASHLIGHT = 5;
3376 IDLE = 6;
3377 MEMORY = 7;
3378 // Amount that total computed drain exceeded the drain estimated using the
3379 // battery level changes and capacity.
3380 OVERCOUNTED = 8;
3381 PHONE = 9;
3382 SCREEN = 10;
3383 // Amount that total computed drain was below the drain estimated using the
3384 // battery level changes and capacity.
3385 UNACCOUNTED = 11;
3386 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3387 WIFI = 13;
3388 }
3389 optional DrainType drain_type = 1;
3390
3391 // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset
3392 // (i.e. roughly since device was last significantly charged).
3393 optional float power_milli_amp_hours = 2;
Rafal Slawik3bea8952018-11-15 12:39:33 +00003394}
arangelov4e994062018-11-13 16:12:38 +00003395
3396/**
3397 * Logs device policy features.
3398 *
3399 * Logged from:
3400 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3401 * packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
3402 */
3403message DevicePolicyEvent {
3404 // The event id - unique for each event.
3405 optional android.stats.devicepolicy.EventId event_id = 1;
3406 // The admin package name.
3407 optional string admin_package_name = 2;
3408 // A generic integer parameter.
3409 optional int32 integer_value = 3;
3410 // A generic boolean parameter.
3411 optional bool boolean_value = 4;
3412 // A parameter specifying a time period in milliseconds.
3413 optional uint64 time_period_millis = 5;
3414 // A parameter specifying a list of package names, bundle extras or string parameters.
3415 optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
3416}