blob: 4eb283876b380a87b088e930eed51e6d56558cae [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";
Chiachang Wangf6bedc22019-01-14 11:54:32 +080028import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080029import "frameworks/base/core/proto/android/os/enums.proto";
Chiachang Wangf6bedc22019-01-14 11:54:32 +080030import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080031import "frameworks/base/core/proto/android/server/enums.proto";
Bookatz48d362e2018-11-06 15:49:08 -080032import "frameworks/base/core/proto/android/server/location/enums.proto";
Yangsteraf9aee72018-10-12 09:26:16 -070033import "frameworks/base/core/proto/android/service/procstats_enum.proto";
34import "frameworks/base/core/proto/android/stats/enums.proto";
shawnlinea5b66b2018-11-13 15:05:29 +080035import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
Yao Chen8c433862018-10-24 14:09:20 -070036import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080037import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080038import "frameworks/base/core/proto/android/telephony/enums.proto";
39import "frameworks/base/core/proto/android/view/enums.proto";
arangelov4e994062018-11-13 16:12:38 +000040import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
41import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080042
Yao Chend54f9dd2017-10-17 17:37:48 +000043/**
Stefan Lafonae2df012017-11-14 09:17:21 -080044 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000045 * raw stats log events from the Android system, also known as "atoms."
46 *
47 * This field contains a single oneof with all of the available messages.
48 * The stats-log-api-gen tool runs as part of the Android build and
49 * generates the android.util.StatsLog class, which contains the constants
50 * and methods that Android uses to log.
51 *
Stefan Lafonae2df012017-11-14 09:17:21 -080052 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000053 * Instead, statsd on Android constructs these messages synthetically,
54 * in the format defined here and in stats_log.proto.
55 */
Stefan Lafonae2df012017-11-14 09:17:21 -080056message Atom {
57 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070058 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070059 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
60 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070061 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070062 BleScanResultReceived ble_scan_result_received = 4;
63 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080064 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070065 SyncStateChanged sync_state_changed = 7;
66 ScheduledJobStateChanged scheduled_job_state_changed = 8;
67 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070068 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080069 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
70 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
71 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070072 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
73 MemoryFactorStateChanged memory_factor_state_changed = 15;
74 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
75 CachedKillReported cached_kill_reported = 17;
76 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070077 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080078 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
79 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
80 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070081 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080082 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070083 CameraStateChanged camera_state_changed = 25;
84 FlashlightStateChanged flashlight_state_changed = 26;
85 UidProcessStateChanged uid_process_state_changed = 27;
86 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
87 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070088 BatteryLevelChanged battery_level_changed = 30;
89 ChargingStateChanged charging_state_changed = 31;
90 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070091 InteractiveStateChanged interactive_state_changed = 33;
92 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070093 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
94 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070095 WifiLockStateChanged wifi_lock_state_changed = 37;
96 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
97 WifiScanStateChanged wifi_scan_state_changed = 39;
98 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070099 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -0700100 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -0700101 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +0900102 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -0700103 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -0800104 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -0800105 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800106 AppStartOccurred app_start_occurred = 48;
107 AppStartCanceled app_start_canceled = 49;
108 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800109 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800110 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800111 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800112 LmkStateChanged lmk_state_changed = 54;
113 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800114 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800115 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800116 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800117 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800118 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800119 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800120 KeyguardStateChanged keyguard_state_changed = 62;
121 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
122 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800123 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800124 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800125 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
126 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Bookatz48d362e2018-11-06 15:49:08 -0800127 GpsSignalQualityChanged gps_signal_quality_changed = 69;
Andrew Chantb56388b2018-03-22 21:07:33 -0700128 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800129 SpeakerImpedanceReported speaker_impedance_reported = 71;
130 HardwareFailed hardware_failed = 72;
131 PhysicalDropDetected physical_drop_detected = 73;
132 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800133 MobileConnectionStateChanged mobile_connection_state_changed = 75;
134 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700135 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800136 AppCrashOccurred app_crash_occurred = 78;
137 ANROccurred anr_occurred = 79;
138 WTFOccurred wtf_occurred = 80;
139 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700140 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700141 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700142 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700143 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700144 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700145 FingerprintAcquired fingerprint_acquired = 87;
146 FingerprintAuthenticated fingerprint_authenticated = 88;
147 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700148 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700149 BatteryHealthSnapshot battery_health_snapshot = 91;
150 SlowIo slow_io = 92;
151 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700152 PhoneServiceStateChanged phone_service_state_changed = 94;
153 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100154 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700155 SettingsUIChanged settings_ui_changed = 97;
Chenjie Yuae9dfac2018-10-25 16:06:56 -0700156 ConnectivityStateChanged connectivity_state_changed = 98;
Chenjie Yu75b3c492018-10-06 21:45:19 -0700157 // TODO: service state change is very noisy shortly after boot, as well
158 // as at other transitions - coming out of doze, device plugged in, etc.
159 // Consider removing this if it becomes a problem
160 ServiceStateChanged service_state_changed = 99;
161 ServiceLaunchReported service_launch_reported = 100;
Yangster-macb89807e2018-11-15 21:10:57 -0800162 PhenotypeFlagStateChanged phenotype_flag_state_changed = 101;
163 BinaryPushStateChanged binary_push_state_changed = 102;
arangelov4e994062018-11-13 16:12:38 +0000164 DevicePolicyEvent device_policy_event = 103;
shawnlinea5b66b2018-11-13 15:05:29 +0800165 DocsUIFileOperationCanceledReported docs_ui_file_op_canceled = 104;
166 DocsUIFileOperationCopyMoveModeReported docs_ui_file_op_copy_move_mode_reported = 105;
167 DocsUIFileOperationFailureReported docs_ui_file_op_failure = 106;
168 DocsUIFileOperationReported docs_ui_provider_file_op = 107;
169 DocsUIInvalidScopedAccessRequestReported docs_ui_invalid_scoped_access_request = 108;
170 DocsUILaunchReported docs_ui_launch_reported = 109;
171 DocsUIRootVisitedReported docs_ui_root_visited = 110;
172 DocsUIStartupMsReported docs_ui_startup_ms = 111;
173 DocsUIUserActionReported docs_ui_user_action_reported = 112;
Bookatzda1798c2018-12-13 14:16:00 -0800174 WifiEnabledStateChanged wifi_enabled_state_changed = 113;
175 WifiRunningStateChanged wifi_running_state_changed = 114;
Ben Murdochbab399f2018-12-06 11:01:38 +0000176 AppCompacted app_compacted = 115;
lifr157fc552018-12-12 16:38:04 +0800177 NetworkDnsEventReported network_dns_event_Reported = 116;
shawnlina75e82d2019-01-07 10:31:12 +0800178 DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported = 117;
179 DocsUIPickResultReported docs_ui_pick_result_reported = 118;
180 DocsUISearchModeReported docs_ui_search_mode_reported = 119;
181 DocsUISearchTypeReported docs_ui_search_type_reported = 120;
Chiachang Wangf6bedc22019-01-14 11:54:32 +0800182 DataStallEvent data_stall_event = 121;
Yao Chend54f9dd2017-10-17 17:37:48 +0000183 }
David Chenc8a43242017-10-17 16:23:28 -0700184
David Chen6e3e6cb2018-01-03 16:14:06 -0800185 // Pulled events will start at field 10000.
Rafal Slawik3bea8952018-11-15 12:39:33 +0000186 // Next: 10043
David Chenc8a43242017-10-17 16:23:28 -0700187 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800188 WifiBytesTransfer wifi_bytes_transfer = 10000;
189 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
190 MobileBytesTransfer mobile_bytes_transfer = 10002;
191 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800192 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800193 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800194 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800195 CpuTimePerFreq cpu_time_per_freq = 10008;
196 CpuTimePerUid cpu_time_per_uid = 10009;
197 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800198 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800199 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800200 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800201 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800202 SystemElapsedRealtime system_elapsed_realtime = 10014;
203 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800204 CpuActiveTime cpu_active_time = 10016;
205 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000206 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800207 RemainingBatteryCapacity remaining_battery_capacity = 10019;
208 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800209 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100210 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100211 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100212 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000213 DiskStats disk_stats = 10025;
214 DirectoryUsage directory_usage = 10026;
215 AppSize app_size = 10027;
216 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700217 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700218 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700219 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700220 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700221 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700222 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700223 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100224 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100225 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700226 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800227 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
228 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
229 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
Rafal Slawik3bea8952018-11-15 12:39:33 +0000230 ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
Tej Singhb1dbc8b2018-11-19 15:49:47 -0800231 BatteryLevel battery_level = 10043;
Bookatz366a4432018-11-20 09:42:33 -0800232 BuildInformation build_information = 10044;
David Chenc8a43242017-10-17 16:23:28 -0700233 }
yroa1fe77c2018-02-26 14:22:54 -0800234
Bookatz76aafcf2018-09-17 16:17:10 -0700235 // DO NOT USE field numbers above 100,000 in AOSP.
236 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
237 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700238}
239
Yao Chend54f9dd2017-10-17 17:37:48 +0000240/**
Yangster-mac20877162017-12-22 17:19:39 -0800241 * This proto represents a node of an attribution chain.
242 * Note: All attribution chains are represented as a repeated field of type
243 * AttributionNode. It is understood that in such arrays, the order is that
244 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000245 */
Yangster-mac20877162017-12-22 17:19:39 -0800246message AttributionNode {
247 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800248 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800249
Yangster-mac20877162017-12-22 17:19:39 -0800250 // The (optional) string tag for an element in the attribution chain. If the
251 // element has no tag, it is encoded as an empty string.
252 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700253}
254
Yangster-mac48b3d622018-08-18 12:38:11 -0700255message KeyValuePair {
256 optional int32 key = 1;
257 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700258 int32 value_int = 2;
259 int64 value_long = 3;
260 string value_str = 4;
261 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700262 }
263}
264
265message KeyValuePairsAtom {
266 optional int32 uid = 1;
267 repeated KeyValuePair pairs = 2;
268}
269
Yao Chend54f9dd2017-10-17 17:37:48 +0000270/*
271 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800272 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000273 *
274 * RULES:
275 * - The field ids for each atom must start at 1, and count upwards by 1.
276 * Skipping field ids is not allowed.
277 * - These form an API, so renaming, renumbering or removing fields is
278 * not allowed between android releases. (This is not currently enforced,
279 * but there will be a tool to enforce this restriction).
280 * - The types must be built-in protocol buffer types, namely, no sub-messages
281 * are allowed (yet). The bytes type is also not allowed.
282 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800283 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000284 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800285 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000286 * - A field that is a uid should be a string field, tagged with the [xxx]
287 * annotation. The generated code on android will be represented by UIDs,
288 * and those UIDs will be translated in xxx to those strings.
289 *
290 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700291 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000292 * - If there is a UID, it goes first. Think in an object-oriented fashion.
293 * *****************************************************************************
294 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700295
Yao Chend54f9dd2017-10-17 17:37:48 +0000296/**
Yangster-mace16189a2018-08-26 12:20:16 -0700297 * Logs when the Thermal service HAL notifies the throttling start/stop events.
298 *
299 * Logged from:
300 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
301 */
302message ThermalThrottlingStateChanged {
303 optional android.os.TemperatureTypeEnum sensor_type = 1;
304
305 enum State {
306 UNKNOWN = 0;
307 START = 1;
308 STOP = 2;
309 }
310
311 optional State state = 2;
312
313 optional float temperature = 3;
314}
315
316/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000317 * Logs when the screen state changes.
318 *
319 * Logged from:
320 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
321 */
322message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800323 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700324 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700325}
Yao Chend54f9dd2017-10-17 17:37:48 +0000326
327/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700328 * Logs that the process state of the uid, as determined by ActivityManager
329 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000330 *
331 * Logged from:
332 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
333 */
Bookatzc1a050a2017-10-10 15:49:28 -0700334message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700335 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000336
Bookatzdb026a22018-01-10 19:01:56 -0800337 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700338 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000339}
340
341/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700342 * Logs process state change of a process, as per the activity manager.
343 *
344 * Logged from:
345 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
346 */
347message ProcessStateChanged {
348 optional int32 uid = 1;
349 optional string process_name = 2;
350 optional string package_name = 3;
351 // TODO: remove this when validation is done
352 optional int64 version = 5;
353 // The state, from frameworks/base/core/proto/android/app/enums.proto.
354 optional android.app.ProcessStateEnum state = 4;
355}
356
357/**
358 * Logs when ActivityManagerService sleep state is changed.
359 *
360 * Logged from:
361 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
362 */
363message ActivityManagerSleepStateChanged {
364 // TODO: import frameworks proto
365 enum State {
366 UNKNOWN = 0;
367 ASLEEP = 1;
368 AWAKE = 2;
369 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700370 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700371}
372
373/**
374 * Logs when system memory state changes.
375 *
376 * Logged from:
377 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
378 */
379message MemoryFactorStateChanged {
380 // TODO: import frameworks proto
381 enum State {
382 MEMORY_UNKNOWN = 0;
383 NORMAL = 1; // normal.
384 MODERATE = 2; // moderate memory pressure.
385 LOW = 3; // low memory.
386 CRITICAL = 4; // critical memory.
387
388 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700389 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700390}
391
392/**
393 * Logs when app is using too much cpu, according to ActivityManagerService.
394 *
395 * Logged from:
396 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
397 */
398message ExcessiveCpuUsageReported {
399 optional int32 uid = 1;
400 optional string process_name = 2;
401 optional string package_name = 3;
402 // package version. TODO: remove this when validation is done
403 optional int64 version = 4;
404}
405
406/**
407 * Logs when a cached process is killed, along with its pss.
408 *
409 * Logged from:
410 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
411 */
412message CachedKillReported {
413 optional int32 uid = 1;
414 optional string process_name = 2;
415 optional string package_name = 3;
416 // TODO: remove this when validation is done
417 optional int64 version = 5;
418 optional int64 pss = 4;
419}
420
421/**
422 * Logs when memory stats of a process is reported.
423 *
424 * Logged from:
425 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
426 */
427message ProcessMemoryStatReported {
428 optional int32 uid = 1;
429 optional string process_name = 2;
430 optional string package_name = 3;
431 //TODO: remove this when validation is done
432 optional int64 version = 9;
433 optional int64 pss = 4;
434 optional int64 uss = 5;
435 optional int64 rss = 6;
436 enum Type {
437 ADD_PSS_INTERNAL_SINGLE = 0;
438 ADD_PSS_INTERNAL_ALL_MEM = 1;
439 ADD_PSS_INTERNAL_ALL_POLL = 2;
440 ADD_PSS_EXTERNAL = 3;
441 ADD_PSS_EXTERNAL_SLOW = 4;
442 }
443 optional Type type = 7;
444 optional int64 duration = 8;
445}
446
447/**
Bookatzc1a050a2017-10-10 15:49:28 -0700448 * Logs that a process started, finished, crashed, or ANRed.
449 *
450 * Logged from:
451 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
452 */
453message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700454 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700455
David Chen0b5c90c2018-01-25 16:51:49 -0800456 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800457 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700458
Bookatzddccf0a2017-11-28 16:48:14 -0800459 // What lifecycle state the process changed to.
460 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800461 enum State {
462 FINISHED = 0;
463 STARTED = 1;
464 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800465 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800466 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700467}
468
Bookatzc1a050a2017-10-10 15:49:28 -0700469/**
470 * Logs when the ble scan state changes.
471 *
472 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700473 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700474 */
475message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800476 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700477
478 enum State {
479 OFF = 0;
480 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700481 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
482 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700483 }
484 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700485
Bookatze5ec0b42018-03-26 13:34:56 -0700486 // Does the scan have a filter.
487 optional bool is_filtered = 3;
488 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
489 optional bool is_first_match = 4;
490 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
491 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700492}
493
494/**
495 * Logs reporting of a ble scan finding results.
496 *
497 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700498 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700499 */
Bookatzae6738e2018-09-13 11:38:56 -0700500// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700501message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800502 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700503
504 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800505 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700506}
507
508/**
509 * Logs when a sensor state changes.
510 *
511 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700512 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700513 */
514message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800515 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700516
Bookatzc1a050a2017-10-10 15:49:28 -0700517 // The id (int) of the sensor.
518 optional int32 sensor_id = 2;
519
520 enum State {
521 OFF = 0;
522 ON = 1;
523 }
524 optional State state = 3;
525}
526
Bookatzc1a050a2017-10-10 15:49:28 -0700527/**
528 * Logs when GPS state changes.
529 *
530 * Logged from:
531 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
532 */
533message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800534 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700535
536 enum State {
537 OFF = 0;
538 ON = 1;
539 }
540 optional State state = 2;
541}
542
Bookatz48d362e2018-11-06 15:49:08 -0800543/**
544 * Logs when GPS signal quality.
545 *
546 * Logged from:
547 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
548 */
549message GpsSignalQualityChanged {
550 optional android.server.location.GpsSignalQualityEnum level = 1;
551}
552
Bookatzc1a050a2017-10-10 15:49:28 -0700553
554/**
555 * Logs when a sync manager sync state changes.
556 *
557 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700558 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700559 */
560message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800561 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700562
David Chen0b5c90c2018-01-25 16:51:49 -0800563 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800564 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700565
566 enum State {
567 OFF = 0;
568 ON = 1;
569 }
570 optional State state = 3;
571}
572
Yangster-mac96353002018-09-05 11:18:55 -0700573/*
574 * Deferred job stats.
575 *
576 * Logged from:
577 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
578*/
579message DeferredJobStatsReported {
580 repeated AttributionNode attribution_node = 1;
581
582 // Number of jobs deferred.
583 optional int32 num_jobs_deferred = 2;
584
585 // Time since the last job runs.
586 optional int64 time_since_last_job_millis = 3;
587}
588
Bookatzc1a050a2017-10-10 15:49:28 -0700589/**
590 * Logs when a job scheduler job 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 ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800596 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700597
598 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800599 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700600
601 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800602 FINISHED = 0;
603 STARTED = 1;
604 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700605 }
606 optional State state = 3;
607
Tej Singh33a412b2018-03-16 18:43:59 -0700608 // The reason a job has stopped.
609 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700610 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700611 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700612}
613
614/**
615 * Logs when the audio state changes.
616 *
617 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700618 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700619 */
620message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800621 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700622
623 enum State {
624 OFF = 0;
625 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700626 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
627 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700628 }
629 optional State state = 2;
630}
631
632/**
633 * Logs when the video codec state changes.
634 *
635 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700636 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700637 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800638message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800639 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700640
641 enum State {
642 OFF = 0;
643 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700644 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
645 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700646 }
647 optional State state = 2;
648}
649
650/**
651 * Logs when the flashlight state changes.
652 *
653 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700654 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700655 */
656message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800657 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700658
659 enum State {
660 OFF = 0;
661 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700662 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
663 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700664 }
665 optional State state = 2;
666}
667
668/**
669 * Logs when the camera state changes.
670 *
671 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700672 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700673 */
674message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800675 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700676
677 enum State {
678 OFF = 0;
679 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700680 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
681 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700682 }
683 optional State state = 2;
684}
685
686/**
687 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000688 *
689 * Logged from:
690 * TODO
691 */
Bookatzd6746242017-10-24 18:39:35 -0700692message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800693 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000694
Bookatz1a1b0462018-01-12 11:47:03 -0800695 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
696 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700697 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700698
699 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
700 optional string tag = 3;
701
702 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800703 RELEASE = 0;
704 ACQUIRE = 1;
705 CHANGE_RELEASE = 2;
706 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700707 }
708 optional State state = 4;
709}
710
711/**
Bookatzc1a050a2017-10-10 15:49:28 -0700712 * Logs when a partial wakelock is considered 'long' (over 1 min).
713 *
714 * Logged from:
715 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
716 */
717message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800718 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700719
Yao Chend54f9dd2017-10-17 17:37:48 +0000720 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
721 optional string tag = 2;
722
Bookatzc1a050a2017-10-10 15:49:28 -0700723 // TODO: I have no idea what this is.
724 optional string history_tag = 3;
725
726 enum State {
727 OFF = 0;
728 ON = 1;
729 }
730 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000731}
732
Bookatzc1a050a2017-10-10 15:49:28 -0700733/**
Bookatza66083f2018-09-20 17:24:00 -0700734 * Logs when the device is interactive, according to the PowerManager Notifier.
735 *
736 * Logged from:
737 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
738 */
739message InteractiveStateChanged {
740 enum State {
741 OFF = 0;
742 ON = 1;
743 }
744 optional State state = 1;
745}
746
747/**
Bookatzc1a050a2017-10-10 15:49:28 -0700748 * Logs Battery Saver state change.
749 *
750 * Logged from:
751 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
752 */
753message BatterySaverModeStateChanged {
754 enum State {
755 OFF = 0;
756 ON = 1;
757 }
758 optional State state = 1;
759}
760
761/**
762 * Logs Doze mode state change.
763 *
764 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800765 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700766 */
767message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800768 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800769}
770
771
772/**
773 * Logs state change of Doze mode including maintenance windows.
774 *
775 * Logged from:
776 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
777 */
778message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800779 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700780}
781
782/**
783 * Logs screen brightness level.
784 *
785 * Logged from:
786 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
787 */
788message ScreenBrightnessChanged {
789 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
790 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700791}
792
793/**
794 * Logs battery level (percent full, from 0 to 100).
795 *
796 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700797 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700798 */
799message BatteryLevelChanged {
800 // Battery level. Should be in [0, 100].
801 optional int32 battery_level = 1;
802}
803
804/**
805 * Logs change in charging status of the device.
806 *
807 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700808 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700809 */
810message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800811 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
812 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700813}
814
815/**
816 * Logs whether the device is plugged in, and what power source it is using.
817 *
818 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700819 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700820 */
821message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800822 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
823 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700824}
825
Bookatz8c6571b2017-10-24 15:04:41 -0700826/**
827 * Logs when an app's wakeup alarm fires.
828 *
829 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700830 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700831 */
832message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800833 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800834
835 // Name of the wakeup alarm.
836 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700837
838 // Name of source package (for historical reasons, since BatteryStats tracked it).
839 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800840}
841
842/**
843 * Logs when an an app causes the mobile radio to change state.
844 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
845 *
846 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700847 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800848 */
849message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800850 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800851
Bookatz1a1b0462018-01-12 11:47:03 -0800852 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
853 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800854}
855
856/**
857 * Logs when an an app causes the wifi radio to change state.
858 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
859 *
860 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700861 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800862 */
863message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800864 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800865
Bookatz1a1b0462018-01-12 11:47:03 -0800866 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
867 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700868}
869
870/**
871 * Logs kernel wakeup reasons and aborts.
872 *
873 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700874 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700875 */
876message KernelWakeupReported {
877 // Name of the kernel wakeup reason (or abort).
878 optional string wakeup_reason_name = 1;
879
880 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800881 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700882}
883
884/**
Bookatzda1798c2018-12-13 14:16:00 -0800885 * Logs when Wifi is toggled on/off.
Bookatza0a1f8a2018-12-17 12:28:32 -0800886 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
Bookatzda1798c2018-12-13 14:16:00 -0800887 *
888 * Logged from:
889 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
890 */
891message WifiEnabledStateChanged {
892 enum State {
893 OFF = 0;
894 ON = 1;
895 }
896 optional State state = 1;
897}
898
899/**
900 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
Bookatza0a1f8a2018-12-17 12:28:32 -0800901 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
902 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
Bookatzda1798c2018-12-13 14:16:00 -0800903 *
904 * Logged from:
905 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
906 */
907message WifiRunningStateChanged {
908 repeated AttributionNode attribution_node = 1;
909
910 enum State {
911 OFF = 0;
912 ON = 1;
913 }
914 optional State state = 2;
915}
916
917/**
Bookatze5885242017-10-24 20:10:31 -0700918 * Logs wifi locks held by an app.
919 *
920 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700921 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700922 */
923message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800924 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700925
926 enum State {
927 OFF = 0;
928 ON = 1;
929 }
930 optional State state = 2;
931}
932
933/**
934 * Logs wifi signal strength changes.
935 *
936 * Logged from:
Bookatz819ea832018-11-28 16:53:31 -0800937 * frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
Bookatze5885242017-10-24 20:10:31 -0700938 */
939message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800940 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
941 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700942}
943
944/**
945 * Logs wifi scans performed by an app.
946 *
947 * Logged from:
Bookatz819ea832018-11-28 16:53:31 -0800948 * frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
Bookatze5885242017-10-24 20:10:31 -0700949 */
950message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800951 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700952
953 enum State {
954 OFF = 0;
955 ON = 1;
956 }
957 optional State state = 2;
958}
959
960/**
Tej Singh4503e102018-01-04 14:35:01 -0800961 * Logs wifi multicast locks held by an app
962 *
963 * Logged from:
Bookatz819ea832018-11-28 16:53:31 -0800964 * frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
Tej Singh4503e102018-01-04 14:35:01 -0800965 */
966message WifiMulticastLockStateChanged {
967 repeated AttributionNode attribution_node = 1;
968
969 enum State {
970 OFF = 0;
971 ON = 1;
972 }
973 optional State state = 2;
Bookatz819ea832018-11-28 16:53:31 -0800974
975 optional string tag = 3;
Tej Singh4503e102018-01-04 14:35:01 -0800976}
977
978/**
Tej Singh1ea42892018-01-19 09:27:00 -0800979 * Logs shutdown reason and duration on next boot.
980 *
981 * Logged from:
982 * frameworks/base/core/java/com/android/server/BootReceiver.java
983 */
984message ShutdownSequenceReported {
985 // True if shutdown is for a reboot. Default: false if we do not know.
986 optional bool reboot = 1;
987
988 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
989 optional string reason = 2;
990
991 // Beginning of shutdown time in ms using wall clock time since unix epoch.
992 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800993 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800994
995 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800996 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800997}
998
Tej Singh6483ea42018-01-25 17:45:49 -0800999
1000/**
1001 * Logs boot reason and duration.
1002 *
1003 * Logged from:
1004 * system/core/bootstat/bootstat.cpp
1005 */
1006message BootSequenceReported {
1007 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
1008 // Default: "<EMPTY>" if not available.
1009 optional string bootloader_reason = 1;
1010
1011 // Reason for system boot. Eg. bootloader, reboot,userrequested
1012 // Default: "<EMPTY>" if not available.
1013 optional string system_reason = 2;
1014
1015 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -08001016 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -08001017
1018 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001019 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -08001020
1021 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001022 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -08001023
1024 // Time since last boot in ms. Default: 0 if not available.
1025 optional int64 time_since_last_boot = 6;
1026}
1027
Tej Singhc477d9c2018-02-05 18:31:39 -08001028
1029/**
1030 * Logs call state and disconnect cause (if applicable).
1031 *
1032 * Logged from:
1033 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
1034 */
1035message CallStateChanged {
1036 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1037 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1038 optional android.telecom.CallStateEnum call_state = 1;
1039
1040 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1041 // This value is only applicable when the call_state is DISCONNECTED, and
1042 // should always be UNKNOWN if the call_state is not DISCONNECTED.
1043 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1044 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1045
1046 // True if the call is self-managed, which are apps that use the
1047 // telecom infrastructure to make their own calls.
1048 optional bool self_managed = 3;
1049
1050 // True if call is external. External calls are calls on connected Wear
1051 // devices but show up in Telecom so the user can pull them onto the device.
1052 optional bool external_call = 4;
1053}
1054
Tej Singh1ea42892018-01-19 09:27:00 -08001055/**
Tej Singhdd7bd352018-02-09 19:33:15 -08001056 * Logs keyguard state. The keyguard is the lock screen.
1057 *
1058 * Logged from:
1059 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1060 */
1061message KeyguardStateChanged {
1062 enum State {
1063 UNKNOWN = 0;
1064 // The keyguard is hidden when the phone is unlocked.
1065 HIDDEN = 1;
1066 // The keyguard is shown when the phone is locked (screen turns off).
1067 SHOWN= 2;
1068 // The keyguard is occluded when something is overlaying the keyguard.
1069 // Eg. Opening the camera while on the lock screen.
1070 OCCLUDED = 3;
1071 }
1072 optional State state = 1;
1073}
1074
1075/**
1076 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1077 * prompts the user to enter a password (pattern, pin, etc).
1078 *
1079 * Logged from:
1080 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1081 */
1082
1083message KeyguardBouncerStateChanged {
1084 enum State {
1085 UNKNOWN = 0;
1086 // Bouncer is hidden, either as a result of successfully entering the
1087 // password, screen timing out, or user going back to lock screen.
1088 HIDDEN = 1;
1089 // This is when the user is being prompted to enter the password.
1090 SHOWN = 2;
1091 }
1092 optional State state = 1;
1093}
1094
1095/**
1096 * Logs the result of entering a password into the keyguard bouncer.
1097 *
1098 * Logged from:
1099 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1100 */
1101message KeyguardBouncerPasswordEntered {
1102 enum BouncerResult {
1103 UNKNOWN = 0;
1104 // The password entered was incorrect.
1105 FAILURE = 1;
1106 // The password entered was correct.
1107 SUCCESS = 2;
1108 }
1109 optional BouncerResult result = 1;
1110}
1111
Tej Singha883b372018-02-15 11:30:01 -08001112/*
1113 * Logs changes to the configuration of the device. The configuration is defined
1114 * in frameworks/base/core/java/android/content/res/Configuration.java
1115 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1116 * Please go there to interpret the possible values each field can be.
1117 *
1118 * Logged from:
1119 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1120 */
1121message ResourceConfigurationChanged {
1122 // Bit mask of color capabilities of the screen.
1123 // Contains information about the color gamut and hdr mode of the screen.
1124 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001125 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001126
1127 // The target screen density being rendered to.
1128 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001129 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001130
1131 // Current user preference for the scaling factor for fonts,
1132 // relative to the base density scaling.
1133 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001134 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001135
1136 // Flag indicating whether the hard keyboard is hidden.
1137 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001138 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001139
1140 // The type of keyboard attached to the device.
1141 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1142 optional int32 keyboard = 5;
1143
1144 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1145 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001146 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001147
1148 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1149 // 0 if undefined.
1150 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1151 optional int32 mcc = 7;
1152
1153 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1154 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1155 // MNC_ZERO symbol defined in Configuration.java.
1156 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1157 optional int32 mnc = 8;
1158
1159 // The kind of navigation available on the device.
1160 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1161 optional int32 navigation = 9;
1162
1163 // Flag indicating whether the navigation is available.
1164 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001165 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001166
1167 // Overall orientation of the screen.
1168 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1169 optional int32 orientation = 11;
1170
1171 // The current height of the available screen space, in dp units.
1172 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001173 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001174
1175 // Bit mask of overall layout of the screen.
1176 // Contains information about screen size, whether the screen is wider/taller
1177 // than normal, whether the screen layout is right-tl-left or left-to-right,
1178 // and whether the screen has a rounded shape.
1179 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001180 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001181
1182 // Current width of the available screen space, in dp units.
1183 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001184 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001185
1186 // The smallest screen size an application will see in normal operation.
1187 // This is the smallest value of both screenWidthDp and screenHeightDp
1188 // in portrait and landscape.
1189 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001190 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001191
1192 // The type of touch screen attached to the device.
1193 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1194 optional int32 touchscreen = 16;
1195
1196 // Bit mask of the ui mode.
1197 // Contains information about the overall ui mode of the device.
1198 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1199 // Also contains information about whether the device is in night mode.
1200 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001201 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001202}
1203
Tej Singheee317b2018-03-07 19:28:05 -08001204
1205/**
1206 * Logs changes in the connection state of the mobile radio.
1207 *
1208 * Logged from:
1209 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1210 */
1211message MobileConnectionStateChanged {
1212 // States are from the state machine DataConnection.java.
1213 enum State {
1214 UNKNOWN = 0;
1215 // The connection is inactive, or disconnected.
1216 INACTIVE = 1;
1217 // The connection is being activated, or connecting.
1218 ACTIVATING = 2;
1219 // The connection is active, or connected.
1220 ACTIVE = 3;
1221 // The connection is disconnecting.
1222 DISCONNECTING = 4;
1223 // The connection is disconnecting after creating a connection.
1224 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1225 }
1226 optional State state = 1;
1227 // For multi-sim phones, this distinguishes between the sim cards.
1228 optional int32 sim_slot_index = 2;
1229 // Used to identify the connection. Starts at 0 and increments by 1 for
1230 // every new network created. Resets whenever the device reboots.
1231 optional int32 data_connection_id = 3;
1232 // A bitmask for the capabilities of this connection.
1233 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1234 // Default value (if we have no information): 0
1235 optional int64 capabilities = 4;
1236 // If this connection has internet.
1237 // This just checks if the DEFAULT bit of capabilities is set.
1238 optional bool has_internet = 5;
1239}
1240
1241/**
1242 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1243 *
1244 * Logged from:
1245 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1246 */
1247message MobileRadioTechnologyChanged {
1248 optional android.telephony.NetworkTypeEnum state = 1;
1249 // For multi-sim phones, this distinguishes between the sim cards.
1250 optional int32 sim_slot_index = 2;
1251}
1252
Andrew Chantb56388b2018-03-22 21:07:33 -07001253/**
1254 * Logs the VID and PID of any connected USB devices.
1255 *
1256 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1257 *
1258 * Logged by Vendor.
1259 */
1260message UsbDeviceAttached {
1261 optional int32 vid = 1;
1262 optional int32 pid = 2;
1263 optional bool has_audio = 3;
1264 optional bool has_hid = 4;
1265 optional bool has_storage = 5;
Badhri Jagan Sridharan5ec629f2018-11-16 15:39:22 -08001266 enum State {
1267 STATE_DISCONNECTED = 0;
1268 STATE_CONNECTED = 1;
1269 }
1270 optional State state = 6;
Badhri Jagan Sridharanc2c54a22018-12-14 14:41:26 -08001271 optional int64 last_connect_duration_millis = 7;
Andrew Chantb56388b2018-03-22 21:07:33 -07001272}
1273
Tej Singheee317b2018-03-07 19:28:05 -08001274
Tej Singhdd7bd352018-02-09 19:33:15 -08001275/**
Tej Singh5d991e12018-03-09 19:48:11 -08001276 * Logs when Bluetooth is enabled and disabled.
1277 *
1278 * Logged from:
1279 * services/core/java/com/android/server/BluetoothManagerService.java
1280 */
1281message BluetoothEnabledStateChanged {
1282 repeated AttributionNode attribution_node = 1;
1283 // Whether or not bluetooth is enabled on the device.
1284 enum State {
1285 UNKNOWN = 0;
1286 ENABLED = 1;
1287 DISABLED = 2;
1288 }
1289 optional State state = 2;
1290 // The reason for being enabled/disabled.
1291 // Eg. Airplane mode, crash, application request.
1292 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1293 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001294 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001295}
1296
1297/**
1298 * Logs when a Bluetooth device connects and disconnects.
1299 *
1300 * Logged from:
1301 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1302 */
1303message BluetoothConnectionStateChanged {
1304 // The state of the connection.
1305 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1306 optional android.bluetooth.ConnectionStateEnum state = 1;
1307 // An identifier that can be used to match connect and disconnect events.
1308 // Currently is last two bytes of a hash of a device level ID and
1309 // the mac address of the bluetooth device that is connected.
1310 optional int32 obfuscated_id = 2;
1311 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1312 // From android.bluetooth.BluetoothAdapter.java
1313 optional int32 bt_profile = 3;
1314}
1315
1316/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001317 * Logs when something is plugged into or removed from the USB-C connector.
1318 *
1319 * Logged from:
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001320 * UsbService
Andrew Chant28d627e2018-02-22 15:17:05 -08001321 */
1322message UsbConnectorStateChanged {
1323 enum State {
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001324 STATE_DISCONNECTED = 0;
1325 STATE_CONNECTED = 1;
Andrew Chant28d627e2018-02-22 15:17:05 -08001326 }
1327 optional State state = 1;
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001328 optional string id = 2;
Badhri Jagan Sridharanfaf62072018-11-16 17:17:03 -08001329 // Last active session in ms.
1330 // 0 when the port is in connected state.
1331 optional int64 last_connect_duration_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001332}
1333
1334/**
1335 * Logs the reported speaker impedance.
1336 *
1337 * Logged from:
1338 * Vendor audio implementation.
1339 */
1340message SpeakerImpedanceReported {
1341 optional int32 speaker_location = 1;
1342 optional int32 impedance = 2;
1343}
1344
1345/**
1346 * Logs the report of a failed hardware.
1347 *
1348 * Logged from:
1349 * Vendor HALs.
1350 *
1351 */
1352message HardwareFailed {
1353 enum HardwareType {
1354 HARDWARE_FAILED_UNKNOWN = 0;
1355 HARDWARE_FAILED_MICROPHONE = 1;
1356 HARDWARE_FAILED_CODEC = 2;
1357 HARDWARE_FAILED_SPEAKER = 3;
1358 HARDWARE_FAILED_FINGERPRINT = 4;
1359 }
1360 optional HardwareType hardware_type = 1;
1361
1362 /* hardware_location allows vendors to differentiate between multiple instances of
1363 * the same hardware_type. The specific locations are vendor defined integers,
1364 * referring to board-specific numbering schemes.
1365 */
1366 optional int32 hardware_location = 2;
1367
1368 /* failure_code is specific to the HardwareType of the failed hardware.
1369 * It should use the enum values defined below.
1370 */
1371 enum MicrophoneFailureCode {
1372 MICROPHONE_FAILURE_COMPLETE = 0;
1373 }
1374 enum CodecFailureCode {
1375 CODEC_FAILURE_COMPLETE = 0;
1376 }
1377 enum SpeakerFailureCode {
1378 SPEAKER_FAILURE_COMPLETE = 0;
1379 SPEAKER_FAILURE_HIGH_Z = 1;
1380 SPEAKER_FAILURE_SHORT = 2;
1381 }
1382 enum FingerprintFailureCode {
1383 FINGERPRINT_FAILURE_COMPLETE = 0;
1384 FINGERPRINT_SENSOR_BROKEN = 1;
1385 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1386 }
1387 optional int32 failure_code = 3;
1388}
1389
1390/**
1391 * Log an event when the device has been physically dropped.
1392 * Reported from the /vendor partition.
1393 */
1394message PhysicalDropDetected {
1395 // Confidence that the event was actually a drop, 0 -> 100
1396 optional int32 confidence_pctg = 1;
1397 // Peak acceleration of the drop, in 1/1000s of a g.
1398 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001399 // Duration of freefall in ms
1400 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001401}
1402
1403/**
1404 * Log bucketed battery charge cycles.
1405 *
1406 * Each bucket represents cycles of the battery past
Maggie White38c9d322018-11-20 10:07:52 -08001407 * a given charge point. For example, if 10 cycle buckets are
1408 * initialized, bucket 1 is the lowest 1/10th of the battery,
1409 * and bucket 10 is 100%.
Andrew Chant28d627e2018-02-22 15:17:05 -08001410 *
1411 * Logged from:
1412 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1413 */
1414message ChargeCyclesReported {
1415 optional int32 cycle_bucket_1 = 1;
1416 optional int32 cycle_bucket_2 = 2;
1417 optional int32 cycle_bucket_3 = 3;
1418 optional int32 cycle_bucket_4 = 4;
1419 optional int32 cycle_bucket_5 = 5;
1420 optional int32 cycle_bucket_6 = 6;
1421 optional int32 cycle_bucket_7 = 7;
1422 optional int32 cycle_bucket_8 = 8;
Maggie White38c9d322018-11-20 10:07:52 -08001423 optional int32 cycle_bucket_9 = 9;
1424 optional int32 cycle_bucket_10 = 10;
Andrew Chant28d627e2018-02-22 15:17:05 -08001425}
1426
1427/**
Howard Roa46b6582018-09-18 16:45:02 -07001428 * Log battery health snapshot.
1429 *
1430 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1431 * are snapshotted periodically over 24hrs.
1432 */
1433message BatteryHealthSnapshot {
1434 enum BatterySnapshotType {
1435 UNKNOWN = 0;
1436 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1437 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1438 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1439 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1440 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1441 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1442 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1443 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1444 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1445 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1446 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1447 }
1448 optional BatterySnapshotType type = 1;
1449 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001450 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001451 // Voltage Battery Voltage, in microVolts.
1452 optional int32 voltage_micro_volt = 3;
1453 // Current Battery current, in microAmps.
1454 optional int32 current_micro_amps = 4;
1455 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1456 optional int32 open_circuit_micro_volt = 5;
1457 // Resistance Battery Resistance, in microOhms.
1458 optional int32 resistance_micro_ohm = 6;
1459 // Level Battery Level, as % of full.
1460 optional int32 level_percent = 7;
1461}
1462
1463/**
1464 * Log slow I/O operations on the primary storage.
1465 */
1466message SlowIo {
1467 // Classifications of IO Operations.
1468 enum IoOperation {
1469 UNKNOWN = 0;
1470 READ = 1;
1471 WRITE = 2;
1472 UNMAP = 3;
1473 SYNC = 4;
1474 }
1475 optional IoOperation operation = 1;
1476
1477 // The number of slow IO operations of this type over 24 hours.
1478 optional int32 count = 2;
1479}
1480
1481/**
1482 * Log battery caused shutdown with the last recorded voltage.
1483 */
1484message BatteryCausedShutdown {
1485 // The last recorded battery voltage prior to shutdown.
1486 optional int32 last_recorded_micro_volt = 1;
1487}
1488
1489/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001490 * Logs the duration of a davey (jank of >=700ms) when it occurs
1491 *
1492 * Logged from:
1493 * frameworks/base/libs/hwui/JankTracker.cpp
1494 */
1495message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001496 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001497 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001498
Tej Singhbb8554a2018-01-26 11:59:14 -08001499 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001500 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001501}
1502
1503/**
Bookatze5885242017-10-24 20:10:31 -07001504 * Logs phone signal strength changes.
1505 *
1506 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001507 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001508 */
1509message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001510 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1511 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001512}
1513
Yangster4ccebea2018-10-09 17:09:02 -07001514
1515/**
1516 * Logs when the phone state, sim state or signal strength changes
1517 *
1518 * Logged from:
1519 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1520 */
1521message PhoneServiceStateChanged {
1522 optional android.telephony.ServiceStateEnum state = 1;
1523 optional android.telephony.SimStateEnum sim_state = 2;
1524 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1525}
1526
1527/**
1528 * Logs when the phone becomes on or off.
1529 *
1530 * Logged from:
1531 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1532 */
1533message PhoneStateChanged {
1534 enum State {
1535 OFF = 0;
1536 ON = 1;
1537 }
1538 optional State state = 1;
1539}
1540
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001541message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001542 optional android.stats.launcher.LauncherAction action = 1;
1543 optional android.stats.launcher.LauncherState src_state = 2;
1544 optional android.stats.launcher.LauncherState dst_state = 3;
1545 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001546 optional bool is_swipe_up_enabled = 5;
1547}
1548
David Chenc28b2bb2017-10-24 12:52:52 -07001549/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001550 * Logs when Settings UI has changed.
1551 *
1552 * Logged from:
1553 * packages/apps/Settings
1554 */
1555message SettingsUIChanged {
1556 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001557 * Where this SettingsUIChange event comes from. For example, if
1558 * it's a PAGE_VISIBLE event, where the page is opened from.
1559 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001560 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001561
1562 /**
1563 * What the UI action is.
1564 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001565 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001566
1567 /**
1568 * Where the action is happening
1569 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001570 optional android.app.settings.PageId page_id = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001571
1572 /**
1573 * What preference changed in this event.
1574 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001575 optional string changed_preference_key = 4;
Fan Zhang916c13b2018-10-16 22:49:45 -07001576
1577 /**
1578 * The new value of the changed preference.
1579 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001580 optional int64 changed_preference_int_value = 5;
Fan Zhang916c13b2018-10-16 22:49:45 -07001581}
1582
1583/**
David Chenc28b2bb2017-10-24 12:52:52 -07001584 * Logs that a setting was updated.
1585 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001586 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001587 * The tag and is_default allow resetting of settings to default values based on the specified
1588 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1589 */
1590message SettingChanged {
1591 // The name of the setting.
1592 optional string setting = 1;
1593
1594 // The change being imposed on this setting. May represent a number, eg "3".
1595 optional string value = 2;
1596
1597 // The new value of this setting. For most settings, this is same as value. For some settings,
1598 // value is +X or -X where X represents an element in a set. For example, if the previous value
1599 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1600 // The +/- feature is currently only used for location_providers_allowed.
1601 optional string new_value = 3;
1602
1603 // The previous value of this setting.
1604 optional string prev_value = 4;
1605
1606 // The tag used with the is_default for resetting sets of settings. This is generally null.
1607 optional string tag = 5;
1608
Bookatz90867622018-01-31 15:05:57 -08001609 // True if this setting with tag should be resettable.
1610 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001611
David Chenbd789912018-03-16 17:19:55 -07001612 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001613 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001614
1615 enum ChangeReason {
1616 UPDATED = 1; // Updated can be an insertion or an update.
1617 DELETED = 2;
1618 }
1619 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001620}
Chenjie Yub3dda412017-10-24 13:41:59 -07001621
Chenjie Yu05013b32017-11-21 10:21:41 -08001622/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001623 * Logs activity going to foreground or background
1624 *
1625 * Logged from:
1626 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1627 */
1628message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001629 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001630 optional string pkg_name = 2;
1631 optional string class_name = 3;
1632
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001633 enum State {
1634 BACKGROUND = 0;
1635 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001636 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001637 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001638}
David Chenc8a43242017-10-17 16:23:28 -07001639
1640/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001641 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001642 * Logged from:
1643 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1644 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001645message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001646 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001647
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001648 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001649
1650 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001651 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001652 optional string process_name = 3;
1653
1654 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001655 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001656
1657 optional string package_name = 5;
1658
1659 enum InstantApp {
1660 UNAVAILABLE = 0;
1661 FALSE = 1;
1662 TRUE = 2;
1663 }
1664 optional InstantApp is_instant_app = 6;
1665
1666 enum ForegroundState {
1667 UNKNOWN = 0;
1668 BACKGROUND = 1;
1669 FOREGROUND = 2;
1670 }
1671 optional ForegroundState foreground_state = 7;
Yang Lu732d6382018-11-05 07:53:12 -08001672
1673 optional android.server.ErrorSource error_source = 8;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001674}
David Chen9e3808c2017-11-20 17:25:34 -08001675
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001676/**
1677 * Logs when a WTF (What a Terrible Failure) happened.
1678 * Logged from:
1679 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1680 */
1681message WTFOccurred {
1682 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001683
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001684 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001685
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001686 // The name of the process.
1687 // system_server if it is not by an app
1688 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001689
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001690 // The pid if available. -1 means not available.
1691 optional sint32 pid = 4;
Yang Lu732d6382018-11-05 07:53:12 -08001692
1693 optional android.server.ErrorSource error_source = 5;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001694}
1695
1696/**
1697 * Logs when system server reports low memory.
1698 * Logged from:
1699 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1700 */
1701message LowMemReported {
1702}
1703
1704/**
1705 * Logs when an app ANR (App Not Responding) occurs.
1706 * Logged from:
1707 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1708 */
1709message ANROccurred {
1710 optional int32 uid = 1 [(is_uid) = true];
1711
1712 optional string process_name = 2;
1713
1714 optional string short_component_name = 3;
1715
1716 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001717
1718 enum InstantApp {
1719 UNAVAILABLE = 0;
1720 FALSE = 1;
1721 TRUE = 2;
1722 }
1723 optional InstantApp is_instant_app = 5;
1724
1725 enum ForegroundState {
1726 UNKNOWN = 0;
1727 BACKGROUND = 1;
1728 FOREGROUND = 2;
1729 }
1730 optional ForegroundState foreground_state = 6;
Yang Lu732d6382018-11-05 07:53:12 -08001731
1732 optional android.server.ErrorSource error_source = 7;
1733
1734 optional string package_name = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001735}
1736
Bookatza7020bd2018-08-28 16:29:35 -07001737/**
1738 * Logs when the vibrator state changes.
1739 * Logged from:
1740 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1741 */
1742message VibratorStateChanged {
1743 repeated AttributionNode attribution_node = 1;
1744
1745 enum State {
1746 OFF = 0;
1747 ON = 1;
1748 }
1749 optional State state = 2;
1750
1751 // Duration (in milliseconds) requested to keep the vibrator on.
1752 // Only applicable for State == ON.
1753 optional int64 duration_millis = 3;
1754}
1755
David Chen0a368b22017-12-06 16:28:16 -08001756/*
1757 * Allows other apps to push events into statsd.
1758 * Logged from:
1759 * frameworks/base/core/java/android/util/StatsLog.java
1760 */
David Chen0b5c90c2018-01-25 16:51:49 -08001761message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001762 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001763 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001764
1765 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1766 optional int32 label = 2;
1767
1768 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1769 // predicates for the metrics).
1770 enum State {
1771 UNKNOWN = 0;
1772 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1773 STOP = 2;
1774 START = 3;
1775 }
1776 optional State state = 3;
1777}
1778
David Chen9e3808c2017-11-20 17:25:34 -08001779/**
Bookatz7948c872018-09-04 12:58:33 -07001780 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1781 * For example, this could be due to the user manually changing the time.
1782 *
1783 * Logged from:
1784 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1785 */
1786message WallClockTimeShifted {
1787 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1788 optional int64 wall_clock_timestamp_millis = 1;
1789}
1790
1791/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001792 * Logs when statsd detects an anomaly.
1793 *
1794 * Logged from:
1795 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1796 */
1797message AnomalyDetected {
1798 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001799 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001800
Yangster-mac94e197c2018-01-02 16:03:03 -08001801 // Id of the config whose anomaly detection alert fired.
1802 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001803
Yangster-mac94e197c2018-01-02 16:03:03 -08001804 // Id of the alert (i.e. name of the anomaly that was detected).
1805 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001806}
1807
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001808message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001809 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001810 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001811
1812 // The app package name.
1813 optional string pkg_name = 2;
1814
1815 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001816 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001817 WARM = 1;
1818 HOT = 2;
1819 COLD = 3;
1820 }
1821 // The transition type.
1822 optional TransitionType type = 3;
1823
1824 // The activity name.
1825 optional string activity_name = 4;
1826
1827 // The name of the calling app. Empty if not set.
1828 optional string calling_pkg_name = 5;
1829
1830 // Whether the app is an instant app.
1831 optional bool is_instant_app = 6;
1832
1833 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001834 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001835
Bookatz80d11a02018-01-16 10:46:35 -08001836 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001837
David Chen0b5c90c2018-01-25 16:51:49 -08001838 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001839 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001840 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001841 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001842 optional int32 bind_application_delay_millis = 11;
1843 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001844
1845 // Empty if not set.
1846 optional string launch_token = 13;
1847
Calin Juravle759fbda2018-02-20 19:52:30 +00001848 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001849 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001850
1851 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001852 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001853}
1854
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001855message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001856 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001857 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001858
1859 // The app package name.
1860 optional string pkg_name = 2;
1861
1862 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001863 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001864 WARM = 1;
1865 HOT = 2;
1866 COLD = 3;
1867 }
1868 // The transition type.
1869 optional TransitionType type = 3;
1870
1871 // The activity name.
1872 optional string activity_name = 4;
1873}
1874
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001875message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001876 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001877 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001878
1879 // The app package name.
1880 optional string pkg_name = 2;
1881
1882 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001883 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001884 WITH_BUNDLE = 1;
1885 WITHOUT_BUNDLE = 2;
1886 }
1887 // The transition type.
1888 optional TransitionType type = 3;
1889
1890 // The activity name.
1891 optional string activity_name = 4;
1892
1893 optional bool transition_process_running = 5;
1894
1895 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001896 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001897}
1898
Bookatz8fcd09a2017-12-18 13:01:10 -08001899/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001900 * Logs a picture-in-picture action
1901 * Logged from:
1902 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1903 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1904 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1905 */
1906message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001907 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001908 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001909
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001910 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001911
Chenjie Yu52cacc62017-12-08 18:11:45 -08001912 enum State {
1913 ENTERED = 1;
1914 EXPANDED_TO_FULL_SCREEN = 2;
1915 MINIMIZED = 3;
1916 DISMISSED = 4;
1917 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001918 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001919}
1920
1921/**
Chenjie Yue8904192017-12-08 19:12:57 -08001922 * Logs overlay action
1923 * Logged from:
1924 * services/core/java/com/android/server/wm/Session.java
1925 */
1926message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001927 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001928
1929 optional string package_name = 2;
1930
1931 optional bool using_alert_window = 3;
1932
1933 enum State {
1934 ENTERED = 1;
1935 EXITED = 2;
1936 }
1937 optional State state = 4;
1938}
1939
Chenjie Yuccfe6452018-01-30 11:33:21 -08001940/*
1941 * Logs foreground service starts and stops.
1942 * Note that this is not when a service starts or stops, but when it is
1943 * considered foreground.
1944 * Logged from
1945 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1946 */
1947message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001948 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001949 // package_name + "/" + class_name
1950 optional string short_name = 2;
1951
1952 enum State {
1953 ENTER = 1;
1954 EXIT = 2;
1955 }
1956 optional State state = 3;
1957}
1958
Chenjie Yue8904192017-12-08 19:12:57 -08001959/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001960 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1961 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1962 * attributed back to the parent (host) uid. One example is Chrome.
1963 *
1964 * Logged from:
1965 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1966 */
1967message IsolatedUidChanged {
1968 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001969 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001970 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001971 optional int32 parent_uid = 1;
1972
1973 optional int32 isolated_uid = 2;
1974
1975 // We expect an isolated uid to be removed before if it's used for another parent uid.
1976 enum Event {
1977 REMOVED = 0;
1978 CREATED = 1;
1979 }
1980 optional Event event = 3;
1981}
1982
1983/*
1984 * Logs the reception of an incoming network packet causing the main system to wake up for
1985 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1986 * and processed by WakeupController.cpp.
1987 */
1988message PacketWakeupOccurred {
1989 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1990 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001991 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001992 // The interface name on which the packet was received.
1993 optional string iface = 2;
1994 // The ethertype value of the packet.
1995 optional int32 ethertype = 3;
1996 // String representation of the destination MAC address of the packet.
1997 optional string destination_hardware_address = 4;
1998 // String representation of the source address of the packet if this was an IP packet.
1999 optional string source_ip = 5;
2000 // String representation of the destination address of the packet if this was an IP packet.
2001 optional string destination_ip = 6;
2002 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
2003 // field if this was an IPv6 packet. The range of possible values is the same for both IP
2004 // families.
2005 optional int32 ip_next_header = 7;
2006 // The source port if this was a TCP or UDP packet.
2007 optional int32 source_port = 8;
2008 // The destination port if this was a TCP or UDP packet.
2009 optional int32 destination_port = 9;
2010}
2011
2012/*
2013 * Logs the memory stats for an app on startup.
2014 * Logged from:
2015 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2016 */
2017message AppStartMemoryStateCaptured {
2018 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002019 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002020
2021 // The process name.
2022 optional string process_name = 2;
2023
2024 // The activity name.
2025 optional string activity_name = 3;
2026
2027 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002028 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002029
2030 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002031 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002032
2033 // RSS
2034 optional int64 rss_in_bytes = 6;
2035
2036 // CACHE
2037 optional int64 cache_in_bytes = 7;
2038
2039 // SWAP
2040 optional int64 swap_in_bytes = 8;
2041}
2042
2043/*
2044 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
2045 * for LMK event.
2046 * Logged from:
2047 * system/core/lmkd/lmkd.c
2048 */
2049message LmkStateChanged {
2050 enum State {
2051 UNKNOWN = 0;
2052 START = 1;
2053 STOP = 2;
2054 }
2055 optional State state = 1;
2056}
2057
2058/*
2059 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
2060 * Logged from:
2061 * system/core/lmkd/lmkd.c
2062 */
2063message LmkKillOccurred {
2064 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002065 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002066
2067 // The process name.
2068 optional string process_name = 2;
2069
2070 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002071 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002072
2073 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002074 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002075
2076 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002077 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002078
2079 // RSS
2080 optional int64 rss_in_bytes = 6;
2081
2082 // CACHE
2083 optional int64 cache_in_bytes = 7;
2084
2085 // SWAP
2086 optional int64 swap_in_bytes = 8;
Jim Blackler8593d1f2018-11-21 15:24:48 +00002087
2088 // The elapsed real time of start of the process.
2089 optional int64 process_start_time_nanos = 9;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002090}
2091
Rajeev Kumar51b54602018-03-01 12:18:26 -08002092/*
2093 * Logs when the ActivityManagerService detects that an app died.
2094 *
2095 * Logged from:
2096 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2097 */
2098message AppDied {
2099 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002100 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002101}
2102
Howard Ro21a039c2018-08-06 14:55:47 -07002103/**
2104 * An atom for generic metrics logging. Available from Android Q.
2105 */
2106message GenericAtom {
2107 // The uid of the application that sent this custom atom.
2108 optional int32 uid = 1 [(is_uid) = true];
2109
2110 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002111 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002112}
2113
Tej Singhd6d6d772018-09-05 17:41:25 -07002114/**
2115 * Logs when a fingerprint acquire event occurs.
2116 *
2117 * Logged from:
2118 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2119 */
2120message FingerprintAcquired {
2121 // The associated user. Eg: 0 for owners, 10+ for others.
2122 // Defined in android/os/UserHandle.java
2123 optional int32 user = 1;
2124 // If this acquire is for a crypto fingerprint.
2125 // e.g. Secure purchases, unlock password storage.
2126 optional bool is_crypto = 2;
2127}
2128
2129/**
2130 * Logs when a fingerprint authentication event occurs.
2131 *
2132 * Logged from:
2133 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2134 */
2135message FingerprintAuthenticated {
2136 // The associated user. Eg: 0 for owners, 10+ for others.
2137 // Defined in android/os/UserHandle.java
2138 optional int32 user = 1;
2139 // If this authentication is for a crypto fingerprint.
2140 // e.g. Secure purchases, unlock password storage.
2141 optional bool is_crypto = 2;
2142 // Whether or not this authentication was successful.
2143 optional bool is_authenticated = 3;
2144}
2145
2146/**
2147 * Logs when a fingerprint error occurs.
2148 *
2149 * Logged from:
2150 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2151 */
2152message FingerprintErrorOccurred {
2153 // The associated user. Eg: 0 for owners, 10+ for others.
2154 // Defined in android/os/UserHandle.java
2155 optional int32 user = 1;
2156 // If this error is for a crypto fingerprint.
2157 // e.g. Secure purchases, unlock password storage.
2158 optional bool is_crypto = 2;
2159
2160 enum Error {
2161 UNKNOWN = 0;
2162 LOCKOUT = 1;
2163 PERMANENT_LOCKOUT = 2;
2164 }
2165 // The type of error.
2166 optional Error error = 3;
2167}
Howard Ro688ae182018-09-25 00:09:36 -07002168
2169message Notification {
2170
2171 // Type of notification event.
2172 enum Type {
2173 TYPE_UNKNOWN = 0;
2174 // Notification became visible to the user.
2175 TYPE_OPEN = 1;
2176 // Notification became hidden.
2177 TYPE_CLOSE = 2;
2178 // Notification switched to detail mode.
2179 TYPE_DETAIL = 3;
2180 // Notification was clicked.
2181 TYPE_ACTION = 4;
2182 // Notification was dismissed.
2183 TYPE_DISMISS = 5;
2184 // Notification switched to summary mode. The enum value of 14 is to
2185 // match that of metrics_constants.
2186 TYPE_COLLAPSE = 14;
2187 }
2188 optional Type type = 1;
2189
2190 // Package name associated with the notification.
2191 optional string package_name = 2;
2192
2193 // Tag associated with notification.
2194 optional string tag = 3;
2195
2196 // Application-supplied ID associated with the notification.
2197 optional int32 id = 4;
2198
2199 // Index of notification in the notification panel.
2200 optional int32 shade_index = 5;
2201
2202 // The number of notifications in the notification panel.
2203 optional int32 shade_count = 6;
2204
2205 // Importance for the notification.
2206 optional int32 importance = 7;
2207
2208 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002209 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002210
2211 // Importance for the notification channel.
2212 optional int32 channel_importance = 9;
2213
Howard Ro183c2bd2018-10-18 13:52:10 -07002214 // Application-supplied ID associated with the notifications group.
2215 optional string group_id = 10;
2216
Howard Ro688ae182018-09-25 00:09:36 -07002217 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002218 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002219
Howard Ro183c2bd2018-10-18 13:52:10 -07002220 // Reason for dismissal of a notification. This field is only meaningful for
2221 // TYPE_DISMISS events.
2222 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002223
Howard Ro183c2bd2018-10-18 13:52:10 -07002224 // The first post time of notification, stable across updates.
2225 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002226
Howard Ro183c2bd2018-10-18 13:52:10 -07002227 // The most recent interruption time, or the creation time if no updates.
2228 // Differs from update_millis because updates are filtered based on whether
2229 // they actually interrupted the user.
2230 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002231
Howard Ro183c2bd2018-10-18 13:52:10 -07002232 // The most recent update time, or the creation time if no updates.
2233 optional int64 update_millis = 15;
2234
2235 // The most recent visibility event.
2236 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002237}
2238
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002239/*
Yangster-macb89807e2018-11-15 21:10:57 -08002240 * Logs when a flag flip state changes.
2241 * Logged in P/h.
2242 */
2243message PhenotypeFlagStateChanged {
2244 // Mendel configuration name.
2245 optional string mendel_config_name = 1;
2246 // State
2247 enum State {
2248 STATE_UNKNOWN = 0;
2249 COMMITTED = 1;
2250 }
2251 optional State state = 2;
2252}
2253
2254/*
2255 * Logs when a binary push state changes.
2256 * Logged in Play store
2257 */
2258message BinaryPushStateChanged {
2259 // Binary package name.
2260 optional string binary_name = 1;
2261 // Version code.
2262 optional int64 version = 2;
2263 // State
2264 enum State {
2265 STATE_UNKNOWN = 0;
2266 DOWNLOAD_START = 1;
2267 DOWNLOAD_DONE = 2;
2268 INSTALL_START = 3;
2269 INSTALL_DONE = 4;
2270 REBOOT_START = 5;
2271 REBOOT_DONE = 6;
2272 }
2273 optional State state = 3;
2274}
2275
2276/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002277 * Logs when a connection becomes available and lost.
2278 * Logged in StatsCompanionService.java
2279 */
2280message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002281 // Id of the network.
2282 optional int32 net_id = 1;
2283
2284 enum State {
2285 UNKNOWN = 0;
2286 CONNECTED = 1;
2287 DISCONNECTED = 2;
2288 }
2289 // Connected state of a network.
2290 optional State state = 2;
2291}
2292
2293/**
2294 * Logs when a service starts and stops.
2295 * Logged from:
2296 * services/core/java/com/android/server/am/ActiveServices.java
2297 */
2298message ServiceStateChanged {
2299
2300 optional int32 uid = 1 [(is_uid) = true];
2301
2302 optional string package_name = 2;
2303
2304 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002305
2306 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002307 START = 1;
2308 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002309 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002310
2311 optional State state = 4;
2312}
2313
2314/**
2315 * Logs when a service is launched.
2316 * Logged from:
2317 * services/core/java/com/android/server/am/ActiveServices.java
2318 */
2319message ServiceLaunchReported {
2320
2321 optional int32 uid = 1 [(is_uid) = true];
2322
2323 optional string package_name = 2;
2324
2325 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002326}
Howard Ro688ae182018-09-25 00:09:36 -07002327
Chenjie Yubbcbc602018-02-05 16:51:52 -08002328//////////////////////////////////////////////////////////////////////
2329// Pulled atoms below this line //
2330//////////////////////////////////////////////////////////////////////
2331
2332/**
David Chenc8a43242017-10-17 16:23:28 -07002333 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2334 *
2335 * Pulled from:
2336 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2337 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002338message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002339 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002340
2341 optional int64 rx_bytes = 2;
2342
2343 optional int64 rx_packets = 3;
2344
2345 optional int64 tx_bytes = 4;
2346
2347 optional int64 tx_packets = 5;
2348}
2349
2350/**
2351 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2352 *
2353 * Pulled from:
2354 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2355 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002356message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002357 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002358
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002359 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2360 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002361
2362 optional int64 rx_bytes = 3;
2363
2364 optional int64 rx_packets = 4;
2365
2366 optional int64 tx_bytes = 5;
2367
2368 optional int64 tx_packets = 6;
2369}
2370
2371/**
2372 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2373 *
2374 * Pulled from:
2375 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2376 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002377message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002378 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002379
2380 optional int64 rx_bytes = 2;
2381
2382 optional int64 rx_packets = 3;
2383
2384 optional int64 tx_bytes = 4;
2385
2386 optional int64 tx_packets = 5;
2387}
2388
2389/**
2390 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2391 *
2392 * Pulled from:
2393 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2394 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002395message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002396 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002397
Yao Chenc40a19d2018-03-15 16:48:25 -07002398 // 1 denotes foreground and 0 denotes background. This is called Set in
2399 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002400 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002401
2402 optional int64 rx_bytes = 3;
2403
2404 optional int64 rx_packets = 4;
2405
2406 optional int64 tx_bytes = 5;
2407
2408 optional int64 tx_packets = 6;
2409}
2410
2411/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002412 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2413 *
2414 * Pulled from:
2415 * StatsCompanionService
2416 */
2417message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002418 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002419
2420 optional int64 rx_bytes = 2;
2421
2422 optional int64 tx_bytes = 3;
2423}
2424
2425/**
David Chenc8a43242017-10-17 16:23:28 -07002426 * Pulls the kernel wakelock durations. This atom is adapted from
2427 * android/internal/os/KernelWakelockStats.java
2428 *
2429 * Pulled from:
2430 * StatsCompanionService using KernelWakelockReader.
2431 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002432message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002433 optional string name = 1;
2434
2435 optional int32 count = 2;
2436
2437 optional int32 version = 3;
2438
Yangster-maca8a30442018-10-13 23:46:34 -07002439 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002440}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002441
Chenjie Yu05013b32017-11-21 10:21:41 -08002442/**
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002443 * Pulls low power state information. If power.stats HAL is not available, this
2444 * includes platform and subsystem sleep state information,
2445 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
2446 * as defined in:
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002447 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002448 * hardware/interfaces/power/1.1/types.hal
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002449 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
2450 * as defined in:
2451 * hardware/interfaces/power/stats/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002452 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002453message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002454 // Subsystem name
2455 optional string subsystem_name = 1;
2456 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2457 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002458 // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
2459 // powerEntityStateName from the corresponding PowerEntityStateInfo.
Chenjie Yubbcbc602018-02-05 16:51:52 -08002460 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002461 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002462 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002463 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002464 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002465}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002466
Chenjie Yu05013b32017-11-21 10:21:41 -08002467/**
Bookatz92da2832018-11-01 18:10:03 -07002468 * Pulls on-device power measurement information.
2469 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2470 * Pulled from:
2471 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2472 */
2473message OnDevicePowerMeasurement {
2474 // Name of the subsystem (to which the rail belongs).
2475 optional string subsystem_name = 1;
2476
2477 // Rail name. The rail lies within the subsystem.
2478 optional string rail_name = 2;
2479
2480 // Time (in ms since boot) at which the rail energy value was measured.
2481 // This may differ slightly from the time that statsd logs this information.
2482 optional uint64 measurement_timestamp_millis = 3;
2483
2484 // Accumulated energy used via the rail since device boot in uWs.
2485 optional uint64 energy_microwatt_secs = 4;
2486}
2487
2488/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002489 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002490 * Pulls the time the cpu spend on the frequency index. Frequency index
2491 * starts from highest to lowest. The value should be monotonically
2492 * increasing since boot. However, if there is a cpu
2493 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002494 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002495message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002496 optional uint32 cluster = 1;
2497 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002498 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002499}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002500
Chenjie Yu05013b32017-11-21 10:21:41 -08002501/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002502 * Pulls Cpu Time Per Uid.
2503 * Note that isolated process uid time should be attributed to host uids.
2504 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002505message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002506 optional int32 uid = 1 [(is_uid) = true];
Misha Wagner6bc6c912018-11-16 13:19:54 +00002507 optional uint64 user_time_micros = 2;
2508 optional uint64 sys_time_micros = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002509}
2510
2511/**
2512 * Pulls Cpu Time Per Uid per frequency.
2513 * Note that isolated process uid time should be attributed to host uids.
2514 * For each uid, we order the time by descending frequencies.
2515 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002516message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002517 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002518 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002519 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002520}
Hugo Benichi884970e2017-11-14 22:42:46 +09002521
Chenjie Yu05013b32017-11-21 10:21:41 -08002522/**
2523 * Pulls Wifi Controller Activity Energy Info
2524 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002525message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002526 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002527 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002528 // stack reported state
2529 // TODO: replace this with proto enum
2530 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002531 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002532 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002533 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002534 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002535 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002536 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002537 // product of current(mA), voltage(V) and time(ms)
2538 optional uint64 controller_energy_used = 6;
2539}
2540
2541/**
2542 * Pulls Modem Activity Energy Info
2543 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002544message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002545 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002546 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002547 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002548 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002549 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002550 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002551 /**
2552 * Tx power index
2553 * index 0 = tx_power < 0dBm
2554 * index 1 = 0dBm < tx_power < 5dBm
2555 * index 2 = 5dBm < tx_power < 15dBm
2556 * index 3 = 15dBm < tx_power < 20dBm
2557 * index 4 = tx_power > 20dBm
2558 */
2559 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002560 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002561 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002562 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002563 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002564 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002565 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002566 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002567 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002568 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002569 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002570 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002571 // product of current(mA), voltage(V) and time(ms)
2572 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002573}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002574
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002575/**
2576 * Pulls Bluetooth Activity Energy Info
2577 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2578 */
2579message BluetoothActivityInfo {
2580 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002581 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002582 // bluetooth stack state
2583 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002584 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002585 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002586 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002587 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002588 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002589 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002590 // product of current(mA), voltage(V) and time(ms)
2591 optional uint64 energy_used = 6;
2592}
2593
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002594/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002595 * Logs the memory stats for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002596 *
2597 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002598 */
2599message ProcessMemoryState {
2600 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002601 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002602
2603 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002604 // Usually package name, "system" for system server.
2605 // Provided by ActivityManagerService.
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002606 optional string process_name = 2;
2607
Rafal Slawikda51b932018-12-13 16:31:33 +00002608 // Current OOM score adjustment. Value read from ProcessRecord.
Yangster-maca8a30442018-10-13 23:46:34 -07002609 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002610
2611 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002612 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002613
2614 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002615 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002616
Rajeev Kumar90235992018-01-29 11:06:48 -08002617 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002618 // Value is read from /proc/PID/stat, field 24. Or from memory.stat, field
2619 // total_rss if per-app memory cgroups are enabled.
Rajeev Kumar90235992018-01-29 11:06:48 -08002620 optional int64 rss_in_bytes = 6;
2621
2622 // CACHE
Rafal Slawikda51b932018-12-13 16:31:33 +00002623 // Value is read from memory.stat, field total_cache if per-app memory
2624 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002625 optional int64 cache_in_bytes = 7;
2626
2627 // SWAP
Rafal Slawikda51b932018-12-13 16:31:33 +00002628 // Value is read from memory.stat, field total_swap if per-app memory
2629 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002630 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002631
Rafal Slawikd03ae422018-11-20 11:27:45 +00002632 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002633 optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
Rafal Slawik272a8162018-11-01 15:12:28 +00002634
2635 // Elapsed real time when the process started.
2636 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2637 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002638}
2639
2640/*
Rafal Slawik08621582018-10-15 14:53:07 +01002641 * Logs the memory stats for a native process (from procfs).
Rafal Slawikda51b932018-12-13 16:31:33 +00002642 *
2643 * Pulled from StatsCompanionService for selected native processes.
Rafal Slawik08621582018-10-15 14:53:07 +01002644 */
2645message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002646 // The uid if available. -1 means not available.
2647 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002648
Rafal Slawikbf67d072018-10-23 11:07:54 +01002649 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002650 // Value read from /proc/PID/cmdline.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002651 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002652
Rafal Slawikbf67d072018-10-23 11:07:54 +01002653 // # of page-faults
2654 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002655
Rafal Slawikbf67d072018-10-23 11:07:54 +01002656 // # of major page-faults
2657 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002658
Rafal Slawikbf67d072018-10-23 11:07:54 +01002659 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002660 // Value read from /proc/PID/stat, field 24.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002661 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002662
Rafal Slawikd03ae422018-11-20 11:27:45 +00002663 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002664 optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
Rafal Slawikbf67d072018-10-23 11:07:54 +01002665
2666 // Elapsed real time when the process started.
2667 // Value is read from /proc/PID/stat, field 22.
2668 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002669}
2670
2671/*
Rafal Slawik3bea8952018-11-15 12:39:33 +00002672 * Logs the memory high-water mark for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002673 *
2674 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
2675 * and for selected native processes.
Rafal Slawik44b88142018-12-15 16:48:09 +00002676 *
2677 * Pulling this atom resets high-water mark counters for all processes.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002678 */
2679message ProcessMemoryHighWaterMark {
2680 // The uid if available. -1 means not available.
2681 optional int32 uid = 1 [(is_uid) = true];
2682
Rafal Slawikda51b932018-12-13 16:31:33 +00002683 // The process name.
2684 // Usually package name or process cmdline.
2685 // Provided by ActivityManagerService or read from /proc/PID/cmdline.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002686 optional string process_name = 2;
2687
2688 // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
2689 // /proc/PID/status.
2690 optional int64 rss_high_water_mark_in_bytes = 3;
2691}
2692
2693/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002694 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002695 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002696message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002697 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002698}
2699
2700/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002701 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002702 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002703message SystemUptime {
2704 // Milliseconds since the system was booted.
2705 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2706 // for external input).
2707 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002708 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002709}
2710
2711/*
2712 * Reads from /proc/uid_concurrent_active_time which has the format:
2713 * active: X (X is # cores)
2714 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2715 * [uid1]: [time-0] [time-1] [time-2] ... ...
2716 * ...
2717 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2718 * The file contains a monotonically increasing count of time for a single boot.
2719 */
2720message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002721 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002722 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002723}
2724
2725/**
2726 * Reads from /proc/uid_concurrent_policy_time which has the format:
2727 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2728 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2729 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2730 * ...
2731 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2732 * The file contains a monotonically increasing count of time for a single boot.
2733 */
2734message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002735 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002736 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002737 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002738}
2739
2740/*
2741 * Pulls free disk space, for data, system partition and temporary directory.
2742 */
2743message DiskSpace {
2744 // available bytes in data partition
2745 optional uint64 data_available_bytes = 1;
2746 // available bytes in system partition
2747 optional uint64 system_available_bytes = 2;
2748 // available bytes in download cache or temp directories
2749 optional uint64 temp_available_bytes = 3;
2750}
Tej Singhbf972d92018-01-10 20:51:13 -08002751
2752/**
2753 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002754 * Pulled from:
2755 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002756 */
2757message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002758 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002759}
2760
2761/**
2762 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002763 * Pulled from:
2764 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002765 */
2766message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002767 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002768}
2769
2770/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002771 * Pulls battery voltage.
2772 * Pulled from:
2773 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2774 */
2775message BatteryVoltage {
2776 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002777 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002778}
2779
2780/**
Tej Singhb1dbc8b2018-11-19 15:49:47 -08002781 * Pulls battery level (percent full, from 0 to 100).
2782 *
2783 * Pulled from:
2784 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2785 */
2786message BatteryLevel {
2787 // Battery level. Should be in [0, 100].
2788 optional int32 battery_level = 1;
2789}
2790
2791/**
Tej Singhd89137e2018-03-26 14:51:40 -07002792 * Pulls the temperature of various parts of the device.
2793 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002794 *
2795 * Pulled from:
2796 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2797 */
2798message Temperature {
Tej Singhb6070b92018-12-19 19:00:12 -08002799 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
Tej Singh40298312018-02-16 00:15:09 -08002800 optional android.os.TemperatureTypeEnum sensor_location = 1;
2801
2802 // The name of the temperature source. Eg. CPU0
2803 optional string sensor_name = 2;
2804
Tej Singhd89137e2018-03-26 14:51:40 -07002805 // Temperature in tenths of a degree C.
Tej Singhb6070b92018-12-19 19:00:12 -08002806 // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
Yangster-maca8a30442018-10-13 23:46:34 -07002807 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002808}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002809
2810/**
2811 * Pulls the statistics of calls to Binder.
2812 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002813 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2814 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002815 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002816 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002817 */
2818message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002819 // UID of the process responsible for the binder transaction. It will be set if the process
2820 // executing the binder transaction attribute the transaction to another uid using
2821 // Binder.setThreadWorkSource().
2822 //
2823 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002824 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002825 // UID of the process executing the binder transaction.
2826 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002827 // Fully qualified class name of the API call.
2828 //
2829 // This is a system server class name.
2830 //
2831 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2832 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2833 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2834 // commonly used APIs.
2835 optional string service_class_name = 2;
2836 // Method name of the API call. It can also be a transaction code if we cannot
2837 // resolve it to a name. See Binder#getTransactionName.
2838 //
2839 // This is a system server method name.
2840 optional string service_method_name = 3;
2841 // Total number of API calls.
2842 optional int64 call_count = 4;
2843 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2844 optional bool screen_interactive = 13;
2845 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2846 // call_count will be equal to recorded_call_count.
2847 //
2848 // If recorded_call_count is different than call_count, it means data collection has been
2849 // sampled. All the fields below will be sampled in this case.
2850 optional int64 recorded_call_count = 12;
2851 // Number of exceptions thrown by the API.
2852 optional int64 recorded_exception_count = 5;
2853 // Total latency of all API calls.
2854 // Average can be computed using total_latency_micros / recorded_call_count.
2855 optional int64 recorded_total_latency_micros = 6;
2856 // Maximum latency of one API call.
2857 optional int64 recorded_max_latency_micros = 7;
2858 // Total CPU usage of all API calls.
2859 // Average can be computed using total_cpu_micros / recorded_call_count.
2860 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2861 optional int64 recorded_total_cpu_micros = 8;
2862 // Maximum CPU usage of one API call.
2863 optional int64 recorded_max_cpu_micros = 9;
2864 // Maximum parcel reply size of one API call.
2865 optional int64 recorded_max_reply_size_bytes = 10;
2866 // Maximum parcel request size of one API call.
2867 optional int64 recorded_max_request_size_bytes = 11;
2868}
2869
2870/**
2871 * Pulls the statistics of exceptions during calls to Binder.
2872 *
2873 * Binder stats are cumulative from boot unless somebody reset the data using
2874 * > adb shell dumpsys binder_calls_stats --reset
2875 */
2876message BinderCallsExceptions {
2877 // Exception class name, e.g. java.lang.IllegalArgumentException.
2878 //
2879 // This is an exception class name thrown by the system server.
2880 optional string exception_class_name = 1;
2881 // Total number of exceptions.
2882 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002883}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002884
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002885/**
2886 * Pulls the statistics of message dispatching on HandlerThreads.
2887 *
2888 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2889 * config on the device.
2890 *
2891 * Next tag: 11
2892 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002893message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002894 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002895 optional int32 uid = 1 [(is_uid) = true];
2896
2897 // Fully qualified class name of the handler target class.
2898 //
2899 // This field does not contain PII. This is a system server class name.
2900 optional string handler_class_name = 2;
2901
2902 // The name of the thread that runs the Looper.
2903 //
2904 // This field does not contain PII. This is a system server thread name.
2905 optional string looper_thread_name = 3;
2906
2907 // The name of the dispatched message.
2908 //
2909 // This field does not contain PII. This is a system server constant or class
2910 // name.
2911 optional string message_name = 4;
2912
2913 // Total number of successfully dispatched messages.
2914 optional int64 message_count = 5;
2915
2916 // Total number of messages that failed dispatching.
2917 optional int64 exception_count = 6;
2918
2919 // Total number of processed messages we have data recorded for. If we
2920 // collected data for all the messages, message_count will be equal to
2921 // recorded_message_count.
2922 //
2923 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002924 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002925 optional int64 recorded_message_count = 7;
2926
2927 // Total latency of all processed messages.
2928 // Average can be computed using recorded_total_latency_micros /
2929 // recorded_message_count.
2930 optional int64 recorded_total_latency_micros = 8;
2931
2932 // Total CPU usage of all processed message.
2933 // Average can be computed using recorded_total_cpu_micros /
2934 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002935 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002936 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002937
2938 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2939 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002940
2941 // Max recorded CPU usage of all processed messages.
2942 optional int64 recorded_max_cpu_micros = 11;
2943
2944 // Max recorded latency of all processed messages.
2945 optional int64 recorded_max_latency_micros = 12;
2946
2947 // Total number of messages we tracked the dispatching delay for. If we
2948 // collected data for all the messages, message_count will be equal to
2949 // recorded_delay_message_count.
2950 //
2951 // If recorded_delay_message_count is different than message_count, it means data
2952 // collection has been sampled or/and not all messages specified the target dispatch time.
2953 // The fields below will be sampled in this case.
2954 optional int64 recorded_delay_message_count = 13;
2955
2956 // Total dispatching delay of all processed messages.
2957 // Calculated as a difference between the target dispatching time (Message.when)
2958 // and the actual dispatching time.
2959 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2960 optional int64 recorded_total_delay_millis = 14;
2961
2962 // Max dispatching delay of all processed messages.
2963 // Calculated as a difference between the target dispatching time (Message.when)
2964 // and the actual dispatching time.
2965 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002966}
Tej Singh86dc9db2018-09-06 00:39:57 +00002967
2968/**
2969 * Pulls disk information, such as write speed and latency.
2970 */
2971message DiskStats {
2972 // Time taken to open, write 512B to, and close a file.
2973 // -1 if error performing the check.
2974 optional int64 data_write_latency_millis = 1;
2975
2976 optional bool file_based_encryption = 2;
2977
2978 // Recent disk write speed in kB/s.
2979 // -1 if error querying storageed.
2980 // 0 if data is unavailable.
2981 optional int32 recent_disk_write_speed = 3;
2982}
2983
2984
2985/**
2986 * Free and total bytes of the Data, Cache, and System partition.
2987 */
2988message DirectoryUsage {
2989 enum Directory {
2990 UNKNOWN = 0;
2991 DATA = 1;
2992 CACHE = 2;
2993 SYSTEM = 3;
2994 }
2995 optional Directory directory = 1;
2996 optional int64 free_bytes = 2;
2997 optional int64 total_bytes = 3;
2998}
2999
3000
3001/**
3002 * Size of an application: apk size, data size, and cache size.
3003 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
3004 * Information is only reported for apps with the primary user (user 0).
3005 * Sizes are aggregated by package name.
3006 */
3007message AppSize {
3008 // Including uids will involve modifying diskstats logic.
3009 optional string package_name = 1;
3010 // App size in bytes. -1 if unavailable.
3011 optional int64 app_size_bytes = 2;
3012 // App data size in bytes. -1 if unavailable.
3013 optional int64 app_data_size_bytes = 3;
3014 // App cache size in bytes. -1 if unavailable.
3015 optional int64 app_cache_size_bytes = 4;
3016 // Time that the cache file was produced.
3017 // Uses System.currentTimeMillis(), which is wall clock time.
3018 optional int64 cache_time_millis = 5;
3019}
3020
3021
3022/**
3023 * Size of a particular category. Eg: photos, videos.
3024 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
3025 */
3026message CategorySize {
3027 enum Category {
3028 UNKNOWN = 0;
3029 APP_SIZE = 1;
3030 APP_DATA_SIZE = 2;
3031 APP_CACHE_SIZE = 3;
3032 PHOTOS = 4;
3033 VIDEOS = 5;
3034 AUDIO = 6;
3035 DOWNLOADS = 7;
3036 SYSTEM = 8;
3037 OTHER = 9;
3038 }
3039 optional Category category = 1;
3040 // Category size in bytes.
3041 optional int64 size_bytes = 2;
3042 // Time that the cache file was produced.
3043 // Uses System.currentTimeMillis(), which is wall clock time.
3044 optional int64 cache_time_millis = 3;
3045}
Tej Singhd6d6d772018-09-05 17:41:25 -07003046
3047/**
Tej Singhe7726dc2018-09-21 11:42:12 -07003048 * Pulls per uid I/O stats. The stats are cumulative since boot.
3049 *
3050 * Read/write bytes are I/O events from a storage device
3051 * Read/write chars are data requested by read/write syscalls, and can be
3052 * satisfied by caching.
3053 *
3054 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
3055 */
3056message DiskIo {
3057 optional int32 uid = 1 [(is_uid) = true];
3058 optional int64 fg_chars_read = 2;
3059 optional int64 fg_chars_write = 3;
3060 optional int64 fg_bytes_read = 4;
3061 optional int64 fg_bytes_write = 5;
3062 optional int64 bg_chars_read = 6;
3063 optional int64 bg_chars_write = 7;
3064 optional int64 bg_bytes_read = 8;
3065 optional int64 bg_bytes_write = 9;
3066 optional int64 fg_fsync = 10;
3067 optional int64 bg_fsync= 11;
3068}
3069
3070
3071/**
Tej Singhd6d6d772018-09-05 17:41:25 -07003072 * Pulls the number of fingerprints for each user.
3073 *
3074 * Pulled from StatsCompanionService, which queries FingerprintManager.
3075 */
3076message NumFingerprints {
3077 // The associated user. Eg: 0 for owners, 10+ for others.
3078 // Defined in android/os/UserHandle.java
3079 optional int32 user = 1;
3080 // Number of fingerprints registered to that user.
3081 optional int32 num_fingerprints = 2;
3082}
Chenjie Yu12e5e672018-09-14 15:54:59 -07003083
Yangsteraf9aee72018-10-12 09:26:16 -07003084message AggStats {
3085 optional int64 min = 1;
3086
3087 optional int64 average = 2;
3088
3089 optional int64 max = 3;
3090}
3091
3092message ProcessStatsStateProto {
3093 optional android.service.procstats.ScreenState screen_state = 1;
3094
3095 optional android.service.procstats.MemoryState memory_state = 2;
3096
3097 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
3098 // and not frameworks/base/core/java/android/app/ActivityManager.java
3099 optional android.service.procstats.ProcessState process_state = 3;
3100
3101 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003102 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003103
3104 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003105 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07003106
3107 // # of samples taken
3108 optional int32 sample_size = 5;
3109
3110 // PSS is memory reserved for this process
3111 optional AggStats pss = 6;
3112
3113 // USS is memory shared between processes, divided evenly for accounting
3114 optional AggStats uss = 7;
3115
3116 // RSS is memory resident for this process
3117 optional AggStats rss = 8;
3118}
3119
3120// Next Tag: 7
3121message ProcessStatsProto {
3122 // Name of process.
3123 optional string process = 1;
3124
3125 // Uid of the process.
3126 optional int32 uid = 2;
3127
3128 // Information about how often kills occurred
3129 message Kill {
3130 // Count of excessive CPU kills
3131 optional int32 cpu = 1;
3132
3133 // Count of kills when cached
3134 optional int32 cached = 2;
3135
3136 // PSS stats during cached kill
3137 optional AggStats cached_pss = 3;
3138 }
3139 optional Kill kill = 3;
3140
3141 // Time and memory spent in various states.
3142 repeated ProcessStatsStateProto states = 5;
3143
3144 // Total time process has been running... screen_state, memory_state, and process_state
3145 // will not be set.
3146 optional ProcessStatsStateProto total_running_state = 6;
3147}
3148
3149message PackageServiceOperationStatsProto {
3150 // Operate enum: Started, Foreground, Bound, Executing
3151 optional android.service.procstats.ServiceOperationState operation = 1;
3152
3153 // Number of times the service was in this operation.
3154 optional int32 count = 2;
3155
3156 // Information about a state the service can be in.
3157 message StateStats {
3158 // Screen state enum.
3159 optional android.service.procstats.ScreenState screen_state = 1;
3160 // Memory state enum.
3161 optional android.service.procstats.MemoryState memory_state = 2;
3162
3163 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003164 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003165 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003166 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003167 }
3168 repeated StateStats state_stats = 3;
3169}
3170
3171message PackageServiceStatsProto {
3172 // Name of service component.
3173 optional string service_name = 1;
3174
3175 // The operation stats.
3176 // The package_name, package_uid, package_version, service_name will not be set to save space.
3177 repeated PackageServiceOperationStatsProto operation_stats = 2;
3178}
3179
3180message PackageAssociationSourceProcessStatsProto {
3181 // Uid of the process.
3182 optional int32 process_uid = 1;
3183 // Process name.
3184 optional string process_name = 2;
3185
3186 // Total count of the times this association appeared.
3187 optional int32 total_count = 3;
3188
3189 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003190 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003191
3192 // Total count of the times this association became actively impacting its target process.
3193 optional int32 active_count = 5;
3194
3195 // Information on one source in this association.
3196 message StateStats {
3197 // Process state enum.
3198 optional android.service.procstats.ProcessState process_state = 1;
3199 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003200 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003201 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003202 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003203 }
3204 repeated StateStats active_state_stats = 6;
3205}
3206
3207message PackageAssociationProcessStatsProto {
3208 // Name of the target component.
3209 optional string component_name = 1;
3210 // Information on one source in this association.
3211 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3212}
3213
3214
3215message ProcessStatsPackageProto {
3216 // Name of package.
3217 optional string package = 1;
3218
3219 // Uid of the package.
3220 optional int32 uid = 2;
3221
3222 // Version of the package.
3223 optional int64 version = 3;
3224
3225 // Stats for each process running with the package loaded in to it.
3226 repeated ProcessStatsProto process_stats = 4;
3227
3228 // Stats for each of the package's services.
3229 repeated PackageServiceStatsProto service_stats = 5;
3230
3231 // Stats for each association with the package.
3232 repeated PackageAssociationProcessStatsProto association_stats = 6;
3233}
3234
3235message ProcessStatsSectionProto {
3236 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003237 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003238
3239 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003240 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003241
3242 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003243 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003244
3245 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003246 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003247
3248 // System runtime library. e.g. "libdvm.so", "libart.so".
3249 optional string runtime = 5;
3250
3251 // whether kernel reports swapped pss.
3252 optional bool has_swapped_pss = 6;
3253
3254 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3255 enum Status {
3256 STATUS_UNKNOWN = 0;
3257 STATUS_COMPLETE = 1;
3258 STATUS_PARTIAL = 2;
3259 STATUS_SHUTDOWN = 3;
3260 STATUS_SYSPROPS = 4;
3261 }
3262 repeated Status status = 7;
3263
3264 // Stats for each process.
3265 repeated ProcessStatsProto process_stats = 8;
3266
3267 // Stats for each package.
3268 repeated ProcessStatsPackageProto package_stats = 9;
3269}
3270
Chenjie Yu12e5e672018-09-14 15:54:59 -07003271/**
3272 * Pulled from ProcessStatsService.java
3273 */
3274message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003275 optional ProcessStatsSectionProto proc_stats_section = 1;
3276}
3277
3278message PowerProfileProto {
3279 optional double cpu_suspend = 1;
3280
3281 optional double cpu_idle = 2;
3282
3283 optional double cpu_active = 3;
3284
3285 message CpuCluster {
3286 optional int32 id = 1;
3287 optional double cluster_power = 2;
3288 optional int32 cores = 3;
3289 repeated int64 speed = 4;
3290 repeated double core_power = 5;
3291 }
3292
3293 repeated CpuCluster cpu_cluster = 40;
3294
3295 optional double wifi_scan = 4;
3296
3297 optional double wifi_on = 5;
3298
3299 optional double wifi_active = 6;
3300
3301 optional double wifi_controller_idle = 7;
3302
3303 optional double wifi_controller_rx = 8;
3304
3305 optional double wifi_controller_tx = 9;
3306
3307 repeated double wifi_controller_tx_levels = 10;
3308
3309 optional double wifi_controller_operating_voltage = 11;
3310
3311 optional double bluetooth_controller_idle = 12;
3312
3313 optional double bluetooth_controller_rx = 13;
3314
3315 optional double bluetooth_controller_tx = 14;
3316
3317 optional double bluetooth_controller_operating_voltage = 15;
3318
3319 optional double modem_controller_sleep = 16;
3320
3321 optional double modem_controller_idle = 17;
3322
3323 optional double modem_controller_rx = 18;
3324
3325 repeated double modem_controller_tx = 19;
3326
3327 optional double modem_controller_operating_voltage = 20;
3328
3329 optional double gps_on = 21;
3330
3331 repeated double gps_signal_quality_based = 22;
3332
3333 optional double gps_operating_voltage = 23;
3334
3335 optional double bluetooth_on = 24;
3336
3337 optional double bluetooth_active = 25;
3338
3339 optional double bluetooth_at_cmd = 26;
3340
3341 optional double ambient_display = 27;
3342
3343 optional double screen_on = 28;
3344
3345 optional double radio_on = 29;
3346
3347 optional double radio_scanning = 30;
3348
3349 optional double radio_active = 31;
3350
3351 optional double screen_full = 32;
3352
3353 optional double audio = 33;
3354
3355 optional double video = 34;
3356
3357 optional double flashlight = 35;
3358
3359 optional double memory = 36;
3360
3361 optional double camera = 37;
3362
3363 optional double wifi_batched_scan = 38;
3364
3365 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003366}
Chenjie Yuab530202018-09-26 12:39:20 -07003367
3368/**
3369 * power_profile.xml and other constants for power model calculations.
3370 * Pulled from PowerProfile.java
3371 */
3372message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003373 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003374}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003375
3376/**
arangelovd5db50e2018-10-12 20:24:39 +01003377 * Logs when a user restriction was added or removed.
3378 *
3379 * Logged from:
3380 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3381 */
3382message UserRestrictionChanged {
3383 // The raw string of the user restriction as defined in UserManager.
3384 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3385 optional string restriction = 1;
3386 // Whether the restriction is enabled or disabled.
3387 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003388}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003389
3390/**
3391 * Pulls process user time and system time. Puller takes a snapshot of all pids
3392 * in the system and returns cpu stats for those that are working at the time.
3393 * Dead pids will be dropped. Kernel processes are excluded.
3394 * Min cool-down is 5 sec.
3395 */
3396message ProcessCpuTime {
3397 optional int32 uid = 1 [(is_uid) = true];
3398
3399 optional string process_name = 2;
3400 // Process cpu time in user space, cumulative from boot/process start
3401 optional int64 user_time_millis = 3;
3402 // Process cpu time in system space, cumulative from boot/process start
3403 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003404}
Misha Wagner5a51e002018-10-03 15:04:09 +01003405
3406/**
3407 * Pulls the CPU usage for each thread.
3408 *
3409 * Read from /proc/$PID/task/$TID/time_in_state files.
3410 *
3411 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3412 * time_in_state files not being present on some phones, have not been addressed. These should be
3413 * considered before a public release.
3414 */
3415message CpuTimePerThreadFreq {
3416 // UID that owns the process.
3417 optional int32 uid = 1 [(is_uid) = true];
3418 // ID of the process.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003419 optional int32 process_id = 2;
Misha Wagner5a51e002018-10-03 15:04:09 +01003420 // ID of the thread.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003421 optional int32 thread_id = 3;
Misha Wagner5a51e002018-10-03 15:04:09 +01003422 // Name of the process taken from `/proc/$PID/cmdline`.
3423 optional string process_name = 4;
3424 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3425 optional string thread_name = 5;
Misha Wagnerfde69582018-11-28 13:26:32 +00003426
3427 // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
3428 // are given in KHz, and time is given in milliseconds since the thread started. All eight
3429 // frequencies are given here as the alternative is sending eight separate atoms. This method
3430 // significantly reduces the amount of data created
3431 optional int32 frequency1_khz = 6;
3432 optional int32 time1_millis = 7;
3433 optional int32 frequency2_khz = 8;
3434 optional int32 time2_millis = 9;
3435 optional int32 frequency3_khz = 10;
3436 optional int32 time3_millis = 11;
3437 optional int32 frequency4_khz = 12;
3438 optional int32 time4_millis = 13;
3439 optional int32 frequency5_khz = 14;
3440 optional int32 time5_millis = 15;
3441 optional int32 frequency6_khz = 16;
3442 optional int32 time6_millis = 17;
3443 optional int32 frequency7_khz = 18;
3444 optional int32 time7_millis = 19;
3445 optional int32 frequency8_khz = 20;
3446 optional int32 time8_millis = 21;
Misha Wagner5a51e002018-10-03 15:04:09 +01003447}
Bookatz75ee6042018-11-09 12:27:37 -08003448
3449/**
Bookatz366a4432018-11-20 09:42:33 -08003450 * Pulls information about the device's build.
3451 */
3452message BuildInformation {
3453 // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
3454 // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
3455 optional string fingerprint = 1;
3456
3457 // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
3458 optional string brand = 2;
3459
3460 // Build.PRODUCT. The name of the overall product.
3461 optional string product = 3;
3462
3463 // Build.DEVICE. The name of the industrial design.
3464 optional string device = 4;
3465
3466 // Build.VERSION.RELEASE. The user-visible version string. E.g., "1.0" or "3.4b5" or "bananas".
3467 optional string version_release = 5;
3468
3469 // Build.ID. E.g. a label like "M4-rc20".
3470 optional string id = 6;
3471
3472 // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
3473 // represent this build.
3474 optional string version_incremental = 7;
3475
3476 // Build.TYPE. The type of build, like "user" or "eng".
3477 optional string type = 8;
3478
3479 // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
3480 optional string tags = 9;
3481}
3482
3483/**
Bookatz75ee6042018-11-09 12:27:37 -08003484 * Pulls on-device BatteryStats power use calculations for the overall device.
3485 */
3486message DeviceCalculatedPowerUse {
Bookatz3dbc13a2018-12-21 12:16:51 -08003487 // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3488 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3489 // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3490 optional int64 computed_power_nano_amp_secs = 1;
Bookatz75ee6042018-11-09 12:27:37 -08003491}
3492
3493/**
3494 * Pulls on-device BatteryStats power use calculations broken down by uid.
3495 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3496 * that is attributed to non-uid items. They must all be included to get the total power use.
3497 */
3498message DeviceCalculatedPowerBlameUid {
3499 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3500 optional int32 uid = 1 [(is_uid) = true];
3501
Bookatz3dbc13a2018-12-21 12:16:51 -08003502 // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3503 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3504 optional int64 power_nano_amp_secs = 2;
Bookatz75ee6042018-11-09 12:27:37 -08003505}
3506
3507/**
3508 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3509 * drain type.
3510 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3511 * is attributed uids. They must all be included to get the total power use.
3512 */
3513message DeviceCalculatedPowerBlameOther {
3514 // The type of item whose power use is being reported.
3515 enum DrainType {
3516 AMBIENT_DISPLAY = 0;
3517 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3518 BLUETOOTH = 2;
3519 CAMERA = 3;
3520 // Cell-standby
3521 CELL = 4;
3522 FLASHLIGHT = 5;
3523 IDLE = 6;
3524 MEMORY = 7;
3525 // Amount that total computed drain exceeded the drain estimated using the
3526 // battery level changes and capacity.
3527 OVERCOUNTED = 8;
3528 PHONE = 9;
3529 SCREEN = 10;
3530 // Amount that total computed drain was below the drain estimated using the
3531 // battery level changes and capacity.
3532 UNACCOUNTED = 11;
3533 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3534 WIFI = 13;
3535 }
3536 optional DrainType drain_type = 1;
3537
Bookatz3dbc13a2018-12-21 12:16:51 -08003538 // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3539 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3540 optional int64 power_nano_amp_secs = 2;
Rafal Slawik3bea8952018-11-15 12:39:33 +00003541}
arangelov4e994062018-11-13 16:12:38 +00003542
3543/**
3544 * Logs device policy features.
3545 *
3546 * Logged from:
3547 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3548 * packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
3549 */
3550message DevicePolicyEvent {
3551 // The event id - unique for each event.
3552 optional android.stats.devicepolicy.EventId event_id = 1;
3553 // The admin package name.
3554 optional string admin_package_name = 2;
3555 // A generic integer parameter.
3556 optional int32 integer_value = 3;
3557 // A generic boolean parameter.
3558 optional bool boolean_value = 4;
3559 // A parameter specifying a time period in milliseconds.
3560 optional uint64 time_period_millis = 5;
3561 // A parameter specifying a list of package names, bundle extras or string parameters.
3562 optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
3563}
shawnlinea5b66b2018-11-13 15:05:29 +08003564
3565/**
3566 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
3567 *
3568 * Logged from:
3569 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3570 */
3571message DocsUILaunchReported {
3572 optional android.stats.docsui.LaunchAction launch_action = 1;
3573 optional bool has_initial_uri = 2;
3574 optional android.stats.docsui.MimeType mime_type = 3;
3575 optional android.stats.docsui.Root initial_root = 4;
3576}
3577
3578/**
3579 * Logs root/app visited event in file managers/picker. Call this when the user
3580 * taps on root/app in hamburger menu.
3581 *
3582 * Logged from:
3583 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3584 */
3585message DocsUIRootVisitedReported {
3586 optional android.stats.docsui.ContextScope scope = 1;
3587 optional android.stats.docsui.Root root = 2;
3588}
3589
3590/**
3591 * Logs file operation stats. Call this when a file operation has completed.
3592 *
3593 * Logged from:
3594 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3595 */
3596message DocsUIFileOperationReported {
3597 optional android.stats.docsui.Provider provider = 1;
3598 optional android.stats.docsui.FileOperation file_op = 2;
3599}
3600
3601/**
3602 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
3603 * mode.
3604 *
3605 * Logged from:
3606 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3607 */
3608message DocsUIFileOperationCopyMoveModeReported {
3609 optional android.stats.docsui.FileOperation file_op = 1;
3610 optional android.stats.docsui.CopyMoveOpMode mode = 2;
3611}
3612
3613
3614/**
3615 * Logs file sub operation stats. Call this when a file operation has failed.
3616 *
3617 * Logged from:
3618 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3619 */
3620message DocsUIFileOperationFailureReported {
3621 optional android.stats.docsui.Authority authority = 1;
3622 optional android.stats.docsui.SubFileOperation sub_op = 2;
3623}
3624
3625/**
3626* Logs the cancellation of a file operation. Call this when a job is canceled
3627*
3628* Logged from:
3629* package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3630*/
3631message DocsUIFileOperationCanceledReported {
3632 optional android.stats.docsui.FileOperation file_op = 1;
3633}
3634
3635/**
3636 * Logs startup time in milliseconds.
3637 *
3638 * Logged from:
3639 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3640 */
3641message DocsUIStartupMsReported {
3642 optional int32 startup_millis = 1;
3643}
3644
3645/**
3646 * Logs the action that was started by user.
3647 *
3648 * Logged from:
3649 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3650 */
3651message DocsUIUserActionReported {
3652 optional android.stats.docsui.UserAction action = 1;
3653}
3654
3655/**
3656 * Logs the invalid type when invalid scoped access is requested.
3657 *
3658 * Logged from:
3659 * package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
3660 */
3661message DocsUIInvalidScopedAccessRequestReported {
3662 optional android.stats.docsui.InvalidScopedAccess type = 1;
Rafal Slawikda51b932018-12-13 16:31:33 +00003663}
Ben Murdochbab399f2018-12-06 11:01:38 +00003664
3665/**
shawnlina75e82d2019-01-07 10:31:12 +08003666 * Logs the package name that launches docsui picker mode.
3667 *
3668 * Logged from:
3669 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3670 */
3671message DocsUIPickerLaunchedFromReported {
3672 optional string package_name = 1;
3673}
3674
3675/**
3676 * Logs the search type.
3677 *
3678 * Logged from:
3679 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3680 */
3681message DocsUISearchTypeReported {
3682 optional android.stats.docsui.SearchType search_type = 1;
3683}
3684
3685/**
3686 * Logs the search mode.
3687 *
3688 * Logged from:
3689 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3690 */
3691message DocsUISearchModeReported {
3692 optional android.stats.docsui.SearchMode search_mode = 1;
3693}
3694
3695/**
3696 * Logs the pick result information.
3697 *
3698 * Logged from:
3699 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3700 */
3701message DocsUIPickResultReported {
3702 optional int32 total_action_count = 1;
3703 optional int64 duration_millis = 2;
3704 optional int32 file_count= 3;
3705 optional bool is_searching = 4;
3706 optional android.stats.docsui.Root picked_from = 5;
3707 optional android.stats.docsui.MimeType mime_type = 6;
3708 optional int32 repeatedly_pick_times = 7;
3709}
3710
3711/**
Ben Murdochbab399f2018-12-06 11:01:38 +00003712 * Logs when an app's memory is compacted.
3713 *
3714 * Logged from:
3715 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3716 */
3717message AppCompacted {
3718 // The pid of the process being compacted.
3719 optional int32 pid = 1;
3720
3721 // The name of the process being compacted.
3722 optional string process_name = 2;
3723
3724 // The type of compaction.
3725 enum Action {
3726 UNKNOWN = 0;
3727 SOME = 1;
3728 FULL = 2;
3729 }
Ben Murdoch01720b82018-12-19 18:03:44 +00003730 optional Action action = 3;
Ben Murdochbab399f2018-12-06 11:01:38 +00003731
3732 // Total RSS in kilobytes consumed by the process prior to compaction.
3733 optional int64 before_rss_total_kilobytes = 4;
3734
3735 // File RSS in kilobytes consumed by the process prior to compaction.
3736 optional int64 before_rss_file_kilobytes = 5;
3737
3738 // Anonymous RSS in kilobytes consumed by the process prior to compaction.
3739 optional int64 before_rss_anon_kilobytes = 6;
3740
3741 // Swap in kilobytes consumed by the process prior to compaction.
3742 optional int64 before_swap_kilobytes = 7;
3743
3744 // Total RSS in kilobytes consumed by the process after compaction.
3745 optional int64 after_rss_total_kilobytes = 8;
3746
3747 // File RSS in kilobytes consumed by the process after compaction.
3748 optional int64 after_rss_file_kilobytes = 9;
3749
3750 // Anonymous RSS in kilobytes consumed by the process after compaction.
3751 optional int64 after_rss_anon_kilobytes = 10;
3752
3753 // Swap in kilobytes consumed by the process after compaction.
3754 optional int64 after_swap_kilobytes = 11;
3755
3756 // The time taken to perform compaction in milliseconds.
3757 optional int64 time_to_compact_millis = 12;
3758
3759 // The last compaction action performed for this app.
3760 optional Action last_action = 13;
3761
Ben Murdoch01720b82018-12-19 18:03:44 +00003762 // The last time that compaction was attempted on this process in milliseconds
3763 // since boot, not including sleep (see SystemClock.uptimeMillis()).
3764 optional int64 last_compact_timestamp_ms_since_boot = 14;
Ben Murdochbab399f2018-12-06 11:01:38 +00003765
Ben Murdoch01720b82018-12-19 18:03:44 +00003766 // The oom_score_adj at the time of compaction.
3767 optional int32 oom_score_adj = 15;
Ben Murdochbab399f2018-12-06 11:01:38 +00003768
3769 // The process state at the time of compaction.
3770 optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
3771}
lifr157fc552018-12-12 16:38:04 +08003772
3773/**
3774 * Logs the latency period(in microseconds) and the return code of
3775 * the DNS(Domain Name System) lookups.
3776 * These 4 methods(GETADDRINFO,GETHOSTBYNAME,GETHOSTBYADDR,RES_NSEND)
3777 * to get info(address or hostname) from DNS server(or DNS cache).
3778 * Logged from:
3779 * /system/netd/server/DnsProxyListener.cpp
3780 */
3781message NetworkDnsEventReported {
3782 // The types of the DNS lookups, as defined in
3783 //system/netd/server/binder/android/net/metrics/INetdEventListener.aidl
3784 enum EventType {
3785 EVENT_UNKNOWN = 0;
3786 EVENT_GETADDRINFO = 1;
3787 EVENT_GETHOSTBYNAME = 2;
3788 EVENT_GETHOSTBYADDR = 3;
3789 EVENT_RES_NSEND = 4;
3790 }
3791 optional EventType event_type = 1;
3792
3793 // The return value of the DNS resolver for each DNS lookups.
3794 //bionic/libc/include/netdb.h
3795 //system/netd/resolv/include/netd_resolv/resolv.h
3796 enum ReturnCode {
3797 EAI_NOERR = 0;
3798 EAI_ADDRFAMILY = 1;
3799 EAI_AGAIN = 2;
3800 EAI_BADFLAGS = 3;
3801 EAI_FAIL = 4;
3802 EAI_FAMILY = 5;
3803 EAI_MEMORY = 6;
3804 EAI_NODATA = 7;
3805 EAI_NONAME = 8;
3806 EAI_SERVICE = 9;
3807 EAI_SOCKTYPE = 10;
3808 EAI_SYSTEM = 11;
3809 EAI_BADHINTS = 12;
3810 EAI_PROTOCOL = 13;
3811 EAI_OVERFLOW = 14;
3812 RESOLV_TIMEOUT = 255;
3813 EAI_MAX = 256;
3814 }
3815 optional ReturnCode return_code = 2;
3816
3817 // The latency period(in microseconds) it took for this DNS lookup to complete.
3818 optional int32 latency_micros = 3;
3819}
Chiachang Wangf6bedc22019-01-14 11:54:32 +08003820
3821/**
3822 * Logs when a data stall event occurs.
3823 *
3824 * Log from:
3825 * frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
3826 */
3827message DataStallEvent {
3828 // Data stall evaluation type.
3829 // See frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
3830 // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
3831 optional int32 evaluation_type = 1;
3832 // See definition in data_stall_event.proto.
3833 optional com.android.server.connectivity.ProbeResult validation_result = 2;
3834 // See definition in data_stall_event.proto.
3835 optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
3836 // See definition in data_stall_event.proto.
3837 optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
3838 // See definition in data_stall_event.proto.
3839 optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
3840 // See definition in data_stall_event.proto.
3841 optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
3842}