blob: 3208d7dc193d1ffe0dcc82bc32a72c2037e37c25 [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Fan Zhangf837b8e2018-10-23 12:38:30 -070025import "frameworks/base/core/proto/android/app/settings_enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070026import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080027import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080028import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080029import "frameworks/base/core/proto/android/server/enums.proto";
Bookatz48d362e2018-11-06 15:49:08 -080030import "frameworks/base/core/proto/android/server/location/enums.proto";
Yangsteraf9aee72018-10-12 09:26:16 -070031import "frameworks/base/core/proto/android/service/procstats_enum.proto";
32import "frameworks/base/core/proto/android/stats/enums.proto";
Yao Chen8c433862018-10-24 14:09:20 -070033import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080034import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080035import "frameworks/base/core/proto/android/telephony/enums.proto";
36import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080037
Yao Chend54f9dd2017-10-17 17:37:48 +000038/**
Stefan Lafonae2df012017-11-14 09:17:21 -080039 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000040 * raw stats log events from the Android system, also known as "atoms."
41 *
42 * This field contains a single oneof with all of the available messages.
43 * The stats-log-api-gen tool runs as part of the Android build and
44 * generates the android.util.StatsLog class, which contains the constants
45 * and methods that Android uses to log.
46 *
Stefan Lafonae2df012017-11-14 09:17:21 -080047 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000048 * Instead, statsd on Android constructs these messages synthetically,
49 * in the format defined here and in stats_log.proto.
50 */
Stefan Lafonae2df012017-11-14 09:17:21 -080051message Atom {
52 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070053 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070054 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
55 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070056 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070057 BleScanResultReceived ble_scan_result_received = 4;
58 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080059 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070060 SyncStateChanged sync_state_changed = 7;
61 ScheduledJobStateChanged scheduled_job_state_changed = 8;
62 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070063 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080064 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
65 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
66 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070067 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
68 MemoryFactorStateChanged memory_factor_state_changed = 15;
69 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
70 CachedKillReported cached_kill_reported = 17;
71 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070072 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080073 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
74 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
75 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070076 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080077 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070078 CameraStateChanged camera_state_changed = 25;
79 FlashlightStateChanged flashlight_state_changed = 26;
80 UidProcessStateChanged uid_process_state_changed = 27;
81 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
82 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070083 BatteryLevelChanged battery_level_changed = 30;
84 ChargingStateChanged charging_state_changed = 31;
85 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070086 InteractiveStateChanged interactive_state_changed = 33;
87 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070088 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
89 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070090 WifiLockStateChanged wifi_lock_state_changed = 37;
91 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
92 WifiScanStateChanged wifi_scan_state_changed = 39;
93 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070094 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070095 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070096 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090097 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070098 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080099 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -0800100 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800101 AppStartOccurred app_start_occurred = 48;
102 AppStartCanceled app_start_canceled = 49;
103 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800104 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800105 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800106 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800107 LmkStateChanged lmk_state_changed = 54;
108 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800109 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800110 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800111 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800112 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800113 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800114 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800115 KeyguardStateChanged keyguard_state_changed = 62;
116 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
117 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800118 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800119 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800120 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
121 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Bookatz48d362e2018-11-06 15:49:08 -0800122 GpsSignalQualityChanged gps_signal_quality_changed = 69;
Andrew Chantb56388b2018-03-22 21:07:33 -0700123 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800124 SpeakerImpedanceReported speaker_impedance_reported = 71;
125 HardwareFailed hardware_failed = 72;
126 PhysicalDropDetected physical_drop_detected = 73;
127 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800128 MobileConnectionStateChanged mobile_connection_state_changed = 75;
129 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700130 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800131 AppCrashOccurred app_crash_occurred = 78;
132 ANROccurred anr_occurred = 79;
133 WTFOccurred wtf_occurred = 80;
134 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700135 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700136 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700137 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700138 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700139 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700140 FingerprintAcquired fingerprint_acquired = 87;
141 FingerprintAuthenticated fingerprint_authenticated = 88;
142 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700143 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700144 BatteryHealthSnapshot battery_health_snapshot = 91;
145 SlowIo slow_io = 92;
146 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700147 PhoneServiceStateChanged phone_service_state_changed = 94;
148 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100149 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700150 SettingsUIChanged settings_ui_changed = 97;
Chenjie Yuae9dfac2018-10-25 16:06:56 -0700151 ConnectivityStateChanged connectivity_state_changed = 98;
Chenjie Yu75b3c492018-10-06 21:45:19 -0700152 // TODO: service state change is very noisy shortly after boot, as well
153 // as at other transitions - coming out of doze, device plugged in, etc.
154 // Consider removing this if it becomes a problem
155 ServiceStateChanged service_state_changed = 99;
156 ServiceLaunchReported service_launch_reported = 100;
Yangster-macb89807e2018-11-15 21:10:57 -0800157 PhenotypeFlagStateChanged phenotype_flag_state_changed = 101;
158 BinaryPushStateChanged binary_push_state_changed = 102;
Yao Chend54f9dd2017-10-17 17:37:48 +0000159 }
David Chenc8a43242017-10-17 16:23:28 -0700160
David Chen6e3e6cb2018-01-03 16:14:06 -0800161 // Pulled events will start at field 10000.
Rafal Slawik3bea8952018-11-15 12:39:33 +0000162 // Next: 10043
David Chenc8a43242017-10-17 16:23:28 -0700163 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800164 WifiBytesTransfer wifi_bytes_transfer = 10000;
165 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
166 MobileBytesTransfer mobile_bytes_transfer = 10002;
167 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800168 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800169 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800170 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800171 CpuTimePerFreq cpu_time_per_freq = 10008;
172 CpuTimePerUid cpu_time_per_uid = 10009;
173 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800174 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800175 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800176 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800177 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800178 SystemElapsedRealtime system_elapsed_realtime = 10014;
179 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800180 CpuActiveTime cpu_active_time = 10016;
181 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000182 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800183 RemainingBatteryCapacity remaining_battery_capacity = 10019;
184 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800185 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100186 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100187 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100188 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000189 DiskStats disk_stats = 10025;
190 DirectoryUsage directory_usage = 10026;
191 AppSize app_size = 10027;
192 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700193 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700194 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700195 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700196 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700197 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700198 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700199 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100200 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100201 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700202 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800203 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
204 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
205 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
Rafal Slawik3bea8952018-11-15 12:39:33 +0000206 ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
Tej Singhb1dbc8b2018-11-19 15:49:47 -0800207 BatteryLevel battery_level = 10043;
David Chenc8a43242017-10-17 16:23:28 -0700208 }
yroa1fe77c2018-02-26 14:22:54 -0800209
Bookatz76aafcf2018-09-17 16:17:10 -0700210 // DO NOT USE field numbers above 100,000 in AOSP.
211 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
212 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700213}
214
Yao Chend54f9dd2017-10-17 17:37:48 +0000215/**
Yangster-mac20877162017-12-22 17:19:39 -0800216 * This proto represents a node of an attribution chain.
217 * Note: All attribution chains are represented as a repeated field of type
218 * AttributionNode. It is understood that in such arrays, the order is that
219 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000220 */
Yangster-mac20877162017-12-22 17:19:39 -0800221message AttributionNode {
222 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800223 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800224
Yangster-mac20877162017-12-22 17:19:39 -0800225 // The (optional) string tag for an element in the attribution chain. If the
226 // element has no tag, it is encoded as an empty string.
227 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700228}
229
Yangster-mac48b3d622018-08-18 12:38:11 -0700230message KeyValuePair {
231 optional int32 key = 1;
232 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700233 int32 value_int = 2;
234 int64 value_long = 3;
235 string value_str = 4;
236 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700237 }
238}
239
240message KeyValuePairsAtom {
241 optional int32 uid = 1;
242 repeated KeyValuePair pairs = 2;
243}
244
Yao Chend54f9dd2017-10-17 17:37:48 +0000245/*
246 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800247 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000248 *
249 * RULES:
250 * - The field ids for each atom must start at 1, and count upwards by 1.
251 * Skipping field ids is not allowed.
252 * - These form an API, so renaming, renumbering or removing fields is
253 * not allowed between android releases. (This is not currently enforced,
254 * but there will be a tool to enforce this restriction).
255 * - The types must be built-in protocol buffer types, namely, no sub-messages
256 * are allowed (yet). The bytes type is also not allowed.
257 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800258 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000259 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800260 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000261 * - A field that is a uid should be a string field, tagged with the [xxx]
262 * annotation. The generated code on android will be represented by UIDs,
263 * and those UIDs will be translated in xxx to those strings.
264 *
265 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700266 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000267 * - If there is a UID, it goes first. Think in an object-oriented fashion.
268 * *****************************************************************************
269 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700270
Yao Chend54f9dd2017-10-17 17:37:48 +0000271/**
Yangster-mace16189a2018-08-26 12:20:16 -0700272 * Logs when the Thermal service HAL notifies the throttling start/stop events.
273 *
274 * Logged from:
275 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
276 */
277message ThermalThrottlingStateChanged {
278 optional android.os.TemperatureTypeEnum sensor_type = 1;
279
280 enum State {
281 UNKNOWN = 0;
282 START = 1;
283 STOP = 2;
284 }
285
286 optional State state = 2;
287
288 optional float temperature = 3;
289}
290
291/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000292 * Logs when the screen state changes.
293 *
294 * Logged from:
295 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
296 */
297message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800298 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700299 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700300}
Yao Chend54f9dd2017-10-17 17:37:48 +0000301
302/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700303 * Logs that the process state of the uid, as determined by ActivityManager
304 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000305 *
306 * Logged from:
307 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
308 */
Bookatzc1a050a2017-10-10 15:49:28 -0700309message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700310 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000311
Bookatzdb026a22018-01-10 19:01:56 -0800312 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700313 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000314}
315
316/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700317 * Logs process state change of a process, as per the activity manager.
318 *
319 * Logged from:
320 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
321 */
322message ProcessStateChanged {
323 optional int32 uid = 1;
324 optional string process_name = 2;
325 optional string package_name = 3;
326 // TODO: remove this when validation is done
327 optional int64 version = 5;
328 // The state, from frameworks/base/core/proto/android/app/enums.proto.
329 optional android.app.ProcessStateEnum state = 4;
330}
331
332/**
333 * Logs when ActivityManagerService sleep state is changed.
334 *
335 * Logged from:
336 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
337 */
338message ActivityManagerSleepStateChanged {
339 // TODO: import frameworks proto
340 enum State {
341 UNKNOWN = 0;
342 ASLEEP = 1;
343 AWAKE = 2;
344 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700345 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700346}
347
348/**
349 * Logs when system memory state changes.
350 *
351 * Logged from:
352 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
353 */
354message MemoryFactorStateChanged {
355 // TODO: import frameworks proto
356 enum State {
357 MEMORY_UNKNOWN = 0;
358 NORMAL = 1; // normal.
359 MODERATE = 2; // moderate memory pressure.
360 LOW = 3; // low memory.
361 CRITICAL = 4; // critical memory.
362
363 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700364 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700365}
366
367/**
368 * Logs when app is using too much cpu, according to ActivityManagerService.
369 *
370 * Logged from:
371 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
372 */
373message ExcessiveCpuUsageReported {
374 optional int32 uid = 1;
375 optional string process_name = 2;
376 optional string package_name = 3;
377 // package version. TODO: remove this when validation is done
378 optional int64 version = 4;
379}
380
381/**
382 * Logs when a cached process is killed, along with its pss.
383 *
384 * Logged from:
385 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
386 */
387message CachedKillReported {
388 optional int32 uid = 1;
389 optional string process_name = 2;
390 optional string package_name = 3;
391 // TODO: remove this when validation is done
392 optional int64 version = 5;
393 optional int64 pss = 4;
394}
395
396/**
397 * Logs when memory stats of a process is reported.
398 *
399 * Logged from:
400 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
401 */
402message ProcessMemoryStatReported {
403 optional int32 uid = 1;
404 optional string process_name = 2;
405 optional string package_name = 3;
406 //TODO: remove this when validation is done
407 optional int64 version = 9;
408 optional int64 pss = 4;
409 optional int64 uss = 5;
410 optional int64 rss = 6;
411 enum Type {
412 ADD_PSS_INTERNAL_SINGLE = 0;
413 ADD_PSS_INTERNAL_ALL_MEM = 1;
414 ADD_PSS_INTERNAL_ALL_POLL = 2;
415 ADD_PSS_EXTERNAL = 3;
416 ADD_PSS_EXTERNAL_SLOW = 4;
417 }
418 optional Type type = 7;
419 optional int64 duration = 8;
420}
421
422/**
Bookatzc1a050a2017-10-10 15:49:28 -0700423 * Logs that a process started, finished, crashed, or ANRed.
424 *
425 * Logged from:
426 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
427 */
428message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700429 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700430
David Chen0b5c90c2018-01-25 16:51:49 -0800431 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800432 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700433
Bookatzddccf0a2017-11-28 16:48:14 -0800434 // What lifecycle state the process changed to.
435 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800436 enum State {
437 FINISHED = 0;
438 STARTED = 1;
439 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800440 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800441 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700442}
443
Bookatzc1a050a2017-10-10 15:49:28 -0700444/**
445 * Logs when the ble scan state changes.
446 *
447 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700448 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700449 */
450message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800451 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700452
453 enum State {
454 OFF = 0;
455 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700456 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
457 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700458 }
459 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700460
Bookatze5ec0b42018-03-26 13:34:56 -0700461 // Does the scan have a filter.
462 optional bool is_filtered = 3;
463 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
464 optional bool is_first_match = 4;
465 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
466 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700467}
468
469/**
470 * Logs reporting of a ble scan finding results.
471 *
472 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700473 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700474 */
Bookatzae6738e2018-09-13 11:38:56 -0700475// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700476message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800477 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700478
479 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800480 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700481}
482
483/**
484 * Logs when a sensor state changes.
485 *
486 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700487 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700488 */
489message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800490 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700491
Bookatzc1a050a2017-10-10 15:49:28 -0700492 // The id (int) of the sensor.
493 optional int32 sensor_id = 2;
494
495 enum State {
496 OFF = 0;
497 ON = 1;
498 }
499 optional State state = 3;
500}
501
Bookatzc1a050a2017-10-10 15:49:28 -0700502/**
503 * Logs when GPS state changes.
504 *
505 * Logged from:
506 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
507 */
508message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800509 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700510
511 enum State {
512 OFF = 0;
513 ON = 1;
514 }
515 optional State state = 2;
516}
517
Bookatz48d362e2018-11-06 15:49:08 -0800518/**
519 * Logs when GPS signal quality.
520 *
521 * Logged from:
522 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
523 */
524message GpsSignalQualityChanged {
525 optional android.server.location.GpsSignalQualityEnum level = 1;
526}
527
Bookatzc1a050a2017-10-10 15:49:28 -0700528
529/**
530 * Logs when a sync manager sync state changes.
531 *
532 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700533 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700534 */
535message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800536 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700537
David Chen0b5c90c2018-01-25 16:51:49 -0800538 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800539 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700540
541 enum State {
542 OFF = 0;
543 ON = 1;
544 }
545 optional State state = 3;
546}
547
Yangster-mac96353002018-09-05 11:18:55 -0700548/*
549 * Deferred job stats.
550 *
551 * Logged from:
552 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
553*/
554message DeferredJobStatsReported {
555 repeated AttributionNode attribution_node = 1;
556
557 // Number of jobs deferred.
558 optional int32 num_jobs_deferred = 2;
559
560 // Time since the last job runs.
561 optional int64 time_since_last_job_millis = 3;
562}
563
Bookatzc1a050a2017-10-10 15:49:28 -0700564/**
565 * Logs when a job scheduler job state changes.
566 *
567 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700568 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700569 */
570message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800571 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700572
573 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800574 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700575
576 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800577 FINISHED = 0;
578 STARTED = 1;
579 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700580 }
581 optional State state = 3;
582
Tej Singh33a412b2018-03-16 18:43:59 -0700583 // The reason a job has stopped.
584 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700585 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700586 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700587}
588
589/**
590 * Logs when the audio state changes.
591 *
592 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700593 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700594 */
595message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800596 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700597
598 enum State {
599 OFF = 0;
600 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700601 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
602 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700603 }
604 optional State state = 2;
605}
606
607/**
608 * Logs when the video codec state changes.
609 *
610 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700611 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700612 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800613message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800614 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700615
616 enum State {
617 OFF = 0;
618 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700619 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
620 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700621 }
622 optional State state = 2;
623}
624
625/**
626 * Logs when the flashlight state changes.
627 *
628 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700629 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700630 */
631message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800632 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700633
634 enum State {
635 OFF = 0;
636 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700637 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
638 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700639 }
640 optional State state = 2;
641}
642
643/**
644 * Logs when the camera state changes.
645 *
646 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700647 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700648 */
649message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800650 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700651
652 enum State {
653 OFF = 0;
654 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700655 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
656 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700657 }
658 optional State state = 2;
659}
660
661/**
662 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000663 *
664 * Logged from:
665 * TODO
666 */
Bookatzd6746242017-10-24 18:39:35 -0700667message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800668 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000669
Bookatz1a1b0462018-01-12 11:47:03 -0800670 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
671 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700672 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700673
674 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
675 optional string tag = 3;
676
677 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800678 RELEASE = 0;
679 ACQUIRE = 1;
680 CHANGE_RELEASE = 2;
681 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700682 }
683 optional State state = 4;
684}
685
686/**
Bookatzc1a050a2017-10-10 15:49:28 -0700687 * Logs when a partial wakelock is considered 'long' (over 1 min).
688 *
689 * Logged from:
690 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
691 */
692message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800693 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700694
Yao Chend54f9dd2017-10-17 17:37:48 +0000695 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
696 optional string tag = 2;
697
Bookatzc1a050a2017-10-10 15:49:28 -0700698 // TODO: I have no idea what this is.
699 optional string history_tag = 3;
700
701 enum State {
702 OFF = 0;
703 ON = 1;
704 }
705 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000706}
707
Bookatzc1a050a2017-10-10 15:49:28 -0700708/**
Bookatza66083f2018-09-20 17:24:00 -0700709 * Logs when the device is interactive, according to the PowerManager Notifier.
710 *
711 * Logged from:
712 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
713 */
714message InteractiveStateChanged {
715 enum State {
716 OFF = 0;
717 ON = 1;
718 }
719 optional State state = 1;
720}
721
722/**
Bookatzc1a050a2017-10-10 15:49:28 -0700723 * Logs Battery Saver state change.
724 *
725 * Logged from:
726 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
727 */
728message BatterySaverModeStateChanged {
729 enum State {
730 OFF = 0;
731 ON = 1;
732 }
733 optional State state = 1;
734}
735
736/**
737 * Logs Doze mode state change.
738 *
739 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800740 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700741 */
742message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800743 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800744}
745
746
747/**
748 * Logs state change of Doze mode including maintenance windows.
749 *
750 * Logged from:
751 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
752 */
753message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800754 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700755}
756
757/**
758 * Logs screen brightness level.
759 *
760 * Logged from:
761 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
762 */
763message ScreenBrightnessChanged {
764 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
765 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700766}
767
768/**
769 * Logs battery level (percent full, from 0 to 100).
770 *
771 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700772 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700773 */
774message BatteryLevelChanged {
775 // Battery level. Should be in [0, 100].
776 optional int32 battery_level = 1;
777}
778
779/**
780 * Logs change in charging status of the device.
781 *
782 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700783 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700784 */
785message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800786 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
787 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700788}
789
790/**
791 * Logs whether the device is plugged in, and what power source it is using.
792 *
793 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700794 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700795 */
796message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800797 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
798 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700799}
800
Bookatz8c6571b2017-10-24 15:04:41 -0700801/**
802 * Logs when an app's wakeup alarm fires.
803 *
804 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700805 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700806 */
807message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800808 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800809
810 // Name of the wakeup alarm.
811 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700812
813 // Name of source package (for historical reasons, since BatteryStats tracked it).
814 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800815}
816
817/**
818 * Logs when an an app causes the mobile radio to change state.
819 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
820 *
821 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700822 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800823 */
824message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800825 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800826
Bookatz1a1b0462018-01-12 11:47:03 -0800827 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
828 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800829}
830
831/**
832 * Logs when an an app causes the wifi radio to change state.
833 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
834 *
835 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700836 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800837 */
838message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800839 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800840
Bookatz1a1b0462018-01-12 11:47:03 -0800841 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
842 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700843}
844
845/**
846 * Logs kernel wakeup reasons and aborts.
847 *
848 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700849 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700850 */
851message KernelWakeupReported {
852 // Name of the kernel wakeup reason (or abort).
853 optional string wakeup_reason_name = 1;
854
855 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800856 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700857}
858
859/**
860 * Logs wifi locks held by an app.
861 *
862 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700863 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700864 */
865message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800866 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700867
868 enum State {
869 OFF = 0;
870 ON = 1;
871 }
872 optional State state = 2;
873}
874
875/**
876 * Logs wifi signal strength changes.
877 *
878 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700879 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700880 */
881message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800882 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
883 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700884}
885
886/**
887 * Logs wifi scans performed by an app.
888 *
889 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700890 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700891 */
892message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800893 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700894
895 enum State {
896 OFF = 0;
897 ON = 1;
898 }
899 optional State state = 2;
900}
901
902/**
Tej Singh4503e102018-01-04 14:35:01 -0800903 * Logs wifi multicast locks held by an app
904 *
905 * Logged from:
906 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
907 */
908message WifiMulticastLockStateChanged {
909 repeated AttributionNode attribution_node = 1;
910
911 enum State {
912 OFF = 0;
913 ON = 1;
914 }
915 optional State state = 2;
916}
917
918/**
Tej Singh1ea42892018-01-19 09:27:00 -0800919 * Logs shutdown reason and duration on next boot.
920 *
921 * Logged from:
922 * frameworks/base/core/java/com/android/server/BootReceiver.java
923 */
924message ShutdownSequenceReported {
925 // True if shutdown is for a reboot. Default: false if we do not know.
926 optional bool reboot = 1;
927
928 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
929 optional string reason = 2;
930
931 // Beginning of shutdown time in ms using wall clock time since unix epoch.
932 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800933 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800934
935 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800936 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800937}
938
Tej Singh6483ea42018-01-25 17:45:49 -0800939
940/**
941 * Logs boot reason and duration.
942 *
943 * Logged from:
944 * system/core/bootstat/bootstat.cpp
945 */
946message BootSequenceReported {
947 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
948 // Default: "<EMPTY>" if not available.
949 optional string bootloader_reason = 1;
950
951 // Reason for system boot. Eg. bootloader, reboot,userrequested
952 // Default: "<EMPTY>" if not available.
953 optional string system_reason = 2;
954
955 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800956 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800957
958 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800959 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800960
961 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800962 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800963
964 // Time since last boot in ms. Default: 0 if not available.
965 optional int64 time_since_last_boot = 6;
966}
967
Tej Singhc477d9c2018-02-05 18:31:39 -0800968
969/**
970 * Logs call state and disconnect cause (if applicable).
971 *
972 * Logged from:
973 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
974 */
975message CallStateChanged {
976 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
977 // From frameworks/base/core/proto/android/telecomm/enums.proto.
978 optional android.telecom.CallStateEnum call_state = 1;
979
980 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
981 // This value is only applicable when the call_state is DISCONNECTED, and
982 // should always be UNKNOWN if the call_state is not DISCONNECTED.
983 // From frameworks/base/core/proto/android/telecomm/enums.proto.
984 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
985
986 // True if the call is self-managed, which are apps that use the
987 // telecom infrastructure to make their own calls.
988 optional bool self_managed = 3;
989
990 // True if call is external. External calls are calls on connected Wear
991 // devices but show up in Telecom so the user can pull them onto the device.
992 optional bool external_call = 4;
993}
994
Tej Singh1ea42892018-01-19 09:27:00 -0800995/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800996 * Logs keyguard state. The keyguard is the lock screen.
997 *
998 * Logged from:
999 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1000 */
1001message KeyguardStateChanged {
1002 enum State {
1003 UNKNOWN = 0;
1004 // The keyguard is hidden when the phone is unlocked.
1005 HIDDEN = 1;
1006 // The keyguard is shown when the phone is locked (screen turns off).
1007 SHOWN= 2;
1008 // The keyguard is occluded when something is overlaying the keyguard.
1009 // Eg. Opening the camera while on the lock screen.
1010 OCCLUDED = 3;
1011 }
1012 optional State state = 1;
1013}
1014
1015/**
1016 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1017 * prompts the user to enter a password (pattern, pin, etc).
1018 *
1019 * Logged from:
1020 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1021 */
1022
1023message KeyguardBouncerStateChanged {
1024 enum State {
1025 UNKNOWN = 0;
1026 // Bouncer is hidden, either as a result of successfully entering the
1027 // password, screen timing out, or user going back to lock screen.
1028 HIDDEN = 1;
1029 // This is when the user is being prompted to enter the password.
1030 SHOWN = 2;
1031 }
1032 optional State state = 1;
1033}
1034
1035/**
1036 * Logs the result of entering a password into the keyguard bouncer.
1037 *
1038 * Logged from:
1039 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1040 */
1041message KeyguardBouncerPasswordEntered {
1042 enum BouncerResult {
1043 UNKNOWN = 0;
1044 // The password entered was incorrect.
1045 FAILURE = 1;
1046 // The password entered was correct.
1047 SUCCESS = 2;
1048 }
1049 optional BouncerResult result = 1;
1050}
1051
Tej Singha883b372018-02-15 11:30:01 -08001052/*
1053 * Logs changes to the configuration of the device. The configuration is defined
1054 * in frameworks/base/core/java/android/content/res/Configuration.java
1055 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1056 * Please go there to interpret the possible values each field can be.
1057 *
1058 * Logged from:
1059 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1060 */
1061message ResourceConfigurationChanged {
1062 // Bit mask of color capabilities of the screen.
1063 // Contains information about the color gamut and hdr mode of the screen.
1064 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001065 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001066
1067 // The target screen density being rendered to.
1068 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001069 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001070
1071 // Current user preference for the scaling factor for fonts,
1072 // relative to the base density scaling.
1073 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001074 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001075
1076 // Flag indicating whether the hard keyboard is hidden.
1077 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001078 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001079
1080 // The type of keyboard attached to the device.
1081 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1082 optional int32 keyboard = 5;
1083
1084 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1085 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001086 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001087
1088 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1089 // 0 if undefined.
1090 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1091 optional int32 mcc = 7;
1092
1093 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1094 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1095 // MNC_ZERO symbol defined in Configuration.java.
1096 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1097 optional int32 mnc = 8;
1098
1099 // The kind of navigation available on the device.
1100 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1101 optional int32 navigation = 9;
1102
1103 // Flag indicating whether the navigation is available.
1104 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001105 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001106
1107 // Overall orientation of the screen.
1108 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1109 optional int32 orientation = 11;
1110
1111 // The current height of the available screen space, in dp units.
1112 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001113 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001114
1115 // Bit mask of overall layout of the screen.
1116 // Contains information about screen size, whether the screen is wider/taller
1117 // than normal, whether the screen layout is right-tl-left or left-to-right,
1118 // and whether the screen has a rounded shape.
1119 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001120 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001121
1122 // Current width of the available screen space, in dp units.
1123 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001124 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001125
1126 // The smallest screen size an application will see in normal operation.
1127 // This is the smallest value of both screenWidthDp and screenHeightDp
1128 // in portrait and landscape.
1129 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001130 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001131
1132 // The type of touch screen attached to the device.
1133 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1134 optional int32 touchscreen = 16;
1135
1136 // Bit mask of the ui mode.
1137 // Contains information about the overall ui mode of the device.
1138 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1139 // Also contains information about whether the device is in night mode.
1140 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001141 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001142}
1143
Tej Singheee317b2018-03-07 19:28:05 -08001144
1145/**
1146 * Logs changes in the connection state of the mobile radio.
1147 *
1148 * Logged from:
1149 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1150 */
1151message MobileConnectionStateChanged {
1152 // States are from the state machine DataConnection.java.
1153 enum State {
1154 UNKNOWN = 0;
1155 // The connection is inactive, or disconnected.
1156 INACTIVE = 1;
1157 // The connection is being activated, or connecting.
1158 ACTIVATING = 2;
1159 // The connection is active, or connected.
1160 ACTIVE = 3;
1161 // The connection is disconnecting.
1162 DISCONNECTING = 4;
1163 // The connection is disconnecting after creating a connection.
1164 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1165 }
1166 optional State state = 1;
1167 // For multi-sim phones, this distinguishes between the sim cards.
1168 optional int32 sim_slot_index = 2;
1169 // Used to identify the connection. Starts at 0 and increments by 1 for
1170 // every new network created. Resets whenever the device reboots.
1171 optional int32 data_connection_id = 3;
1172 // A bitmask for the capabilities of this connection.
1173 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1174 // Default value (if we have no information): 0
1175 optional int64 capabilities = 4;
1176 // If this connection has internet.
1177 // This just checks if the DEFAULT bit of capabilities is set.
1178 optional bool has_internet = 5;
1179}
1180
1181/**
1182 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1183 *
1184 * Logged from:
1185 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1186 */
1187message MobileRadioTechnologyChanged {
1188 optional android.telephony.NetworkTypeEnum state = 1;
1189 // For multi-sim phones, this distinguishes between the sim cards.
1190 optional int32 sim_slot_index = 2;
1191}
1192
Andrew Chantb56388b2018-03-22 21:07:33 -07001193/**
1194 * Logs the VID and PID of any connected USB devices.
1195 *
1196 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1197 *
1198 * Logged by Vendor.
1199 */
1200message UsbDeviceAttached {
1201 optional int32 vid = 1;
1202 optional int32 pid = 2;
1203 optional bool has_audio = 3;
1204 optional bool has_hid = 4;
1205 optional bool has_storage = 5;
1206}
1207
Tej Singheee317b2018-03-07 19:28:05 -08001208
Tej Singhdd7bd352018-02-09 19:33:15 -08001209/**
Tej Singh5d991e12018-03-09 19:48:11 -08001210 * Logs when Bluetooth is enabled and disabled.
1211 *
1212 * Logged from:
1213 * services/core/java/com/android/server/BluetoothManagerService.java
1214 */
1215message BluetoothEnabledStateChanged {
1216 repeated AttributionNode attribution_node = 1;
1217 // Whether or not bluetooth is enabled on the device.
1218 enum State {
1219 UNKNOWN = 0;
1220 ENABLED = 1;
1221 DISABLED = 2;
1222 }
1223 optional State state = 2;
1224 // The reason for being enabled/disabled.
1225 // Eg. Airplane mode, crash, application request.
1226 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1227 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001228 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001229}
1230
1231/**
1232 * Logs when a Bluetooth device connects and disconnects.
1233 *
1234 * Logged from:
1235 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1236 */
1237message BluetoothConnectionStateChanged {
1238 // The state of the connection.
1239 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1240 optional android.bluetooth.ConnectionStateEnum state = 1;
1241 // An identifier that can be used to match connect and disconnect events.
1242 // Currently is last two bytes of a hash of a device level ID and
1243 // the mac address of the bluetooth device that is connected.
1244 optional int32 obfuscated_id = 2;
1245 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1246 // From android.bluetooth.BluetoothAdapter.java
1247 optional int32 bt_profile = 3;
1248}
1249
1250/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001251 * Logs when something is plugged into or removed from the USB-C connector.
1252 *
1253 * Logged from:
1254 * Vendor USB HAL.
1255 */
1256message UsbConnectorStateChanged {
1257 enum State {
1258 DISCONNECTED = 0;
1259 CONNECTED = 1;
1260 }
1261 optional State state = 1;
1262}
1263
1264/**
1265 * Logs the reported speaker impedance.
1266 *
1267 * Logged from:
1268 * Vendor audio implementation.
1269 */
1270message SpeakerImpedanceReported {
1271 optional int32 speaker_location = 1;
1272 optional int32 impedance = 2;
1273}
1274
1275/**
1276 * Logs the report of a failed hardware.
1277 *
1278 * Logged from:
1279 * Vendor HALs.
1280 *
1281 */
1282message HardwareFailed {
1283 enum HardwareType {
1284 HARDWARE_FAILED_UNKNOWN = 0;
1285 HARDWARE_FAILED_MICROPHONE = 1;
1286 HARDWARE_FAILED_CODEC = 2;
1287 HARDWARE_FAILED_SPEAKER = 3;
1288 HARDWARE_FAILED_FINGERPRINT = 4;
1289 }
1290 optional HardwareType hardware_type = 1;
1291
1292 /* hardware_location allows vendors to differentiate between multiple instances of
1293 * the same hardware_type. The specific locations are vendor defined integers,
1294 * referring to board-specific numbering schemes.
1295 */
1296 optional int32 hardware_location = 2;
1297
1298 /* failure_code is specific to the HardwareType of the failed hardware.
1299 * It should use the enum values defined below.
1300 */
1301 enum MicrophoneFailureCode {
1302 MICROPHONE_FAILURE_COMPLETE = 0;
1303 }
1304 enum CodecFailureCode {
1305 CODEC_FAILURE_COMPLETE = 0;
1306 }
1307 enum SpeakerFailureCode {
1308 SPEAKER_FAILURE_COMPLETE = 0;
1309 SPEAKER_FAILURE_HIGH_Z = 1;
1310 SPEAKER_FAILURE_SHORT = 2;
1311 }
1312 enum FingerprintFailureCode {
1313 FINGERPRINT_FAILURE_COMPLETE = 0;
1314 FINGERPRINT_SENSOR_BROKEN = 1;
1315 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1316 }
1317 optional int32 failure_code = 3;
1318}
1319
1320/**
1321 * Log an event when the device has been physically dropped.
1322 * Reported from the /vendor partition.
1323 */
1324message PhysicalDropDetected {
1325 // Confidence that the event was actually a drop, 0 -> 100
1326 optional int32 confidence_pctg = 1;
1327 // Peak acceleration of the drop, in 1/1000s of a g.
1328 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001329 // Duration of freefall in ms
1330 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001331}
1332
1333/**
1334 * Log bucketed battery charge cycles.
1335 *
1336 * Each bucket represents cycles of the battery past
1337 * a given charge point. For example, bucket 1 is the
1338 * lowest 1/8th of the battery, and bucket 8 is 100%.
1339 *
1340 * Logged from:
1341 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1342 */
1343message ChargeCyclesReported {
1344 optional int32 cycle_bucket_1 = 1;
1345 optional int32 cycle_bucket_2 = 2;
1346 optional int32 cycle_bucket_3 = 3;
1347 optional int32 cycle_bucket_4 = 4;
1348 optional int32 cycle_bucket_5 = 5;
1349 optional int32 cycle_bucket_6 = 6;
1350 optional int32 cycle_bucket_7 = 7;
1351 optional int32 cycle_bucket_8 = 8;
1352}
1353
1354/**
Howard Roa46b6582018-09-18 16:45:02 -07001355 * Log battery health snapshot.
1356 *
1357 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1358 * are snapshotted periodically over 24hrs.
1359 */
1360message BatteryHealthSnapshot {
1361 enum BatterySnapshotType {
1362 UNKNOWN = 0;
1363 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1364 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1365 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1366 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1367 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1368 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1369 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1370 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1371 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1372 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1373 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1374 }
1375 optional BatterySnapshotType type = 1;
1376 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001377 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001378 // Voltage Battery Voltage, in microVolts.
1379 optional int32 voltage_micro_volt = 3;
1380 // Current Battery current, in microAmps.
1381 optional int32 current_micro_amps = 4;
1382 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1383 optional int32 open_circuit_micro_volt = 5;
1384 // Resistance Battery Resistance, in microOhms.
1385 optional int32 resistance_micro_ohm = 6;
1386 // Level Battery Level, as % of full.
1387 optional int32 level_percent = 7;
1388}
1389
1390/**
1391 * Log slow I/O operations on the primary storage.
1392 */
1393message SlowIo {
1394 // Classifications of IO Operations.
1395 enum IoOperation {
1396 UNKNOWN = 0;
1397 READ = 1;
1398 WRITE = 2;
1399 UNMAP = 3;
1400 SYNC = 4;
1401 }
1402 optional IoOperation operation = 1;
1403
1404 // The number of slow IO operations of this type over 24 hours.
1405 optional int32 count = 2;
1406}
1407
1408/**
1409 * Log battery caused shutdown with the last recorded voltage.
1410 */
1411message BatteryCausedShutdown {
1412 // The last recorded battery voltage prior to shutdown.
1413 optional int32 last_recorded_micro_volt = 1;
1414}
1415
1416/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001417 * Logs the duration of a davey (jank of >=700ms) when it occurs
1418 *
1419 * Logged from:
1420 * frameworks/base/libs/hwui/JankTracker.cpp
1421 */
1422message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001423 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001424 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001425
Tej Singhbb8554a2018-01-26 11:59:14 -08001426 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001427 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001428}
1429
1430/**
Bookatze5885242017-10-24 20:10:31 -07001431 * Logs phone signal strength changes.
1432 *
1433 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001434 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001435 */
1436message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001437 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1438 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001439}
1440
Yangster4ccebea2018-10-09 17:09:02 -07001441
1442/**
1443 * Logs when the phone state, sim state or signal strength changes
1444 *
1445 * Logged from:
1446 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1447 */
1448message PhoneServiceStateChanged {
1449 optional android.telephony.ServiceStateEnum state = 1;
1450 optional android.telephony.SimStateEnum sim_state = 2;
1451 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1452}
1453
1454/**
1455 * Logs when the phone becomes on or off.
1456 *
1457 * Logged from:
1458 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1459 */
1460message PhoneStateChanged {
1461 enum State {
1462 OFF = 0;
1463 ON = 1;
1464 }
1465 optional State state = 1;
1466}
1467
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001468message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001469 optional android.stats.launcher.LauncherAction action = 1;
1470 optional android.stats.launcher.LauncherState src_state = 2;
1471 optional android.stats.launcher.LauncherState dst_state = 3;
1472 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001473 optional bool is_swipe_up_enabled = 5;
1474}
1475
David Chenc28b2bb2017-10-24 12:52:52 -07001476/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001477 * Logs when Settings UI has changed.
1478 *
1479 * Logged from:
1480 * packages/apps/Settings
1481 */
1482message SettingsUIChanged {
1483 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001484 * Where this SettingsUIChange event comes from. For example, if
1485 * it's a PAGE_VISIBLE event, where the page is opened from.
1486 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001487 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001488
1489 /**
1490 * What the UI action is.
1491 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001492 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001493
1494 /**
1495 * Where the action is happening
1496 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001497 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001498
1499 /**
1500 * What preference changed in this event.
1501 */
1502 optional string changedPreferenceKey = 4;
1503
1504 /**
1505 * The new value of the changed preference.
1506 */
1507 optional int64 changedPreferenceIntValue = 5;
1508}
1509
1510/**
David Chenc28b2bb2017-10-24 12:52:52 -07001511 * Logs that a setting was updated.
1512 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001513 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001514 * The tag and is_default allow resetting of settings to default values based on the specified
1515 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1516 */
1517message SettingChanged {
1518 // The name of the setting.
1519 optional string setting = 1;
1520
1521 // The change being imposed on this setting. May represent a number, eg "3".
1522 optional string value = 2;
1523
1524 // The new value of this setting. For most settings, this is same as value. For some settings,
1525 // value is +X or -X where X represents an element in a set. For example, if the previous value
1526 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1527 // The +/- feature is currently only used for location_providers_allowed.
1528 optional string new_value = 3;
1529
1530 // The previous value of this setting.
1531 optional string prev_value = 4;
1532
1533 // The tag used with the is_default for resetting sets of settings. This is generally null.
1534 optional string tag = 5;
1535
Bookatz90867622018-01-31 15:05:57 -08001536 // True if this setting with tag should be resettable.
1537 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001538
David Chenbd789912018-03-16 17:19:55 -07001539 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001540 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001541
1542 enum ChangeReason {
1543 UPDATED = 1; // Updated can be an insertion or an update.
1544 DELETED = 2;
1545 }
1546 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001547}
Chenjie Yub3dda412017-10-24 13:41:59 -07001548
Chenjie Yu05013b32017-11-21 10:21:41 -08001549/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001550 * Logs activity going to foreground or background
1551 *
1552 * Logged from:
1553 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1554 */
1555message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001556 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001557 optional string pkg_name = 2;
1558 optional string class_name = 3;
1559
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001560 enum State {
1561 BACKGROUND = 0;
1562 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001563 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001564 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001565}
David Chenc8a43242017-10-17 16:23:28 -07001566
1567/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001568 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001569 * Logged from:
1570 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1571 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001572message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001573 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001574
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001575 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001576
1577 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001578 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001579 optional string process_name = 3;
1580
1581 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001582 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001583
1584 optional string package_name = 5;
1585
1586 enum InstantApp {
1587 UNAVAILABLE = 0;
1588 FALSE = 1;
1589 TRUE = 2;
1590 }
1591 optional InstantApp is_instant_app = 6;
1592
1593 enum ForegroundState {
1594 UNKNOWN = 0;
1595 BACKGROUND = 1;
1596 FOREGROUND = 2;
1597 }
1598 optional ForegroundState foreground_state = 7;
Yang Lu732d6382018-11-05 07:53:12 -08001599
1600 optional android.server.ErrorSource error_source = 8;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001601}
David Chen9e3808c2017-11-20 17:25:34 -08001602
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001603/**
1604 * Logs when a WTF (What a Terrible Failure) happened.
1605 * Logged from:
1606 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1607 */
1608message WTFOccurred {
1609 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001610
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001611 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001612
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001613 // The name of the process.
1614 // system_server if it is not by an app
1615 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001616
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001617 // The pid if available. -1 means not available.
1618 optional sint32 pid = 4;
Yang Lu732d6382018-11-05 07:53:12 -08001619
1620 optional android.server.ErrorSource error_source = 5;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001621}
1622
1623/**
1624 * Logs when system server reports low memory.
1625 * Logged from:
1626 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1627 */
1628message LowMemReported {
1629}
1630
1631/**
1632 * Logs when an app ANR (App Not Responding) occurs.
1633 * Logged from:
1634 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1635 */
1636message ANROccurred {
1637 optional int32 uid = 1 [(is_uid) = true];
1638
1639 optional string process_name = 2;
1640
1641 optional string short_component_name = 3;
1642
1643 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001644
1645 enum InstantApp {
1646 UNAVAILABLE = 0;
1647 FALSE = 1;
1648 TRUE = 2;
1649 }
1650 optional InstantApp is_instant_app = 5;
1651
1652 enum ForegroundState {
1653 UNKNOWN = 0;
1654 BACKGROUND = 1;
1655 FOREGROUND = 2;
1656 }
1657 optional ForegroundState foreground_state = 6;
Yang Lu732d6382018-11-05 07:53:12 -08001658
1659 optional android.server.ErrorSource error_source = 7;
1660
1661 optional string package_name = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001662}
1663
Bookatza7020bd2018-08-28 16:29:35 -07001664/**
1665 * Logs when the vibrator state changes.
1666 * Logged from:
1667 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1668 */
1669message VibratorStateChanged {
1670 repeated AttributionNode attribution_node = 1;
1671
1672 enum State {
1673 OFF = 0;
1674 ON = 1;
1675 }
1676 optional State state = 2;
1677
1678 // Duration (in milliseconds) requested to keep the vibrator on.
1679 // Only applicable for State == ON.
1680 optional int64 duration_millis = 3;
1681}
1682
David Chen0a368b22017-12-06 16:28:16 -08001683/*
1684 * Allows other apps to push events into statsd.
1685 * Logged from:
1686 * frameworks/base/core/java/android/util/StatsLog.java
1687 */
David Chen0b5c90c2018-01-25 16:51:49 -08001688message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001689 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001690 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001691
1692 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1693 optional int32 label = 2;
1694
1695 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1696 // predicates for the metrics).
1697 enum State {
1698 UNKNOWN = 0;
1699 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1700 STOP = 2;
1701 START = 3;
1702 }
1703 optional State state = 3;
1704}
1705
David Chen9e3808c2017-11-20 17:25:34 -08001706/**
Bookatz7948c872018-09-04 12:58:33 -07001707 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1708 * For example, this could be due to the user manually changing the time.
1709 *
1710 * Logged from:
1711 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1712 */
1713message WallClockTimeShifted {
1714 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1715 optional int64 wall_clock_timestamp_millis = 1;
1716}
1717
1718/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001719 * Logs when statsd detects an anomaly.
1720 *
1721 * Logged from:
1722 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1723 */
1724message AnomalyDetected {
1725 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001726 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001727
Yangster-mac94e197c2018-01-02 16:03:03 -08001728 // Id of the config whose anomaly detection alert fired.
1729 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001730
Yangster-mac94e197c2018-01-02 16:03:03 -08001731 // Id of the alert (i.e. name of the anomaly that was detected).
1732 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001733}
1734
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001735message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001736 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001737 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001738
1739 // The app package name.
1740 optional string pkg_name = 2;
1741
1742 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001743 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001744 WARM = 1;
1745 HOT = 2;
1746 COLD = 3;
1747 }
1748 // The transition type.
1749 optional TransitionType type = 3;
1750
1751 // The activity name.
1752 optional string activity_name = 4;
1753
1754 // The name of the calling app. Empty if not set.
1755 optional string calling_pkg_name = 5;
1756
1757 // Whether the app is an instant app.
1758 optional bool is_instant_app = 6;
1759
1760 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001761 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001762
Bookatz80d11a02018-01-16 10:46:35 -08001763 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001764
David Chen0b5c90c2018-01-25 16:51:49 -08001765 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001766 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001767 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001768 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001769 optional int32 bind_application_delay_millis = 11;
1770 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001771
1772 // Empty if not set.
1773 optional string launch_token = 13;
1774
Calin Juravle759fbda2018-02-20 19:52:30 +00001775 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001776 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001777
1778 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001779 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001780}
1781
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001782message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001783 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001784 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001785
1786 // The app package name.
1787 optional string pkg_name = 2;
1788
1789 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001790 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001791 WARM = 1;
1792 HOT = 2;
1793 COLD = 3;
1794 }
1795 // The transition type.
1796 optional TransitionType type = 3;
1797
1798 // The activity name.
1799 optional string activity_name = 4;
1800}
1801
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001802message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001803 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001804 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001805
1806 // The app package name.
1807 optional string pkg_name = 2;
1808
1809 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001810 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001811 WITH_BUNDLE = 1;
1812 WITHOUT_BUNDLE = 2;
1813 }
1814 // The transition type.
1815 optional TransitionType type = 3;
1816
1817 // The activity name.
1818 optional string activity_name = 4;
1819
1820 optional bool transition_process_running = 5;
1821
1822 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001823 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001824}
1825
Bookatz8fcd09a2017-12-18 13:01:10 -08001826/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001827 * Logs a picture-in-picture action
1828 * Logged from:
1829 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1830 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1831 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1832 */
1833message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001834 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001835 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001836
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001837 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001838
Chenjie Yu52cacc62017-12-08 18:11:45 -08001839 enum State {
1840 ENTERED = 1;
1841 EXPANDED_TO_FULL_SCREEN = 2;
1842 MINIMIZED = 3;
1843 DISMISSED = 4;
1844 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001845 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001846}
1847
1848/**
Chenjie Yue8904192017-12-08 19:12:57 -08001849 * Logs overlay action
1850 * Logged from:
1851 * services/core/java/com/android/server/wm/Session.java
1852 */
1853message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001854 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001855
1856 optional string package_name = 2;
1857
1858 optional bool using_alert_window = 3;
1859
1860 enum State {
1861 ENTERED = 1;
1862 EXITED = 2;
1863 }
1864 optional State state = 4;
1865}
1866
Chenjie Yuccfe6452018-01-30 11:33:21 -08001867/*
1868 * Logs foreground service starts and stops.
1869 * Note that this is not when a service starts or stops, but when it is
1870 * considered foreground.
1871 * Logged from
1872 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1873 */
1874message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001875 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001876 // package_name + "/" + class_name
1877 optional string short_name = 2;
1878
1879 enum State {
1880 ENTER = 1;
1881 EXIT = 2;
1882 }
1883 optional State state = 3;
1884}
1885
Chenjie Yue8904192017-12-08 19:12:57 -08001886/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001887 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1888 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1889 * attributed back to the parent (host) uid. One example is Chrome.
1890 *
1891 * Logged from:
1892 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1893 */
1894message IsolatedUidChanged {
1895 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001896 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001897 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001898 optional int32 parent_uid = 1;
1899
1900 optional int32 isolated_uid = 2;
1901
1902 // We expect an isolated uid to be removed before if it's used for another parent uid.
1903 enum Event {
1904 REMOVED = 0;
1905 CREATED = 1;
1906 }
1907 optional Event event = 3;
1908}
1909
1910/*
1911 * Logs the reception of an incoming network packet causing the main system to wake up for
1912 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1913 * and processed by WakeupController.cpp.
1914 */
1915message PacketWakeupOccurred {
1916 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1917 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001918 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001919 // The interface name on which the packet was received.
1920 optional string iface = 2;
1921 // The ethertype value of the packet.
1922 optional int32 ethertype = 3;
1923 // String representation of the destination MAC address of the packet.
1924 optional string destination_hardware_address = 4;
1925 // String representation of the source address of the packet if this was an IP packet.
1926 optional string source_ip = 5;
1927 // String representation of the destination address of the packet if this was an IP packet.
1928 optional string destination_ip = 6;
1929 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1930 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1931 // families.
1932 optional int32 ip_next_header = 7;
1933 // The source port if this was a TCP or UDP packet.
1934 optional int32 source_port = 8;
1935 // The destination port if this was a TCP or UDP packet.
1936 optional int32 destination_port = 9;
1937}
1938
1939/*
1940 * Logs the memory stats for an app on startup.
1941 * Logged from:
1942 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1943 */
1944message AppStartMemoryStateCaptured {
1945 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001946 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001947
1948 // The process name.
1949 optional string process_name = 2;
1950
1951 // The activity name.
1952 optional string activity_name = 3;
1953
1954 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001955 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001956
1957 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001958 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001959
1960 // RSS
1961 optional int64 rss_in_bytes = 6;
1962
1963 // CACHE
1964 optional int64 cache_in_bytes = 7;
1965
1966 // SWAP
1967 optional int64 swap_in_bytes = 8;
1968}
1969
1970/*
1971 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1972 * for LMK event.
1973 * Logged from:
1974 * system/core/lmkd/lmkd.c
1975 */
1976message LmkStateChanged {
1977 enum State {
1978 UNKNOWN = 0;
1979 START = 1;
1980 STOP = 2;
1981 }
1982 optional State state = 1;
1983}
1984
1985/*
1986 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1987 * Logged from:
1988 * system/core/lmkd/lmkd.c
1989 */
1990message LmkKillOccurred {
1991 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001992 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001993
1994 // The process name.
1995 optional string process_name = 2;
1996
1997 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07001998 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001999
2000 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002001 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002002
2003 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002004 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002005
2006 // RSS
2007 optional int64 rss_in_bytes = 6;
2008
2009 // CACHE
2010 optional int64 cache_in_bytes = 7;
2011
2012 // SWAP
2013 optional int64 swap_in_bytes = 8;
2014}
2015
Rajeev Kumar51b54602018-03-01 12:18:26 -08002016/*
2017 * Logs when the ActivityManagerService detects that an app died.
2018 *
2019 * Logged from:
2020 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2021 */
2022message AppDied {
2023 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002024 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002025}
2026
Howard Ro21a039c2018-08-06 14:55:47 -07002027/**
2028 * An atom for generic metrics logging. Available from Android Q.
2029 */
2030message GenericAtom {
2031 // The uid of the application that sent this custom atom.
2032 optional int32 uid = 1 [(is_uid) = true];
2033
2034 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002035 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002036}
2037
Tej Singhd6d6d772018-09-05 17:41:25 -07002038/**
2039 * Logs when a fingerprint acquire event occurs.
2040 *
2041 * Logged from:
2042 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2043 */
2044message FingerprintAcquired {
2045 // The associated user. Eg: 0 for owners, 10+ for others.
2046 // Defined in android/os/UserHandle.java
2047 optional int32 user = 1;
2048 // If this acquire is for a crypto fingerprint.
2049 // e.g. Secure purchases, unlock password storage.
2050 optional bool is_crypto = 2;
2051}
2052
2053/**
2054 * Logs when a fingerprint authentication event occurs.
2055 *
2056 * Logged from:
2057 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2058 */
2059message FingerprintAuthenticated {
2060 // The associated user. Eg: 0 for owners, 10+ for others.
2061 // Defined in android/os/UserHandle.java
2062 optional int32 user = 1;
2063 // If this authentication is for a crypto fingerprint.
2064 // e.g. Secure purchases, unlock password storage.
2065 optional bool is_crypto = 2;
2066 // Whether or not this authentication was successful.
2067 optional bool is_authenticated = 3;
2068}
2069
2070/**
2071 * Logs when a fingerprint error occurs.
2072 *
2073 * Logged from:
2074 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2075 */
2076message FingerprintErrorOccurred {
2077 // The associated user. Eg: 0 for owners, 10+ for others.
2078 // Defined in android/os/UserHandle.java
2079 optional int32 user = 1;
2080 // If this error is for a crypto fingerprint.
2081 // e.g. Secure purchases, unlock password storage.
2082 optional bool is_crypto = 2;
2083
2084 enum Error {
2085 UNKNOWN = 0;
2086 LOCKOUT = 1;
2087 PERMANENT_LOCKOUT = 2;
2088 }
2089 // The type of error.
2090 optional Error error = 3;
2091}
Howard Ro688ae182018-09-25 00:09:36 -07002092
2093message Notification {
2094
2095 // Type of notification event.
2096 enum Type {
2097 TYPE_UNKNOWN = 0;
2098 // Notification became visible to the user.
2099 TYPE_OPEN = 1;
2100 // Notification became hidden.
2101 TYPE_CLOSE = 2;
2102 // Notification switched to detail mode.
2103 TYPE_DETAIL = 3;
2104 // Notification was clicked.
2105 TYPE_ACTION = 4;
2106 // Notification was dismissed.
2107 TYPE_DISMISS = 5;
2108 // Notification switched to summary mode. The enum value of 14 is to
2109 // match that of metrics_constants.
2110 TYPE_COLLAPSE = 14;
2111 }
2112 optional Type type = 1;
2113
2114 // Package name associated with the notification.
2115 optional string package_name = 2;
2116
2117 // Tag associated with notification.
2118 optional string tag = 3;
2119
2120 // Application-supplied ID associated with the notification.
2121 optional int32 id = 4;
2122
2123 // Index of notification in the notification panel.
2124 optional int32 shade_index = 5;
2125
2126 // The number of notifications in the notification panel.
2127 optional int32 shade_count = 6;
2128
2129 // Importance for the notification.
2130 optional int32 importance = 7;
2131
2132 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002133 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002134
2135 // Importance for the notification channel.
2136 optional int32 channel_importance = 9;
2137
Howard Ro183c2bd2018-10-18 13:52:10 -07002138 // Application-supplied ID associated with the notifications group.
2139 optional string group_id = 10;
2140
Howard Ro688ae182018-09-25 00:09:36 -07002141 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002142 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002143
Howard Ro183c2bd2018-10-18 13:52:10 -07002144 // Reason for dismissal of a notification. This field is only meaningful for
2145 // TYPE_DISMISS events.
2146 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002147
Howard Ro183c2bd2018-10-18 13:52:10 -07002148 // The first post time of notification, stable across updates.
2149 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002150
Howard Ro183c2bd2018-10-18 13:52:10 -07002151 // The most recent interruption time, or the creation time if no updates.
2152 // Differs from update_millis because updates are filtered based on whether
2153 // they actually interrupted the user.
2154 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002155
Howard Ro183c2bd2018-10-18 13:52:10 -07002156 // The most recent update time, or the creation time if no updates.
2157 optional int64 update_millis = 15;
2158
2159 // The most recent visibility event.
2160 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002161}
2162
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002163/*
Yangster-macb89807e2018-11-15 21:10:57 -08002164 * Logs when a flag flip state changes.
2165 * Logged in P/h.
2166 */
2167message PhenotypeFlagStateChanged {
2168 // Mendel configuration name.
2169 optional string mendel_config_name = 1;
2170 // State
2171 enum State {
2172 STATE_UNKNOWN = 0;
2173 COMMITTED = 1;
2174 }
2175 optional State state = 2;
2176}
2177
2178/*
2179 * Logs when a binary push state changes.
2180 * Logged in Play store
2181 */
2182message BinaryPushStateChanged {
2183 // Binary package name.
2184 optional string binary_name = 1;
2185 // Version code.
2186 optional int64 version = 2;
2187 // State
2188 enum State {
2189 STATE_UNKNOWN = 0;
2190 DOWNLOAD_START = 1;
2191 DOWNLOAD_DONE = 2;
2192 INSTALL_START = 3;
2193 INSTALL_DONE = 4;
2194 REBOOT_START = 5;
2195 REBOOT_DONE = 6;
2196 }
2197 optional State state = 3;
2198}
2199
2200/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002201 * Logs when a connection becomes available and lost.
2202 * Logged in StatsCompanionService.java
2203 */
2204message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002205 // Id of the network.
2206 optional int32 net_id = 1;
2207
2208 enum State {
2209 UNKNOWN = 0;
2210 CONNECTED = 1;
2211 DISCONNECTED = 2;
2212 }
2213 // Connected state of a network.
2214 optional State state = 2;
2215}
2216
2217/**
2218 * Logs when a service starts and stops.
2219 * Logged from:
2220 * services/core/java/com/android/server/am/ActiveServices.java
2221 */
2222message ServiceStateChanged {
2223
2224 optional int32 uid = 1 [(is_uid) = true];
2225
2226 optional string package_name = 2;
2227
2228 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002229
2230 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002231 START = 1;
2232 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002233 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002234
2235 optional State state = 4;
2236}
2237
2238/**
2239 * Logs when a service is launched.
2240 * Logged from:
2241 * services/core/java/com/android/server/am/ActiveServices.java
2242 */
2243message ServiceLaunchReported {
2244
2245 optional int32 uid = 1 [(is_uid) = true];
2246
2247 optional string package_name = 2;
2248
2249 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002250}
Howard Ro688ae182018-09-25 00:09:36 -07002251
Chenjie Yubbcbc602018-02-05 16:51:52 -08002252//////////////////////////////////////////////////////////////////////
2253// Pulled atoms below this line //
2254//////////////////////////////////////////////////////////////////////
2255
2256/**
David Chenc8a43242017-10-17 16:23:28 -07002257 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2258 *
2259 * Pulled from:
2260 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2261 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002262message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002263 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002264
2265 optional int64 rx_bytes = 2;
2266
2267 optional int64 rx_packets = 3;
2268
2269 optional int64 tx_bytes = 4;
2270
2271 optional int64 tx_packets = 5;
2272}
2273
2274/**
2275 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2276 *
2277 * Pulled from:
2278 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2279 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002280message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002281 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002282
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002283 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2284 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002285
2286 optional int64 rx_bytes = 3;
2287
2288 optional int64 rx_packets = 4;
2289
2290 optional int64 tx_bytes = 5;
2291
2292 optional int64 tx_packets = 6;
2293}
2294
2295/**
2296 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2297 *
2298 * Pulled from:
2299 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2300 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002301message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002302 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002303
2304 optional int64 rx_bytes = 2;
2305
2306 optional int64 rx_packets = 3;
2307
2308 optional int64 tx_bytes = 4;
2309
2310 optional int64 tx_packets = 5;
2311}
2312
2313/**
2314 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2315 *
2316 * Pulled from:
2317 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2318 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002319message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002320 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002321
Yao Chenc40a19d2018-03-15 16:48:25 -07002322 // 1 denotes foreground and 0 denotes background. This is called Set in
2323 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002324 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002325
2326 optional int64 rx_bytes = 3;
2327
2328 optional int64 rx_packets = 4;
2329
2330 optional int64 tx_bytes = 5;
2331
2332 optional int64 tx_packets = 6;
2333}
2334
2335/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002336 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2337 *
2338 * Pulled from:
2339 * StatsCompanionService
2340 */
2341message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002342 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002343
2344 optional int64 rx_bytes = 2;
2345
2346 optional int64 tx_bytes = 3;
2347}
2348
2349/**
David Chenc8a43242017-10-17 16:23:28 -07002350 * Pulls the kernel wakelock durations. This atom is adapted from
2351 * android/internal/os/KernelWakelockStats.java
2352 *
2353 * Pulled from:
2354 * StatsCompanionService using KernelWakelockReader.
2355 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002356message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002357 optional string name = 1;
2358
2359 optional int32 count = 2;
2360
2361 optional int32 version = 3;
2362
Yangster-maca8a30442018-10-13 23:46:34 -07002363 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002364}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002365
Chenjie Yu05013b32017-11-21 10:21:41 -08002366/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002367 * Pulls low power state information. This includes platform and subsystem sleep state information,
2368 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002369 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002370 * hardware/interfaces/power/1.1/types.hal
2371 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002372message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002373 // Subsystem name
2374 optional string subsystem_name = 1;
2375 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2376 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2377 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002378 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002379 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002380 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002381 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002382}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002383
Chenjie Yu05013b32017-11-21 10:21:41 -08002384/**
Bookatz92da2832018-11-01 18:10:03 -07002385 * Pulls on-device power measurement information.
2386 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2387 * Pulled from:
2388 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2389 */
2390message OnDevicePowerMeasurement {
2391 // Name of the subsystem (to which the rail belongs).
2392 optional string subsystem_name = 1;
2393
2394 // Rail name. The rail lies within the subsystem.
2395 optional string rail_name = 2;
2396
2397 // Time (in ms since boot) at which the rail energy value was measured.
2398 // This may differ slightly from the time that statsd logs this information.
2399 optional uint64 measurement_timestamp_millis = 3;
2400
2401 // Accumulated energy used via the rail since device boot in uWs.
2402 optional uint64 energy_microwatt_secs = 4;
2403}
2404
2405/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002406 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002407 * Pulls the time the cpu spend on the frequency index. Frequency index
2408 * starts from highest to lowest. The value should be monotonically
2409 * increasing since boot. However, if there is a cpu
2410 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002411 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002412message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002413 optional uint32 cluster = 1;
2414 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002415 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002416}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002417
Chenjie Yu05013b32017-11-21 10:21:41 -08002418/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002419 * Pulls Cpu Time Per Uid.
2420 * Note that isolated process uid time should be attributed to host uids.
2421 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002422message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002423 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002424 optional uint64 user_time_millis = 2;
2425 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002426}
2427
2428/**
2429 * Pulls Cpu Time Per Uid per frequency.
2430 * Note that isolated process uid time should be attributed to host uids.
2431 * For each uid, we order the time by descending frequencies.
2432 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002433message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002434 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002435 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002436 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002437}
Hugo Benichi884970e2017-11-14 22:42:46 +09002438
Chenjie Yu05013b32017-11-21 10:21:41 -08002439/**
2440 * Pulls Wifi Controller Activity Energy Info
2441 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002442message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002443 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002444 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002445 // stack reported state
2446 // TODO: replace this with proto enum
2447 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002448 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002449 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002450 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002451 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002452 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002453 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002454 // product of current(mA), voltage(V) and time(ms)
2455 optional uint64 controller_energy_used = 6;
2456}
2457
2458/**
2459 * Pulls Modem Activity Energy Info
2460 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002461message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002462 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002463 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002464 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002465 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002466 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002467 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002468 /**
2469 * Tx power index
2470 * index 0 = tx_power < 0dBm
2471 * index 1 = 0dBm < tx_power < 5dBm
2472 * index 2 = 5dBm < tx_power < 15dBm
2473 * index 3 = 15dBm < tx_power < 20dBm
2474 * index 4 = tx_power > 20dBm
2475 */
2476 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002477 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002478 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002479 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002480 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002481 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002482 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002483 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002484 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002485 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002486 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002487 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002488 // product of current(mA), voltage(V) and time(ms)
2489 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002490}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002491
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002492/**
2493 * Pulls Bluetooth Activity Energy Info
2494 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2495 */
2496message BluetoothActivityInfo {
2497 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002498 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002499 // bluetooth stack state
2500 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002501 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002502 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002503 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002504 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002505 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002506 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002507 // product of current(mA), voltage(V) and time(ms)
2508 optional uint64 energy_used = 6;
2509}
2510
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002511/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002512 * Logs the memory stats for a process.
2513 */
2514message ProcessMemoryState {
2515 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002516 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002517
2518 // The process name.
2519 optional string process_name = 2;
2520
2521 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002522 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002523
2524 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002525 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002526
2527 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002528 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002529
Rajeev Kumar90235992018-01-29 11:06:48 -08002530 // RSS
2531 optional int64 rss_in_bytes = 6;
2532
2533 // CACHE
2534 optional int64 cache_in_bytes = 7;
2535
2536 // SWAP
2537 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002538
2539 // RSS high watermark.
2540 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2541 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002542 // Deprecated: use ProcessMemoryHighWaterMark atom instead.
2543 optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
Rafal Slawik272a8162018-11-01 15:12:28 +00002544
2545 // Elapsed real time when the process started.
2546 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2547 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002548}
2549
2550/*
Rafal Slawik08621582018-10-15 14:53:07 +01002551 * Logs the memory stats for a native process (from procfs).
2552 */
2553message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002554 // The uid if available. -1 means not available.
2555 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002556
Rafal Slawikbf67d072018-10-23 11:07:54 +01002557 // The process name.
2558 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002559
Rafal Slawikbf67d072018-10-23 11:07:54 +01002560 // # of page-faults
2561 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002562
Rafal Slawikbf67d072018-10-23 11:07:54 +01002563 // # of major page-faults
2564 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002565
Rafal Slawikbf67d072018-10-23 11:07:54 +01002566 // RSS
2567 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002568
Rafal Slawikbf67d072018-10-23 11:07:54 +01002569 // RSS high watermark.
2570 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002571 // Deprecated: use ProcessMemoryHighWaterMark atom instead.
2572 optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
Rafal Slawikbf67d072018-10-23 11:07:54 +01002573
2574 // Elapsed real time when the process started.
2575 // Value is read from /proc/PID/stat, field 22.
2576 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002577}
2578
2579/*
Rafal Slawik3bea8952018-11-15 12:39:33 +00002580 * Logs the memory high-water mark for a process.
2581 * Recorded in ActivityManagerService.
2582 */
2583message ProcessMemoryHighWaterMark {
2584 // The uid if available. -1 means not available.
2585 optional int32 uid = 1 [(is_uid) = true];
2586
2587 // The process name. Provided by ActivityManagerService or read from /proc/PID/cmdline.
2588 optional string process_name = 2;
2589
2590 // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
2591 // /proc/PID/status.
2592 optional int64 rss_high_water_mark_in_bytes = 3;
2593}
2594
2595/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002596 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002597 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002598message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002599 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002600}
2601
2602/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002603 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002604 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002605message SystemUptime {
2606 // Milliseconds since the system was booted.
2607 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2608 // for external input).
2609 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002610 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002611}
2612
2613/*
2614 * Reads from /proc/uid_concurrent_active_time which has the format:
2615 * active: X (X is # cores)
2616 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2617 * [uid1]: [time-0] [time-1] [time-2] ... ...
2618 * ...
2619 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2620 * The file contains a monotonically increasing count of time for a single boot.
2621 */
2622message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002623 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002624 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002625}
2626
2627/**
2628 * Reads from /proc/uid_concurrent_policy_time which has the format:
2629 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2630 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2631 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2632 * ...
2633 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2634 * The file contains a monotonically increasing count of time for a single boot.
2635 */
2636message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002637 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002638 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002639 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002640}
2641
2642/*
2643 * Pulls free disk space, for data, system partition and temporary directory.
2644 */
2645message DiskSpace {
2646 // available bytes in data partition
2647 optional uint64 data_available_bytes = 1;
2648 // available bytes in system partition
2649 optional uint64 system_available_bytes = 2;
2650 // available bytes in download cache or temp directories
2651 optional uint64 temp_available_bytes = 3;
2652}
Tej Singhbf972d92018-01-10 20:51:13 -08002653
2654/**
2655 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002656 * Pulled from:
2657 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002658 */
2659message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002660 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002661}
2662
2663/**
2664 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002665 * Pulled from:
2666 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002667 */
2668message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002669 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002670}
2671
2672/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002673 * Pulls battery voltage.
2674 * Pulled from:
2675 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2676 */
2677message BatteryVoltage {
2678 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002679 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002680}
2681
2682/**
Tej Singhb1dbc8b2018-11-19 15:49:47 -08002683 * Pulls battery level (percent full, from 0 to 100).
2684 *
2685 * Pulled from:
2686 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2687 */
2688message BatteryLevel {
2689 // Battery level. Should be in [0, 100].
2690 optional int32 battery_level = 1;
2691}
2692
2693/**
Tej Singhd89137e2018-03-26 14:51:40 -07002694 * Pulls the temperature of various parts of the device.
2695 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002696 *
2697 * Pulled from:
2698 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2699 */
2700message Temperature {
2701 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2702 optional android.os.TemperatureTypeEnum sensor_location = 1;
2703
2704 // The name of the temperature source. Eg. CPU0
2705 optional string sensor_name = 2;
2706
Tej Singhd89137e2018-03-26 14:51:40 -07002707 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002708 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002709}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002710
2711/**
2712 * Pulls the statistics of calls to Binder.
2713 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002714 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2715 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002716 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002717 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002718 */
2719message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002720 // UID of the process responsible for the binder transaction. It will be set if the process
2721 // executing the binder transaction attribute the transaction to another uid using
2722 // Binder.setThreadWorkSource().
2723 //
2724 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002725 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002726 // UID of the process executing the binder transaction.
2727 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002728 // Fully qualified class name of the API call.
2729 //
2730 // This is a system server class name.
2731 //
2732 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2733 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2734 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2735 // commonly used APIs.
2736 optional string service_class_name = 2;
2737 // Method name of the API call. It can also be a transaction code if we cannot
2738 // resolve it to a name. See Binder#getTransactionName.
2739 //
2740 // This is a system server method name.
2741 optional string service_method_name = 3;
2742 // Total number of API calls.
2743 optional int64 call_count = 4;
2744 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2745 optional bool screen_interactive = 13;
2746 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2747 // call_count will be equal to recorded_call_count.
2748 //
2749 // If recorded_call_count is different than call_count, it means data collection has been
2750 // sampled. All the fields below will be sampled in this case.
2751 optional int64 recorded_call_count = 12;
2752 // Number of exceptions thrown by the API.
2753 optional int64 recorded_exception_count = 5;
2754 // Total latency of all API calls.
2755 // Average can be computed using total_latency_micros / recorded_call_count.
2756 optional int64 recorded_total_latency_micros = 6;
2757 // Maximum latency of one API call.
2758 optional int64 recorded_max_latency_micros = 7;
2759 // Total CPU usage of all API calls.
2760 // Average can be computed using total_cpu_micros / recorded_call_count.
2761 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2762 optional int64 recorded_total_cpu_micros = 8;
2763 // Maximum CPU usage of one API call.
2764 optional int64 recorded_max_cpu_micros = 9;
2765 // Maximum parcel reply size of one API call.
2766 optional int64 recorded_max_reply_size_bytes = 10;
2767 // Maximum parcel request size of one API call.
2768 optional int64 recorded_max_request_size_bytes = 11;
2769}
2770
2771/**
2772 * Pulls the statistics of exceptions during calls to Binder.
2773 *
2774 * Binder stats are cumulative from boot unless somebody reset the data using
2775 * > adb shell dumpsys binder_calls_stats --reset
2776 */
2777message BinderCallsExceptions {
2778 // Exception class name, e.g. java.lang.IllegalArgumentException.
2779 //
2780 // This is an exception class name thrown by the system server.
2781 optional string exception_class_name = 1;
2782 // Total number of exceptions.
2783 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002784}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002785
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002786/**
2787 * Pulls the statistics of message dispatching on HandlerThreads.
2788 *
2789 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2790 * config on the device.
2791 *
2792 * Next tag: 11
2793 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002794message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002795 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002796 optional int32 uid = 1 [(is_uid) = true];
2797
2798 // Fully qualified class name of the handler target class.
2799 //
2800 // This field does not contain PII. This is a system server class name.
2801 optional string handler_class_name = 2;
2802
2803 // The name of the thread that runs the Looper.
2804 //
2805 // This field does not contain PII. This is a system server thread name.
2806 optional string looper_thread_name = 3;
2807
2808 // The name of the dispatched message.
2809 //
2810 // This field does not contain PII. This is a system server constant or class
2811 // name.
2812 optional string message_name = 4;
2813
2814 // Total number of successfully dispatched messages.
2815 optional int64 message_count = 5;
2816
2817 // Total number of messages that failed dispatching.
2818 optional int64 exception_count = 6;
2819
2820 // Total number of processed messages we have data recorded for. If we
2821 // collected data for all the messages, message_count will be equal to
2822 // recorded_message_count.
2823 //
2824 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002825 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002826 optional int64 recorded_message_count = 7;
2827
2828 // Total latency of all processed messages.
2829 // Average can be computed using recorded_total_latency_micros /
2830 // recorded_message_count.
2831 optional int64 recorded_total_latency_micros = 8;
2832
2833 // Total CPU usage of all processed message.
2834 // Average can be computed using recorded_total_cpu_micros /
2835 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002836 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002837 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002838
2839 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2840 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002841
2842 // Max recorded CPU usage of all processed messages.
2843 optional int64 recorded_max_cpu_micros = 11;
2844
2845 // Max recorded latency of all processed messages.
2846 optional int64 recorded_max_latency_micros = 12;
2847
2848 // Total number of messages we tracked the dispatching delay for. If we
2849 // collected data for all the messages, message_count will be equal to
2850 // recorded_delay_message_count.
2851 //
2852 // If recorded_delay_message_count is different than message_count, it means data
2853 // collection has been sampled or/and not all messages specified the target dispatch time.
2854 // The fields below will be sampled in this case.
2855 optional int64 recorded_delay_message_count = 13;
2856
2857 // Total dispatching delay of all processed messages.
2858 // Calculated as a difference between the target dispatching time (Message.when)
2859 // and the actual dispatching time.
2860 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2861 optional int64 recorded_total_delay_millis = 14;
2862
2863 // Max dispatching delay of all processed messages.
2864 // Calculated as a difference between the target dispatching time (Message.when)
2865 // and the actual dispatching time.
2866 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002867}
Tej Singh86dc9db2018-09-06 00:39:57 +00002868
2869/**
2870 * Pulls disk information, such as write speed and latency.
2871 */
2872message DiskStats {
2873 // Time taken to open, write 512B to, and close a file.
2874 // -1 if error performing the check.
2875 optional int64 data_write_latency_millis = 1;
2876
2877 optional bool file_based_encryption = 2;
2878
2879 // Recent disk write speed in kB/s.
2880 // -1 if error querying storageed.
2881 // 0 if data is unavailable.
2882 optional int32 recent_disk_write_speed = 3;
2883}
2884
2885
2886/**
2887 * Free and total bytes of the Data, Cache, and System partition.
2888 */
2889message DirectoryUsage {
2890 enum Directory {
2891 UNKNOWN = 0;
2892 DATA = 1;
2893 CACHE = 2;
2894 SYSTEM = 3;
2895 }
2896 optional Directory directory = 1;
2897 optional int64 free_bytes = 2;
2898 optional int64 total_bytes = 3;
2899}
2900
2901
2902/**
2903 * Size of an application: apk size, data size, and cache size.
2904 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2905 * Information is only reported for apps with the primary user (user 0).
2906 * Sizes are aggregated by package name.
2907 */
2908message AppSize {
2909 // Including uids will involve modifying diskstats logic.
2910 optional string package_name = 1;
2911 // App size in bytes. -1 if unavailable.
2912 optional int64 app_size_bytes = 2;
2913 // App data size in bytes. -1 if unavailable.
2914 optional int64 app_data_size_bytes = 3;
2915 // App cache size in bytes. -1 if unavailable.
2916 optional int64 app_cache_size_bytes = 4;
2917 // Time that the cache file was produced.
2918 // Uses System.currentTimeMillis(), which is wall clock time.
2919 optional int64 cache_time_millis = 5;
2920}
2921
2922
2923/**
2924 * Size of a particular category. Eg: photos, videos.
2925 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2926 */
2927message CategorySize {
2928 enum Category {
2929 UNKNOWN = 0;
2930 APP_SIZE = 1;
2931 APP_DATA_SIZE = 2;
2932 APP_CACHE_SIZE = 3;
2933 PHOTOS = 4;
2934 VIDEOS = 5;
2935 AUDIO = 6;
2936 DOWNLOADS = 7;
2937 SYSTEM = 8;
2938 OTHER = 9;
2939 }
2940 optional Category category = 1;
2941 // Category size in bytes.
2942 optional int64 size_bytes = 2;
2943 // Time that the cache file was produced.
2944 // Uses System.currentTimeMillis(), which is wall clock time.
2945 optional int64 cache_time_millis = 3;
2946}
Tej Singhd6d6d772018-09-05 17:41:25 -07002947
2948/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002949 * Pulls per uid I/O stats. The stats are cumulative since boot.
2950 *
2951 * Read/write bytes are I/O events from a storage device
2952 * Read/write chars are data requested by read/write syscalls, and can be
2953 * satisfied by caching.
2954 *
2955 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2956 */
2957message DiskIo {
2958 optional int32 uid = 1 [(is_uid) = true];
2959 optional int64 fg_chars_read = 2;
2960 optional int64 fg_chars_write = 3;
2961 optional int64 fg_bytes_read = 4;
2962 optional int64 fg_bytes_write = 5;
2963 optional int64 bg_chars_read = 6;
2964 optional int64 bg_chars_write = 7;
2965 optional int64 bg_bytes_read = 8;
2966 optional int64 bg_bytes_write = 9;
2967 optional int64 fg_fsync = 10;
2968 optional int64 bg_fsync= 11;
2969}
2970
2971
2972/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002973 * Pulls the number of fingerprints for each user.
2974 *
2975 * Pulled from StatsCompanionService, which queries FingerprintManager.
2976 */
2977message NumFingerprints {
2978 // The associated user. Eg: 0 for owners, 10+ for others.
2979 // Defined in android/os/UserHandle.java
2980 optional int32 user = 1;
2981 // Number of fingerprints registered to that user.
2982 optional int32 num_fingerprints = 2;
2983}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002984
Yangsteraf9aee72018-10-12 09:26:16 -07002985message AggStats {
2986 optional int64 min = 1;
2987
2988 optional int64 average = 2;
2989
2990 optional int64 max = 3;
2991}
2992
2993message ProcessStatsStateProto {
2994 optional android.service.procstats.ScreenState screen_state = 1;
2995
2996 optional android.service.procstats.MemoryState memory_state = 2;
2997
2998 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2999 // and not frameworks/base/core/java/android/app/ActivityManager.java
3000 optional android.service.procstats.ProcessState process_state = 3;
3001
3002 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003003 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003004
3005 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003006 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07003007
3008 // # of samples taken
3009 optional int32 sample_size = 5;
3010
3011 // PSS is memory reserved for this process
3012 optional AggStats pss = 6;
3013
3014 // USS is memory shared between processes, divided evenly for accounting
3015 optional AggStats uss = 7;
3016
3017 // RSS is memory resident for this process
3018 optional AggStats rss = 8;
3019}
3020
3021// Next Tag: 7
3022message ProcessStatsProto {
3023 // Name of process.
3024 optional string process = 1;
3025
3026 // Uid of the process.
3027 optional int32 uid = 2;
3028
3029 // Information about how often kills occurred
3030 message Kill {
3031 // Count of excessive CPU kills
3032 optional int32 cpu = 1;
3033
3034 // Count of kills when cached
3035 optional int32 cached = 2;
3036
3037 // PSS stats during cached kill
3038 optional AggStats cached_pss = 3;
3039 }
3040 optional Kill kill = 3;
3041
3042 // Time and memory spent in various states.
3043 repeated ProcessStatsStateProto states = 5;
3044
3045 // Total time process has been running... screen_state, memory_state, and process_state
3046 // will not be set.
3047 optional ProcessStatsStateProto total_running_state = 6;
3048}
3049
3050message PackageServiceOperationStatsProto {
3051 // Operate enum: Started, Foreground, Bound, Executing
3052 optional android.service.procstats.ServiceOperationState operation = 1;
3053
3054 // Number of times the service was in this operation.
3055 optional int32 count = 2;
3056
3057 // Information about a state the service can be in.
3058 message StateStats {
3059 // Screen state enum.
3060 optional android.service.procstats.ScreenState screen_state = 1;
3061 // Memory state enum.
3062 optional android.service.procstats.MemoryState memory_state = 2;
3063
3064 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003065 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003066 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003067 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003068 }
3069 repeated StateStats state_stats = 3;
3070}
3071
3072message PackageServiceStatsProto {
3073 // Name of service component.
3074 optional string service_name = 1;
3075
3076 // The operation stats.
3077 // The package_name, package_uid, package_version, service_name will not be set to save space.
3078 repeated PackageServiceOperationStatsProto operation_stats = 2;
3079}
3080
3081message PackageAssociationSourceProcessStatsProto {
3082 // Uid of the process.
3083 optional int32 process_uid = 1;
3084 // Process name.
3085 optional string process_name = 2;
3086
3087 // Total count of the times this association appeared.
3088 optional int32 total_count = 3;
3089
3090 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003091 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003092
3093 // Total count of the times this association became actively impacting its target process.
3094 optional int32 active_count = 5;
3095
3096 // Information on one source in this association.
3097 message StateStats {
3098 // Process state enum.
3099 optional android.service.procstats.ProcessState process_state = 1;
3100 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003101 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003102 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003103 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003104 }
3105 repeated StateStats active_state_stats = 6;
3106}
3107
3108message PackageAssociationProcessStatsProto {
3109 // Name of the target component.
3110 optional string component_name = 1;
3111 // Information on one source in this association.
3112 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3113}
3114
3115
3116message ProcessStatsPackageProto {
3117 // Name of package.
3118 optional string package = 1;
3119
3120 // Uid of the package.
3121 optional int32 uid = 2;
3122
3123 // Version of the package.
3124 optional int64 version = 3;
3125
3126 // Stats for each process running with the package loaded in to it.
3127 repeated ProcessStatsProto process_stats = 4;
3128
3129 // Stats for each of the package's services.
3130 repeated PackageServiceStatsProto service_stats = 5;
3131
3132 // Stats for each association with the package.
3133 repeated PackageAssociationProcessStatsProto association_stats = 6;
3134}
3135
3136message ProcessStatsSectionProto {
3137 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003138 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003139
3140 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003141 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003142
3143 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003144 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003145
3146 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003147 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003148
3149 // System runtime library. e.g. "libdvm.so", "libart.so".
3150 optional string runtime = 5;
3151
3152 // whether kernel reports swapped pss.
3153 optional bool has_swapped_pss = 6;
3154
3155 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3156 enum Status {
3157 STATUS_UNKNOWN = 0;
3158 STATUS_COMPLETE = 1;
3159 STATUS_PARTIAL = 2;
3160 STATUS_SHUTDOWN = 3;
3161 STATUS_SYSPROPS = 4;
3162 }
3163 repeated Status status = 7;
3164
3165 // Stats for each process.
3166 repeated ProcessStatsProto process_stats = 8;
3167
3168 // Stats for each package.
3169 repeated ProcessStatsPackageProto package_stats = 9;
3170}
3171
Chenjie Yu12e5e672018-09-14 15:54:59 -07003172/**
3173 * Pulled from ProcessStatsService.java
3174 */
3175message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003176 optional ProcessStatsSectionProto proc_stats_section = 1;
3177}
3178
3179message PowerProfileProto {
3180 optional double cpu_suspend = 1;
3181
3182 optional double cpu_idle = 2;
3183
3184 optional double cpu_active = 3;
3185
3186 message CpuCluster {
3187 optional int32 id = 1;
3188 optional double cluster_power = 2;
3189 optional int32 cores = 3;
3190 repeated int64 speed = 4;
3191 repeated double core_power = 5;
3192 }
3193
3194 repeated CpuCluster cpu_cluster = 40;
3195
3196 optional double wifi_scan = 4;
3197
3198 optional double wifi_on = 5;
3199
3200 optional double wifi_active = 6;
3201
3202 optional double wifi_controller_idle = 7;
3203
3204 optional double wifi_controller_rx = 8;
3205
3206 optional double wifi_controller_tx = 9;
3207
3208 repeated double wifi_controller_tx_levels = 10;
3209
3210 optional double wifi_controller_operating_voltage = 11;
3211
3212 optional double bluetooth_controller_idle = 12;
3213
3214 optional double bluetooth_controller_rx = 13;
3215
3216 optional double bluetooth_controller_tx = 14;
3217
3218 optional double bluetooth_controller_operating_voltage = 15;
3219
3220 optional double modem_controller_sleep = 16;
3221
3222 optional double modem_controller_idle = 17;
3223
3224 optional double modem_controller_rx = 18;
3225
3226 repeated double modem_controller_tx = 19;
3227
3228 optional double modem_controller_operating_voltage = 20;
3229
3230 optional double gps_on = 21;
3231
3232 repeated double gps_signal_quality_based = 22;
3233
3234 optional double gps_operating_voltage = 23;
3235
3236 optional double bluetooth_on = 24;
3237
3238 optional double bluetooth_active = 25;
3239
3240 optional double bluetooth_at_cmd = 26;
3241
3242 optional double ambient_display = 27;
3243
3244 optional double screen_on = 28;
3245
3246 optional double radio_on = 29;
3247
3248 optional double radio_scanning = 30;
3249
3250 optional double radio_active = 31;
3251
3252 optional double screen_full = 32;
3253
3254 optional double audio = 33;
3255
3256 optional double video = 34;
3257
3258 optional double flashlight = 35;
3259
3260 optional double memory = 36;
3261
3262 optional double camera = 37;
3263
3264 optional double wifi_batched_scan = 38;
3265
3266 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003267}
Chenjie Yuab530202018-09-26 12:39:20 -07003268
3269/**
3270 * power_profile.xml and other constants for power model calculations.
3271 * Pulled from PowerProfile.java
3272 */
3273message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003274 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003275}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003276
3277/**
arangelovd5db50e2018-10-12 20:24:39 +01003278 * Logs when a user restriction was added or removed.
3279 *
3280 * Logged from:
3281 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3282 */
3283message UserRestrictionChanged {
3284 // The raw string of the user restriction as defined in UserManager.
3285 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3286 optional string restriction = 1;
3287 // Whether the restriction is enabled or disabled.
3288 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003289}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003290
3291/**
3292 * Pulls process user time and system time. Puller takes a snapshot of all pids
3293 * in the system and returns cpu stats for those that are working at the time.
3294 * Dead pids will be dropped. Kernel processes are excluded.
3295 * Min cool-down is 5 sec.
3296 */
3297message ProcessCpuTime {
3298 optional int32 uid = 1 [(is_uid) = true];
3299
3300 optional string process_name = 2;
3301 // Process cpu time in user space, cumulative from boot/process start
3302 optional int64 user_time_millis = 3;
3303 // Process cpu time in system space, cumulative from boot/process start
3304 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003305}
Misha Wagner5a51e002018-10-03 15:04:09 +01003306
3307/**
3308 * Pulls the CPU usage for each thread.
3309 *
3310 * Read from /proc/$PID/task/$TID/time_in_state files.
3311 *
3312 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3313 * time_in_state files not being present on some phones, have not been addressed. These should be
3314 * considered before a public release.
3315 */
3316message CpuTimePerThreadFreq {
3317 // UID that owns the process.
3318 optional int32 uid = 1 [(is_uid) = true];
3319 // ID of the process.
3320 optional uint32 process_id = 2;
3321 // ID of the thread.
3322 optional uint32 thread_id = 3;
3323 // Name of the process taken from `/proc/$PID/cmdline`.
3324 optional string process_name = 4;
3325 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3326 optional string thread_name = 5;
3327 // What frequency the CPU was running at, in KHz
3328 optional uint32 frequency_khz = 6;
3329 // Time spent in frequency in milliseconds, since thread start.
3330 optional uint32 time_millis = 7;
3331}
Bookatz75ee6042018-11-09 12:27:37 -08003332
3333/**
3334 * Pulls on-device BatteryStats power use calculations for the overall device.
3335 */
3336message DeviceCalculatedPowerUse {
3337 // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset
3338 // (i.e. roughly since device was last significantly charged).
3339 // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3340 optional float computed_power_milli_amp_hours = 1;
3341}
3342
3343/**
3344 * Pulls on-device BatteryStats power use calculations broken down by uid.
3345 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3346 * that is attributed to non-uid items. They must all be included to get the total power use.
3347 */
3348message DeviceCalculatedPowerBlameUid {
3349 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3350 optional int32 uid = 1 [(is_uid) = true];
3351
3352 // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset
3353 // (i.e. roughly since device was last significantly charged).
3354 optional float power_milli_amp_hours = 2;
3355}
3356
3357/**
3358 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3359 * drain type.
3360 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3361 * is attributed uids. They must all be included to get the total power use.
3362 */
3363message DeviceCalculatedPowerBlameOther {
3364 // The type of item whose power use is being reported.
3365 enum DrainType {
3366 AMBIENT_DISPLAY = 0;
3367 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3368 BLUETOOTH = 2;
3369 CAMERA = 3;
3370 // Cell-standby
3371 CELL = 4;
3372 FLASHLIGHT = 5;
3373 IDLE = 6;
3374 MEMORY = 7;
3375 // Amount that total computed drain exceeded the drain estimated using the
3376 // battery level changes and capacity.
3377 OVERCOUNTED = 8;
3378 PHONE = 9;
3379 SCREEN = 10;
3380 // Amount that total computed drain was below the drain estimated using the
3381 // battery level changes and capacity.
3382 UNACCOUNTED = 11;
3383 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3384 WIFI = 13;
3385 }
3386 optional DrainType drain_type = 1;
3387
3388 // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset
3389 // (i.e. roughly since device was last significantly charged).
3390 optional float power_milli_amp_hours = 2;
Rafal Slawik3bea8952018-11-15 12:39:33 +00003391}