blob: 726abe245f0ea5b5aa9b47ebd9e8b4a9ebe48870 [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";
Joe Onorato62c220b2017-11-18 20:32:56 -080037
Yao Chend54f9dd2017-10-17 17:37:48 +000038/**
Stefan Lafonae2df012017-11-14 09:17:21 -080039 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000040 * raw stats log events from the Android system, also known as "atoms."
41 *
42 * This field contains a single oneof with all of the available messages.
43 * The stats-log-api-gen tool runs as part of the Android build and
44 * generates the android.util.StatsLog class, which contains the constants
45 * and methods that Android uses to log.
46 *
Stefan Lafonae2df012017-11-14 09:17:21 -080047 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000048 * Instead, statsd on Android constructs these messages synthetically,
49 * in the format defined here and in stats_log.proto.
50 */
Stefan Lafonae2df012017-11-14 09:17:21 -080051message Atom {
52 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070053 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070054 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
55 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070056 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070057 BleScanResultReceived ble_scan_result_received = 4;
58 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080059 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070060 SyncStateChanged sync_state_changed = 7;
61 ScheduledJobStateChanged scheduled_job_state_changed = 8;
62 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070063 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080064 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
65 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
66 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070067 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
68 MemoryFactorStateChanged memory_factor_state_changed = 15;
69 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
70 CachedKillReported cached_kill_reported = 17;
71 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070072 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080073 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
74 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
75 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070076 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080077 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070078 CameraStateChanged camera_state_changed = 25;
79 FlashlightStateChanged flashlight_state_changed = 26;
80 UidProcessStateChanged uid_process_state_changed = 27;
81 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
82 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070083 BatteryLevelChanged battery_level_changed = 30;
84 ChargingStateChanged charging_state_changed = 31;
85 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070086 InteractiveStateChanged interactive_state_changed = 33;
87 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070088 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
89 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070090 WifiLockStateChanged wifi_lock_state_changed = 37;
91 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
92 WifiScanStateChanged wifi_scan_state_changed = 39;
93 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070094 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070095 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070096 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090097 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070098 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080099 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -0800100 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800101 AppStartOccurred app_start_occurred = 48;
102 AppStartCanceled app_start_canceled = 49;
103 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800104 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800105 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800106 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800107 LmkStateChanged lmk_state_changed = 54;
108 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800109 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800110 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800111 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800112 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800113 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800114 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800115 KeyguardStateChanged keyguard_state_changed = 62;
116 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
117 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800118 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800119 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800120 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
121 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Bookatz48d362e2018-11-06 15:49:08 -0800122 GpsSignalQualityChanged gps_signal_quality_changed = 69;
Andrew Chantb56388b2018-03-22 21:07:33 -0700123 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800124 SpeakerImpedanceReported speaker_impedance_reported = 71;
125 HardwareFailed hardware_failed = 72;
126 PhysicalDropDetected physical_drop_detected = 73;
127 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800128 MobileConnectionStateChanged mobile_connection_state_changed = 75;
129 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700130 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800131 AppCrashOccurred app_crash_occurred = 78;
132 ANROccurred anr_occurred = 79;
133 WTFOccurred wtf_occurred = 80;
134 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700135 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700136 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700137 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700138 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700139 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700140 FingerprintAcquired fingerprint_acquired = 87;
141 FingerprintAuthenticated fingerprint_authenticated = 88;
142 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700143 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700144 BatteryHealthSnapshot battery_health_snapshot = 91;
145 SlowIo slow_io = 92;
146 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700147 PhoneServiceStateChanged phone_service_state_changed = 94;
148 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100149 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700150 SettingsUIChanged settings_ui_changed = 97;
Chenjie Yuae9dfac2018-10-25 16:06:56 -0700151 ConnectivityStateChanged connectivity_state_changed = 98;
Chenjie Yu75b3c492018-10-06 21:45:19 -0700152 // TODO: service state change is very noisy shortly after boot, as well
153 // as at other transitions - coming out of doze, device plugged in, etc.
154 // Consider removing this if it becomes a problem
155 ServiceStateChanged service_state_changed = 99;
156 ServiceLaunchReported service_launch_reported = 100;
Yangster-macb89807e2018-11-15 21:10:57 -0800157 PhenotypeFlagStateChanged phenotype_flag_state_changed = 101;
158 BinaryPushStateChanged binary_push_state_changed = 102;
Yao Chend54f9dd2017-10-17 17:37:48 +0000159 }
David Chenc8a43242017-10-17 16:23:28 -0700160
David Chen6e3e6cb2018-01-03 16:14:06 -0800161 // Pulled events will start at field 10000.
Rafal Slawik3bea8952018-11-15 12:39:33 +0000162 // Next: 10043
David Chenc8a43242017-10-17 16:23:28 -0700163 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800164 WifiBytesTransfer wifi_bytes_transfer = 10000;
165 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
166 MobileBytesTransfer mobile_bytes_transfer = 10002;
167 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800168 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800169 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800170 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800171 CpuTimePerFreq cpu_time_per_freq = 10008;
172 CpuTimePerUid cpu_time_per_uid = 10009;
173 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800174 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800175 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800176 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800177 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800178 SystemElapsedRealtime system_elapsed_realtime = 10014;
179 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800180 CpuActiveTime cpu_active_time = 10016;
181 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000182 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800183 RemainingBatteryCapacity remaining_battery_capacity = 10019;
184 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800185 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100186 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100187 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100188 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000189 DiskStats disk_stats = 10025;
190 DirectoryUsage directory_usage = 10026;
191 AppSize app_size = 10027;
192 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700193 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700194 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700195 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700196 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700197 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700198 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700199 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100200 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100201 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700202 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800203 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
204 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
205 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
Rafal Slawik3bea8952018-11-15 12:39:33 +0000206 ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
David Chenc8a43242017-10-17 16:23:28 -0700207 }
yroa1fe77c2018-02-26 14:22:54 -0800208
Bookatz76aafcf2018-09-17 16:17:10 -0700209 // DO NOT USE field numbers above 100,000 in AOSP.
210 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
211 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700212}
213
Yao Chend54f9dd2017-10-17 17:37:48 +0000214/**
Yangster-mac20877162017-12-22 17:19:39 -0800215 * This proto represents a node of an attribution chain.
216 * Note: All attribution chains are represented as a repeated field of type
217 * AttributionNode. It is understood that in such arrays, the order is that
218 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000219 */
Yangster-mac20877162017-12-22 17:19:39 -0800220message AttributionNode {
221 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800222 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800223
Yangster-mac20877162017-12-22 17:19:39 -0800224 // The (optional) string tag for an element in the attribution chain. If the
225 // element has no tag, it is encoded as an empty string.
226 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700227}
228
Yangster-mac48b3d622018-08-18 12:38:11 -0700229message KeyValuePair {
230 optional int32 key = 1;
231 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700232 int32 value_int = 2;
233 int64 value_long = 3;
234 string value_str = 4;
235 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700236 }
237}
238
239message KeyValuePairsAtom {
240 optional int32 uid = 1;
241 repeated KeyValuePair pairs = 2;
242}
243
Yao Chend54f9dd2017-10-17 17:37:48 +0000244/*
245 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800246 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000247 *
248 * RULES:
249 * - The field ids for each atom must start at 1, and count upwards by 1.
250 * Skipping field ids is not allowed.
251 * - These form an API, so renaming, renumbering or removing fields is
252 * not allowed between android releases. (This is not currently enforced,
253 * but there will be a tool to enforce this restriction).
254 * - The types must be built-in protocol buffer types, namely, no sub-messages
255 * are allowed (yet). The bytes type is also not allowed.
256 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800257 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000258 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800259 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000260 * - A field that is a uid should be a string field, tagged with the [xxx]
261 * annotation. The generated code on android will be represented by UIDs,
262 * and those UIDs will be translated in xxx to those strings.
263 *
264 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700265 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000266 * - If there is a UID, it goes first. Think in an object-oriented fashion.
267 * *****************************************************************************
268 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700269
Yao Chend54f9dd2017-10-17 17:37:48 +0000270/**
Yangster-mace16189a2018-08-26 12:20:16 -0700271 * Logs when the Thermal service HAL notifies the throttling start/stop events.
272 *
273 * Logged from:
274 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
275 */
276message ThermalThrottlingStateChanged {
277 optional android.os.TemperatureTypeEnum sensor_type = 1;
278
279 enum State {
280 UNKNOWN = 0;
281 START = 1;
282 STOP = 2;
283 }
284
285 optional State state = 2;
286
287 optional float temperature = 3;
288}
289
290/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000291 * Logs when the screen state changes.
292 *
293 * Logged from:
294 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
295 */
296message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800297 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700298 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700299}
Yao Chend54f9dd2017-10-17 17:37:48 +0000300
301/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700302 * Logs that the process state of the uid, as determined by ActivityManager
303 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000304 *
305 * Logged from:
306 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
307 */
Bookatzc1a050a2017-10-10 15:49:28 -0700308message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700309 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000310
Bookatzdb026a22018-01-10 19:01:56 -0800311 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700312 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000313}
314
315/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700316 * Logs process state change of a process, as per the activity manager.
317 *
318 * Logged from:
319 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
320 */
321message ProcessStateChanged {
322 optional int32 uid = 1;
323 optional string process_name = 2;
324 optional string package_name = 3;
325 // TODO: remove this when validation is done
326 optional int64 version = 5;
327 // The state, from frameworks/base/core/proto/android/app/enums.proto.
328 optional android.app.ProcessStateEnum state = 4;
329}
330
331/**
332 * Logs when ActivityManagerService sleep state is changed.
333 *
334 * Logged from:
335 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
336 */
337message ActivityManagerSleepStateChanged {
338 // TODO: import frameworks proto
339 enum State {
340 UNKNOWN = 0;
341 ASLEEP = 1;
342 AWAKE = 2;
343 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700344 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700345}
346
347/**
348 * Logs when system memory state changes.
349 *
350 * Logged from:
351 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
352 */
353message MemoryFactorStateChanged {
354 // TODO: import frameworks proto
355 enum State {
356 MEMORY_UNKNOWN = 0;
357 NORMAL = 1; // normal.
358 MODERATE = 2; // moderate memory pressure.
359 LOW = 3; // low memory.
360 CRITICAL = 4; // critical memory.
361
362 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700363 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700364}
365
366/**
367 * Logs when app is using too much cpu, according to ActivityManagerService.
368 *
369 * Logged from:
370 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
371 */
372message ExcessiveCpuUsageReported {
373 optional int32 uid = 1;
374 optional string process_name = 2;
375 optional string package_name = 3;
376 // package version. TODO: remove this when validation is done
377 optional int64 version = 4;
378}
379
380/**
381 * Logs when a cached process is killed, along with its pss.
382 *
383 * Logged from:
384 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
385 */
386message CachedKillReported {
387 optional int32 uid = 1;
388 optional string process_name = 2;
389 optional string package_name = 3;
390 // TODO: remove this when validation is done
391 optional int64 version = 5;
392 optional int64 pss = 4;
393}
394
395/**
396 * Logs when memory stats of a process is reported.
397 *
398 * Logged from:
399 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
400 */
401message ProcessMemoryStatReported {
402 optional int32 uid = 1;
403 optional string process_name = 2;
404 optional string package_name = 3;
405 //TODO: remove this when validation is done
406 optional int64 version = 9;
407 optional int64 pss = 4;
408 optional int64 uss = 5;
409 optional int64 rss = 6;
410 enum Type {
411 ADD_PSS_INTERNAL_SINGLE = 0;
412 ADD_PSS_INTERNAL_ALL_MEM = 1;
413 ADD_PSS_INTERNAL_ALL_POLL = 2;
414 ADD_PSS_EXTERNAL = 3;
415 ADD_PSS_EXTERNAL_SLOW = 4;
416 }
417 optional Type type = 7;
418 optional int64 duration = 8;
419}
420
421/**
Bookatzc1a050a2017-10-10 15:49:28 -0700422 * Logs that a process started, finished, crashed, or ANRed.
423 *
424 * Logged from:
425 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
426 */
427message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700428 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700429
David Chen0b5c90c2018-01-25 16:51:49 -0800430 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800431 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700432
Bookatzddccf0a2017-11-28 16:48:14 -0800433 // What lifecycle state the process changed to.
434 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800435 enum State {
436 FINISHED = 0;
437 STARTED = 1;
438 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800439 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800440 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700441}
442
Bookatzc1a050a2017-10-10 15:49:28 -0700443/**
444 * Logs when the ble scan state changes.
445 *
446 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700447 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700448 */
449message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800450 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700451
452 enum State {
453 OFF = 0;
454 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700455 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
456 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700457 }
458 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700459
Bookatze5ec0b42018-03-26 13:34:56 -0700460 // Does the scan have a filter.
461 optional bool is_filtered = 3;
462 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
463 optional bool is_first_match = 4;
464 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
465 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700466}
467
468/**
469 * Logs reporting of a ble scan finding results.
470 *
471 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700472 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700473 */
Bookatzae6738e2018-09-13 11:38:56 -0700474// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700475message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800476 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700477
478 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800479 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700480}
481
482/**
483 * Logs when a sensor state changes.
484 *
485 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700486 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700487 */
488message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800489 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700490
Bookatzc1a050a2017-10-10 15:49:28 -0700491 // The id (int) of the sensor.
492 optional int32 sensor_id = 2;
493
494 enum State {
495 OFF = 0;
496 ON = 1;
497 }
498 optional State state = 3;
499}
500
Bookatzc1a050a2017-10-10 15:49:28 -0700501/**
502 * Logs when GPS state changes.
503 *
504 * Logged from:
505 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
506 */
507message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800508 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700509
510 enum State {
511 OFF = 0;
512 ON = 1;
513 }
514 optional State state = 2;
515}
516
Bookatz48d362e2018-11-06 15:49:08 -0800517/**
518 * Logs when GPS signal quality.
519 *
520 * Logged from:
521 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
522 */
523message GpsSignalQualityChanged {
524 optional android.server.location.GpsSignalQualityEnum level = 1;
525}
526
Bookatzc1a050a2017-10-10 15:49:28 -0700527
528/**
529 * Logs when a sync manager sync state changes.
530 *
531 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700532 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700533 */
534message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800535 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700536
David Chen0b5c90c2018-01-25 16:51:49 -0800537 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800538 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700539
540 enum State {
541 OFF = 0;
542 ON = 1;
543 }
544 optional State state = 3;
545}
546
Yangster-mac96353002018-09-05 11:18:55 -0700547/*
548 * Deferred job stats.
549 *
550 * Logged from:
551 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
552*/
553message DeferredJobStatsReported {
554 repeated AttributionNode attribution_node = 1;
555
556 // Number of jobs deferred.
557 optional int32 num_jobs_deferred = 2;
558
559 // Time since the last job runs.
560 optional int64 time_since_last_job_millis = 3;
561}
562
Bookatzc1a050a2017-10-10 15:49:28 -0700563/**
564 * Logs when a job scheduler job state changes.
565 *
566 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700567 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700568 */
569message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800570 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700571
572 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800573 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700574
575 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800576 FINISHED = 0;
577 STARTED = 1;
578 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700579 }
580 optional State state = 3;
581
Tej Singh33a412b2018-03-16 18:43:59 -0700582 // The reason a job has stopped.
583 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700584 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700585 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700586}
587
588/**
589 * Logs when the audio state changes.
590 *
591 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700592 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700593 */
594message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800595 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700596
597 enum State {
598 OFF = 0;
599 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700600 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
601 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700602 }
603 optional State state = 2;
604}
605
606/**
607 * Logs when the video codec state changes.
608 *
609 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700610 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700611 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800612message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800613 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700614
615 enum State {
616 OFF = 0;
617 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700618 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
619 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700620 }
621 optional State state = 2;
622}
623
624/**
625 * Logs when the flashlight state changes.
626 *
627 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700628 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700629 */
630message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800631 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700632
633 enum State {
634 OFF = 0;
635 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700636 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
637 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700638 }
639 optional State state = 2;
640}
641
642/**
643 * Logs when the camera state changes.
644 *
645 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700646 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700647 */
648message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800649 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700650
651 enum State {
652 OFF = 0;
653 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700654 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
655 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700656 }
657 optional State state = 2;
658}
659
660/**
661 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000662 *
663 * Logged from:
664 * TODO
665 */
Bookatzd6746242017-10-24 18:39:35 -0700666message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800667 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000668
Bookatz1a1b0462018-01-12 11:47:03 -0800669 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
670 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700671 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700672
673 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
674 optional string tag = 3;
675
676 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800677 RELEASE = 0;
678 ACQUIRE = 1;
679 CHANGE_RELEASE = 2;
680 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700681 }
682 optional State state = 4;
683}
684
685/**
Bookatzc1a050a2017-10-10 15:49:28 -0700686 * Logs when a partial wakelock is considered 'long' (over 1 min).
687 *
688 * Logged from:
689 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
690 */
691message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800692 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700693
Yao Chend54f9dd2017-10-17 17:37:48 +0000694 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
695 optional string tag = 2;
696
Bookatzc1a050a2017-10-10 15:49:28 -0700697 // TODO: I have no idea what this is.
698 optional string history_tag = 3;
699
700 enum State {
701 OFF = 0;
702 ON = 1;
703 }
704 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000705}
706
Bookatzc1a050a2017-10-10 15:49:28 -0700707/**
Bookatza66083f2018-09-20 17:24:00 -0700708 * Logs when the device is interactive, according to the PowerManager Notifier.
709 *
710 * Logged from:
711 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
712 */
713message InteractiveStateChanged {
714 enum State {
715 OFF = 0;
716 ON = 1;
717 }
718 optional State state = 1;
719}
720
721/**
Bookatzc1a050a2017-10-10 15:49:28 -0700722 * Logs Battery Saver state change.
723 *
724 * Logged from:
725 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
726 */
727message BatterySaverModeStateChanged {
728 enum State {
729 OFF = 0;
730 ON = 1;
731 }
732 optional State state = 1;
733}
734
735/**
736 * Logs Doze mode state change.
737 *
738 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800739 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700740 */
741message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800742 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800743}
744
745
746/**
747 * Logs state change of Doze mode including maintenance windows.
748 *
749 * Logged from:
750 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
751 */
752message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800753 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700754}
755
756/**
757 * Logs screen brightness level.
758 *
759 * Logged from:
760 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
761 */
762message ScreenBrightnessChanged {
763 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
764 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700765}
766
767/**
768 * Logs battery level (percent full, from 0 to 100).
769 *
770 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700771 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700772 */
773message BatteryLevelChanged {
774 // Battery level. Should be in [0, 100].
775 optional int32 battery_level = 1;
776}
777
778/**
779 * Logs change in charging status of the device.
780 *
781 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700782 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700783 */
784message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800785 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
786 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700787}
788
789/**
790 * Logs whether the device is plugged in, and what power source it is using.
791 *
792 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700793 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700794 */
795message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800796 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
797 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700798}
799
Bookatz8c6571b2017-10-24 15:04:41 -0700800/**
801 * Logs when an app's wakeup alarm fires.
802 *
803 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700804 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700805 */
806message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800807 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800808
809 // Name of the wakeup alarm.
810 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700811
812 // Name of source package (for historical reasons, since BatteryStats tracked it).
813 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800814}
815
816/**
817 * Logs when an an app causes the mobile radio to change state.
818 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
819 *
820 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700821 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800822 */
823message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800824 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800825
Bookatz1a1b0462018-01-12 11:47:03 -0800826 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
827 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800828}
829
830/**
831 * Logs when an an app causes the wifi radio to change state.
832 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
833 *
834 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700835 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800836 */
837message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800838 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800839
Bookatz1a1b0462018-01-12 11:47:03 -0800840 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
841 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700842}
843
844/**
845 * Logs kernel wakeup reasons and aborts.
846 *
847 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700848 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700849 */
850message KernelWakeupReported {
851 // Name of the kernel wakeup reason (or abort).
852 optional string wakeup_reason_name = 1;
853
854 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800855 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700856}
857
858/**
859 * Logs wifi locks held by an app.
860 *
861 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700862 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700863 */
864message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800865 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700866
867 enum State {
868 OFF = 0;
869 ON = 1;
870 }
871 optional State state = 2;
872}
873
874/**
875 * Logs wifi signal strength changes.
876 *
877 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700878 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700879 */
880message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800881 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
882 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700883}
884
885/**
886 * Logs wifi scans performed by an app.
887 *
888 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700889 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700890 */
891message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800892 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700893
894 enum State {
895 OFF = 0;
896 ON = 1;
897 }
898 optional State state = 2;
899}
900
901/**
Tej Singh4503e102018-01-04 14:35:01 -0800902 * Logs wifi multicast locks held by an app
903 *
904 * Logged from:
905 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
906 */
907message WifiMulticastLockStateChanged {
908 repeated AttributionNode attribution_node = 1;
909
910 enum State {
911 OFF = 0;
912 ON = 1;
913 }
914 optional State state = 2;
915}
916
917/**
Tej Singh1ea42892018-01-19 09:27:00 -0800918 * Logs shutdown reason and duration on next boot.
919 *
920 * Logged from:
921 * frameworks/base/core/java/com/android/server/BootReceiver.java
922 */
923message ShutdownSequenceReported {
924 // True if shutdown is for a reboot. Default: false if we do not know.
925 optional bool reboot = 1;
926
927 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
928 optional string reason = 2;
929
930 // Beginning of shutdown time in ms using wall clock time since unix epoch.
931 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800932 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800933
934 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800935 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800936}
937
Tej Singh6483ea42018-01-25 17:45:49 -0800938
939/**
940 * Logs boot reason and duration.
941 *
942 * Logged from:
943 * system/core/bootstat/bootstat.cpp
944 */
945message BootSequenceReported {
946 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
947 // Default: "<EMPTY>" if not available.
948 optional string bootloader_reason = 1;
949
950 // Reason for system boot. Eg. bootloader, reboot,userrequested
951 // Default: "<EMPTY>" if not available.
952 optional string system_reason = 2;
953
954 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800955 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800956
957 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800958 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800959
960 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800961 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800962
963 // Time since last boot in ms. Default: 0 if not available.
964 optional int64 time_since_last_boot = 6;
965}
966
Tej Singhc477d9c2018-02-05 18:31:39 -0800967
968/**
969 * Logs call state and disconnect cause (if applicable).
970 *
971 * Logged from:
972 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
973 */
974message CallStateChanged {
975 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
976 // From frameworks/base/core/proto/android/telecomm/enums.proto.
977 optional android.telecom.CallStateEnum call_state = 1;
978
979 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
980 // This value is only applicable when the call_state is DISCONNECTED, and
981 // should always be UNKNOWN if the call_state is not DISCONNECTED.
982 // From frameworks/base/core/proto/android/telecomm/enums.proto.
983 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
984
985 // True if the call is self-managed, which are apps that use the
986 // telecom infrastructure to make their own calls.
987 optional bool self_managed = 3;
988
989 // True if call is external. External calls are calls on connected Wear
990 // devices but show up in Telecom so the user can pull them onto the device.
991 optional bool external_call = 4;
992}
993
Tej Singh1ea42892018-01-19 09:27:00 -0800994/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800995 * Logs keyguard state. The keyguard is the lock screen.
996 *
997 * Logged from:
998 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
999 */
1000message KeyguardStateChanged {
1001 enum State {
1002 UNKNOWN = 0;
1003 // The keyguard is hidden when the phone is unlocked.
1004 HIDDEN = 1;
1005 // The keyguard is shown when the phone is locked (screen turns off).
1006 SHOWN= 2;
1007 // The keyguard is occluded when something is overlaying the keyguard.
1008 // Eg. Opening the camera while on the lock screen.
1009 OCCLUDED = 3;
1010 }
1011 optional State state = 1;
1012}
1013
1014/**
1015 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1016 * prompts the user to enter a password (pattern, pin, etc).
1017 *
1018 * Logged from:
1019 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1020 */
1021
1022message KeyguardBouncerStateChanged {
1023 enum State {
1024 UNKNOWN = 0;
1025 // Bouncer is hidden, either as a result of successfully entering the
1026 // password, screen timing out, or user going back to lock screen.
1027 HIDDEN = 1;
1028 // This is when the user is being prompted to enter the password.
1029 SHOWN = 2;
1030 }
1031 optional State state = 1;
1032}
1033
1034/**
1035 * Logs the result of entering a password into the keyguard bouncer.
1036 *
1037 * Logged from:
1038 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1039 */
1040message KeyguardBouncerPasswordEntered {
1041 enum BouncerResult {
1042 UNKNOWN = 0;
1043 // The password entered was incorrect.
1044 FAILURE = 1;
1045 // The password entered was correct.
1046 SUCCESS = 2;
1047 }
1048 optional BouncerResult result = 1;
1049}
1050
Tej Singha883b372018-02-15 11:30:01 -08001051/*
1052 * Logs changes to the configuration of the device. The configuration is defined
1053 * in frameworks/base/core/java/android/content/res/Configuration.java
1054 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1055 * Please go there to interpret the possible values each field can be.
1056 *
1057 * Logged from:
1058 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1059 */
1060message ResourceConfigurationChanged {
1061 // Bit mask of color capabilities of the screen.
1062 // Contains information about the color gamut and hdr mode of the screen.
1063 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001064 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001065
1066 // The target screen density being rendered to.
1067 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001068 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001069
1070 // Current user preference for the scaling factor for fonts,
1071 // relative to the base density scaling.
1072 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001073 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001074
1075 // Flag indicating whether the hard keyboard is hidden.
1076 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001077 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001078
1079 // The type of keyboard attached to the device.
1080 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1081 optional int32 keyboard = 5;
1082
1083 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1084 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001085 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001086
1087 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1088 // 0 if undefined.
1089 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1090 optional int32 mcc = 7;
1091
1092 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1093 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1094 // MNC_ZERO symbol defined in Configuration.java.
1095 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1096 optional int32 mnc = 8;
1097
1098 // The kind of navigation available on the device.
1099 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1100 optional int32 navigation = 9;
1101
1102 // Flag indicating whether the navigation is available.
1103 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001104 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001105
1106 // Overall orientation of the screen.
1107 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1108 optional int32 orientation = 11;
1109
1110 // The current height of the available screen space, in dp units.
1111 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001112 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001113
1114 // Bit mask of overall layout of the screen.
1115 // Contains information about screen size, whether the screen is wider/taller
1116 // than normal, whether the screen layout is right-tl-left or left-to-right,
1117 // and whether the screen has a rounded shape.
1118 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001119 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001120
1121 // Current width of the available screen space, in dp units.
1122 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001123 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001124
1125 // The smallest screen size an application will see in normal operation.
1126 // This is the smallest value of both screenWidthDp and screenHeightDp
1127 // in portrait and landscape.
1128 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001129 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001130
1131 // The type of touch screen attached to the device.
1132 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1133 optional int32 touchscreen = 16;
1134
1135 // Bit mask of the ui mode.
1136 // Contains information about the overall ui mode of the device.
1137 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1138 // Also contains information about whether the device is in night mode.
1139 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001140 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001141}
1142
Tej Singheee317b2018-03-07 19:28:05 -08001143
1144/**
1145 * Logs changes in the connection state of the mobile radio.
1146 *
1147 * Logged from:
1148 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1149 */
1150message MobileConnectionStateChanged {
1151 // States are from the state machine DataConnection.java.
1152 enum State {
1153 UNKNOWN = 0;
1154 // The connection is inactive, or disconnected.
1155 INACTIVE = 1;
1156 // The connection is being activated, or connecting.
1157 ACTIVATING = 2;
1158 // The connection is active, or connected.
1159 ACTIVE = 3;
1160 // The connection is disconnecting.
1161 DISCONNECTING = 4;
1162 // The connection is disconnecting after creating a connection.
1163 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1164 }
1165 optional State state = 1;
1166 // For multi-sim phones, this distinguishes between the sim cards.
1167 optional int32 sim_slot_index = 2;
1168 // Used to identify the connection. Starts at 0 and increments by 1 for
1169 // every new network created. Resets whenever the device reboots.
1170 optional int32 data_connection_id = 3;
1171 // A bitmask for the capabilities of this connection.
1172 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1173 // Default value (if we have no information): 0
1174 optional int64 capabilities = 4;
1175 // If this connection has internet.
1176 // This just checks if the DEFAULT bit of capabilities is set.
1177 optional bool has_internet = 5;
1178}
1179
1180/**
1181 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1182 *
1183 * Logged from:
1184 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1185 */
1186message MobileRadioTechnologyChanged {
1187 optional android.telephony.NetworkTypeEnum state = 1;
1188 // For multi-sim phones, this distinguishes between the sim cards.
1189 optional int32 sim_slot_index = 2;
1190}
1191
Andrew Chantb56388b2018-03-22 21:07:33 -07001192/**
1193 * Logs the VID and PID of any connected USB devices.
1194 *
1195 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1196 *
1197 * Logged by Vendor.
1198 */
1199message UsbDeviceAttached {
1200 optional int32 vid = 1;
1201 optional int32 pid = 2;
1202 optional bool has_audio = 3;
1203 optional bool has_hid = 4;
1204 optional bool has_storage = 5;
1205}
1206
Tej Singheee317b2018-03-07 19:28:05 -08001207
Tej Singhdd7bd352018-02-09 19:33:15 -08001208/**
Tej Singh5d991e12018-03-09 19:48:11 -08001209 * Logs when Bluetooth is enabled and disabled.
1210 *
1211 * Logged from:
1212 * services/core/java/com/android/server/BluetoothManagerService.java
1213 */
1214message BluetoothEnabledStateChanged {
1215 repeated AttributionNode attribution_node = 1;
1216 // Whether or not bluetooth is enabled on the device.
1217 enum State {
1218 UNKNOWN = 0;
1219 ENABLED = 1;
1220 DISABLED = 2;
1221 }
1222 optional State state = 2;
1223 // The reason for being enabled/disabled.
1224 // Eg. Airplane mode, crash, application request.
1225 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1226 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001227 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001228}
1229
1230/**
1231 * Logs when a Bluetooth device connects and disconnects.
1232 *
1233 * Logged from:
1234 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1235 */
1236message BluetoothConnectionStateChanged {
1237 // The state of the connection.
1238 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1239 optional android.bluetooth.ConnectionStateEnum state = 1;
1240 // An identifier that can be used to match connect and disconnect events.
1241 // Currently is last two bytes of a hash of a device level ID and
1242 // the mac address of the bluetooth device that is connected.
1243 optional int32 obfuscated_id = 2;
1244 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1245 // From android.bluetooth.BluetoothAdapter.java
1246 optional int32 bt_profile = 3;
1247}
1248
1249/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001250 * Logs when something is plugged into or removed from the USB-C connector.
1251 *
1252 * Logged from:
1253 * Vendor USB HAL.
1254 */
1255message UsbConnectorStateChanged {
1256 enum State {
1257 DISCONNECTED = 0;
1258 CONNECTED = 1;
1259 }
1260 optional State state = 1;
1261}
1262
1263/**
1264 * Logs the reported speaker impedance.
1265 *
1266 * Logged from:
1267 * Vendor audio implementation.
1268 */
1269message SpeakerImpedanceReported {
1270 optional int32 speaker_location = 1;
1271 optional int32 impedance = 2;
1272}
1273
1274/**
1275 * Logs the report of a failed hardware.
1276 *
1277 * Logged from:
1278 * Vendor HALs.
1279 *
1280 */
1281message HardwareFailed {
1282 enum HardwareType {
1283 HARDWARE_FAILED_UNKNOWN = 0;
1284 HARDWARE_FAILED_MICROPHONE = 1;
1285 HARDWARE_FAILED_CODEC = 2;
1286 HARDWARE_FAILED_SPEAKER = 3;
1287 HARDWARE_FAILED_FINGERPRINT = 4;
1288 }
1289 optional HardwareType hardware_type = 1;
1290
1291 /* hardware_location allows vendors to differentiate between multiple instances of
1292 * the same hardware_type. The specific locations are vendor defined integers,
1293 * referring to board-specific numbering schemes.
1294 */
1295 optional int32 hardware_location = 2;
1296
1297 /* failure_code is specific to the HardwareType of the failed hardware.
1298 * It should use the enum values defined below.
1299 */
1300 enum MicrophoneFailureCode {
1301 MICROPHONE_FAILURE_COMPLETE = 0;
1302 }
1303 enum CodecFailureCode {
1304 CODEC_FAILURE_COMPLETE = 0;
1305 }
1306 enum SpeakerFailureCode {
1307 SPEAKER_FAILURE_COMPLETE = 0;
1308 SPEAKER_FAILURE_HIGH_Z = 1;
1309 SPEAKER_FAILURE_SHORT = 2;
1310 }
1311 enum FingerprintFailureCode {
1312 FINGERPRINT_FAILURE_COMPLETE = 0;
1313 FINGERPRINT_SENSOR_BROKEN = 1;
1314 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1315 }
1316 optional int32 failure_code = 3;
1317}
1318
1319/**
1320 * Log an event when the device has been physically dropped.
1321 * Reported from the /vendor partition.
1322 */
1323message PhysicalDropDetected {
1324 // Confidence that the event was actually a drop, 0 -> 100
1325 optional int32 confidence_pctg = 1;
1326 // Peak acceleration of the drop, in 1/1000s of a g.
1327 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001328 // Duration of freefall in ms
1329 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001330}
1331
1332/**
1333 * Log bucketed battery charge cycles.
1334 *
1335 * Each bucket represents cycles of the battery past
1336 * a given charge point. For example, bucket 1 is the
1337 * lowest 1/8th of the battery, and bucket 8 is 100%.
1338 *
1339 * Logged from:
1340 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1341 */
1342message ChargeCyclesReported {
1343 optional int32 cycle_bucket_1 = 1;
1344 optional int32 cycle_bucket_2 = 2;
1345 optional int32 cycle_bucket_3 = 3;
1346 optional int32 cycle_bucket_4 = 4;
1347 optional int32 cycle_bucket_5 = 5;
1348 optional int32 cycle_bucket_6 = 6;
1349 optional int32 cycle_bucket_7 = 7;
1350 optional int32 cycle_bucket_8 = 8;
1351}
1352
1353/**
Howard Roa46b6582018-09-18 16:45:02 -07001354 * Log battery health snapshot.
1355 *
1356 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1357 * are snapshotted periodically over 24hrs.
1358 */
1359message BatteryHealthSnapshot {
1360 enum BatterySnapshotType {
1361 UNKNOWN = 0;
1362 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1363 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1364 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1365 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1366 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1367 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1368 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1369 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1370 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1371 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1372 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1373 }
1374 optional BatterySnapshotType type = 1;
1375 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001376 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001377 // Voltage Battery Voltage, in microVolts.
1378 optional int32 voltage_micro_volt = 3;
1379 // Current Battery current, in microAmps.
1380 optional int32 current_micro_amps = 4;
1381 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1382 optional int32 open_circuit_micro_volt = 5;
1383 // Resistance Battery Resistance, in microOhms.
1384 optional int32 resistance_micro_ohm = 6;
1385 // Level Battery Level, as % of full.
1386 optional int32 level_percent = 7;
1387}
1388
1389/**
1390 * Log slow I/O operations on the primary storage.
1391 */
1392message SlowIo {
1393 // Classifications of IO Operations.
1394 enum IoOperation {
1395 UNKNOWN = 0;
1396 READ = 1;
1397 WRITE = 2;
1398 UNMAP = 3;
1399 SYNC = 4;
1400 }
1401 optional IoOperation operation = 1;
1402
1403 // The number of slow IO operations of this type over 24 hours.
1404 optional int32 count = 2;
1405}
1406
1407/**
1408 * Log battery caused shutdown with the last recorded voltage.
1409 */
1410message BatteryCausedShutdown {
1411 // The last recorded battery voltage prior to shutdown.
1412 optional int32 last_recorded_micro_volt = 1;
1413}
1414
1415/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001416 * Logs the duration of a davey (jank of >=700ms) when it occurs
1417 *
1418 * Logged from:
1419 * frameworks/base/libs/hwui/JankTracker.cpp
1420 */
1421message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001422 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001423 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001424
Tej Singhbb8554a2018-01-26 11:59:14 -08001425 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001426 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001427}
1428
1429/**
Bookatze5885242017-10-24 20:10:31 -07001430 * Logs phone signal strength changes.
1431 *
1432 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001433 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001434 */
1435message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001436 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1437 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001438}
1439
Yangster4ccebea2018-10-09 17:09:02 -07001440
1441/**
1442 * Logs when the phone state, sim state or signal strength changes
1443 *
1444 * Logged from:
1445 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1446 */
1447message PhoneServiceStateChanged {
1448 optional android.telephony.ServiceStateEnum state = 1;
1449 optional android.telephony.SimStateEnum sim_state = 2;
1450 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1451}
1452
1453/**
1454 * Logs when the phone becomes on or off.
1455 *
1456 * Logged from:
1457 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1458 */
1459message PhoneStateChanged {
1460 enum State {
1461 OFF = 0;
1462 ON = 1;
1463 }
1464 optional State state = 1;
1465}
1466
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001467message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001468 optional android.stats.launcher.LauncherAction action = 1;
1469 optional android.stats.launcher.LauncherState src_state = 2;
1470 optional android.stats.launcher.LauncherState dst_state = 3;
1471 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001472 optional bool is_swipe_up_enabled = 5;
1473}
1474
David Chenc28b2bb2017-10-24 12:52:52 -07001475/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001476 * Logs when Settings UI has changed.
1477 *
1478 * Logged from:
1479 * packages/apps/Settings
1480 */
1481message SettingsUIChanged {
1482 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001483 * Where this SettingsUIChange event comes from. For example, if
1484 * it's a PAGE_VISIBLE event, where the page is opened from.
1485 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001486 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001487
1488 /**
1489 * What the UI action is.
1490 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001491 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001492
1493 /**
1494 * Where the action is happening
1495 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001496 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001497
1498 /**
1499 * What preference changed in this event.
1500 */
1501 optional string changedPreferenceKey = 4;
1502
1503 /**
1504 * The new value of the changed preference.
1505 */
1506 optional int64 changedPreferenceIntValue = 5;
1507}
1508
1509/**
David Chenc28b2bb2017-10-24 12:52:52 -07001510 * Logs that a setting was updated.
1511 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001512 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001513 * The tag and is_default allow resetting of settings to default values based on the specified
1514 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1515 */
1516message SettingChanged {
1517 // The name of the setting.
1518 optional string setting = 1;
1519
1520 // The change being imposed on this setting. May represent a number, eg "3".
1521 optional string value = 2;
1522
1523 // The new value of this setting. For most settings, this is same as value. For some settings,
1524 // value is +X or -X where X represents an element in a set. For example, if the previous value
1525 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1526 // The +/- feature is currently only used for location_providers_allowed.
1527 optional string new_value = 3;
1528
1529 // The previous value of this setting.
1530 optional string prev_value = 4;
1531
1532 // The tag used with the is_default for resetting sets of settings. This is generally null.
1533 optional string tag = 5;
1534
Bookatz90867622018-01-31 15:05:57 -08001535 // True if this setting with tag should be resettable.
1536 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001537
David Chenbd789912018-03-16 17:19:55 -07001538 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001539 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001540
1541 enum ChangeReason {
1542 UPDATED = 1; // Updated can be an insertion or an update.
1543 DELETED = 2;
1544 }
1545 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001546}
Chenjie Yub3dda412017-10-24 13:41:59 -07001547
Chenjie Yu05013b32017-11-21 10:21:41 -08001548/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001549 * Logs activity going to foreground or background
1550 *
1551 * Logged from:
1552 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1553 */
1554message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001555 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001556 optional string pkg_name = 2;
1557 optional string class_name = 3;
1558
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001559 enum State {
1560 BACKGROUND = 0;
1561 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001562 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001563 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001564}
David Chenc8a43242017-10-17 16:23:28 -07001565
1566/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001567 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001568 * Logged from:
1569 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1570 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001571message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001572 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001573
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001574 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001575
1576 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001577 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001578 optional string process_name = 3;
1579
1580 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001581 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001582
1583 optional string package_name = 5;
1584
1585 enum InstantApp {
1586 UNAVAILABLE = 0;
1587 FALSE = 1;
1588 TRUE = 2;
1589 }
1590 optional InstantApp is_instant_app = 6;
1591
1592 enum ForegroundState {
1593 UNKNOWN = 0;
1594 BACKGROUND = 1;
1595 FOREGROUND = 2;
1596 }
1597 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001598}
David Chen9e3808c2017-11-20 17:25:34 -08001599
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001600/**
1601 * Logs when a WTF (What a Terrible Failure) happened.
1602 * Logged from:
1603 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1604 */
1605message WTFOccurred {
1606 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001607
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001608 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001609
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001610 // The name of the process.
1611 // system_server if it is not by an app
1612 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001613
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001614 // The pid if available. -1 means not available.
1615 optional sint32 pid = 4;
1616}
1617
1618/**
1619 * Logs when system server reports low memory.
1620 * Logged from:
1621 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1622 */
1623message LowMemReported {
1624}
1625
1626/**
1627 * Logs when an app ANR (App Not Responding) occurs.
1628 * Logged from:
1629 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1630 */
1631message ANROccurred {
1632 optional int32 uid = 1 [(is_uid) = true];
1633
1634 optional string process_name = 2;
1635
1636 optional string short_component_name = 3;
1637
1638 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001639
1640 enum InstantApp {
1641 UNAVAILABLE = 0;
1642 FALSE = 1;
1643 TRUE = 2;
1644 }
1645 optional InstantApp is_instant_app = 5;
1646
1647 enum ForegroundState {
1648 UNKNOWN = 0;
1649 BACKGROUND = 1;
1650 FOREGROUND = 2;
1651 }
1652 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001653}
1654
Bookatza7020bd2018-08-28 16:29:35 -07001655/**
1656 * Logs when the vibrator state changes.
1657 * Logged from:
1658 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1659 */
1660message VibratorStateChanged {
1661 repeated AttributionNode attribution_node = 1;
1662
1663 enum State {
1664 OFF = 0;
1665 ON = 1;
1666 }
1667 optional State state = 2;
1668
1669 // Duration (in milliseconds) requested to keep the vibrator on.
1670 // Only applicable for State == ON.
1671 optional int64 duration_millis = 3;
1672}
1673
David Chen0a368b22017-12-06 16:28:16 -08001674/*
1675 * Allows other apps to push events into statsd.
1676 * Logged from:
1677 * frameworks/base/core/java/android/util/StatsLog.java
1678 */
David Chen0b5c90c2018-01-25 16:51:49 -08001679message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001680 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001681 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001682
1683 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1684 optional int32 label = 2;
1685
1686 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1687 // predicates for the metrics).
1688 enum State {
1689 UNKNOWN = 0;
1690 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1691 STOP = 2;
1692 START = 3;
1693 }
1694 optional State state = 3;
1695}
1696
David Chen9e3808c2017-11-20 17:25:34 -08001697/**
Bookatz7948c872018-09-04 12:58:33 -07001698 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1699 * For example, this could be due to the user manually changing the time.
1700 *
1701 * Logged from:
1702 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1703 */
1704message WallClockTimeShifted {
1705 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1706 optional int64 wall_clock_timestamp_millis = 1;
1707}
1708
1709/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001710 * Logs when statsd detects an anomaly.
1711 *
1712 * Logged from:
1713 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1714 */
1715message AnomalyDetected {
1716 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001717 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001718
Yangster-mac94e197c2018-01-02 16:03:03 -08001719 // Id of the config whose anomaly detection alert fired.
1720 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001721
Yangster-mac94e197c2018-01-02 16:03:03 -08001722 // Id of the alert (i.e. name of the anomaly that was detected).
1723 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001724}
1725
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001726message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001727 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001728 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001729
1730 // The app package name.
1731 optional string pkg_name = 2;
1732
1733 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001734 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001735 WARM = 1;
1736 HOT = 2;
1737 COLD = 3;
1738 }
1739 // The transition type.
1740 optional TransitionType type = 3;
1741
1742 // The activity name.
1743 optional string activity_name = 4;
1744
1745 // The name of the calling app. Empty if not set.
1746 optional string calling_pkg_name = 5;
1747
1748 // Whether the app is an instant app.
1749 optional bool is_instant_app = 6;
1750
1751 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001752 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001753
Bookatz80d11a02018-01-16 10:46:35 -08001754 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001755
David Chen0b5c90c2018-01-25 16:51:49 -08001756 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001757 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001758 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001759 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001760 optional int32 bind_application_delay_millis = 11;
1761 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001762
1763 // Empty if not set.
1764 optional string launch_token = 13;
1765
Calin Juravle759fbda2018-02-20 19:52:30 +00001766 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001767 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001768
1769 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001770 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001771}
1772
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001773message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001774 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001775 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001776
1777 // The app package name.
1778 optional string pkg_name = 2;
1779
1780 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001781 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001782 WARM = 1;
1783 HOT = 2;
1784 COLD = 3;
1785 }
1786 // The transition type.
1787 optional TransitionType type = 3;
1788
1789 // The activity name.
1790 optional string activity_name = 4;
1791}
1792
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001793message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001794 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001795 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001796
1797 // The app package name.
1798 optional string pkg_name = 2;
1799
1800 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001801 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001802 WITH_BUNDLE = 1;
1803 WITHOUT_BUNDLE = 2;
1804 }
1805 // The transition type.
1806 optional TransitionType type = 3;
1807
1808 // The activity name.
1809 optional string activity_name = 4;
1810
1811 optional bool transition_process_running = 5;
1812
1813 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001814 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001815}
1816
Bookatz8fcd09a2017-12-18 13:01:10 -08001817/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001818 * Logs a picture-in-picture action
1819 * Logged from:
1820 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1821 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1822 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1823 */
1824message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001825 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001826 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001827
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001828 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001829
Chenjie Yu52cacc62017-12-08 18:11:45 -08001830 enum State {
1831 ENTERED = 1;
1832 EXPANDED_TO_FULL_SCREEN = 2;
1833 MINIMIZED = 3;
1834 DISMISSED = 4;
1835 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001836 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001837}
1838
1839/**
Chenjie Yue8904192017-12-08 19:12:57 -08001840 * Logs overlay action
1841 * Logged from:
1842 * services/core/java/com/android/server/wm/Session.java
1843 */
1844message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001845 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001846
1847 optional string package_name = 2;
1848
1849 optional bool using_alert_window = 3;
1850
1851 enum State {
1852 ENTERED = 1;
1853 EXITED = 2;
1854 }
1855 optional State state = 4;
1856}
1857
Chenjie Yuccfe6452018-01-30 11:33:21 -08001858/*
1859 * Logs foreground service starts and stops.
1860 * Note that this is not when a service starts or stops, but when it is
1861 * considered foreground.
1862 * Logged from
1863 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1864 */
1865message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001866 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001867 // package_name + "/" + class_name
1868 optional string short_name = 2;
1869
1870 enum State {
1871 ENTER = 1;
1872 EXIT = 2;
1873 }
1874 optional State state = 3;
1875}
1876
Chenjie Yue8904192017-12-08 19:12:57 -08001877/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001878 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1879 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1880 * attributed back to the parent (host) uid. One example is Chrome.
1881 *
1882 * Logged from:
1883 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1884 */
1885message IsolatedUidChanged {
1886 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001887 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001888 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001889 optional int32 parent_uid = 1;
1890
1891 optional int32 isolated_uid = 2;
1892
1893 // We expect an isolated uid to be removed before if it's used for another parent uid.
1894 enum Event {
1895 REMOVED = 0;
1896 CREATED = 1;
1897 }
1898 optional Event event = 3;
1899}
1900
1901/*
1902 * Logs the reception of an incoming network packet causing the main system to wake up for
1903 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1904 * and processed by WakeupController.cpp.
1905 */
1906message PacketWakeupOccurred {
1907 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1908 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001909 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001910 // The interface name on which the packet was received.
1911 optional string iface = 2;
1912 // The ethertype value of the packet.
1913 optional int32 ethertype = 3;
1914 // String representation of the destination MAC address of the packet.
1915 optional string destination_hardware_address = 4;
1916 // String representation of the source address of the packet if this was an IP packet.
1917 optional string source_ip = 5;
1918 // String representation of the destination address of the packet if this was an IP packet.
1919 optional string destination_ip = 6;
1920 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1921 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1922 // families.
1923 optional int32 ip_next_header = 7;
1924 // The source port if this was a TCP or UDP packet.
1925 optional int32 source_port = 8;
1926 // The destination port if this was a TCP or UDP packet.
1927 optional int32 destination_port = 9;
1928}
1929
1930/*
1931 * Logs the memory stats for an app on startup.
1932 * Logged from:
1933 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1934 */
1935message AppStartMemoryStateCaptured {
1936 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001937 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001938
1939 // The process name.
1940 optional string process_name = 2;
1941
1942 // The activity name.
1943 optional string activity_name = 3;
1944
1945 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001946 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001947
1948 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001949 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001950
1951 // RSS
1952 optional int64 rss_in_bytes = 6;
1953
1954 // CACHE
1955 optional int64 cache_in_bytes = 7;
1956
1957 // SWAP
1958 optional int64 swap_in_bytes = 8;
1959}
1960
1961/*
1962 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1963 * for LMK event.
1964 * Logged from:
1965 * system/core/lmkd/lmkd.c
1966 */
1967message LmkStateChanged {
1968 enum State {
1969 UNKNOWN = 0;
1970 START = 1;
1971 STOP = 2;
1972 }
1973 optional State state = 1;
1974}
1975
1976/*
1977 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1978 * Logged from:
1979 * system/core/lmkd/lmkd.c
1980 */
1981message LmkKillOccurred {
1982 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001983 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001984
1985 // The process name.
1986 optional string process_name = 2;
1987
1988 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07001989 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001990
1991 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001992 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001993
1994 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001995 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001996
1997 // RSS
1998 optional int64 rss_in_bytes = 6;
1999
2000 // CACHE
2001 optional int64 cache_in_bytes = 7;
2002
2003 // SWAP
2004 optional int64 swap_in_bytes = 8;
2005}
2006
Rajeev Kumar51b54602018-03-01 12:18:26 -08002007/*
2008 * Logs when the ActivityManagerService detects that an app died.
2009 *
2010 * Logged from:
2011 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2012 */
2013message AppDied {
2014 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002015 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002016}
2017
Howard Ro21a039c2018-08-06 14:55:47 -07002018/**
2019 * An atom for generic metrics logging. Available from Android Q.
2020 */
2021message GenericAtom {
2022 // The uid of the application that sent this custom atom.
2023 optional int32 uid = 1 [(is_uid) = true];
2024
2025 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002026 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002027}
2028
Tej Singhd6d6d772018-09-05 17:41:25 -07002029/**
2030 * Logs when a fingerprint acquire event occurs.
2031 *
2032 * Logged from:
2033 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2034 */
2035message FingerprintAcquired {
2036 // The associated user. Eg: 0 for owners, 10+ for others.
2037 // Defined in android/os/UserHandle.java
2038 optional int32 user = 1;
2039 // If this acquire is for a crypto fingerprint.
2040 // e.g. Secure purchases, unlock password storage.
2041 optional bool is_crypto = 2;
2042}
2043
2044/**
2045 * Logs when a fingerprint authentication event occurs.
2046 *
2047 * Logged from:
2048 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2049 */
2050message FingerprintAuthenticated {
2051 // The associated user. Eg: 0 for owners, 10+ for others.
2052 // Defined in android/os/UserHandle.java
2053 optional int32 user = 1;
2054 // If this authentication is for a crypto fingerprint.
2055 // e.g. Secure purchases, unlock password storage.
2056 optional bool is_crypto = 2;
2057 // Whether or not this authentication was successful.
2058 optional bool is_authenticated = 3;
2059}
2060
2061/**
2062 * Logs when a fingerprint error occurs.
2063 *
2064 * Logged from:
2065 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2066 */
2067message FingerprintErrorOccurred {
2068 // The associated user. Eg: 0 for owners, 10+ for others.
2069 // Defined in android/os/UserHandle.java
2070 optional int32 user = 1;
2071 // If this error is for a crypto fingerprint.
2072 // e.g. Secure purchases, unlock password storage.
2073 optional bool is_crypto = 2;
2074
2075 enum Error {
2076 UNKNOWN = 0;
2077 LOCKOUT = 1;
2078 PERMANENT_LOCKOUT = 2;
2079 }
2080 // The type of error.
2081 optional Error error = 3;
2082}
Howard Ro688ae182018-09-25 00:09:36 -07002083
2084message Notification {
2085
2086 // Type of notification event.
2087 enum Type {
2088 TYPE_UNKNOWN = 0;
2089 // Notification became visible to the user.
2090 TYPE_OPEN = 1;
2091 // Notification became hidden.
2092 TYPE_CLOSE = 2;
2093 // Notification switched to detail mode.
2094 TYPE_DETAIL = 3;
2095 // Notification was clicked.
2096 TYPE_ACTION = 4;
2097 // Notification was dismissed.
2098 TYPE_DISMISS = 5;
2099 // Notification switched to summary mode. The enum value of 14 is to
2100 // match that of metrics_constants.
2101 TYPE_COLLAPSE = 14;
2102 }
2103 optional Type type = 1;
2104
2105 // Package name associated with the notification.
2106 optional string package_name = 2;
2107
2108 // Tag associated with notification.
2109 optional string tag = 3;
2110
2111 // Application-supplied ID associated with the notification.
2112 optional int32 id = 4;
2113
2114 // Index of notification in the notification panel.
2115 optional int32 shade_index = 5;
2116
2117 // The number of notifications in the notification panel.
2118 optional int32 shade_count = 6;
2119
2120 // Importance for the notification.
2121 optional int32 importance = 7;
2122
2123 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002124 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002125
2126 // Importance for the notification channel.
2127 optional int32 channel_importance = 9;
2128
Howard Ro183c2bd2018-10-18 13:52:10 -07002129 // Application-supplied ID associated with the notifications group.
2130 optional string group_id = 10;
2131
Howard Ro688ae182018-09-25 00:09:36 -07002132 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002133 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002134
Howard Ro183c2bd2018-10-18 13:52:10 -07002135 // Reason for dismissal of a notification. This field is only meaningful for
2136 // TYPE_DISMISS events.
2137 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002138
Howard Ro183c2bd2018-10-18 13:52:10 -07002139 // The first post time of notification, stable across updates.
2140 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002141
Howard Ro183c2bd2018-10-18 13:52:10 -07002142 // The most recent interruption time, or the creation time if no updates.
2143 // Differs from update_millis because updates are filtered based on whether
2144 // they actually interrupted the user.
2145 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002146
Howard Ro183c2bd2018-10-18 13:52:10 -07002147 // The most recent update time, or the creation time if no updates.
2148 optional int64 update_millis = 15;
2149
2150 // The most recent visibility event.
2151 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002152}
2153
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002154/*
Yangster-macb89807e2018-11-15 21:10:57 -08002155 * Logs when a flag flip state changes.
2156 * Logged in P/h.
2157 */
2158message PhenotypeFlagStateChanged {
2159 // Mendel configuration name.
2160 optional string mendel_config_name = 1;
2161 // State
2162 enum State {
2163 STATE_UNKNOWN = 0;
2164 COMMITTED = 1;
2165 }
2166 optional State state = 2;
2167}
2168
2169/*
2170 * Logs when a binary push state changes.
2171 * Logged in Play store
2172 */
2173message BinaryPushStateChanged {
2174 // Binary package name.
2175 optional string binary_name = 1;
2176 // Version code.
2177 optional int64 version = 2;
2178 // State
2179 enum State {
2180 STATE_UNKNOWN = 0;
2181 DOWNLOAD_START = 1;
2182 DOWNLOAD_DONE = 2;
2183 INSTALL_START = 3;
2184 INSTALL_DONE = 4;
2185 REBOOT_START = 5;
2186 REBOOT_DONE = 6;
2187 }
2188 optional State state = 3;
2189}
2190
2191/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002192 * Logs when a connection becomes available and lost.
2193 * Logged in StatsCompanionService.java
2194 */
2195message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002196 // Id of the network.
2197 optional int32 net_id = 1;
2198
2199 enum State {
2200 UNKNOWN = 0;
2201 CONNECTED = 1;
2202 DISCONNECTED = 2;
2203 }
2204 // Connected state of a network.
2205 optional State state = 2;
2206}
2207
2208/**
2209 * Logs when a service starts and stops.
2210 * Logged from:
2211 * services/core/java/com/android/server/am/ActiveServices.java
2212 */
2213message ServiceStateChanged {
2214
2215 optional int32 uid = 1 [(is_uid) = true];
2216
2217 optional string package_name = 2;
2218
2219 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002220
2221 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002222 START = 1;
2223 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002224 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002225
2226 optional State state = 4;
2227}
2228
2229/**
2230 * Logs when a service is launched.
2231 * Logged from:
2232 * services/core/java/com/android/server/am/ActiveServices.java
2233 */
2234message ServiceLaunchReported {
2235
2236 optional int32 uid = 1 [(is_uid) = true];
2237
2238 optional string package_name = 2;
2239
2240 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002241}
Howard Ro688ae182018-09-25 00:09:36 -07002242
Chenjie Yubbcbc602018-02-05 16:51:52 -08002243//////////////////////////////////////////////////////////////////////
2244// Pulled atoms below this line //
2245//////////////////////////////////////////////////////////////////////
2246
2247/**
David Chenc8a43242017-10-17 16:23:28 -07002248 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2249 *
2250 * Pulled from:
2251 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2252 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002253message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002254 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002255
2256 optional int64 rx_bytes = 2;
2257
2258 optional int64 rx_packets = 3;
2259
2260 optional int64 tx_bytes = 4;
2261
2262 optional int64 tx_packets = 5;
2263}
2264
2265/**
2266 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2267 *
2268 * Pulled from:
2269 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2270 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002271message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002272 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002273
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002274 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2275 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002276
2277 optional int64 rx_bytes = 3;
2278
2279 optional int64 rx_packets = 4;
2280
2281 optional int64 tx_bytes = 5;
2282
2283 optional int64 tx_packets = 6;
2284}
2285
2286/**
2287 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2288 *
2289 * Pulled from:
2290 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2291 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002292message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002293 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002294
2295 optional int64 rx_bytes = 2;
2296
2297 optional int64 rx_packets = 3;
2298
2299 optional int64 tx_bytes = 4;
2300
2301 optional int64 tx_packets = 5;
2302}
2303
2304/**
2305 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2306 *
2307 * Pulled from:
2308 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2309 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002310message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002311 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002312
Yao Chenc40a19d2018-03-15 16:48:25 -07002313 // 1 denotes foreground and 0 denotes background. This is called Set in
2314 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002315 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002316
2317 optional int64 rx_bytes = 3;
2318
2319 optional int64 rx_packets = 4;
2320
2321 optional int64 tx_bytes = 5;
2322
2323 optional int64 tx_packets = 6;
2324}
2325
2326/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002327 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2328 *
2329 * Pulled from:
2330 * StatsCompanionService
2331 */
2332message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002333 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002334
2335 optional int64 rx_bytes = 2;
2336
2337 optional int64 tx_bytes = 3;
2338}
2339
2340/**
David Chenc8a43242017-10-17 16:23:28 -07002341 * Pulls the kernel wakelock durations. This atom is adapted from
2342 * android/internal/os/KernelWakelockStats.java
2343 *
2344 * Pulled from:
2345 * StatsCompanionService using KernelWakelockReader.
2346 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002347message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002348 optional string name = 1;
2349
2350 optional int32 count = 2;
2351
2352 optional int32 version = 3;
2353
Yangster-maca8a30442018-10-13 23:46:34 -07002354 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002355}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002356
Chenjie Yu05013b32017-11-21 10:21:41 -08002357/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002358 * Pulls low power state information. This includes platform and subsystem sleep state information,
2359 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002360 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002361 * hardware/interfaces/power/1.1/types.hal
2362 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002363message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002364 // Subsystem name
2365 optional string subsystem_name = 1;
2366 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2367 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2368 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002369 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002370 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002371 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002372 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002373}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002374
Chenjie Yu05013b32017-11-21 10:21:41 -08002375/**
Bookatz92da2832018-11-01 18:10:03 -07002376 * Pulls on-device power measurement information.
2377 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2378 * Pulled from:
2379 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2380 */
2381message OnDevicePowerMeasurement {
2382 // Name of the subsystem (to which the rail belongs).
2383 optional string subsystem_name = 1;
2384
2385 // Rail name. The rail lies within the subsystem.
2386 optional string rail_name = 2;
2387
2388 // Time (in ms since boot) at which the rail energy value was measured.
2389 // This may differ slightly from the time that statsd logs this information.
2390 optional uint64 measurement_timestamp_millis = 3;
2391
2392 // Accumulated energy used via the rail since device boot in uWs.
2393 optional uint64 energy_microwatt_secs = 4;
2394}
2395
2396/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002397 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002398 * Pulls the time the cpu spend on the frequency index. Frequency index
2399 * starts from highest to lowest. The value should be monotonically
2400 * increasing since boot. However, if there is a cpu
2401 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002402 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002403message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002404 optional uint32 cluster = 1;
2405 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002406 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002407}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002408
Chenjie Yu05013b32017-11-21 10:21:41 -08002409/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002410 * Pulls Cpu Time Per Uid.
2411 * Note that isolated process uid time should be attributed to host uids.
2412 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002413message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002414 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002415 optional uint64 user_time_millis = 2;
2416 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002417}
2418
2419/**
2420 * Pulls Cpu Time Per Uid per frequency.
2421 * Note that isolated process uid time should be attributed to host uids.
2422 * For each uid, we order the time by descending frequencies.
2423 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002424message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002425 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002426 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002427 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002428}
Hugo Benichi884970e2017-11-14 22:42:46 +09002429
Chenjie Yu05013b32017-11-21 10:21:41 -08002430/**
2431 * Pulls Wifi Controller Activity Energy Info
2432 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002433message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002434 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002435 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002436 // stack reported state
2437 // TODO: replace this with proto enum
2438 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002439 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002440 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002441 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002442 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002443 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002444 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002445 // product of current(mA), voltage(V) and time(ms)
2446 optional uint64 controller_energy_used = 6;
2447}
2448
2449/**
2450 * Pulls Modem Activity Energy Info
2451 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002452message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002453 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002454 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002455 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002456 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002457 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002458 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002459 /**
2460 * Tx power index
2461 * index 0 = tx_power < 0dBm
2462 * index 1 = 0dBm < tx_power < 5dBm
2463 * index 2 = 5dBm < tx_power < 15dBm
2464 * index 3 = 15dBm < tx_power < 20dBm
2465 * index 4 = tx_power > 20dBm
2466 */
2467 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002468 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002469 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002470 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002471 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002472 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002473 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002474 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002475 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002476 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002477 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002478 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002479 // product of current(mA), voltage(V) and time(ms)
2480 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002481}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002482
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002483/**
2484 * Pulls Bluetooth Activity Energy Info
2485 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2486 */
2487message BluetoothActivityInfo {
2488 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002489 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002490 // bluetooth stack state
2491 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002492 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002493 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002494 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002495 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002496 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002497 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002498 // product of current(mA), voltage(V) and time(ms)
2499 optional uint64 energy_used = 6;
2500}
2501
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002502/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002503 * Logs the memory stats for a process.
2504 */
2505message ProcessMemoryState {
2506 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002507 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002508
2509 // The process name.
2510 optional string process_name = 2;
2511
2512 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002513 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002514
2515 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002516 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002517
2518 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002519 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002520
Rajeev Kumar90235992018-01-29 11:06:48 -08002521 // RSS
2522 optional int64 rss_in_bytes = 6;
2523
2524 // CACHE
2525 optional int64 cache_in_bytes = 7;
2526
2527 // SWAP
2528 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002529
2530 // RSS high watermark.
2531 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2532 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002533 // Deprecated: use ProcessMemoryHighWaterMark atom instead.
2534 optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
Rafal Slawik272a8162018-11-01 15:12:28 +00002535
2536 // Elapsed real time when the process started.
2537 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2538 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002539}
2540
2541/*
Rafal Slawik08621582018-10-15 14:53:07 +01002542 * Logs the memory stats for a native process (from procfs).
2543 */
2544message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002545 // The uid if available. -1 means not available.
2546 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002547
Rafal Slawikbf67d072018-10-23 11:07:54 +01002548 // The process name.
2549 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002550
Rafal Slawikbf67d072018-10-23 11:07:54 +01002551 // # of page-faults
2552 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002553
Rafal Slawikbf67d072018-10-23 11:07:54 +01002554 // # of major page-faults
2555 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002556
Rafal Slawikbf67d072018-10-23 11:07:54 +01002557 // RSS
2558 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002559
Rafal Slawikbf67d072018-10-23 11:07:54 +01002560 // RSS high watermark.
2561 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002562 // Deprecated: use ProcessMemoryHighWaterMark atom instead.
2563 optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
Rafal Slawikbf67d072018-10-23 11:07:54 +01002564
2565 // Elapsed real time when the process started.
2566 // Value is read from /proc/PID/stat, field 22.
2567 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002568}
2569
2570/*
Rafal Slawik3bea8952018-11-15 12:39:33 +00002571 * Logs the memory high-water mark for a process.
2572 * Recorded in ActivityManagerService.
2573 */
2574message ProcessMemoryHighWaterMark {
2575 // The uid if available. -1 means not available.
2576 optional int32 uid = 1 [(is_uid) = true];
2577
2578 // The process name. Provided by ActivityManagerService or read from /proc/PID/cmdline.
2579 optional string process_name = 2;
2580
2581 // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
2582 // /proc/PID/status.
2583 optional int64 rss_high_water_mark_in_bytes = 3;
2584}
2585
2586/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002587 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002588 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002589message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002590 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002591}
2592
2593/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002594 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002595 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002596message SystemUptime {
2597 // Milliseconds since the system was booted.
2598 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2599 // for external input).
2600 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002601 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002602}
2603
2604/*
2605 * Reads from /proc/uid_concurrent_active_time which has the format:
2606 * active: X (X is # cores)
2607 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2608 * [uid1]: [time-0] [time-1] [time-2] ... ...
2609 * ...
2610 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2611 * The file contains a monotonically increasing count of time for a single boot.
2612 */
2613message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002614 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002615 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002616}
2617
2618/**
2619 * Reads from /proc/uid_concurrent_policy_time which has the format:
2620 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2621 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2622 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2623 * ...
2624 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2625 * The file contains a monotonically increasing count of time for a single boot.
2626 */
2627message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002628 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002629 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002630 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002631}
2632
2633/*
2634 * Pulls free disk space, for data, system partition and temporary directory.
2635 */
2636message DiskSpace {
2637 // available bytes in data partition
2638 optional uint64 data_available_bytes = 1;
2639 // available bytes in system partition
2640 optional uint64 system_available_bytes = 2;
2641 // available bytes in download cache or temp directories
2642 optional uint64 temp_available_bytes = 3;
2643}
Tej Singhbf972d92018-01-10 20:51:13 -08002644
2645/**
2646 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002647 * Pulled from:
2648 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002649 */
2650message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002651 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002652}
2653
2654/**
2655 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002656 * Pulled from:
2657 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002658 */
2659message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002660 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002661}
2662
2663/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002664 * Pulls battery voltage.
2665 * Pulled from:
2666 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2667 */
2668message BatteryVoltage {
2669 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002670 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002671}
2672
2673/**
Tej Singhd89137e2018-03-26 14:51:40 -07002674 * Pulls the temperature of various parts of the device.
2675 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002676 *
2677 * Pulled from:
2678 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2679 */
2680message Temperature {
2681 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2682 optional android.os.TemperatureTypeEnum sensor_location = 1;
2683
2684 // The name of the temperature source. Eg. CPU0
2685 optional string sensor_name = 2;
2686
Tej Singhd89137e2018-03-26 14:51:40 -07002687 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002688 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002689}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002690
2691/**
2692 * Pulls the statistics of calls to Binder.
2693 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002694 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2695 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002696 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002697 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002698 */
2699message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002700 // UID of the process responsible for the binder transaction. It will be set if the process
2701 // executing the binder transaction attribute the transaction to another uid using
2702 // Binder.setThreadWorkSource().
2703 //
2704 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002705 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002706 // UID of the process executing the binder transaction.
2707 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002708 // Fully qualified class name of the API call.
2709 //
2710 // This is a system server class name.
2711 //
2712 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2713 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2714 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2715 // commonly used APIs.
2716 optional string service_class_name = 2;
2717 // Method name of the API call. It can also be a transaction code if we cannot
2718 // resolve it to a name. See Binder#getTransactionName.
2719 //
2720 // This is a system server method name.
2721 optional string service_method_name = 3;
2722 // Total number of API calls.
2723 optional int64 call_count = 4;
2724 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2725 optional bool screen_interactive = 13;
2726 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2727 // call_count will be equal to recorded_call_count.
2728 //
2729 // If recorded_call_count is different than call_count, it means data collection has been
2730 // sampled. All the fields below will be sampled in this case.
2731 optional int64 recorded_call_count = 12;
2732 // Number of exceptions thrown by the API.
2733 optional int64 recorded_exception_count = 5;
2734 // Total latency of all API calls.
2735 // Average can be computed using total_latency_micros / recorded_call_count.
2736 optional int64 recorded_total_latency_micros = 6;
2737 // Maximum latency of one API call.
2738 optional int64 recorded_max_latency_micros = 7;
2739 // Total CPU usage of all API calls.
2740 // Average can be computed using total_cpu_micros / recorded_call_count.
2741 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2742 optional int64 recorded_total_cpu_micros = 8;
2743 // Maximum CPU usage of one API call.
2744 optional int64 recorded_max_cpu_micros = 9;
2745 // Maximum parcel reply size of one API call.
2746 optional int64 recorded_max_reply_size_bytes = 10;
2747 // Maximum parcel request size of one API call.
2748 optional int64 recorded_max_request_size_bytes = 11;
2749}
2750
2751/**
2752 * Pulls the statistics of exceptions during calls to Binder.
2753 *
2754 * Binder stats are cumulative from boot unless somebody reset the data using
2755 * > adb shell dumpsys binder_calls_stats --reset
2756 */
2757message BinderCallsExceptions {
2758 // Exception class name, e.g. java.lang.IllegalArgumentException.
2759 //
2760 // This is an exception class name thrown by the system server.
2761 optional string exception_class_name = 1;
2762 // Total number of exceptions.
2763 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002764}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002765
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002766/**
2767 * Pulls the statistics of message dispatching on HandlerThreads.
2768 *
2769 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2770 * config on the device.
2771 *
2772 * Next tag: 11
2773 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002774message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002775 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002776 optional int32 uid = 1 [(is_uid) = true];
2777
2778 // Fully qualified class name of the handler target class.
2779 //
2780 // This field does not contain PII. This is a system server class name.
2781 optional string handler_class_name = 2;
2782
2783 // The name of the thread that runs the Looper.
2784 //
2785 // This field does not contain PII. This is a system server thread name.
2786 optional string looper_thread_name = 3;
2787
2788 // The name of the dispatched message.
2789 //
2790 // This field does not contain PII. This is a system server constant or class
2791 // name.
2792 optional string message_name = 4;
2793
2794 // Total number of successfully dispatched messages.
2795 optional int64 message_count = 5;
2796
2797 // Total number of messages that failed dispatching.
2798 optional int64 exception_count = 6;
2799
2800 // Total number of processed messages we have data recorded for. If we
2801 // collected data for all the messages, message_count will be equal to
2802 // recorded_message_count.
2803 //
2804 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002805 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002806 optional int64 recorded_message_count = 7;
2807
2808 // Total latency of all processed messages.
2809 // Average can be computed using recorded_total_latency_micros /
2810 // recorded_message_count.
2811 optional int64 recorded_total_latency_micros = 8;
2812
2813 // Total CPU usage of all processed message.
2814 // Average can be computed using recorded_total_cpu_micros /
2815 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002816 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002817 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002818
2819 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2820 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002821
2822 // Max recorded CPU usage of all processed messages.
2823 optional int64 recorded_max_cpu_micros = 11;
2824
2825 // Max recorded latency of all processed messages.
2826 optional int64 recorded_max_latency_micros = 12;
2827
2828 // Total number of messages we tracked the dispatching delay for. If we
2829 // collected data for all the messages, message_count will be equal to
2830 // recorded_delay_message_count.
2831 //
2832 // If recorded_delay_message_count is different than message_count, it means data
2833 // collection has been sampled or/and not all messages specified the target dispatch time.
2834 // The fields below will be sampled in this case.
2835 optional int64 recorded_delay_message_count = 13;
2836
2837 // Total dispatching delay of all processed messages.
2838 // Calculated as a difference between the target dispatching time (Message.when)
2839 // and the actual dispatching time.
2840 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2841 optional int64 recorded_total_delay_millis = 14;
2842
2843 // Max dispatching delay of all processed messages.
2844 // Calculated as a difference between the target dispatching time (Message.when)
2845 // and the actual dispatching time.
2846 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002847}
Tej Singh86dc9db2018-09-06 00:39:57 +00002848
2849/**
2850 * Pulls disk information, such as write speed and latency.
2851 */
2852message DiskStats {
2853 // Time taken to open, write 512B to, and close a file.
2854 // -1 if error performing the check.
2855 optional int64 data_write_latency_millis = 1;
2856
2857 optional bool file_based_encryption = 2;
2858
2859 // Recent disk write speed in kB/s.
2860 // -1 if error querying storageed.
2861 // 0 if data is unavailable.
2862 optional int32 recent_disk_write_speed = 3;
2863}
2864
2865
2866/**
2867 * Free and total bytes of the Data, Cache, and System partition.
2868 */
2869message DirectoryUsage {
2870 enum Directory {
2871 UNKNOWN = 0;
2872 DATA = 1;
2873 CACHE = 2;
2874 SYSTEM = 3;
2875 }
2876 optional Directory directory = 1;
2877 optional int64 free_bytes = 2;
2878 optional int64 total_bytes = 3;
2879}
2880
2881
2882/**
2883 * Size of an application: apk size, data size, and cache size.
2884 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2885 * Information is only reported for apps with the primary user (user 0).
2886 * Sizes are aggregated by package name.
2887 */
2888message AppSize {
2889 // Including uids will involve modifying diskstats logic.
2890 optional string package_name = 1;
2891 // App size in bytes. -1 if unavailable.
2892 optional int64 app_size_bytes = 2;
2893 // App data size in bytes. -1 if unavailable.
2894 optional int64 app_data_size_bytes = 3;
2895 // App cache size in bytes. -1 if unavailable.
2896 optional int64 app_cache_size_bytes = 4;
2897 // Time that the cache file was produced.
2898 // Uses System.currentTimeMillis(), which is wall clock time.
2899 optional int64 cache_time_millis = 5;
2900}
2901
2902
2903/**
2904 * Size of a particular category. Eg: photos, videos.
2905 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2906 */
2907message CategorySize {
2908 enum Category {
2909 UNKNOWN = 0;
2910 APP_SIZE = 1;
2911 APP_DATA_SIZE = 2;
2912 APP_CACHE_SIZE = 3;
2913 PHOTOS = 4;
2914 VIDEOS = 5;
2915 AUDIO = 6;
2916 DOWNLOADS = 7;
2917 SYSTEM = 8;
2918 OTHER = 9;
2919 }
2920 optional Category category = 1;
2921 // Category size in bytes.
2922 optional int64 size_bytes = 2;
2923 // Time that the cache file was produced.
2924 // Uses System.currentTimeMillis(), which is wall clock time.
2925 optional int64 cache_time_millis = 3;
2926}
Tej Singhd6d6d772018-09-05 17:41:25 -07002927
2928/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002929 * Pulls per uid I/O stats. The stats are cumulative since boot.
2930 *
2931 * Read/write bytes are I/O events from a storage device
2932 * Read/write chars are data requested by read/write syscalls, and can be
2933 * satisfied by caching.
2934 *
2935 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2936 */
2937message DiskIo {
2938 optional int32 uid = 1 [(is_uid) = true];
2939 optional int64 fg_chars_read = 2;
2940 optional int64 fg_chars_write = 3;
2941 optional int64 fg_bytes_read = 4;
2942 optional int64 fg_bytes_write = 5;
2943 optional int64 bg_chars_read = 6;
2944 optional int64 bg_chars_write = 7;
2945 optional int64 bg_bytes_read = 8;
2946 optional int64 bg_bytes_write = 9;
2947 optional int64 fg_fsync = 10;
2948 optional int64 bg_fsync= 11;
2949}
2950
2951
2952/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002953 * Pulls the number of fingerprints for each user.
2954 *
2955 * Pulled from StatsCompanionService, which queries FingerprintManager.
2956 */
2957message NumFingerprints {
2958 // The associated user. Eg: 0 for owners, 10+ for others.
2959 // Defined in android/os/UserHandle.java
2960 optional int32 user = 1;
2961 // Number of fingerprints registered to that user.
2962 optional int32 num_fingerprints = 2;
2963}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002964
Yangsteraf9aee72018-10-12 09:26:16 -07002965message AggStats {
2966 optional int64 min = 1;
2967
2968 optional int64 average = 2;
2969
2970 optional int64 max = 3;
2971}
2972
2973message ProcessStatsStateProto {
2974 optional android.service.procstats.ScreenState screen_state = 1;
2975
2976 optional android.service.procstats.MemoryState memory_state = 2;
2977
2978 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2979 // and not frameworks/base/core/java/android/app/ActivityManager.java
2980 optional android.service.procstats.ProcessState process_state = 3;
2981
2982 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002983 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002984
2985 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002986 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07002987
2988 // # of samples taken
2989 optional int32 sample_size = 5;
2990
2991 // PSS is memory reserved for this process
2992 optional AggStats pss = 6;
2993
2994 // USS is memory shared between processes, divided evenly for accounting
2995 optional AggStats uss = 7;
2996
2997 // RSS is memory resident for this process
2998 optional AggStats rss = 8;
2999}
3000
3001// Next Tag: 7
3002message ProcessStatsProto {
3003 // Name of process.
3004 optional string process = 1;
3005
3006 // Uid of the process.
3007 optional int32 uid = 2;
3008
3009 // Information about how often kills occurred
3010 message Kill {
3011 // Count of excessive CPU kills
3012 optional int32 cpu = 1;
3013
3014 // Count of kills when cached
3015 optional int32 cached = 2;
3016
3017 // PSS stats during cached kill
3018 optional AggStats cached_pss = 3;
3019 }
3020 optional Kill kill = 3;
3021
3022 // Time and memory spent in various states.
3023 repeated ProcessStatsStateProto states = 5;
3024
3025 // Total time process has been running... screen_state, memory_state, and process_state
3026 // will not be set.
3027 optional ProcessStatsStateProto total_running_state = 6;
3028}
3029
3030message PackageServiceOperationStatsProto {
3031 // Operate enum: Started, Foreground, Bound, Executing
3032 optional android.service.procstats.ServiceOperationState operation = 1;
3033
3034 // Number of times the service was in this operation.
3035 optional int32 count = 2;
3036
3037 // Information about a state the service can be in.
3038 message StateStats {
3039 // Screen state enum.
3040 optional android.service.procstats.ScreenState screen_state = 1;
3041 // Memory state enum.
3042 optional android.service.procstats.MemoryState memory_state = 2;
3043
3044 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003045 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003046 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003047 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003048 }
3049 repeated StateStats state_stats = 3;
3050}
3051
3052message PackageServiceStatsProto {
3053 // Name of service component.
3054 optional string service_name = 1;
3055
3056 // The operation stats.
3057 // The package_name, package_uid, package_version, service_name will not be set to save space.
3058 repeated PackageServiceOperationStatsProto operation_stats = 2;
3059}
3060
3061message PackageAssociationSourceProcessStatsProto {
3062 // Uid of the process.
3063 optional int32 process_uid = 1;
3064 // Process name.
3065 optional string process_name = 2;
3066
3067 // Total count of the times this association appeared.
3068 optional int32 total_count = 3;
3069
3070 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003071 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003072
3073 // Total count of the times this association became actively impacting its target process.
3074 optional int32 active_count = 5;
3075
3076 // Information on one source in this association.
3077 message StateStats {
3078 // Process state enum.
3079 optional android.service.procstats.ProcessState process_state = 1;
3080 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003081 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003082 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003083 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003084 }
3085 repeated StateStats active_state_stats = 6;
3086}
3087
3088message PackageAssociationProcessStatsProto {
3089 // Name of the target component.
3090 optional string component_name = 1;
3091 // Information on one source in this association.
3092 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3093}
3094
3095
3096message ProcessStatsPackageProto {
3097 // Name of package.
3098 optional string package = 1;
3099
3100 // Uid of the package.
3101 optional int32 uid = 2;
3102
3103 // Version of the package.
3104 optional int64 version = 3;
3105
3106 // Stats for each process running with the package loaded in to it.
3107 repeated ProcessStatsProto process_stats = 4;
3108
3109 // Stats for each of the package's services.
3110 repeated PackageServiceStatsProto service_stats = 5;
3111
3112 // Stats for each association with the package.
3113 repeated PackageAssociationProcessStatsProto association_stats = 6;
3114}
3115
3116message ProcessStatsSectionProto {
3117 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003118 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003119
3120 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003121 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003122
3123 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003124 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003125
3126 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003127 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003128
3129 // System runtime library. e.g. "libdvm.so", "libart.so".
3130 optional string runtime = 5;
3131
3132 // whether kernel reports swapped pss.
3133 optional bool has_swapped_pss = 6;
3134
3135 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3136 enum Status {
3137 STATUS_UNKNOWN = 0;
3138 STATUS_COMPLETE = 1;
3139 STATUS_PARTIAL = 2;
3140 STATUS_SHUTDOWN = 3;
3141 STATUS_SYSPROPS = 4;
3142 }
3143 repeated Status status = 7;
3144
3145 // Stats for each process.
3146 repeated ProcessStatsProto process_stats = 8;
3147
3148 // Stats for each package.
3149 repeated ProcessStatsPackageProto package_stats = 9;
3150}
3151
Chenjie Yu12e5e672018-09-14 15:54:59 -07003152/**
3153 * Pulled from ProcessStatsService.java
3154 */
3155message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003156 optional ProcessStatsSectionProto proc_stats_section = 1;
3157}
3158
3159message PowerProfileProto {
3160 optional double cpu_suspend = 1;
3161
3162 optional double cpu_idle = 2;
3163
3164 optional double cpu_active = 3;
3165
3166 message CpuCluster {
3167 optional int32 id = 1;
3168 optional double cluster_power = 2;
3169 optional int32 cores = 3;
3170 repeated int64 speed = 4;
3171 repeated double core_power = 5;
3172 }
3173
3174 repeated CpuCluster cpu_cluster = 40;
3175
3176 optional double wifi_scan = 4;
3177
3178 optional double wifi_on = 5;
3179
3180 optional double wifi_active = 6;
3181
3182 optional double wifi_controller_idle = 7;
3183
3184 optional double wifi_controller_rx = 8;
3185
3186 optional double wifi_controller_tx = 9;
3187
3188 repeated double wifi_controller_tx_levels = 10;
3189
3190 optional double wifi_controller_operating_voltage = 11;
3191
3192 optional double bluetooth_controller_idle = 12;
3193
3194 optional double bluetooth_controller_rx = 13;
3195
3196 optional double bluetooth_controller_tx = 14;
3197
3198 optional double bluetooth_controller_operating_voltage = 15;
3199
3200 optional double modem_controller_sleep = 16;
3201
3202 optional double modem_controller_idle = 17;
3203
3204 optional double modem_controller_rx = 18;
3205
3206 repeated double modem_controller_tx = 19;
3207
3208 optional double modem_controller_operating_voltage = 20;
3209
3210 optional double gps_on = 21;
3211
3212 repeated double gps_signal_quality_based = 22;
3213
3214 optional double gps_operating_voltage = 23;
3215
3216 optional double bluetooth_on = 24;
3217
3218 optional double bluetooth_active = 25;
3219
3220 optional double bluetooth_at_cmd = 26;
3221
3222 optional double ambient_display = 27;
3223
3224 optional double screen_on = 28;
3225
3226 optional double radio_on = 29;
3227
3228 optional double radio_scanning = 30;
3229
3230 optional double radio_active = 31;
3231
3232 optional double screen_full = 32;
3233
3234 optional double audio = 33;
3235
3236 optional double video = 34;
3237
3238 optional double flashlight = 35;
3239
3240 optional double memory = 36;
3241
3242 optional double camera = 37;
3243
3244 optional double wifi_batched_scan = 38;
3245
3246 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003247}
Chenjie Yuab530202018-09-26 12:39:20 -07003248
3249/**
3250 * power_profile.xml and other constants for power model calculations.
3251 * Pulled from PowerProfile.java
3252 */
3253message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003254 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003255}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003256
3257/**
arangelovd5db50e2018-10-12 20:24:39 +01003258 * Logs when a user restriction was added or removed.
3259 *
3260 * Logged from:
3261 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3262 */
3263message UserRestrictionChanged {
3264 // The raw string of the user restriction as defined in UserManager.
3265 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3266 optional string restriction = 1;
3267 // Whether the restriction is enabled or disabled.
3268 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003269}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003270
3271/**
3272 * Pulls process user time and system time. Puller takes a snapshot of all pids
3273 * in the system and returns cpu stats for those that are working at the time.
3274 * Dead pids will be dropped. Kernel processes are excluded.
3275 * Min cool-down is 5 sec.
3276 */
3277message ProcessCpuTime {
3278 optional int32 uid = 1 [(is_uid) = true];
3279
3280 optional string process_name = 2;
3281 // Process cpu time in user space, cumulative from boot/process start
3282 optional int64 user_time_millis = 3;
3283 // Process cpu time in system space, cumulative from boot/process start
3284 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003285}
Misha Wagner5a51e002018-10-03 15:04:09 +01003286
3287/**
3288 * Pulls the CPU usage for each thread.
3289 *
3290 * Read from /proc/$PID/task/$TID/time_in_state files.
3291 *
3292 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3293 * time_in_state files not being present on some phones, have not been addressed. These should be
3294 * considered before a public release.
3295 */
3296message CpuTimePerThreadFreq {
3297 // UID that owns the process.
3298 optional int32 uid = 1 [(is_uid) = true];
3299 // ID of the process.
3300 optional uint32 process_id = 2;
3301 // ID of the thread.
3302 optional uint32 thread_id = 3;
3303 // Name of the process taken from `/proc/$PID/cmdline`.
3304 optional string process_name = 4;
3305 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3306 optional string thread_name = 5;
3307 // What frequency the CPU was running at, in KHz
3308 optional uint32 frequency_khz = 6;
3309 // Time spent in frequency in milliseconds, since thread start.
3310 optional uint32 time_millis = 7;
3311}
Bookatz75ee6042018-11-09 12:27:37 -08003312
3313/**
3314 * Pulls on-device BatteryStats power use calculations for the overall device.
3315 */
3316message DeviceCalculatedPowerUse {
3317 // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset
3318 // (i.e. roughly since device was last significantly charged).
3319 // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3320 optional float computed_power_milli_amp_hours = 1;
3321}
3322
3323/**
3324 * Pulls on-device BatteryStats power use calculations broken down by uid.
3325 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3326 * that is attributed to non-uid items. They must all be included to get the total power use.
3327 */
3328message DeviceCalculatedPowerBlameUid {
3329 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3330 optional int32 uid = 1 [(is_uid) = true];
3331
3332 // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset
3333 // (i.e. roughly since device was last significantly charged).
3334 optional float power_milli_amp_hours = 2;
3335}
3336
3337/**
3338 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3339 * drain type.
3340 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3341 * is attributed uids. They must all be included to get the total power use.
3342 */
3343message DeviceCalculatedPowerBlameOther {
3344 // The type of item whose power use is being reported.
3345 enum DrainType {
3346 AMBIENT_DISPLAY = 0;
3347 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3348 BLUETOOTH = 2;
3349 CAMERA = 3;
3350 // Cell-standby
3351 CELL = 4;
3352 FLASHLIGHT = 5;
3353 IDLE = 6;
3354 MEMORY = 7;
3355 // Amount that total computed drain exceeded the drain estimated using the
3356 // battery level changes and capacity.
3357 OVERCOUNTED = 8;
3358 PHONE = 9;
3359 SCREEN = 10;
3360 // Amount that total computed drain was below the drain estimated using the
3361 // battery level changes and capacity.
3362 UNACCOUNTED = 11;
3363 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3364 WIFI = 13;
3365 }
3366 optional DrainType drain_type = 1;
3367
3368 // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset
3369 // (i.e. roughly since device was last significantly charged).
3370 optional float power_milli_amp_hours = 2;
Rafal Slawik3bea8952018-11-15 12:39:33 +00003371}