blob: 5868df8f2d4eb37a72ae2b302493e743a69aaebf [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.
Misha Wagner5a51e002018-10-03 15:04:09 +0100162 // Next: 10038
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;
David Chenc8a43242017-10-17 16:23:28 -0700206 }
yroa1fe77c2018-02-26 14:22:54 -0800207
Bookatz76aafcf2018-09-17 16:17:10 -0700208 // DO NOT USE field numbers above 100,000 in AOSP.
209 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
210 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700211}
212
Yao Chend54f9dd2017-10-17 17:37:48 +0000213/**
Yangster-mac20877162017-12-22 17:19:39 -0800214 * This proto represents a node of an attribution chain.
215 * Note: All attribution chains are represented as a repeated field of type
216 * AttributionNode. It is understood that in such arrays, the order is that
217 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000218 */
Yangster-mac20877162017-12-22 17:19:39 -0800219message AttributionNode {
220 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800221 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800222
Yangster-mac20877162017-12-22 17:19:39 -0800223 // The (optional) string tag for an element in the attribution chain. If the
224 // element has no tag, it is encoded as an empty string.
225 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700226}
227
Yangster-mac48b3d622018-08-18 12:38:11 -0700228message KeyValuePair {
229 optional int32 key = 1;
230 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700231 int32 value_int = 2;
232 int64 value_long = 3;
233 string value_str = 4;
234 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700235 }
236}
237
238message KeyValuePairsAtom {
239 optional int32 uid = 1;
240 repeated KeyValuePair pairs = 2;
241}
242
Yao Chend54f9dd2017-10-17 17:37:48 +0000243/*
244 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800245 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000246 *
247 * RULES:
248 * - The field ids for each atom must start at 1, and count upwards by 1.
249 * Skipping field ids is not allowed.
250 * - These form an API, so renaming, renumbering or removing fields is
251 * not allowed between android releases. (This is not currently enforced,
252 * but there will be a tool to enforce this restriction).
253 * - The types must be built-in protocol buffer types, namely, no sub-messages
254 * are allowed (yet). The bytes type is also not allowed.
255 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800256 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000257 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800258 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000259 * - A field that is a uid should be a string field, tagged with the [xxx]
260 * annotation. The generated code on android will be represented by UIDs,
261 * and those UIDs will be translated in xxx to those strings.
262 *
263 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700264 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000265 * - If there is a UID, it goes first. Think in an object-oriented fashion.
266 * *****************************************************************************
267 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700268
Yao Chend54f9dd2017-10-17 17:37:48 +0000269/**
Yangster-mace16189a2018-08-26 12:20:16 -0700270 * Logs when the Thermal service HAL notifies the throttling start/stop events.
271 *
272 * Logged from:
273 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
274 */
275message ThermalThrottlingStateChanged {
276 optional android.os.TemperatureTypeEnum sensor_type = 1;
277
278 enum State {
279 UNKNOWN = 0;
280 START = 1;
281 STOP = 2;
282 }
283
284 optional State state = 2;
285
286 optional float temperature = 3;
287}
288
289/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000290 * Logs when the screen state changes.
291 *
292 * Logged from:
293 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
294 */
295message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800296 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700297 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700298}
Yao Chend54f9dd2017-10-17 17:37:48 +0000299
300/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700301 * Logs that the process state of the uid, as determined by ActivityManager
302 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000303 *
304 * Logged from:
305 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
306 */
Bookatzc1a050a2017-10-10 15:49:28 -0700307message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700308 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000309
Bookatzdb026a22018-01-10 19:01:56 -0800310 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700311 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000312}
313
314/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700315 * Logs process state change of a process, as per the activity manager.
316 *
317 * Logged from:
318 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
319 */
320message ProcessStateChanged {
321 optional int32 uid = 1;
322 optional string process_name = 2;
323 optional string package_name = 3;
324 // TODO: remove this when validation is done
325 optional int64 version = 5;
326 // The state, from frameworks/base/core/proto/android/app/enums.proto.
327 optional android.app.ProcessStateEnum state = 4;
328}
329
330/**
331 * Logs when ActivityManagerService sleep state is changed.
332 *
333 * Logged from:
334 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
335 */
336message ActivityManagerSleepStateChanged {
337 // TODO: import frameworks proto
338 enum State {
339 UNKNOWN = 0;
340 ASLEEP = 1;
341 AWAKE = 2;
342 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700343 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700344}
345
346/**
347 * Logs when system memory state changes.
348 *
349 * Logged from:
350 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
351 */
352message MemoryFactorStateChanged {
353 // TODO: import frameworks proto
354 enum State {
355 MEMORY_UNKNOWN = 0;
356 NORMAL = 1; // normal.
357 MODERATE = 2; // moderate memory pressure.
358 LOW = 3; // low memory.
359 CRITICAL = 4; // critical memory.
360
361 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700362 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700363}
364
365/**
366 * Logs when app is using too much cpu, according to ActivityManagerService.
367 *
368 * Logged from:
369 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
370 */
371message ExcessiveCpuUsageReported {
372 optional int32 uid = 1;
373 optional string process_name = 2;
374 optional string package_name = 3;
375 // package version. TODO: remove this when validation is done
376 optional int64 version = 4;
377}
378
379/**
380 * Logs when a cached process is killed, along with its pss.
381 *
382 * Logged from:
383 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
384 */
385message CachedKillReported {
386 optional int32 uid = 1;
387 optional string process_name = 2;
388 optional string package_name = 3;
389 // TODO: remove this when validation is done
390 optional int64 version = 5;
391 optional int64 pss = 4;
392}
393
394/**
395 * Logs when memory stats of a process is reported.
396 *
397 * Logged from:
398 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
399 */
400message ProcessMemoryStatReported {
401 optional int32 uid = 1;
402 optional string process_name = 2;
403 optional string package_name = 3;
404 //TODO: remove this when validation is done
405 optional int64 version = 9;
406 optional int64 pss = 4;
407 optional int64 uss = 5;
408 optional int64 rss = 6;
409 enum Type {
410 ADD_PSS_INTERNAL_SINGLE = 0;
411 ADD_PSS_INTERNAL_ALL_MEM = 1;
412 ADD_PSS_INTERNAL_ALL_POLL = 2;
413 ADD_PSS_EXTERNAL = 3;
414 ADD_PSS_EXTERNAL_SLOW = 4;
415 }
416 optional Type type = 7;
417 optional int64 duration = 8;
418}
419
420/**
Bookatzc1a050a2017-10-10 15:49:28 -0700421 * Logs that a process started, finished, crashed, or ANRed.
422 *
423 * Logged from:
424 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
425 */
426message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700427 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700428
David Chen0b5c90c2018-01-25 16:51:49 -0800429 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800430 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700431
Bookatzddccf0a2017-11-28 16:48:14 -0800432 // What lifecycle state the process changed to.
433 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800434 enum State {
435 FINISHED = 0;
436 STARTED = 1;
437 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800438 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800439 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700440}
441
Bookatzc1a050a2017-10-10 15:49:28 -0700442/**
443 * Logs when the ble scan state changes.
444 *
445 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700446 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700447 */
448message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800449 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700450
451 enum State {
452 OFF = 0;
453 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700454 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
455 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700456 }
457 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700458
Bookatze5ec0b42018-03-26 13:34:56 -0700459 // Does the scan have a filter.
460 optional bool is_filtered = 3;
461 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
462 optional bool is_first_match = 4;
463 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
464 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700465}
466
467/**
468 * Logs reporting of a ble scan finding results.
469 *
470 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700471 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700472 */
Bookatzae6738e2018-09-13 11:38:56 -0700473// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700474message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800475 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700476
477 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800478 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700479}
480
481/**
482 * Logs when a sensor state changes.
483 *
484 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700485 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700486 */
487message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800488 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700489
Bookatzc1a050a2017-10-10 15:49:28 -0700490 // The id (int) of the sensor.
491 optional int32 sensor_id = 2;
492
493 enum State {
494 OFF = 0;
495 ON = 1;
496 }
497 optional State state = 3;
498}
499
Bookatzc1a050a2017-10-10 15:49:28 -0700500/**
501 * Logs when GPS state changes.
502 *
503 * Logged from:
504 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
505 */
506message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800507 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700508
509 enum State {
510 OFF = 0;
511 ON = 1;
512 }
513 optional State state = 2;
514}
515
Bookatz48d362e2018-11-06 15:49:08 -0800516/**
517 * Logs when GPS signal quality.
518 *
519 * Logged from:
520 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
521 */
522message GpsSignalQualityChanged {
523 optional android.server.location.GpsSignalQualityEnum level = 1;
524}
525
Bookatzc1a050a2017-10-10 15:49:28 -0700526
527/**
528 * Logs when a sync manager sync state changes.
529 *
530 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700531 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700532 */
533message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800534 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700535
David Chen0b5c90c2018-01-25 16:51:49 -0800536 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800537 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700538
539 enum State {
540 OFF = 0;
541 ON = 1;
542 }
543 optional State state = 3;
544}
545
Yangster-mac96353002018-09-05 11:18:55 -0700546/*
547 * Deferred job stats.
548 *
549 * Logged from:
550 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
551*/
552message DeferredJobStatsReported {
553 repeated AttributionNode attribution_node = 1;
554
555 // Number of jobs deferred.
556 optional int32 num_jobs_deferred = 2;
557
558 // Time since the last job runs.
559 optional int64 time_since_last_job_millis = 3;
560}
561
Bookatzc1a050a2017-10-10 15:49:28 -0700562/**
563 * Logs when a job scheduler job state changes.
564 *
565 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700566 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700567 */
568message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800569 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700570
571 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800572 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700573
574 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800575 FINISHED = 0;
576 STARTED = 1;
577 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700578 }
579 optional State state = 3;
580
Tej Singh33a412b2018-03-16 18:43:59 -0700581 // The reason a job has stopped.
582 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700583 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700584 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700585}
586
587/**
588 * Logs when the audio state changes.
589 *
590 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700591 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700592 */
593message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800594 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700595
596 enum State {
597 OFF = 0;
598 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700599 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
600 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700601 }
602 optional State state = 2;
603}
604
605/**
606 * Logs when the video codec state changes.
607 *
608 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700609 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700610 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800611message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800612 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700613
614 enum State {
615 OFF = 0;
616 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700617 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
618 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700619 }
620 optional State state = 2;
621}
622
623/**
624 * Logs when the flashlight state changes.
625 *
626 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700627 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700628 */
629message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800630 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700631
632 enum State {
633 OFF = 0;
634 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700635 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
636 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700637 }
638 optional State state = 2;
639}
640
641/**
642 * Logs when the camera state changes.
643 *
644 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700645 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700646 */
647message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800648 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700649
650 enum State {
651 OFF = 0;
652 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700653 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
654 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700655 }
656 optional State state = 2;
657}
658
659/**
660 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000661 *
662 * Logged from:
663 * TODO
664 */
Bookatzd6746242017-10-24 18:39:35 -0700665message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800666 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000667
Bookatz1a1b0462018-01-12 11:47:03 -0800668 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
669 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700670 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700671
672 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
673 optional string tag = 3;
674
675 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800676 RELEASE = 0;
677 ACQUIRE = 1;
678 CHANGE_RELEASE = 2;
679 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700680 }
681 optional State state = 4;
682}
683
684/**
Bookatzc1a050a2017-10-10 15:49:28 -0700685 * Logs when a partial wakelock is considered 'long' (over 1 min).
686 *
687 * Logged from:
688 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
689 */
690message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800691 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700692
Yao Chend54f9dd2017-10-17 17:37:48 +0000693 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
694 optional string tag = 2;
695
Bookatzc1a050a2017-10-10 15:49:28 -0700696 // TODO: I have no idea what this is.
697 optional string history_tag = 3;
698
699 enum State {
700 OFF = 0;
701 ON = 1;
702 }
703 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000704}
705
Bookatzc1a050a2017-10-10 15:49:28 -0700706/**
Bookatza66083f2018-09-20 17:24:00 -0700707 * Logs when the device is interactive, according to the PowerManager Notifier.
708 *
709 * Logged from:
710 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
711 */
712message InteractiveStateChanged {
713 enum State {
714 OFF = 0;
715 ON = 1;
716 }
717 optional State state = 1;
718}
719
720/**
Bookatzc1a050a2017-10-10 15:49:28 -0700721 * Logs Battery Saver state change.
722 *
723 * Logged from:
724 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
725 */
726message BatterySaverModeStateChanged {
727 enum State {
728 OFF = 0;
729 ON = 1;
730 }
731 optional State state = 1;
732}
733
734/**
735 * Logs Doze mode state change.
736 *
737 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800738 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700739 */
740message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800741 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800742}
743
744
745/**
746 * Logs state change of Doze mode including maintenance windows.
747 *
748 * Logged from:
749 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
750 */
751message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800752 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700753}
754
755/**
756 * Logs screen brightness level.
757 *
758 * Logged from:
759 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
760 */
761message ScreenBrightnessChanged {
762 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
763 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700764}
765
766/**
767 * Logs battery level (percent full, from 0 to 100).
768 *
769 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700770 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700771 */
772message BatteryLevelChanged {
773 // Battery level. Should be in [0, 100].
774 optional int32 battery_level = 1;
775}
776
777/**
778 * Logs change in charging status of the device.
779 *
780 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700781 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700782 */
783message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800784 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
785 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700786}
787
788/**
789 * Logs whether the device is plugged in, and what power source it is using.
790 *
791 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700792 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700793 */
794message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800795 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
796 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700797}
798
Bookatz8c6571b2017-10-24 15:04:41 -0700799/**
800 * Logs when an app's wakeup alarm fires.
801 *
802 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700803 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700804 */
805message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800806 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800807
808 // Name of the wakeup alarm.
809 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700810
811 // Name of source package (for historical reasons, since BatteryStats tracked it).
812 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800813}
814
815/**
816 * Logs when an an app causes the mobile radio to change state.
817 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
818 *
819 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700820 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800821 */
822message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800823 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800824
Bookatz1a1b0462018-01-12 11:47:03 -0800825 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
826 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800827}
828
829/**
830 * Logs when an an app causes the wifi radio to change state.
831 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
832 *
833 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700834 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800835 */
836message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800837 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800838
Bookatz1a1b0462018-01-12 11:47:03 -0800839 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
840 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700841}
842
843/**
844 * Logs kernel wakeup reasons and aborts.
845 *
846 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700847 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700848 */
849message KernelWakeupReported {
850 // Name of the kernel wakeup reason (or abort).
851 optional string wakeup_reason_name = 1;
852
853 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800854 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700855}
856
857/**
858 * Logs wifi locks held by an app.
859 *
860 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700861 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700862 */
863message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800864 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700865
866 enum State {
867 OFF = 0;
868 ON = 1;
869 }
870 optional State state = 2;
871}
872
873/**
874 * Logs wifi signal strength changes.
875 *
876 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700877 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700878 */
879message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800880 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
881 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700882}
883
884/**
885 * Logs wifi scans performed by an app.
886 *
887 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700888 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700889 */
890message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800891 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700892
893 enum State {
894 OFF = 0;
895 ON = 1;
896 }
897 optional State state = 2;
898}
899
900/**
Tej Singh4503e102018-01-04 14:35:01 -0800901 * Logs wifi multicast locks held by an app
902 *
903 * Logged from:
904 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
905 */
906message WifiMulticastLockStateChanged {
907 repeated AttributionNode attribution_node = 1;
908
909 enum State {
910 OFF = 0;
911 ON = 1;
912 }
913 optional State state = 2;
914}
915
916/**
Tej Singh1ea42892018-01-19 09:27:00 -0800917 * Logs shutdown reason and duration on next boot.
918 *
919 * Logged from:
920 * frameworks/base/core/java/com/android/server/BootReceiver.java
921 */
922message ShutdownSequenceReported {
923 // True if shutdown is for a reboot. Default: false if we do not know.
924 optional bool reboot = 1;
925
926 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
927 optional string reason = 2;
928
929 // Beginning of shutdown time in ms using wall clock time since unix epoch.
930 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800931 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800932
933 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800934 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800935}
936
Tej Singh6483ea42018-01-25 17:45:49 -0800937
938/**
939 * Logs boot reason and duration.
940 *
941 * Logged from:
942 * system/core/bootstat/bootstat.cpp
943 */
944message BootSequenceReported {
945 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
946 // Default: "<EMPTY>" if not available.
947 optional string bootloader_reason = 1;
948
949 // Reason for system boot. Eg. bootloader, reboot,userrequested
950 // Default: "<EMPTY>" if not available.
951 optional string system_reason = 2;
952
953 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800954 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800955
956 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800957 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800958
959 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800960 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800961
962 // Time since last boot in ms. Default: 0 if not available.
963 optional int64 time_since_last_boot = 6;
964}
965
Tej Singhc477d9c2018-02-05 18:31:39 -0800966
967/**
968 * Logs call state and disconnect cause (if applicable).
969 *
970 * Logged from:
971 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
972 */
973message CallStateChanged {
974 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
975 // From frameworks/base/core/proto/android/telecomm/enums.proto.
976 optional android.telecom.CallStateEnum call_state = 1;
977
978 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
979 // This value is only applicable when the call_state is DISCONNECTED, and
980 // should always be UNKNOWN if the call_state is not DISCONNECTED.
981 // From frameworks/base/core/proto/android/telecomm/enums.proto.
982 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
983
984 // True if the call is self-managed, which are apps that use the
985 // telecom infrastructure to make their own calls.
986 optional bool self_managed = 3;
987
988 // True if call is external. External calls are calls on connected Wear
989 // devices but show up in Telecom so the user can pull them onto the device.
990 optional bool external_call = 4;
991}
992
Tej Singh1ea42892018-01-19 09:27:00 -0800993/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800994 * Logs keyguard state. The keyguard is the lock screen.
995 *
996 * Logged from:
997 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
998 */
999message KeyguardStateChanged {
1000 enum State {
1001 UNKNOWN = 0;
1002 // The keyguard is hidden when the phone is unlocked.
1003 HIDDEN = 1;
1004 // The keyguard is shown when the phone is locked (screen turns off).
1005 SHOWN= 2;
1006 // The keyguard is occluded when something is overlaying the keyguard.
1007 // Eg. Opening the camera while on the lock screen.
1008 OCCLUDED = 3;
1009 }
1010 optional State state = 1;
1011}
1012
1013/**
1014 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1015 * prompts the user to enter a password (pattern, pin, etc).
1016 *
1017 * Logged from:
1018 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1019 */
1020
1021message KeyguardBouncerStateChanged {
1022 enum State {
1023 UNKNOWN = 0;
1024 // Bouncer is hidden, either as a result of successfully entering the
1025 // password, screen timing out, or user going back to lock screen.
1026 HIDDEN = 1;
1027 // This is when the user is being prompted to enter the password.
1028 SHOWN = 2;
1029 }
1030 optional State state = 1;
1031}
1032
1033/**
1034 * Logs the result of entering a password into the keyguard bouncer.
1035 *
1036 * Logged from:
1037 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1038 */
1039message KeyguardBouncerPasswordEntered {
1040 enum BouncerResult {
1041 UNKNOWN = 0;
1042 // The password entered was incorrect.
1043 FAILURE = 1;
1044 // The password entered was correct.
1045 SUCCESS = 2;
1046 }
1047 optional BouncerResult result = 1;
1048}
1049
Tej Singha883b372018-02-15 11:30:01 -08001050/*
1051 * Logs changes to the configuration of the device. The configuration is defined
1052 * in frameworks/base/core/java/android/content/res/Configuration.java
1053 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1054 * Please go there to interpret the possible values each field can be.
1055 *
1056 * Logged from:
1057 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1058 */
1059message ResourceConfigurationChanged {
1060 // Bit mask of color capabilities of the screen.
1061 // Contains information about the color gamut and hdr mode of the screen.
1062 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001063 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001064
1065 // The target screen density being rendered to.
1066 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001067 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001068
1069 // Current user preference for the scaling factor for fonts,
1070 // relative to the base density scaling.
1071 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001072 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001073
1074 // Flag indicating whether the hard keyboard is hidden.
1075 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001076 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001077
1078 // The type of keyboard attached to the device.
1079 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1080 optional int32 keyboard = 5;
1081
1082 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1083 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001084 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001085
1086 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1087 // 0 if undefined.
1088 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1089 optional int32 mcc = 7;
1090
1091 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1092 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1093 // MNC_ZERO symbol defined in Configuration.java.
1094 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1095 optional int32 mnc = 8;
1096
1097 // The kind of navigation available on the device.
1098 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1099 optional int32 navigation = 9;
1100
1101 // Flag indicating whether the navigation is available.
1102 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001103 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001104
1105 // Overall orientation of the screen.
1106 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1107 optional int32 orientation = 11;
1108
1109 // The current height of the available screen space, in dp units.
1110 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001111 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001112
1113 // Bit mask of overall layout of the screen.
1114 // Contains information about screen size, whether the screen is wider/taller
1115 // than normal, whether the screen layout is right-tl-left or left-to-right,
1116 // and whether the screen has a rounded shape.
1117 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001118 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001119
1120 // Current width of the available screen space, in dp units.
1121 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001122 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001123
1124 // The smallest screen size an application will see in normal operation.
1125 // This is the smallest value of both screenWidthDp and screenHeightDp
1126 // in portrait and landscape.
1127 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001128 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001129
1130 // The type of touch screen attached to the device.
1131 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1132 optional int32 touchscreen = 16;
1133
1134 // Bit mask of the ui mode.
1135 // Contains information about the overall ui mode of the device.
1136 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1137 // Also contains information about whether the device is in night mode.
1138 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001139 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001140}
1141
Tej Singheee317b2018-03-07 19:28:05 -08001142
1143/**
1144 * Logs changes in the connection state of the mobile radio.
1145 *
1146 * Logged from:
1147 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1148 */
1149message MobileConnectionStateChanged {
1150 // States are from the state machine DataConnection.java.
1151 enum State {
1152 UNKNOWN = 0;
1153 // The connection is inactive, or disconnected.
1154 INACTIVE = 1;
1155 // The connection is being activated, or connecting.
1156 ACTIVATING = 2;
1157 // The connection is active, or connected.
1158 ACTIVE = 3;
1159 // The connection is disconnecting.
1160 DISCONNECTING = 4;
1161 // The connection is disconnecting after creating a connection.
1162 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1163 }
1164 optional State state = 1;
1165 // For multi-sim phones, this distinguishes between the sim cards.
1166 optional int32 sim_slot_index = 2;
1167 // Used to identify the connection. Starts at 0 and increments by 1 for
1168 // every new network created. Resets whenever the device reboots.
1169 optional int32 data_connection_id = 3;
1170 // A bitmask for the capabilities of this connection.
1171 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1172 // Default value (if we have no information): 0
1173 optional int64 capabilities = 4;
1174 // If this connection has internet.
1175 // This just checks if the DEFAULT bit of capabilities is set.
1176 optional bool has_internet = 5;
1177}
1178
1179/**
1180 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1181 *
1182 * Logged from:
1183 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1184 */
1185message MobileRadioTechnologyChanged {
1186 optional android.telephony.NetworkTypeEnum state = 1;
1187 // For multi-sim phones, this distinguishes between the sim cards.
1188 optional int32 sim_slot_index = 2;
1189}
1190
Andrew Chantb56388b2018-03-22 21:07:33 -07001191/**
1192 * Logs the VID and PID of any connected USB devices.
1193 *
1194 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1195 *
1196 * Logged by Vendor.
1197 */
1198message UsbDeviceAttached {
1199 optional int32 vid = 1;
1200 optional int32 pid = 2;
1201 optional bool has_audio = 3;
1202 optional bool has_hid = 4;
1203 optional bool has_storage = 5;
1204}
1205
Tej Singheee317b2018-03-07 19:28:05 -08001206
Tej Singhdd7bd352018-02-09 19:33:15 -08001207/**
Tej Singh5d991e12018-03-09 19:48:11 -08001208 * Logs when Bluetooth is enabled and disabled.
1209 *
1210 * Logged from:
1211 * services/core/java/com/android/server/BluetoothManagerService.java
1212 */
1213message BluetoothEnabledStateChanged {
1214 repeated AttributionNode attribution_node = 1;
1215 // Whether or not bluetooth is enabled on the device.
1216 enum State {
1217 UNKNOWN = 0;
1218 ENABLED = 1;
1219 DISABLED = 2;
1220 }
1221 optional State state = 2;
1222 // The reason for being enabled/disabled.
1223 // Eg. Airplane mode, crash, application request.
1224 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1225 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001226 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001227}
1228
1229/**
1230 * Logs when a Bluetooth device connects and disconnects.
1231 *
1232 * Logged from:
1233 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1234 */
1235message BluetoothConnectionStateChanged {
1236 // The state of the connection.
1237 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1238 optional android.bluetooth.ConnectionStateEnum state = 1;
1239 // An identifier that can be used to match connect and disconnect events.
1240 // Currently is last two bytes of a hash of a device level ID and
1241 // the mac address of the bluetooth device that is connected.
1242 optional int32 obfuscated_id = 2;
1243 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1244 // From android.bluetooth.BluetoothAdapter.java
1245 optional int32 bt_profile = 3;
1246}
1247
1248/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001249 * Logs when something is plugged into or removed from the USB-C connector.
1250 *
1251 * Logged from:
1252 * Vendor USB HAL.
1253 */
1254message UsbConnectorStateChanged {
1255 enum State {
1256 DISCONNECTED = 0;
1257 CONNECTED = 1;
1258 }
1259 optional State state = 1;
1260}
1261
1262/**
1263 * Logs the reported speaker impedance.
1264 *
1265 * Logged from:
1266 * Vendor audio implementation.
1267 */
1268message SpeakerImpedanceReported {
1269 optional int32 speaker_location = 1;
1270 optional int32 impedance = 2;
1271}
1272
1273/**
1274 * Logs the report of a failed hardware.
1275 *
1276 * Logged from:
1277 * Vendor HALs.
1278 *
1279 */
1280message HardwareFailed {
1281 enum HardwareType {
1282 HARDWARE_FAILED_UNKNOWN = 0;
1283 HARDWARE_FAILED_MICROPHONE = 1;
1284 HARDWARE_FAILED_CODEC = 2;
1285 HARDWARE_FAILED_SPEAKER = 3;
1286 HARDWARE_FAILED_FINGERPRINT = 4;
1287 }
1288 optional HardwareType hardware_type = 1;
1289
1290 /* hardware_location allows vendors to differentiate between multiple instances of
1291 * the same hardware_type. The specific locations are vendor defined integers,
1292 * referring to board-specific numbering schemes.
1293 */
1294 optional int32 hardware_location = 2;
1295
1296 /* failure_code is specific to the HardwareType of the failed hardware.
1297 * It should use the enum values defined below.
1298 */
1299 enum MicrophoneFailureCode {
1300 MICROPHONE_FAILURE_COMPLETE = 0;
1301 }
1302 enum CodecFailureCode {
1303 CODEC_FAILURE_COMPLETE = 0;
1304 }
1305 enum SpeakerFailureCode {
1306 SPEAKER_FAILURE_COMPLETE = 0;
1307 SPEAKER_FAILURE_HIGH_Z = 1;
1308 SPEAKER_FAILURE_SHORT = 2;
1309 }
1310 enum FingerprintFailureCode {
1311 FINGERPRINT_FAILURE_COMPLETE = 0;
1312 FINGERPRINT_SENSOR_BROKEN = 1;
1313 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1314 }
1315 optional int32 failure_code = 3;
1316}
1317
1318/**
1319 * Log an event when the device has been physically dropped.
1320 * Reported from the /vendor partition.
1321 */
1322message PhysicalDropDetected {
1323 // Confidence that the event was actually a drop, 0 -> 100
1324 optional int32 confidence_pctg = 1;
1325 // Peak acceleration of the drop, in 1/1000s of a g.
1326 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001327 // Duration of freefall in ms
1328 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001329}
1330
1331/**
1332 * Log bucketed battery charge cycles.
1333 *
1334 * Each bucket represents cycles of the battery past
1335 * a given charge point. For example, bucket 1 is the
1336 * lowest 1/8th of the battery, and bucket 8 is 100%.
1337 *
1338 * Logged from:
1339 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1340 */
1341message ChargeCyclesReported {
1342 optional int32 cycle_bucket_1 = 1;
1343 optional int32 cycle_bucket_2 = 2;
1344 optional int32 cycle_bucket_3 = 3;
1345 optional int32 cycle_bucket_4 = 4;
1346 optional int32 cycle_bucket_5 = 5;
1347 optional int32 cycle_bucket_6 = 6;
1348 optional int32 cycle_bucket_7 = 7;
1349 optional int32 cycle_bucket_8 = 8;
1350}
1351
1352/**
Howard Roa46b6582018-09-18 16:45:02 -07001353 * Log battery health snapshot.
1354 *
1355 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1356 * are snapshotted periodically over 24hrs.
1357 */
1358message BatteryHealthSnapshot {
1359 enum BatterySnapshotType {
1360 UNKNOWN = 0;
1361 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1362 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1363 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1364 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1365 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1366 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1367 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1368 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1369 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1370 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1371 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1372 }
1373 optional BatterySnapshotType type = 1;
1374 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001375 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001376 // Voltage Battery Voltage, in microVolts.
1377 optional int32 voltage_micro_volt = 3;
1378 // Current Battery current, in microAmps.
1379 optional int32 current_micro_amps = 4;
1380 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1381 optional int32 open_circuit_micro_volt = 5;
1382 // Resistance Battery Resistance, in microOhms.
1383 optional int32 resistance_micro_ohm = 6;
1384 // Level Battery Level, as % of full.
1385 optional int32 level_percent = 7;
1386}
1387
1388/**
1389 * Log slow I/O operations on the primary storage.
1390 */
1391message SlowIo {
1392 // Classifications of IO Operations.
1393 enum IoOperation {
1394 UNKNOWN = 0;
1395 READ = 1;
1396 WRITE = 2;
1397 UNMAP = 3;
1398 SYNC = 4;
1399 }
1400 optional IoOperation operation = 1;
1401
1402 // The number of slow IO operations of this type over 24 hours.
1403 optional int32 count = 2;
1404}
1405
1406/**
1407 * Log battery caused shutdown with the last recorded voltage.
1408 */
1409message BatteryCausedShutdown {
1410 // The last recorded battery voltage prior to shutdown.
1411 optional int32 last_recorded_micro_volt = 1;
1412}
1413
1414/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001415 * Logs the duration of a davey (jank of >=700ms) when it occurs
1416 *
1417 * Logged from:
1418 * frameworks/base/libs/hwui/JankTracker.cpp
1419 */
1420message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001421 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001422 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001423
Tej Singhbb8554a2018-01-26 11:59:14 -08001424 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001425 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001426}
1427
1428/**
Bookatze5885242017-10-24 20:10:31 -07001429 * Logs phone signal strength changes.
1430 *
1431 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001432 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001433 */
1434message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001435 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1436 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001437}
1438
Yangster4ccebea2018-10-09 17:09:02 -07001439
1440/**
1441 * Logs when the phone state, sim state or signal strength changes
1442 *
1443 * Logged from:
1444 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1445 */
1446message PhoneServiceStateChanged {
1447 optional android.telephony.ServiceStateEnum state = 1;
1448 optional android.telephony.SimStateEnum sim_state = 2;
1449 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1450}
1451
1452/**
1453 * Logs when the phone becomes on or off.
1454 *
1455 * Logged from:
1456 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1457 */
1458message PhoneStateChanged {
1459 enum State {
1460 OFF = 0;
1461 ON = 1;
1462 }
1463 optional State state = 1;
1464}
1465
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001466message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001467 optional android.stats.launcher.LauncherAction action = 1;
1468 optional android.stats.launcher.LauncherState src_state = 2;
1469 optional android.stats.launcher.LauncherState dst_state = 3;
1470 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001471 optional bool is_swipe_up_enabled = 5;
1472}
1473
David Chenc28b2bb2017-10-24 12:52:52 -07001474/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001475 * Logs when Settings UI has changed.
1476 *
1477 * Logged from:
1478 * packages/apps/Settings
1479 */
1480message SettingsUIChanged {
1481 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001482 * Where this SettingsUIChange event comes from. For example, if
1483 * it's a PAGE_VISIBLE event, where the page is opened from.
1484 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001485 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001486
1487 /**
1488 * What the UI action is.
1489 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001490 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001491
1492 /**
1493 * Where the action is happening
1494 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001495 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001496
1497 /**
1498 * What preference changed in this event.
1499 */
1500 optional string changedPreferenceKey = 4;
1501
1502 /**
1503 * The new value of the changed preference.
1504 */
1505 optional int64 changedPreferenceIntValue = 5;
1506}
1507
1508/**
David Chenc28b2bb2017-10-24 12:52:52 -07001509 * Logs that a setting was updated.
1510 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001511 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001512 * The tag and is_default allow resetting of settings to default values based on the specified
1513 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1514 */
1515message SettingChanged {
1516 // The name of the setting.
1517 optional string setting = 1;
1518
1519 // The change being imposed on this setting. May represent a number, eg "3".
1520 optional string value = 2;
1521
1522 // The new value of this setting. For most settings, this is same as value. For some settings,
1523 // value is +X or -X where X represents an element in a set. For example, if the previous value
1524 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1525 // The +/- feature is currently only used for location_providers_allowed.
1526 optional string new_value = 3;
1527
1528 // The previous value of this setting.
1529 optional string prev_value = 4;
1530
1531 // The tag used with the is_default for resetting sets of settings. This is generally null.
1532 optional string tag = 5;
1533
Bookatz90867622018-01-31 15:05:57 -08001534 // True if this setting with tag should be resettable.
1535 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001536
David Chenbd789912018-03-16 17:19:55 -07001537 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001538 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001539
1540 enum ChangeReason {
1541 UPDATED = 1; // Updated can be an insertion or an update.
1542 DELETED = 2;
1543 }
1544 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001545}
Chenjie Yub3dda412017-10-24 13:41:59 -07001546
Chenjie Yu05013b32017-11-21 10:21:41 -08001547/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001548 * Logs activity going to foreground or background
1549 *
1550 * Logged from:
1551 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1552 */
1553message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001554 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001555 optional string pkg_name = 2;
1556 optional string class_name = 3;
1557
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001558 enum State {
1559 BACKGROUND = 0;
1560 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001561 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001562 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001563}
David Chenc8a43242017-10-17 16:23:28 -07001564
1565/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001566 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001567 * Logged from:
1568 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1569 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001570message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001571 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001572
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001573 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001574
1575 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001576 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001577 optional string process_name = 3;
1578
1579 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001580 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001581
1582 optional string package_name = 5;
1583
1584 enum InstantApp {
1585 UNAVAILABLE = 0;
1586 FALSE = 1;
1587 TRUE = 2;
1588 }
1589 optional InstantApp is_instant_app = 6;
1590
1591 enum ForegroundState {
1592 UNKNOWN = 0;
1593 BACKGROUND = 1;
1594 FOREGROUND = 2;
1595 }
1596 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001597}
David Chen9e3808c2017-11-20 17:25:34 -08001598
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001599/**
1600 * Logs when a WTF (What a Terrible Failure) happened.
1601 * Logged from:
1602 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1603 */
1604message WTFOccurred {
1605 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001606
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001607 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001608
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001609 // The name of the process.
1610 // system_server if it is not by an app
1611 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001612
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001613 // The pid if available. -1 means not available.
1614 optional sint32 pid = 4;
1615}
1616
1617/**
1618 * Logs when system server reports low memory.
1619 * Logged from:
1620 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1621 */
1622message LowMemReported {
1623}
1624
1625/**
1626 * Logs when an app ANR (App Not Responding) occurs.
1627 * Logged from:
1628 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1629 */
1630message ANROccurred {
1631 optional int32 uid = 1 [(is_uid) = true];
1632
1633 optional string process_name = 2;
1634
1635 optional string short_component_name = 3;
1636
1637 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001638
1639 enum InstantApp {
1640 UNAVAILABLE = 0;
1641 FALSE = 1;
1642 TRUE = 2;
1643 }
1644 optional InstantApp is_instant_app = 5;
1645
1646 enum ForegroundState {
1647 UNKNOWN = 0;
1648 BACKGROUND = 1;
1649 FOREGROUND = 2;
1650 }
1651 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001652}
1653
Bookatza7020bd2018-08-28 16:29:35 -07001654/**
1655 * Logs when the vibrator state changes.
1656 * Logged from:
1657 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1658 */
1659message VibratorStateChanged {
1660 repeated AttributionNode attribution_node = 1;
1661
1662 enum State {
1663 OFF = 0;
1664 ON = 1;
1665 }
1666 optional State state = 2;
1667
1668 // Duration (in milliseconds) requested to keep the vibrator on.
1669 // Only applicable for State == ON.
1670 optional int64 duration_millis = 3;
1671}
1672
David Chen0a368b22017-12-06 16:28:16 -08001673/*
1674 * Allows other apps to push events into statsd.
1675 * Logged from:
1676 * frameworks/base/core/java/android/util/StatsLog.java
1677 */
David Chen0b5c90c2018-01-25 16:51:49 -08001678message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001679 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001680 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001681
1682 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1683 optional int32 label = 2;
1684
1685 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1686 // predicates for the metrics).
1687 enum State {
1688 UNKNOWN = 0;
1689 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1690 STOP = 2;
1691 START = 3;
1692 }
1693 optional State state = 3;
1694}
1695
David Chen9e3808c2017-11-20 17:25:34 -08001696/**
Bookatz7948c872018-09-04 12:58:33 -07001697 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1698 * For example, this could be due to the user manually changing the time.
1699 *
1700 * Logged from:
1701 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1702 */
1703message WallClockTimeShifted {
1704 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1705 optional int64 wall_clock_timestamp_millis = 1;
1706}
1707
1708/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001709 * Logs when statsd detects an anomaly.
1710 *
1711 * Logged from:
1712 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1713 */
1714message AnomalyDetected {
1715 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001716 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001717
Yangster-mac94e197c2018-01-02 16:03:03 -08001718 // Id of the config whose anomaly detection alert fired.
1719 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001720
Yangster-mac94e197c2018-01-02 16:03:03 -08001721 // Id of the alert (i.e. name of the anomaly that was detected).
1722 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001723}
1724
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001725message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001726 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001727 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001728
1729 // The app package name.
1730 optional string pkg_name = 2;
1731
1732 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001733 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001734 WARM = 1;
1735 HOT = 2;
1736 COLD = 3;
1737 }
1738 // The transition type.
1739 optional TransitionType type = 3;
1740
1741 // The activity name.
1742 optional string activity_name = 4;
1743
1744 // The name of the calling app. Empty if not set.
1745 optional string calling_pkg_name = 5;
1746
1747 // Whether the app is an instant app.
1748 optional bool is_instant_app = 6;
1749
1750 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001751 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001752
Bookatz80d11a02018-01-16 10:46:35 -08001753 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001754
David Chen0b5c90c2018-01-25 16:51:49 -08001755 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001756 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001757 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001758 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001759 optional int32 bind_application_delay_millis = 11;
1760 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001761
1762 // Empty if not set.
1763 optional string launch_token = 13;
1764
Calin Juravle759fbda2018-02-20 19:52:30 +00001765 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001766 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001767
1768 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001769 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001770}
1771
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001772message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001773 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001774 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001775
1776 // The app package name.
1777 optional string pkg_name = 2;
1778
1779 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001780 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001781 WARM = 1;
1782 HOT = 2;
1783 COLD = 3;
1784 }
1785 // The transition type.
1786 optional TransitionType type = 3;
1787
1788 // The activity name.
1789 optional string activity_name = 4;
1790}
1791
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001792message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001793 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001794 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001795
1796 // The app package name.
1797 optional string pkg_name = 2;
1798
1799 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001800 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001801 WITH_BUNDLE = 1;
1802 WITHOUT_BUNDLE = 2;
1803 }
1804 // The transition type.
1805 optional TransitionType type = 3;
1806
1807 // The activity name.
1808 optional string activity_name = 4;
1809
1810 optional bool transition_process_running = 5;
1811
1812 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001813 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001814}
1815
Bookatz8fcd09a2017-12-18 13:01:10 -08001816/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001817 * Logs a picture-in-picture action
1818 * Logged from:
1819 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1820 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1821 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1822 */
1823message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001824 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001825 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001826
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001827 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001828
Chenjie Yu52cacc62017-12-08 18:11:45 -08001829 enum State {
1830 ENTERED = 1;
1831 EXPANDED_TO_FULL_SCREEN = 2;
1832 MINIMIZED = 3;
1833 DISMISSED = 4;
1834 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001835 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001836}
1837
1838/**
Chenjie Yue8904192017-12-08 19:12:57 -08001839 * Logs overlay action
1840 * Logged from:
1841 * services/core/java/com/android/server/wm/Session.java
1842 */
1843message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001844 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001845
1846 optional string package_name = 2;
1847
1848 optional bool using_alert_window = 3;
1849
1850 enum State {
1851 ENTERED = 1;
1852 EXITED = 2;
1853 }
1854 optional State state = 4;
1855}
1856
Chenjie Yuccfe6452018-01-30 11:33:21 -08001857/*
1858 * Logs foreground service starts and stops.
1859 * Note that this is not when a service starts or stops, but when it is
1860 * considered foreground.
1861 * Logged from
1862 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1863 */
1864message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001865 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001866 // package_name + "/" + class_name
1867 optional string short_name = 2;
1868
1869 enum State {
1870 ENTER = 1;
1871 EXIT = 2;
1872 }
1873 optional State state = 3;
1874}
1875
Chenjie Yue8904192017-12-08 19:12:57 -08001876/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001877 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1878 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1879 * attributed back to the parent (host) uid. One example is Chrome.
1880 *
1881 * Logged from:
1882 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1883 */
1884message IsolatedUidChanged {
1885 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001886 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001887 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001888 optional int32 parent_uid = 1;
1889
1890 optional int32 isolated_uid = 2;
1891
1892 // We expect an isolated uid to be removed before if it's used for another parent uid.
1893 enum Event {
1894 REMOVED = 0;
1895 CREATED = 1;
1896 }
1897 optional Event event = 3;
1898}
1899
1900/*
1901 * Logs the reception of an incoming network packet causing the main system to wake up for
1902 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1903 * and processed by WakeupController.cpp.
1904 */
1905message PacketWakeupOccurred {
1906 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1907 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001908 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001909 // The interface name on which the packet was received.
1910 optional string iface = 2;
1911 // The ethertype value of the packet.
1912 optional int32 ethertype = 3;
1913 // String representation of the destination MAC address of the packet.
1914 optional string destination_hardware_address = 4;
1915 // String representation of the source address of the packet if this was an IP packet.
1916 optional string source_ip = 5;
1917 // String representation of the destination address of the packet if this was an IP packet.
1918 optional string destination_ip = 6;
1919 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1920 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1921 // families.
1922 optional int32 ip_next_header = 7;
1923 // The source port if this was a TCP or UDP packet.
1924 optional int32 source_port = 8;
1925 // The destination port if this was a TCP or UDP packet.
1926 optional int32 destination_port = 9;
1927}
1928
1929/*
1930 * Logs the memory stats for an app on startup.
1931 * Logged from:
1932 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1933 */
1934message AppStartMemoryStateCaptured {
1935 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001936 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001937
1938 // The process name.
1939 optional string process_name = 2;
1940
1941 // The activity name.
1942 optional string activity_name = 3;
1943
1944 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001945 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001946
1947 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001948 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001949
1950 // RSS
1951 optional int64 rss_in_bytes = 6;
1952
1953 // CACHE
1954 optional int64 cache_in_bytes = 7;
1955
1956 // SWAP
1957 optional int64 swap_in_bytes = 8;
1958}
1959
1960/*
1961 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1962 * for LMK event.
1963 * Logged from:
1964 * system/core/lmkd/lmkd.c
1965 */
1966message LmkStateChanged {
1967 enum State {
1968 UNKNOWN = 0;
1969 START = 1;
1970 STOP = 2;
1971 }
1972 optional State state = 1;
1973}
1974
1975/*
1976 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1977 * Logged from:
1978 * system/core/lmkd/lmkd.c
1979 */
1980message LmkKillOccurred {
1981 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001982 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001983
1984 // The process name.
1985 optional string process_name = 2;
1986
1987 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07001988 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001989
1990 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001991 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001992
1993 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001994 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001995
1996 // RSS
1997 optional int64 rss_in_bytes = 6;
1998
1999 // CACHE
2000 optional int64 cache_in_bytes = 7;
2001
2002 // SWAP
2003 optional int64 swap_in_bytes = 8;
2004}
2005
Rajeev Kumar51b54602018-03-01 12:18:26 -08002006/*
2007 * Logs when the ActivityManagerService detects that an app died.
2008 *
2009 * Logged from:
2010 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2011 */
2012message AppDied {
2013 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002014 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002015}
2016
Howard Ro21a039c2018-08-06 14:55:47 -07002017/**
2018 * An atom for generic metrics logging. Available from Android Q.
2019 */
2020message GenericAtom {
2021 // The uid of the application that sent this custom atom.
2022 optional int32 uid = 1 [(is_uid) = true];
2023
2024 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002025 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002026}
2027
Tej Singhd6d6d772018-09-05 17:41:25 -07002028/**
2029 * Logs when a fingerprint acquire event occurs.
2030 *
2031 * Logged from:
2032 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2033 */
2034message FingerprintAcquired {
2035 // The associated user. Eg: 0 for owners, 10+ for others.
2036 // Defined in android/os/UserHandle.java
2037 optional int32 user = 1;
2038 // If this acquire is for a crypto fingerprint.
2039 // e.g. Secure purchases, unlock password storage.
2040 optional bool is_crypto = 2;
2041}
2042
2043/**
2044 * Logs when a fingerprint authentication event occurs.
2045 *
2046 * Logged from:
2047 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2048 */
2049message FingerprintAuthenticated {
2050 // The associated user. Eg: 0 for owners, 10+ for others.
2051 // Defined in android/os/UserHandle.java
2052 optional int32 user = 1;
2053 // If this authentication is for a crypto fingerprint.
2054 // e.g. Secure purchases, unlock password storage.
2055 optional bool is_crypto = 2;
2056 // Whether or not this authentication was successful.
2057 optional bool is_authenticated = 3;
2058}
2059
2060/**
2061 * Logs when a fingerprint error occurs.
2062 *
2063 * Logged from:
2064 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2065 */
2066message FingerprintErrorOccurred {
2067 // The associated user. Eg: 0 for owners, 10+ for others.
2068 // Defined in android/os/UserHandle.java
2069 optional int32 user = 1;
2070 // If this error is for a crypto fingerprint.
2071 // e.g. Secure purchases, unlock password storage.
2072 optional bool is_crypto = 2;
2073
2074 enum Error {
2075 UNKNOWN = 0;
2076 LOCKOUT = 1;
2077 PERMANENT_LOCKOUT = 2;
2078 }
2079 // The type of error.
2080 optional Error error = 3;
2081}
Howard Ro688ae182018-09-25 00:09:36 -07002082
2083message Notification {
2084
2085 // Type of notification event.
2086 enum Type {
2087 TYPE_UNKNOWN = 0;
2088 // Notification became visible to the user.
2089 TYPE_OPEN = 1;
2090 // Notification became hidden.
2091 TYPE_CLOSE = 2;
2092 // Notification switched to detail mode.
2093 TYPE_DETAIL = 3;
2094 // Notification was clicked.
2095 TYPE_ACTION = 4;
2096 // Notification was dismissed.
2097 TYPE_DISMISS = 5;
2098 // Notification switched to summary mode. The enum value of 14 is to
2099 // match that of metrics_constants.
2100 TYPE_COLLAPSE = 14;
2101 }
2102 optional Type type = 1;
2103
2104 // Package name associated with the notification.
2105 optional string package_name = 2;
2106
2107 // Tag associated with notification.
2108 optional string tag = 3;
2109
2110 // Application-supplied ID associated with the notification.
2111 optional int32 id = 4;
2112
2113 // Index of notification in the notification panel.
2114 optional int32 shade_index = 5;
2115
2116 // The number of notifications in the notification panel.
2117 optional int32 shade_count = 6;
2118
2119 // Importance for the notification.
2120 optional int32 importance = 7;
2121
2122 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002123 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002124
2125 // Importance for the notification channel.
2126 optional int32 channel_importance = 9;
2127
Howard Ro183c2bd2018-10-18 13:52:10 -07002128 // Application-supplied ID associated with the notifications group.
2129 optional string group_id = 10;
2130
Howard Ro688ae182018-09-25 00:09:36 -07002131 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002132 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002133
Howard Ro183c2bd2018-10-18 13:52:10 -07002134 // Reason for dismissal of a notification. This field is only meaningful for
2135 // TYPE_DISMISS events.
2136 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002137
Howard Ro183c2bd2018-10-18 13:52:10 -07002138 // The first post time of notification, stable across updates.
2139 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002140
Howard Ro183c2bd2018-10-18 13:52:10 -07002141 // The most recent interruption time, or the creation time if no updates.
2142 // Differs from update_millis because updates are filtered based on whether
2143 // they actually interrupted the user.
2144 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002145
Howard Ro183c2bd2018-10-18 13:52:10 -07002146 // The most recent update time, or the creation time if no updates.
2147 optional int64 update_millis = 15;
2148
2149 // The most recent visibility event.
2150 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002151}
2152
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002153/*
Yangster-macb89807e2018-11-15 21:10:57 -08002154 * Logs when a flag flip state changes.
2155 * Logged in P/h.
2156 */
2157message PhenotypeFlagStateChanged {
2158 // Mendel configuration name.
2159 optional string mendel_config_name = 1;
2160 // State
2161 enum State {
2162 STATE_UNKNOWN = 0;
2163 COMMITTED = 1;
2164 }
2165 optional State state = 2;
2166}
2167
2168/*
2169 * Logs when a binary push state changes.
2170 * Logged in Play store
2171 */
2172message BinaryPushStateChanged {
2173 // Binary package name.
2174 optional string binary_name = 1;
2175 // Version code.
2176 optional int64 version = 2;
2177 // State
2178 enum State {
2179 STATE_UNKNOWN = 0;
2180 DOWNLOAD_START = 1;
2181 DOWNLOAD_DONE = 2;
2182 INSTALL_START = 3;
2183 INSTALL_DONE = 4;
2184 REBOOT_START = 5;
2185 REBOOT_DONE = 6;
2186 }
2187 optional State state = 3;
2188}
2189
2190/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002191 * Logs when a connection becomes available and lost.
2192 * Logged in StatsCompanionService.java
2193 */
2194message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002195 // Id of the network.
2196 optional int32 net_id = 1;
2197
2198 enum State {
2199 UNKNOWN = 0;
2200 CONNECTED = 1;
2201 DISCONNECTED = 2;
2202 }
2203 // Connected state of a network.
2204 optional State state = 2;
2205}
2206
2207/**
2208 * Logs when a service starts and stops.
2209 * Logged from:
2210 * services/core/java/com/android/server/am/ActiveServices.java
2211 */
2212message ServiceStateChanged {
2213
2214 optional int32 uid = 1 [(is_uid) = true];
2215
2216 optional string package_name = 2;
2217
2218 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002219
2220 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002221 START = 1;
2222 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002223 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002224
2225 optional State state = 4;
2226}
2227
2228/**
2229 * Logs when a service is launched.
2230 * Logged from:
2231 * services/core/java/com/android/server/am/ActiveServices.java
2232 */
2233message ServiceLaunchReported {
2234
2235 optional int32 uid = 1 [(is_uid) = true];
2236
2237 optional string package_name = 2;
2238
2239 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002240}
Howard Ro688ae182018-09-25 00:09:36 -07002241
Chenjie Yubbcbc602018-02-05 16:51:52 -08002242//////////////////////////////////////////////////////////////////////
2243// Pulled atoms below this line //
2244//////////////////////////////////////////////////////////////////////
2245
2246/**
David Chenc8a43242017-10-17 16:23:28 -07002247 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2248 *
2249 * Pulled from:
2250 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2251 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002252message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002253 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002254
2255 optional int64 rx_bytes = 2;
2256
2257 optional int64 rx_packets = 3;
2258
2259 optional int64 tx_bytes = 4;
2260
2261 optional int64 tx_packets = 5;
2262}
2263
2264/**
2265 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2266 *
2267 * Pulled from:
2268 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2269 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002270message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002271 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002272
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002273 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2274 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002275
2276 optional int64 rx_bytes = 3;
2277
2278 optional int64 rx_packets = 4;
2279
2280 optional int64 tx_bytes = 5;
2281
2282 optional int64 tx_packets = 6;
2283}
2284
2285/**
2286 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2287 *
2288 * Pulled from:
2289 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2290 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002291message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002292 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002293
2294 optional int64 rx_bytes = 2;
2295
2296 optional int64 rx_packets = 3;
2297
2298 optional int64 tx_bytes = 4;
2299
2300 optional int64 tx_packets = 5;
2301}
2302
2303/**
2304 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2305 *
2306 * Pulled from:
2307 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2308 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002309message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002310 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002311
Yao Chenc40a19d2018-03-15 16:48:25 -07002312 // 1 denotes foreground and 0 denotes background. This is called Set in
2313 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002314 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002315
2316 optional int64 rx_bytes = 3;
2317
2318 optional int64 rx_packets = 4;
2319
2320 optional int64 tx_bytes = 5;
2321
2322 optional int64 tx_packets = 6;
2323}
2324
2325/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002326 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2327 *
2328 * Pulled from:
2329 * StatsCompanionService
2330 */
2331message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002332 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002333
2334 optional int64 rx_bytes = 2;
2335
2336 optional int64 tx_bytes = 3;
2337}
2338
2339/**
David Chenc8a43242017-10-17 16:23:28 -07002340 * Pulls the kernel wakelock durations. This atom is adapted from
2341 * android/internal/os/KernelWakelockStats.java
2342 *
2343 * Pulled from:
2344 * StatsCompanionService using KernelWakelockReader.
2345 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002346message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002347 optional string name = 1;
2348
2349 optional int32 count = 2;
2350
2351 optional int32 version = 3;
2352
Yangster-maca8a30442018-10-13 23:46:34 -07002353 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002354}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002355
Chenjie Yu05013b32017-11-21 10:21:41 -08002356/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002357 * Pulls low power state information. This includes platform and subsystem sleep state information,
2358 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002359 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002360 * hardware/interfaces/power/1.1/types.hal
2361 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002362message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002363 // Subsystem name
2364 optional string subsystem_name = 1;
2365 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2366 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2367 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002368 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002369 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002370 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002371 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002372}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002373
Chenjie Yu05013b32017-11-21 10:21:41 -08002374/**
Bookatz92da2832018-11-01 18:10:03 -07002375 * Pulls on-device power measurement information.
2376 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2377 * Pulled from:
2378 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2379 */
2380message OnDevicePowerMeasurement {
2381 // Name of the subsystem (to which the rail belongs).
2382 optional string subsystem_name = 1;
2383
2384 // Rail name. The rail lies within the subsystem.
2385 optional string rail_name = 2;
2386
2387 // Time (in ms since boot) at which the rail energy value was measured.
2388 // This may differ slightly from the time that statsd logs this information.
2389 optional uint64 measurement_timestamp_millis = 3;
2390
2391 // Accumulated energy used via the rail since device boot in uWs.
2392 optional uint64 energy_microwatt_secs = 4;
2393}
2394
2395/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002396 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002397 * Pulls the time the cpu spend on the frequency index. Frequency index
2398 * starts from highest to lowest. The value should be monotonically
2399 * increasing since boot. However, if there is a cpu
2400 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002401 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002402message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002403 optional uint32 cluster = 1;
2404 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002405 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002406}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002407
Chenjie Yu05013b32017-11-21 10:21:41 -08002408/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002409 * Pulls Cpu Time Per Uid.
2410 * Note that isolated process uid time should be attributed to host uids.
2411 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002412message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002413 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002414 optional uint64 user_time_millis = 2;
2415 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002416}
2417
2418/**
2419 * Pulls Cpu Time Per Uid per frequency.
2420 * Note that isolated process uid time should be attributed to host uids.
2421 * For each uid, we order the time by descending frequencies.
2422 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002423message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002424 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002425 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002426 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002427}
Hugo Benichi884970e2017-11-14 22:42:46 +09002428
Chenjie Yu05013b32017-11-21 10:21:41 -08002429/**
2430 * Pulls Wifi Controller Activity Energy Info
2431 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002432message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002433 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002434 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002435 // stack reported state
2436 // TODO: replace this with proto enum
2437 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002438 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002439 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002440 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002441 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002442 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002443 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002444 // product of current(mA), voltage(V) and time(ms)
2445 optional uint64 controller_energy_used = 6;
2446}
2447
2448/**
2449 * Pulls Modem Activity Energy Info
2450 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002451message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002452 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002453 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002454 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002455 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002456 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002457 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002458 /**
2459 * Tx power index
2460 * index 0 = tx_power < 0dBm
2461 * index 1 = 0dBm < tx_power < 5dBm
2462 * index 2 = 5dBm < tx_power < 15dBm
2463 * index 3 = 15dBm < tx_power < 20dBm
2464 * index 4 = tx_power > 20dBm
2465 */
2466 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002467 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002468 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002469 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002470 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002471 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002472 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002473 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002474 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002475 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002476 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002477 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002478 // product of current(mA), voltage(V) and time(ms)
2479 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002480}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002481
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002482/**
2483 * Pulls Bluetooth Activity Energy Info
2484 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2485 */
2486message BluetoothActivityInfo {
2487 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002488 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002489 // bluetooth stack state
2490 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002491 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002492 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002493 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002494 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002495 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002496 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002497 // product of current(mA), voltage(V) and time(ms)
2498 optional uint64 energy_used = 6;
2499}
2500
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002501/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002502 * Logs the memory stats for a process.
2503 */
2504message ProcessMemoryState {
2505 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002506 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002507
2508 // The process name.
2509 optional string process_name = 2;
2510
2511 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002512 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002513
2514 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002515 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002516
2517 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002518 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002519
Rajeev Kumar90235992018-01-29 11:06:48 -08002520 // RSS
2521 optional int64 rss_in_bytes = 6;
2522
2523 // CACHE
2524 optional int64 cache_in_bytes = 7;
2525
2526 // SWAP
2527 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002528
2529 // RSS high watermark.
2530 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2531 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2532 optional int64 rss_high_watermark_in_bytes = 9;
Rafal Slawik272a8162018-11-01 15:12:28 +00002533
2534 // Elapsed real time when the process started.
2535 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2536 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002537}
2538
2539/*
Rafal Slawik08621582018-10-15 14:53:07 +01002540 * Logs the memory stats for a native process (from procfs).
2541 */
2542message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002543 // The uid if available. -1 means not available.
2544 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002545
Rafal Slawikbf67d072018-10-23 11:07:54 +01002546 // The process name.
2547 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002548
Rafal Slawikbf67d072018-10-23 11:07:54 +01002549 // # of page-faults
2550 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002551
Rafal Slawikbf67d072018-10-23 11:07:54 +01002552 // # of major page-faults
2553 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002554
Rafal Slawikbf67d072018-10-23 11:07:54 +01002555 // RSS
2556 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002557
Rafal Slawikbf67d072018-10-23 11:07:54 +01002558 // RSS high watermark.
2559 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
2560 optional int64 rss_high_watermark_in_bytes = 6;
2561
2562 // Elapsed real time when the process started.
2563 // Value is read from /proc/PID/stat, field 22.
2564 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002565}
2566
2567/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002568 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002569 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002570message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002571 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002572}
2573
2574/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002575 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002576 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002577message SystemUptime {
2578 // Milliseconds since the system was booted.
2579 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2580 // for external input).
2581 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002582 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002583}
2584
2585/*
2586 * Reads from /proc/uid_concurrent_active_time which has the format:
2587 * active: X (X is # cores)
2588 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2589 * [uid1]: [time-0] [time-1] [time-2] ... ...
2590 * ...
2591 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2592 * The file contains a monotonically increasing count of time for a single boot.
2593 */
2594message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002595 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002596 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002597}
2598
2599/**
2600 * Reads from /proc/uid_concurrent_policy_time which has the format:
2601 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2602 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2603 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2604 * ...
2605 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2606 * The file contains a monotonically increasing count of time for a single boot.
2607 */
2608message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002609 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002610 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002611 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002612}
2613
2614/*
2615 * Pulls free disk space, for data, system partition and temporary directory.
2616 */
2617message DiskSpace {
2618 // available bytes in data partition
2619 optional uint64 data_available_bytes = 1;
2620 // available bytes in system partition
2621 optional uint64 system_available_bytes = 2;
2622 // available bytes in download cache or temp directories
2623 optional uint64 temp_available_bytes = 3;
2624}
Tej Singhbf972d92018-01-10 20:51:13 -08002625
2626/**
2627 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002628 * Pulled from:
2629 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002630 */
2631message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002632 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002633}
2634
2635/**
2636 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002637 * Pulled from:
2638 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002639 */
2640message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002641 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002642}
2643
2644/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002645 * Pulls battery voltage.
2646 * Pulled from:
2647 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2648 */
2649message BatteryVoltage {
2650 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002651 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002652}
2653
2654/**
Tej Singhd89137e2018-03-26 14:51:40 -07002655 * Pulls the temperature of various parts of the device.
2656 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002657 *
2658 * Pulled from:
2659 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2660 */
2661message Temperature {
2662 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2663 optional android.os.TemperatureTypeEnum sensor_location = 1;
2664
2665 // The name of the temperature source. Eg. CPU0
2666 optional string sensor_name = 2;
2667
Tej Singhd89137e2018-03-26 14:51:40 -07002668 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002669 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002670}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002671
2672/**
2673 * Pulls the statistics of calls to Binder.
2674 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002675 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2676 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002677 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002678 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002679 */
2680message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002681 // UID of the process responsible for the binder transaction. It will be set if the process
2682 // executing the binder transaction attribute the transaction to another uid using
2683 // Binder.setThreadWorkSource().
2684 //
2685 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002686 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002687 // UID of the process executing the binder transaction.
2688 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002689 // Fully qualified class name of the API call.
2690 //
2691 // This is a system server class name.
2692 //
2693 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2694 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2695 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2696 // commonly used APIs.
2697 optional string service_class_name = 2;
2698 // Method name of the API call. It can also be a transaction code if we cannot
2699 // resolve it to a name. See Binder#getTransactionName.
2700 //
2701 // This is a system server method name.
2702 optional string service_method_name = 3;
2703 // Total number of API calls.
2704 optional int64 call_count = 4;
2705 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2706 optional bool screen_interactive = 13;
2707 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2708 // call_count will be equal to recorded_call_count.
2709 //
2710 // If recorded_call_count is different than call_count, it means data collection has been
2711 // sampled. All the fields below will be sampled in this case.
2712 optional int64 recorded_call_count = 12;
2713 // Number of exceptions thrown by the API.
2714 optional int64 recorded_exception_count = 5;
2715 // Total latency of all API calls.
2716 // Average can be computed using total_latency_micros / recorded_call_count.
2717 optional int64 recorded_total_latency_micros = 6;
2718 // Maximum latency of one API call.
2719 optional int64 recorded_max_latency_micros = 7;
2720 // Total CPU usage of all API calls.
2721 // Average can be computed using total_cpu_micros / recorded_call_count.
2722 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2723 optional int64 recorded_total_cpu_micros = 8;
2724 // Maximum CPU usage of one API call.
2725 optional int64 recorded_max_cpu_micros = 9;
2726 // Maximum parcel reply size of one API call.
2727 optional int64 recorded_max_reply_size_bytes = 10;
2728 // Maximum parcel request size of one API call.
2729 optional int64 recorded_max_request_size_bytes = 11;
2730}
2731
2732/**
2733 * Pulls the statistics of exceptions during calls to Binder.
2734 *
2735 * Binder stats are cumulative from boot unless somebody reset the data using
2736 * > adb shell dumpsys binder_calls_stats --reset
2737 */
2738message BinderCallsExceptions {
2739 // Exception class name, e.g. java.lang.IllegalArgumentException.
2740 //
2741 // This is an exception class name thrown by the system server.
2742 optional string exception_class_name = 1;
2743 // Total number of exceptions.
2744 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002745}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002746
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002747/**
2748 * Pulls the statistics of message dispatching on HandlerThreads.
2749 *
2750 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2751 * config on the device.
2752 *
2753 * Next tag: 11
2754 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002755message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002756 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002757 optional int32 uid = 1 [(is_uid) = true];
2758
2759 // Fully qualified class name of the handler target class.
2760 //
2761 // This field does not contain PII. This is a system server class name.
2762 optional string handler_class_name = 2;
2763
2764 // The name of the thread that runs the Looper.
2765 //
2766 // This field does not contain PII. This is a system server thread name.
2767 optional string looper_thread_name = 3;
2768
2769 // The name of the dispatched message.
2770 //
2771 // This field does not contain PII. This is a system server constant or class
2772 // name.
2773 optional string message_name = 4;
2774
2775 // Total number of successfully dispatched messages.
2776 optional int64 message_count = 5;
2777
2778 // Total number of messages that failed dispatching.
2779 optional int64 exception_count = 6;
2780
2781 // Total number of processed messages we have data recorded for. If we
2782 // collected data for all the messages, message_count will be equal to
2783 // recorded_message_count.
2784 //
2785 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002786 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002787 optional int64 recorded_message_count = 7;
2788
2789 // Total latency of all processed messages.
2790 // Average can be computed using recorded_total_latency_micros /
2791 // recorded_message_count.
2792 optional int64 recorded_total_latency_micros = 8;
2793
2794 // Total CPU usage of all processed message.
2795 // Average can be computed using recorded_total_cpu_micros /
2796 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002797 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002798 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002799
2800 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2801 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002802
2803 // Max recorded CPU usage of all processed messages.
2804 optional int64 recorded_max_cpu_micros = 11;
2805
2806 // Max recorded latency of all processed messages.
2807 optional int64 recorded_max_latency_micros = 12;
2808
2809 // Total number of messages we tracked the dispatching delay for. If we
2810 // collected data for all the messages, message_count will be equal to
2811 // recorded_delay_message_count.
2812 //
2813 // If recorded_delay_message_count is different than message_count, it means data
2814 // collection has been sampled or/and not all messages specified the target dispatch time.
2815 // The fields below will be sampled in this case.
2816 optional int64 recorded_delay_message_count = 13;
2817
2818 // Total dispatching delay of all processed messages.
2819 // Calculated as a difference between the target dispatching time (Message.when)
2820 // and the actual dispatching time.
2821 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2822 optional int64 recorded_total_delay_millis = 14;
2823
2824 // Max dispatching delay of all processed messages.
2825 // Calculated as a difference between the target dispatching time (Message.when)
2826 // and the actual dispatching time.
2827 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002828}
Tej Singh86dc9db2018-09-06 00:39:57 +00002829
2830/**
2831 * Pulls disk information, such as write speed and latency.
2832 */
2833message DiskStats {
2834 // Time taken to open, write 512B to, and close a file.
2835 // -1 if error performing the check.
2836 optional int64 data_write_latency_millis = 1;
2837
2838 optional bool file_based_encryption = 2;
2839
2840 // Recent disk write speed in kB/s.
2841 // -1 if error querying storageed.
2842 // 0 if data is unavailable.
2843 optional int32 recent_disk_write_speed = 3;
2844}
2845
2846
2847/**
2848 * Free and total bytes of the Data, Cache, and System partition.
2849 */
2850message DirectoryUsage {
2851 enum Directory {
2852 UNKNOWN = 0;
2853 DATA = 1;
2854 CACHE = 2;
2855 SYSTEM = 3;
2856 }
2857 optional Directory directory = 1;
2858 optional int64 free_bytes = 2;
2859 optional int64 total_bytes = 3;
2860}
2861
2862
2863/**
2864 * Size of an application: apk size, data size, and cache size.
2865 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2866 * Information is only reported for apps with the primary user (user 0).
2867 * Sizes are aggregated by package name.
2868 */
2869message AppSize {
2870 // Including uids will involve modifying diskstats logic.
2871 optional string package_name = 1;
2872 // App size in bytes. -1 if unavailable.
2873 optional int64 app_size_bytes = 2;
2874 // App data size in bytes. -1 if unavailable.
2875 optional int64 app_data_size_bytes = 3;
2876 // App cache size in bytes. -1 if unavailable.
2877 optional int64 app_cache_size_bytes = 4;
2878 // Time that the cache file was produced.
2879 // Uses System.currentTimeMillis(), which is wall clock time.
2880 optional int64 cache_time_millis = 5;
2881}
2882
2883
2884/**
2885 * Size of a particular category. Eg: photos, videos.
2886 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2887 */
2888message CategorySize {
2889 enum Category {
2890 UNKNOWN = 0;
2891 APP_SIZE = 1;
2892 APP_DATA_SIZE = 2;
2893 APP_CACHE_SIZE = 3;
2894 PHOTOS = 4;
2895 VIDEOS = 5;
2896 AUDIO = 6;
2897 DOWNLOADS = 7;
2898 SYSTEM = 8;
2899 OTHER = 9;
2900 }
2901 optional Category category = 1;
2902 // Category size in bytes.
2903 optional int64 size_bytes = 2;
2904 // Time that the cache file was produced.
2905 // Uses System.currentTimeMillis(), which is wall clock time.
2906 optional int64 cache_time_millis = 3;
2907}
Tej Singhd6d6d772018-09-05 17:41:25 -07002908
2909/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002910 * Pulls per uid I/O stats. The stats are cumulative since boot.
2911 *
2912 * Read/write bytes are I/O events from a storage device
2913 * Read/write chars are data requested by read/write syscalls, and can be
2914 * satisfied by caching.
2915 *
2916 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2917 */
2918message DiskIo {
2919 optional int32 uid = 1 [(is_uid) = true];
2920 optional int64 fg_chars_read = 2;
2921 optional int64 fg_chars_write = 3;
2922 optional int64 fg_bytes_read = 4;
2923 optional int64 fg_bytes_write = 5;
2924 optional int64 bg_chars_read = 6;
2925 optional int64 bg_chars_write = 7;
2926 optional int64 bg_bytes_read = 8;
2927 optional int64 bg_bytes_write = 9;
2928 optional int64 fg_fsync = 10;
2929 optional int64 bg_fsync= 11;
2930}
2931
2932
2933/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002934 * Pulls the number of fingerprints for each user.
2935 *
2936 * Pulled from StatsCompanionService, which queries FingerprintManager.
2937 */
2938message NumFingerprints {
2939 // The associated user. Eg: 0 for owners, 10+ for others.
2940 // Defined in android/os/UserHandle.java
2941 optional int32 user = 1;
2942 // Number of fingerprints registered to that user.
2943 optional int32 num_fingerprints = 2;
2944}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002945
Yangsteraf9aee72018-10-12 09:26:16 -07002946message AggStats {
2947 optional int64 min = 1;
2948
2949 optional int64 average = 2;
2950
2951 optional int64 max = 3;
2952}
2953
2954message ProcessStatsStateProto {
2955 optional android.service.procstats.ScreenState screen_state = 1;
2956
2957 optional android.service.procstats.MemoryState memory_state = 2;
2958
2959 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2960 // and not frameworks/base/core/java/android/app/ActivityManager.java
2961 optional android.service.procstats.ProcessState process_state = 3;
2962
2963 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002964 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002965
2966 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002967 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07002968
2969 // # of samples taken
2970 optional int32 sample_size = 5;
2971
2972 // PSS is memory reserved for this process
2973 optional AggStats pss = 6;
2974
2975 // USS is memory shared between processes, divided evenly for accounting
2976 optional AggStats uss = 7;
2977
2978 // RSS is memory resident for this process
2979 optional AggStats rss = 8;
2980}
2981
2982// Next Tag: 7
2983message ProcessStatsProto {
2984 // Name of process.
2985 optional string process = 1;
2986
2987 // Uid of the process.
2988 optional int32 uid = 2;
2989
2990 // Information about how often kills occurred
2991 message Kill {
2992 // Count of excessive CPU kills
2993 optional int32 cpu = 1;
2994
2995 // Count of kills when cached
2996 optional int32 cached = 2;
2997
2998 // PSS stats during cached kill
2999 optional AggStats cached_pss = 3;
3000 }
3001 optional Kill kill = 3;
3002
3003 // Time and memory spent in various states.
3004 repeated ProcessStatsStateProto states = 5;
3005
3006 // Total time process has been running... screen_state, memory_state, and process_state
3007 // will not be set.
3008 optional ProcessStatsStateProto total_running_state = 6;
3009}
3010
3011message PackageServiceOperationStatsProto {
3012 // Operate enum: Started, Foreground, Bound, Executing
3013 optional android.service.procstats.ServiceOperationState operation = 1;
3014
3015 // Number of times the service was in this operation.
3016 optional int32 count = 2;
3017
3018 // Information about a state the service can be in.
3019 message StateStats {
3020 // Screen state enum.
3021 optional android.service.procstats.ScreenState screen_state = 1;
3022 // Memory state enum.
3023 optional android.service.procstats.MemoryState memory_state = 2;
3024
3025 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003026 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003027 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003028 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003029 }
3030 repeated StateStats state_stats = 3;
3031}
3032
3033message PackageServiceStatsProto {
3034 // Name of service component.
3035 optional string service_name = 1;
3036
3037 // The operation stats.
3038 // The package_name, package_uid, package_version, service_name will not be set to save space.
3039 repeated PackageServiceOperationStatsProto operation_stats = 2;
3040}
3041
3042message PackageAssociationSourceProcessStatsProto {
3043 // Uid of the process.
3044 optional int32 process_uid = 1;
3045 // Process name.
3046 optional string process_name = 2;
3047
3048 // Total count of the times this association appeared.
3049 optional int32 total_count = 3;
3050
3051 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003052 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003053
3054 // Total count of the times this association became actively impacting its target process.
3055 optional int32 active_count = 5;
3056
3057 // Information on one source in this association.
3058 message StateStats {
3059 // Process state enum.
3060 optional android.service.procstats.ProcessState process_state = 1;
3061 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003062 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003063 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003064 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003065 }
3066 repeated StateStats active_state_stats = 6;
3067}
3068
3069message PackageAssociationProcessStatsProto {
3070 // Name of the target component.
3071 optional string component_name = 1;
3072 // Information on one source in this association.
3073 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3074}
3075
3076
3077message ProcessStatsPackageProto {
3078 // Name of package.
3079 optional string package = 1;
3080
3081 // Uid of the package.
3082 optional int32 uid = 2;
3083
3084 // Version of the package.
3085 optional int64 version = 3;
3086
3087 // Stats for each process running with the package loaded in to it.
3088 repeated ProcessStatsProto process_stats = 4;
3089
3090 // Stats for each of the package's services.
3091 repeated PackageServiceStatsProto service_stats = 5;
3092
3093 // Stats for each association with the package.
3094 repeated PackageAssociationProcessStatsProto association_stats = 6;
3095}
3096
3097message ProcessStatsSectionProto {
3098 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003099 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003100
3101 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003102 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003103
3104 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003105 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003106
3107 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003108 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003109
3110 // System runtime library. e.g. "libdvm.so", "libart.so".
3111 optional string runtime = 5;
3112
3113 // whether kernel reports swapped pss.
3114 optional bool has_swapped_pss = 6;
3115
3116 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3117 enum Status {
3118 STATUS_UNKNOWN = 0;
3119 STATUS_COMPLETE = 1;
3120 STATUS_PARTIAL = 2;
3121 STATUS_SHUTDOWN = 3;
3122 STATUS_SYSPROPS = 4;
3123 }
3124 repeated Status status = 7;
3125
3126 // Stats for each process.
3127 repeated ProcessStatsProto process_stats = 8;
3128
3129 // Stats for each package.
3130 repeated ProcessStatsPackageProto package_stats = 9;
3131}
3132
Chenjie Yu12e5e672018-09-14 15:54:59 -07003133/**
3134 * Pulled from ProcessStatsService.java
3135 */
3136message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003137 optional ProcessStatsSectionProto proc_stats_section = 1;
3138}
3139
3140message PowerProfileProto {
3141 optional double cpu_suspend = 1;
3142
3143 optional double cpu_idle = 2;
3144
3145 optional double cpu_active = 3;
3146
3147 message CpuCluster {
3148 optional int32 id = 1;
3149 optional double cluster_power = 2;
3150 optional int32 cores = 3;
3151 repeated int64 speed = 4;
3152 repeated double core_power = 5;
3153 }
3154
3155 repeated CpuCluster cpu_cluster = 40;
3156
3157 optional double wifi_scan = 4;
3158
3159 optional double wifi_on = 5;
3160
3161 optional double wifi_active = 6;
3162
3163 optional double wifi_controller_idle = 7;
3164
3165 optional double wifi_controller_rx = 8;
3166
3167 optional double wifi_controller_tx = 9;
3168
3169 repeated double wifi_controller_tx_levels = 10;
3170
3171 optional double wifi_controller_operating_voltage = 11;
3172
3173 optional double bluetooth_controller_idle = 12;
3174
3175 optional double bluetooth_controller_rx = 13;
3176
3177 optional double bluetooth_controller_tx = 14;
3178
3179 optional double bluetooth_controller_operating_voltage = 15;
3180
3181 optional double modem_controller_sleep = 16;
3182
3183 optional double modem_controller_idle = 17;
3184
3185 optional double modem_controller_rx = 18;
3186
3187 repeated double modem_controller_tx = 19;
3188
3189 optional double modem_controller_operating_voltage = 20;
3190
3191 optional double gps_on = 21;
3192
3193 repeated double gps_signal_quality_based = 22;
3194
3195 optional double gps_operating_voltage = 23;
3196
3197 optional double bluetooth_on = 24;
3198
3199 optional double bluetooth_active = 25;
3200
3201 optional double bluetooth_at_cmd = 26;
3202
3203 optional double ambient_display = 27;
3204
3205 optional double screen_on = 28;
3206
3207 optional double radio_on = 29;
3208
3209 optional double radio_scanning = 30;
3210
3211 optional double radio_active = 31;
3212
3213 optional double screen_full = 32;
3214
3215 optional double audio = 33;
3216
3217 optional double video = 34;
3218
3219 optional double flashlight = 35;
3220
3221 optional double memory = 36;
3222
3223 optional double camera = 37;
3224
3225 optional double wifi_batched_scan = 38;
3226
3227 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003228}
Chenjie Yuab530202018-09-26 12:39:20 -07003229
3230/**
3231 * power_profile.xml and other constants for power model calculations.
3232 * Pulled from PowerProfile.java
3233 */
3234message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003235 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003236}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003237
3238/**
arangelovd5db50e2018-10-12 20:24:39 +01003239 * Logs when a user restriction was added or removed.
3240 *
3241 * Logged from:
3242 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3243 */
3244message UserRestrictionChanged {
3245 // The raw string of the user restriction as defined in UserManager.
3246 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3247 optional string restriction = 1;
3248 // Whether the restriction is enabled or disabled.
3249 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003250}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003251
3252/**
3253 * Pulls process user time and system time. Puller takes a snapshot of all pids
3254 * in the system and returns cpu stats for those that are working at the time.
3255 * Dead pids will be dropped. Kernel processes are excluded.
3256 * Min cool-down is 5 sec.
3257 */
3258message ProcessCpuTime {
3259 optional int32 uid = 1 [(is_uid) = true];
3260
3261 optional string process_name = 2;
3262 // Process cpu time in user space, cumulative from boot/process start
3263 optional int64 user_time_millis = 3;
3264 // Process cpu time in system space, cumulative from boot/process start
3265 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003266}
Misha Wagner5a51e002018-10-03 15:04:09 +01003267
3268/**
3269 * Pulls the CPU usage for each thread.
3270 *
3271 * Read from /proc/$PID/task/$TID/time_in_state files.
3272 *
3273 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3274 * time_in_state files not being present on some phones, have not been addressed. These should be
3275 * considered before a public release.
3276 */
3277message CpuTimePerThreadFreq {
3278 // UID that owns the process.
3279 optional int32 uid = 1 [(is_uid) = true];
3280 // ID of the process.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003281 optional int32 process_id = 2;
Misha Wagner5a51e002018-10-03 15:04:09 +01003282 // ID of the thread.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003283 optional int32 thread_id = 3;
Misha Wagner5a51e002018-10-03 15:04:09 +01003284 // Name of the process taken from `/proc/$PID/cmdline`.
3285 optional string process_name = 4;
3286 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3287 optional string thread_name = 5;
3288 // What frequency the CPU was running at, in KHz
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003289 optional int32 frequency_khz = 6;
Misha Wagner5a51e002018-10-03 15:04:09 +01003290 // Time spent in frequency in milliseconds, since thread start.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003291 optional int32 time_millis = 7;
Misha Wagner5a51e002018-10-03 15:04:09 +01003292}
Bookatz75ee6042018-11-09 12:27:37 -08003293
3294/**
3295 * Pulls on-device BatteryStats power use calculations for the overall device.
3296 */
3297message DeviceCalculatedPowerUse {
3298 // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset
3299 // (i.e. roughly since device was last significantly charged).
3300 // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3301 optional float computed_power_milli_amp_hours = 1;
3302}
3303
3304/**
3305 * Pulls on-device BatteryStats power use calculations broken down by uid.
3306 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3307 * that is attributed to non-uid items. They must all be included to get the total power use.
3308 */
3309message DeviceCalculatedPowerBlameUid {
3310 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3311 optional int32 uid = 1 [(is_uid) = true];
3312
3313 // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset
3314 // (i.e. roughly since device was last significantly charged).
3315 optional float power_milli_amp_hours = 2;
3316}
3317
3318/**
3319 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3320 * drain type.
3321 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3322 * is attributed uids. They must all be included to get the total power use.
3323 */
3324message DeviceCalculatedPowerBlameOther {
3325 // The type of item whose power use is being reported.
3326 enum DrainType {
3327 AMBIENT_DISPLAY = 0;
3328 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3329 BLUETOOTH = 2;
3330 CAMERA = 3;
3331 // Cell-standby
3332 CELL = 4;
3333 FLASHLIGHT = 5;
3334 IDLE = 6;
3335 MEMORY = 7;
3336 // Amount that total computed drain exceeded the drain estimated using the
3337 // battery level changes and capacity.
3338 OVERCOUNTED = 8;
3339 PHONE = 9;
3340 SCREEN = 10;
3341 // Amount that total computed drain was below the drain estimated using the
3342 // battery level changes and capacity.
3343 UNACCOUNTED = 11;
3344 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3345 WIFI = 13;
3346 }
3347 optional DrainType drain_type = 1;
3348
3349 // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset
3350 // (i.e. roughly since device was last significantly charged).
3351 optional float power_milli_amp_hours = 2;
3352}