blob: 59b352712d37756c40c8ad137b81928bd178fb6a [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Fan Zhangf837b8e2018-10-23 12:38:30 -070025import "frameworks/base/core/proto/android/app/settings_enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070026import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080027import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080028import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080029import "frameworks/base/core/proto/android/server/enums.proto";
Bookatz48d362e2018-11-06 15:49:08 -080030import "frameworks/base/core/proto/android/server/location/enums.proto";
Yangsteraf9aee72018-10-12 09:26:16 -070031import "frameworks/base/core/proto/android/service/procstats_enum.proto";
32import "frameworks/base/core/proto/android/stats/enums.proto";
shawnlinea5b66b2018-11-13 15:05:29 +080033import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
Yao Chen8c433862018-10-24 14:09:20 -070034import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080035import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080036import "frameworks/base/core/proto/android/telephony/enums.proto";
37import "frameworks/base/core/proto/android/view/enums.proto";
arangelov4e994062018-11-13 16:12:38 +000038import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
39import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080040
Yao Chend54f9dd2017-10-17 17:37:48 +000041/**
Stefan Lafonae2df012017-11-14 09:17:21 -080042 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000043 * raw stats log events from the Android system, also known as "atoms."
44 *
45 * This field contains a single oneof with all of the available messages.
46 * The stats-log-api-gen tool runs as part of the Android build and
47 * generates the android.util.StatsLog class, which contains the constants
48 * and methods that Android uses to log.
49 *
Stefan Lafonae2df012017-11-14 09:17:21 -080050 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000051 * Instead, statsd on Android constructs these messages synthetically,
52 * in the format defined here and in stats_log.proto.
53 */
Stefan Lafonae2df012017-11-14 09:17:21 -080054message Atom {
55 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070056 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070057 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
58 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070059 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070060 BleScanResultReceived ble_scan_result_received = 4;
61 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080062 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070063 SyncStateChanged sync_state_changed = 7;
64 ScheduledJobStateChanged scheduled_job_state_changed = 8;
65 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070066 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080067 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
68 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
69 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070070 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
71 MemoryFactorStateChanged memory_factor_state_changed = 15;
72 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
73 CachedKillReported cached_kill_reported = 17;
74 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070075 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080076 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
77 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
78 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070079 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080080 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070081 CameraStateChanged camera_state_changed = 25;
82 FlashlightStateChanged flashlight_state_changed = 26;
83 UidProcessStateChanged uid_process_state_changed = 27;
84 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
85 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070086 BatteryLevelChanged battery_level_changed = 30;
87 ChargingStateChanged charging_state_changed = 31;
88 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070089 InteractiveStateChanged interactive_state_changed = 33;
90 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070091 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
92 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070093 WifiLockStateChanged wifi_lock_state_changed = 37;
94 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
95 WifiScanStateChanged wifi_scan_state_changed = 39;
96 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070097 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070098 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070099 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +0900100 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -0700101 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -0800102 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -0800103 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800104 AppStartOccurred app_start_occurred = 48;
105 AppStartCanceled app_start_canceled = 49;
106 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800107 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800108 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800109 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800110 LmkStateChanged lmk_state_changed = 54;
111 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800112 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800113 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800114 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800115 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800116 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800117 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800118 KeyguardStateChanged keyguard_state_changed = 62;
119 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
120 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800121 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800122 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800123 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
124 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Bookatz48d362e2018-11-06 15:49:08 -0800125 GpsSignalQualityChanged gps_signal_quality_changed = 69;
Andrew Chantb56388b2018-03-22 21:07:33 -0700126 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800127 SpeakerImpedanceReported speaker_impedance_reported = 71;
128 HardwareFailed hardware_failed = 72;
129 PhysicalDropDetected physical_drop_detected = 73;
130 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800131 MobileConnectionStateChanged mobile_connection_state_changed = 75;
132 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700133 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800134 AppCrashOccurred app_crash_occurred = 78;
135 ANROccurred anr_occurred = 79;
136 WTFOccurred wtf_occurred = 80;
137 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700138 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700139 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700140 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700141 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700142 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700143 FingerprintAcquired fingerprint_acquired = 87;
144 FingerprintAuthenticated fingerprint_authenticated = 88;
145 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700146 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700147 BatteryHealthSnapshot battery_health_snapshot = 91;
148 SlowIo slow_io = 92;
149 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700150 PhoneServiceStateChanged phone_service_state_changed = 94;
151 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100152 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700153 SettingsUIChanged settings_ui_changed = 97;
Chenjie Yuae9dfac2018-10-25 16:06:56 -0700154 ConnectivityStateChanged connectivity_state_changed = 98;
Chenjie Yu75b3c492018-10-06 21:45:19 -0700155 // TODO: service state change is very noisy shortly after boot, as well
156 // as at other transitions - coming out of doze, device plugged in, etc.
157 // Consider removing this if it becomes a problem
158 ServiceStateChanged service_state_changed = 99;
159 ServiceLaunchReported service_launch_reported = 100;
Yangster-macb89807e2018-11-15 21:10:57 -0800160 PhenotypeFlagStateChanged phenotype_flag_state_changed = 101;
161 BinaryPushStateChanged binary_push_state_changed = 102;
arangelov4e994062018-11-13 16:12:38 +0000162 DevicePolicyEvent device_policy_event = 103;
shawnlinea5b66b2018-11-13 15:05:29 +0800163 DocsUIFileOperationCanceledReported docs_ui_file_op_canceled = 104;
164 DocsUIFileOperationCopyMoveModeReported docs_ui_file_op_copy_move_mode_reported = 105;
165 DocsUIFileOperationFailureReported docs_ui_file_op_failure = 106;
166 DocsUIFileOperationReported docs_ui_provider_file_op = 107;
167 DocsUIInvalidScopedAccessRequestReported docs_ui_invalid_scoped_access_request = 108;
168 DocsUILaunchReported docs_ui_launch_reported = 109;
169 DocsUIRootVisitedReported docs_ui_root_visited = 110;
170 DocsUIStartupMsReported docs_ui_startup_ms = 111;
171 DocsUIUserActionReported docs_ui_user_action_reported = 112;
Bookatzda1798c2018-12-13 14:16:00 -0800172 WifiEnabledStateChanged wifi_enabled_state_changed = 113;
173 WifiRunningStateChanged wifi_running_state_changed = 114;
Ben Murdochbab399f2018-12-06 11:01:38 +0000174 AppCompacted app_compacted = 115;
lifr030d23a2019-01-11 16:54:51 +0800175 NetworkDnsEventReported network_dns_event_reported = 116;
shawnlina75e82d2019-01-07 10:31:12 +0800176 DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported = 117;
177 DocsUIPickResultReported docs_ui_pick_result_reported = 118;
178 DocsUISearchModeReported docs_ui_search_mode_reported = 119;
179 DocsUISearchTypeReported docs_ui_search_type_reported = 120;
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 }
David Chenc8a43242017-10-17 16:23:28 -0700181
David Chen6e3e6cb2018-01-03 16:14:06 -0800182 // Pulled events will start at field 10000.
Rafal Slawik3bea8952018-11-15 12:39:33 +0000183 // Next: 10043
David Chenc8a43242017-10-17 16:23:28 -0700184 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800185 WifiBytesTransfer wifi_bytes_transfer = 10000;
186 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
187 MobileBytesTransfer mobile_bytes_transfer = 10002;
188 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800189 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800190 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800191 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800192 CpuTimePerFreq cpu_time_per_freq = 10008;
193 CpuTimePerUid cpu_time_per_uid = 10009;
194 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800195 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800196 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800197 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800198 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800199 SystemElapsedRealtime system_elapsed_realtime = 10014;
200 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800201 CpuActiveTime cpu_active_time = 10016;
202 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000203 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800204 RemainingBatteryCapacity remaining_battery_capacity = 10019;
205 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800206 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100207 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100208 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100209 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000210 DiskStats disk_stats = 10025;
211 DirectoryUsage directory_usage = 10026;
212 AppSize app_size = 10027;
213 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700214 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700215 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700216 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700217 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700218 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700219 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700220 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100221 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100222 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700223 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800224 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
225 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
226 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
Rafal Slawik3bea8952018-11-15 12:39:33 +0000227 ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
Tej Singhb1dbc8b2018-11-19 15:49:47 -0800228 BatteryLevel battery_level = 10043;
Bookatz366a4432018-11-20 09:42:33 -0800229 BuildInformation build_information = 10044;
David Chenc8a43242017-10-17 16:23:28 -0700230 }
yroa1fe77c2018-02-26 14:22:54 -0800231
Bookatz76aafcf2018-09-17 16:17:10 -0700232 // DO NOT USE field numbers above 100,000 in AOSP.
233 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
234 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700235}
236
Yao Chend54f9dd2017-10-17 17:37:48 +0000237/**
Yangster-mac20877162017-12-22 17:19:39 -0800238 * This proto represents a node of an attribution chain.
239 * Note: All attribution chains are represented as a repeated field of type
240 * AttributionNode. It is understood that in such arrays, the order is that
241 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000242 */
Yangster-mac20877162017-12-22 17:19:39 -0800243message AttributionNode {
244 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800245 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800246
Yangster-mac20877162017-12-22 17:19:39 -0800247 // The (optional) string tag for an element in the attribution chain. If the
248 // element has no tag, it is encoded as an empty string.
249 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700250}
251
Yangster-mac48b3d622018-08-18 12:38:11 -0700252message KeyValuePair {
253 optional int32 key = 1;
254 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700255 int32 value_int = 2;
256 int64 value_long = 3;
257 string value_str = 4;
258 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700259 }
260}
261
262message KeyValuePairsAtom {
263 optional int32 uid = 1;
264 repeated KeyValuePair pairs = 2;
265}
266
Yao Chend54f9dd2017-10-17 17:37:48 +0000267/*
268 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800269 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000270 *
271 * RULES:
272 * - The field ids for each atom must start at 1, and count upwards by 1.
273 * Skipping field ids is not allowed.
274 * - These form an API, so renaming, renumbering or removing fields is
275 * not allowed between android releases. (This is not currently enforced,
276 * but there will be a tool to enforce this restriction).
277 * - The types must be built-in protocol buffer types, namely, no sub-messages
278 * are allowed (yet). The bytes type is also not allowed.
279 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800280 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000281 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800282 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000283 * - A field that is a uid should be a string field, tagged with the [xxx]
284 * annotation. The generated code on android will be represented by UIDs,
285 * and those UIDs will be translated in xxx to those strings.
286 *
287 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700288 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000289 * - If there is a UID, it goes first. Think in an object-oriented fashion.
290 * *****************************************************************************
291 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700292
Yao Chend54f9dd2017-10-17 17:37:48 +0000293/**
Yangster-mace16189a2018-08-26 12:20:16 -0700294 * Logs when the Thermal service HAL notifies the throttling start/stop events.
295 *
296 * Logged from:
297 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
298 */
299message ThermalThrottlingStateChanged {
300 optional android.os.TemperatureTypeEnum sensor_type = 1;
301
302 enum State {
303 UNKNOWN = 0;
304 START = 1;
305 STOP = 2;
306 }
307
308 optional State state = 2;
309
310 optional float temperature = 3;
311}
312
313/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000314 * Logs when the screen state changes.
315 *
316 * Logged from:
317 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
318 */
319message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800320 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700321 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700322}
Yao Chend54f9dd2017-10-17 17:37:48 +0000323
324/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700325 * Logs that the process state of the uid, as determined by ActivityManager
326 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000327 *
328 * Logged from:
329 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
330 */
Bookatzc1a050a2017-10-10 15:49:28 -0700331message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700332 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000333
Bookatzdb026a22018-01-10 19:01:56 -0800334 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700335 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000336}
337
338/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700339 * Logs process state change of a process, as per the activity manager.
340 *
341 * Logged from:
342 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
343 */
344message ProcessStateChanged {
345 optional int32 uid = 1;
346 optional string process_name = 2;
347 optional string package_name = 3;
348 // TODO: remove this when validation is done
349 optional int64 version = 5;
350 // The state, from frameworks/base/core/proto/android/app/enums.proto.
351 optional android.app.ProcessStateEnum state = 4;
352}
353
354/**
355 * Logs when ActivityManagerService sleep state is changed.
356 *
357 * Logged from:
358 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
359 */
360message ActivityManagerSleepStateChanged {
361 // TODO: import frameworks proto
362 enum State {
363 UNKNOWN = 0;
364 ASLEEP = 1;
365 AWAKE = 2;
366 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700367 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700368}
369
370/**
371 * Logs when system memory state changes.
372 *
373 * Logged from:
374 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
375 */
376message MemoryFactorStateChanged {
377 // TODO: import frameworks proto
378 enum State {
379 MEMORY_UNKNOWN = 0;
380 NORMAL = 1; // normal.
381 MODERATE = 2; // moderate memory pressure.
382 LOW = 3; // low memory.
383 CRITICAL = 4; // critical memory.
384
385 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700386 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700387}
388
389/**
390 * Logs when app is using too much cpu, according to ActivityManagerService.
391 *
392 * Logged from:
393 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
394 */
395message ExcessiveCpuUsageReported {
396 optional int32 uid = 1;
397 optional string process_name = 2;
398 optional string package_name = 3;
399 // package version. TODO: remove this when validation is done
400 optional int64 version = 4;
401}
402
403/**
404 * Logs when a cached process is killed, along with its pss.
405 *
406 * Logged from:
407 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
408 */
409message CachedKillReported {
410 optional int32 uid = 1;
411 optional string process_name = 2;
412 optional string package_name = 3;
413 // TODO: remove this when validation is done
414 optional int64 version = 5;
415 optional int64 pss = 4;
416}
417
418/**
419 * Logs when memory stats of a process is reported.
420 *
421 * Logged from:
422 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
423 */
424message ProcessMemoryStatReported {
425 optional int32 uid = 1;
426 optional string process_name = 2;
427 optional string package_name = 3;
428 //TODO: remove this when validation is done
429 optional int64 version = 9;
430 optional int64 pss = 4;
431 optional int64 uss = 5;
432 optional int64 rss = 6;
433 enum Type {
434 ADD_PSS_INTERNAL_SINGLE = 0;
435 ADD_PSS_INTERNAL_ALL_MEM = 1;
436 ADD_PSS_INTERNAL_ALL_POLL = 2;
437 ADD_PSS_EXTERNAL = 3;
438 ADD_PSS_EXTERNAL_SLOW = 4;
439 }
440 optional Type type = 7;
441 optional int64 duration = 8;
442}
443
444/**
Bookatzc1a050a2017-10-10 15:49:28 -0700445 * Logs that a process started, finished, crashed, or ANRed.
446 *
447 * Logged from:
448 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
449 */
450message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700451 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700452
David Chen0b5c90c2018-01-25 16:51:49 -0800453 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800454 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700455
Bookatzddccf0a2017-11-28 16:48:14 -0800456 // What lifecycle state the process changed to.
457 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800458 enum State {
459 FINISHED = 0;
460 STARTED = 1;
461 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800462 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800463 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700464}
465
Bookatzc1a050a2017-10-10 15:49:28 -0700466/**
467 * Logs when the ble scan state changes.
468 *
469 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700470 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700471 */
472message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800473 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700474
475 enum State {
476 OFF = 0;
477 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700478 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
479 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700480 }
481 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700482
Bookatze5ec0b42018-03-26 13:34:56 -0700483 // Does the scan have a filter.
484 optional bool is_filtered = 3;
485 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
486 optional bool is_first_match = 4;
487 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
488 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700489}
490
491/**
492 * Logs reporting of a ble scan finding results.
493 *
494 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700495 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700496 */
Bookatzae6738e2018-09-13 11:38:56 -0700497// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700498message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800499 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700500
501 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800502 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700503}
504
505/**
506 * Logs when a sensor state changes.
507 *
508 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700509 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700510 */
511message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800512 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700513
Bookatzc1a050a2017-10-10 15:49:28 -0700514 // The id (int) of the sensor.
515 optional int32 sensor_id = 2;
516
517 enum State {
518 OFF = 0;
519 ON = 1;
520 }
521 optional State state = 3;
522}
523
Bookatzc1a050a2017-10-10 15:49:28 -0700524/**
525 * Logs when GPS state changes.
526 *
527 * Logged from:
528 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
529 */
530message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800531 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700532
533 enum State {
534 OFF = 0;
535 ON = 1;
536 }
537 optional State state = 2;
538}
539
Bookatz48d362e2018-11-06 15:49:08 -0800540/**
541 * Logs when GPS signal quality.
542 *
543 * Logged from:
544 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
545 */
546message GpsSignalQualityChanged {
547 optional android.server.location.GpsSignalQualityEnum level = 1;
548}
549
Bookatzc1a050a2017-10-10 15:49:28 -0700550
551/**
552 * Logs when a sync manager sync state changes.
553 *
554 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700555 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700556 */
557message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800558 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700559
David Chen0b5c90c2018-01-25 16:51:49 -0800560 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800561 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700562
563 enum State {
564 OFF = 0;
565 ON = 1;
566 }
567 optional State state = 3;
568}
569
Yangster-mac96353002018-09-05 11:18:55 -0700570/*
571 * Deferred job stats.
572 *
573 * Logged from:
574 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
575*/
576message DeferredJobStatsReported {
577 repeated AttributionNode attribution_node = 1;
578
579 // Number of jobs deferred.
580 optional int32 num_jobs_deferred = 2;
581
582 // Time since the last job runs.
583 optional int64 time_since_last_job_millis = 3;
584}
585
Bookatzc1a050a2017-10-10 15:49:28 -0700586/**
587 * Logs when a job scheduler job state changes.
588 *
589 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700590 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700591 */
592message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800593 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700594
595 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800596 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700597
598 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800599 FINISHED = 0;
600 STARTED = 1;
601 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700602 }
603 optional State state = 3;
604
Tej Singh33a412b2018-03-16 18:43:59 -0700605 // The reason a job has stopped.
606 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700607 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700608 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700609}
610
611/**
612 * Logs when the audio state changes.
613 *
614 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700615 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700616 */
617message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800618 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700619
620 enum State {
621 OFF = 0;
622 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700623 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
624 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700625 }
626 optional State state = 2;
627}
628
629/**
630 * Logs when the video codec state changes.
631 *
632 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700633 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700634 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800635message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800636 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700637
638 enum State {
639 OFF = 0;
640 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700641 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
642 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700643 }
644 optional State state = 2;
645}
646
647/**
648 * Logs when the flashlight state changes.
649 *
650 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700651 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700652 */
653message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800654 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700655
656 enum State {
657 OFF = 0;
658 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700659 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
660 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700661 }
662 optional State state = 2;
663}
664
665/**
666 * Logs when the camera state changes.
667 *
668 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700669 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700670 */
671message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800672 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700673
674 enum State {
675 OFF = 0;
676 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700677 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
678 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700679 }
680 optional State state = 2;
681}
682
683/**
684 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000685 *
686 * Logged from:
687 * TODO
688 */
Bookatzd6746242017-10-24 18:39:35 -0700689message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800690 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000691
Bookatz1a1b0462018-01-12 11:47:03 -0800692 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
693 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700694 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700695
696 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
697 optional string tag = 3;
698
699 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800700 RELEASE = 0;
701 ACQUIRE = 1;
702 CHANGE_RELEASE = 2;
703 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700704 }
705 optional State state = 4;
706}
707
708/**
Bookatzc1a050a2017-10-10 15:49:28 -0700709 * Logs when a partial wakelock is considered 'long' (over 1 min).
710 *
711 * Logged from:
712 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
713 */
714message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800715 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700716
Yao Chend54f9dd2017-10-17 17:37:48 +0000717 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
718 optional string tag = 2;
719
Bookatzc1a050a2017-10-10 15:49:28 -0700720 // TODO: I have no idea what this is.
721 optional string history_tag = 3;
722
723 enum State {
724 OFF = 0;
725 ON = 1;
726 }
727 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000728}
729
Bookatzc1a050a2017-10-10 15:49:28 -0700730/**
Bookatza66083f2018-09-20 17:24:00 -0700731 * Logs when the device is interactive, according to the PowerManager Notifier.
732 *
733 * Logged from:
734 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
735 */
736message InteractiveStateChanged {
737 enum State {
738 OFF = 0;
739 ON = 1;
740 }
741 optional State state = 1;
742}
743
744/**
Bookatzc1a050a2017-10-10 15:49:28 -0700745 * Logs Battery Saver state change.
746 *
747 * Logged from:
748 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
749 */
750message BatterySaverModeStateChanged {
751 enum State {
752 OFF = 0;
753 ON = 1;
754 }
755 optional State state = 1;
756}
757
758/**
759 * Logs Doze mode state change.
760 *
761 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800762 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700763 */
764message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800765 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800766}
767
768
769/**
770 * Logs state change of Doze mode including maintenance windows.
771 *
772 * Logged from:
773 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
774 */
775message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800776 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700777}
778
779/**
780 * Logs screen brightness level.
781 *
782 * Logged from:
783 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
784 */
785message ScreenBrightnessChanged {
786 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
787 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700788}
789
790/**
791 * Logs battery level (percent full, from 0 to 100).
792 *
793 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700794 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700795 */
796message BatteryLevelChanged {
797 // Battery level. Should be in [0, 100].
798 optional int32 battery_level = 1;
799}
800
801/**
802 * Logs change in charging status of the device.
803 *
804 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700805 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700806 */
807message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800808 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
809 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700810}
811
812/**
813 * Logs whether the device is plugged in, and what power source it is using.
814 *
815 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700816 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700817 */
818message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800819 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
820 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700821}
822
Bookatz8c6571b2017-10-24 15:04:41 -0700823/**
824 * Logs when an app's wakeup alarm fires.
825 *
826 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700827 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700828 */
829message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800830 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800831
832 // Name of the wakeup alarm.
833 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700834
835 // Name of source package (for historical reasons, since BatteryStats tracked it).
836 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800837}
838
839/**
840 * Logs when an an app causes the mobile radio to change state.
841 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
842 *
843 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700844 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800845 */
846message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800847 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800848
Bookatz1a1b0462018-01-12 11:47:03 -0800849 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
850 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800851}
852
853/**
854 * Logs when an an app causes the wifi radio to change state.
855 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
856 *
857 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700858 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800859 */
860message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800861 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800862
Bookatz1a1b0462018-01-12 11:47:03 -0800863 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
864 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700865}
866
867/**
868 * Logs kernel wakeup reasons and aborts.
869 *
870 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700871 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700872 */
873message KernelWakeupReported {
874 // Name of the kernel wakeup reason (or abort).
875 optional string wakeup_reason_name = 1;
876
877 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800878 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700879}
880
881/**
Bookatzda1798c2018-12-13 14:16:00 -0800882 * Logs when Wifi is toggled on/off.
Bookatza0a1f8a2018-12-17 12:28:32 -0800883 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
Bookatzda1798c2018-12-13 14:16:00 -0800884 *
885 * Logged from:
886 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
887 */
888message WifiEnabledStateChanged {
889 enum State {
890 OFF = 0;
891 ON = 1;
892 }
893 optional State state = 1;
894}
895
896/**
897 * 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 -0800898 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
899 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
Bookatzda1798c2018-12-13 14:16:00 -0800900 *
901 * Logged from:
902 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
903 */
904message WifiRunningStateChanged {
905 repeated AttributionNode attribution_node = 1;
906
907 enum State {
908 OFF = 0;
909 ON = 1;
910 }
911 optional State state = 2;
912}
913
914/**
Bookatze5885242017-10-24 20:10:31 -0700915 * Logs wifi locks held by an app.
916 *
917 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700918 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700919 */
920message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800921 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700922
923 enum State {
924 OFF = 0;
925 ON = 1;
926 }
927 optional State state = 2;
928}
929
930/**
931 * Logs wifi signal strength changes.
932 *
933 * Logged from:
Bookatz819ea832018-11-28 16:53:31 -0800934 * frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
Bookatze5885242017-10-24 20:10:31 -0700935 */
936message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800937 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
938 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700939}
940
941/**
942 * Logs wifi scans performed by an app.
943 *
944 * Logged from:
Bookatz819ea832018-11-28 16:53:31 -0800945 * frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
Bookatze5885242017-10-24 20:10:31 -0700946 */
947message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800948 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700949
950 enum State {
951 OFF = 0;
952 ON = 1;
953 }
954 optional State state = 2;
955}
956
957/**
Tej Singh4503e102018-01-04 14:35:01 -0800958 * Logs wifi multicast locks held by an app
959 *
960 * Logged from:
Bookatz819ea832018-11-28 16:53:31 -0800961 * frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
Tej Singh4503e102018-01-04 14:35:01 -0800962 */
963message WifiMulticastLockStateChanged {
964 repeated AttributionNode attribution_node = 1;
965
966 enum State {
967 OFF = 0;
968 ON = 1;
969 }
970 optional State state = 2;
Bookatz819ea832018-11-28 16:53:31 -0800971
972 optional string tag = 3;
Tej Singh4503e102018-01-04 14:35:01 -0800973}
974
975/**
Tej Singh1ea42892018-01-19 09:27:00 -0800976 * Logs shutdown reason and duration on next boot.
977 *
978 * Logged from:
979 * frameworks/base/core/java/com/android/server/BootReceiver.java
980 */
981message ShutdownSequenceReported {
982 // True if shutdown is for a reboot. Default: false if we do not know.
983 optional bool reboot = 1;
984
985 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
986 optional string reason = 2;
987
988 // Beginning of shutdown time in ms using wall clock time since unix epoch.
989 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800990 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800991
992 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800993 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800994}
995
Tej Singh6483ea42018-01-25 17:45:49 -0800996
997/**
998 * Logs boot reason and duration.
999 *
1000 * Logged from:
1001 * system/core/bootstat/bootstat.cpp
1002 */
1003message BootSequenceReported {
1004 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
1005 // Default: "<EMPTY>" if not available.
1006 optional string bootloader_reason = 1;
1007
1008 // Reason for system boot. Eg. bootloader, reboot,userrequested
1009 // Default: "<EMPTY>" if not available.
1010 optional string system_reason = 2;
1011
1012 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -08001013 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -08001014
1015 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001016 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -08001017
1018 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001019 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -08001020
1021 // Time since last boot in ms. Default: 0 if not available.
1022 optional int64 time_since_last_boot = 6;
1023}
1024
Tej Singhc477d9c2018-02-05 18:31:39 -08001025
1026/**
1027 * Logs call state and disconnect cause (if applicable).
1028 *
1029 * Logged from:
1030 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
1031 */
1032message CallStateChanged {
1033 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1034 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1035 optional android.telecom.CallStateEnum call_state = 1;
1036
1037 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1038 // This value is only applicable when the call_state is DISCONNECTED, and
1039 // should always be UNKNOWN if the call_state is not DISCONNECTED.
1040 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1041 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1042
1043 // True if the call is self-managed, which are apps that use the
1044 // telecom infrastructure to make their own calls.
1045 optional bool self_managed = 3;
1046
1047 // True if call is external. External calls are calls on connected Wear
1048 // devices but show up in Telecom so the user can pull them onto the device.
1049 optional bool external_call = 4;
1050}
1051
Tej Singh1ea42892018-01-19 09:27:00 -08001052/**
Tej Singhdd7bd352018-02-09 19:33:15 -08001053 * Logs keyguard state. The keyguard is the lock screen.
1054 *
1055 * Logged from:
1056 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1057 */
1058message KeyguardStateChanged {
1059 enum State {
1060 UNKNOWN = 0;
1061 // The keyguard is hidden when the phone is unlocked.
1062 HIDDEN = 1;
1063 // The keyguard is shown when the phone is locked (screen turns off).
1064 SHOWN= 2;
1065 // The keyguard is occluded when something is overlaying the keyguard.
1066 // Eg. Opening the camera while on the lock screen.
1067 OCCLUDED = 3;
1068 }
1069 optional State state = 1;
1070}
1071
1072/**
1073 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1074 * prompts the user to enter a password (pattern, pin, etc).
1075 *
1076 * Logged from:
1077 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1078 */
1079
1080message KeyguardBouncerStateChanged {
1081 enum State {
1082 UNKNOWN = 0;
1083 // Bouncer is hidden, either as a result of successfully entering the
1084 // password, screen timing out, or user going back to lock screen.
1085 HIDDEN = 1;
1086 // This is when the user is being prompted to enter the password.
1087 SHOWN = 2;
1088 }
1089 optional State state = 1;
1090}
1091
1092/**
1093 * Logs the result of entering a password into the keyguard bouncer.
1094 *
1095 * Logged from:
1096 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1097 */
1098message KeyguardBouncerPasswordEntered {
1099 enum BouncerResult {
1100 UNKNOWN = 0;
1101 // The password entered was incorrect.
1102 FAILURE = 1;
1103 // The password entered was correct.
1104 SUCCESS = 2;
1105 }
1106 optional BouncerResult result = 1;
1107}
1108
Tej Singha883b372018-02-15 11:30:01 -08001109/*
1110 * Logs changes to the configuration of the device. The configuration is defined
1111 * in frameworks/base/core/java/android/content/res/Configuration.java
1112 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1113 * Please go there to interpret the possible values each field can be.
1114 *
1115 * Logged from:
1116 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1117 */
1118message ResourceConfigurationChanged {
1119 // Bit mask of color capabilities of the screen.
1120 // Contains information about the color gamut and hdr mode of the screen.
1121 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001122 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001123
1124 // The target screen density being rendered to.
1125 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001126 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001127
1128 // Current user preference for the scaling factor for fonts,
1129 // relative to the base density scaling.
1130 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001131 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001132
1133 // Flag indicating whether the hard keyboard is hidden.
1134 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001135 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001136
1137 // The type of keyboard attached to the device.
1138 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1139 optional int32 keyboard = 5;
1140
1141 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1142 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001143 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001144
1145 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1146 // 0 if undefined.
1147 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1148 optional int32 mcc = 7;
1149
1150 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1151 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1152 // MNC_ZERO symbol defined in Configuration.java.
1153 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1154 optional int32 mnc = 8;
1155
1156 // The kind of navigation available on the device.
1157 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1158 optional int32 navigation = 9;
1159
1160 // Flag indicating whether the navigation is available.
1161 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001162 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001163
1164 // Overall orientation of the screen.
1165 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1166 optional int32 orientation = 11;
1167
1168 // The current height of the available screen space, in dp units.
1169 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001170 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001171
1172 // Bit mask of overall layout of the screen.
1173 // Contains information about screen size, whether the screen is wider/taller
1174 // than normal, whether the screen layout is right-tl-left or left-to-right,
1175 // and whether the screen has a rounded shape.
1176 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001177 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001178
1179 // Current width of the available screen space, in dp units.
1180 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001181 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001182
1183 // The smallest screen size an application will see in normal operation.
1184 // This is the smallest value of both screenWidthDp and screenHeightDp
1185 // in portrait and landscape.
1186 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001187 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001188
1189 // The type of touch screen attached to the device.
1190 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1191 optional int32 touchscreen = 16;
1192
1193 // Bit mask of the ui mode.
1194 // Contains information about the overall ui mode of the device.
1195 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1196 // Also contains information about whether the device is in night mode.
1197 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001198 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001199}
1200
Tej Singheee317b2018-03-07 19:28:05 -08001201
1202/**
1203 * Logs changes in the connection state of the mobile radio.
1204 *
1205 * Logged from:
1206 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1207 */
1208message MobileConnectionStateChanged {
1209 // States are from the state machine DataConnection.java.
1210 enum State {
1211 UNKNOWN = 0;
1212 // The connection is inactive, or disconnected.
1213 INACTIVE = 1;
1214 // The connection is being activated, or connecting.
1215 ACTIVATING = 2;
1216 // The connection is active, or connected.
1217 ACTIVE = 3;
1218 // The connection is disconnecting.
1219 DISCONNECTING = 4;
1220 // The connection is disconnecting after creating a connection.
1221 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1222 }
1223 optional State state = 1;
1224 // For multi-sim phones, this distinguishes between the sim cards.
1225 optional int32 sim_slot_index = 2;
1226 // Used to identify the connection. Starts at 0 and increments by 1 for
1227 // every new network created. Resets whenever the device reboots.
1228 optional int32 data_connection_id = 3;
1229 // A bitmask for the capabilities of this connection.
1230 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1231 // Default value (if we have no information): 0
1232 optional int64 capabilities = 4;
1233 // If this connection has internet.
1234 // This just checks if the DEFAULT bit of capabilities is set.
1235 optional bool has_internet = 5;
1236}
1237
1238/**
1239 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1240 *
1241 * Logged from:
1242 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1243 */
1244message MobileRadioTechnologyChanged {
1245 optional android.telephony.NetworkTypeEnum state = 1;
1246 // For multi-sim phones, this distinguishes between the sim cards.
1247 optional int32 sim_slot_index = 2;
1248}
1249
Andrew Chantb56388b2018-03-22 21:07:33 -07001250/**
1251 * Logs the VID and PID of any connected USB devices.
1252 *
1253 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1254 *
1255 * Logged by Vendor.
1256 */
1257message UsbDeviceAttached {
1258 optional int32 vid = 1;
1259 optional int32 pid = 2;
1260 optional bool has_audio = 3;
1261 optional bool has_hid = 4;
1262 optional bool has_storage = 5;
Badhri Jagan Sridharan5ec629f2018-11-16 15:39:22 -08001263 enum State {
1264 STATE_DISCONNECTED = 0;
1265 STATE_CONNECTED = 1;
1266 }
1267 optional State state = 6;
Badhri Jagan Sridharanc2c54a22018-12-14 14:41:26 -08001268 optional int64 last_connect_duration_millis = 7;
Andrew Chantb56388b2018-03-22 21:07:33 -07001269}
1270
Tej Singheee317b2018-03-07 19:28:05 -08001271
Tej Singhdd7bd352018-02-09 19:33:15 -08001272/**
Tej Singh5d991e12018-03-09 19:48:11 -08001273 * Logs when Bluetooth is enabled and disabled.
1274 *
1275 * Logged from:
1276 * services/core/java/com/android/server/BluetoothManagerService.java
1277 */
1278message BluetoothEnabledStateChanged {
1279 repeated AttributionNode attribution_node = 1;
1280 // Whether or not bluetooth is enabled on the device.
1281 enum State {
1282 UNKNOWN = 0;
1283 ENABLED = 1;
1284 DISABLED = 2;
1285 }
1286 optional State state = 2;
1287 // The reason for being enabled/disabled.
1288 // Eg. Airplane mode, crash, application request.
1289 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1290 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001291 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001292}
1293
1294/**
1295 * Logs when a Bluetooth device connects and disconnects.
1296 *
1297 * Logged from:
1298 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1299 */
1300message BluetoothConnectionStateChanged {
1301 // The state of the connection.
1302 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1303 optional android.bluetooth.ConnectionStateEnum state = 1;
1304 // An identifier that can be used to match connect and disconnect events.
1305 // Currently is last two bytes of a hash of a device level ID and
1306 // the mac address of the bluetooth device that is connected.
1307 optional int32 obfuscated_id = 2;
1308 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1309 // From android.bluetooth.BluetoothAdapter.java
1310 optional int32 bt_profile = 3;
1311}
1312
1313/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001314 * Logs when something is plugged into or removed from the USB-C connector.
1315 *
1316 * Logged from:
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001317 * UsbService
Andrew Chant28d627e2018-02-22 15:17:05 -08001318 */
1319message UsbConnectorStateChanged {
1320 enum State {
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001321 STATE_DISCONNECTED = 0;
1322 STATE_CONNECTED = 1;
Andrew Chant28d627e2018-02-22 15:17:05 -08001323 }
1324 optional State state = 1;
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001325 optional string id = 2;
Badhri Jagan Sridharanfaf62072018-11-16 17:17:03 -08001326 // Last active session in ms.
1327 // 0 when the port is in connected state.
1328 optional int64 last_connect_duration_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001329}
1330
1331/**
1332 * Logs the reported speaker impedance.
1333 *
1334 * Logged from:
1335 * Vendor audio implementation.
1336 */
1337message SpeakerImpedanceReported {
1338 optional int32 speaker_location = 1;
1339 optional int32 impedance = 2;
1340}
1341
1342/**
1343 * Logs the report of a failed hardware.
1344 *
1345 * Logged from:
1346 * Vendor HALs.
1347 *
1348 */
1349message HardwareFailed {
1350 enum HardwareType {
1351 HARDWARE_FAILED_UNKNOWN = 0;
1352 HARDWARE_FAILED_MICROPHONE = 1;
1353 HARDWARE_FAILED_CODEC = 2;
1354 HARDWARE_FAILED_SPEAKER = 3;
1355 HARDWARE_FAILED_FINGERPRINT = 4;
1356 }
1357 optional HardwareType hardware_type = 1;
1358
1359 /* hardware_location allows vendors to differentiate between multiple instances of
1360 * the same hardware_type. The specific locations are vendor defined integers,
1361 * referring to board-specific numbering schemes.
1362 */
1363 optional int32 hardware_location = 2;
1364
1365 /* failure_code is specific to the HardwareType of the failed hardware.
1366 * It should use the enum values defined below.
1367 */
1368 enum MicrophoneFailureCode {
1369 MICROPHONE_FAILURE_COMPLETE = 0;
1370 }
1371 enum CodecFailureCode {
1372 CODEC_FAILURE_COMPLETE = 0;
1373 }
1374 enum SpeakerFailureCode {
1375 SPEAKER_FAILURE_COMPLETE = 0;
1376 SPEAKER_FAILURE_HIGH_Z = 1;
1377 SPEAKER_FAILURE_SHORT = 2;
1378 }
1379 enum FingerprintFailureCode {
1380 FINGERPRINT_FAILURE_COMPLETE = 0;
1381 FINGERPRINT_SENSOR_BROKEN = 1;
1382 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1383 }
1384 optional int32 failure_code = 3;
1385}
1386
1387/**
1388 * Log an event when the device has been physically dropped.
1389 * Reported from the /vendor partition.
1390 */
1391message PhysicalDropDetected {
1392 // Confidence that the event was actually a drop, 0 -> 100
1393 optional int32 confidence_pctg = 1;
1394 // Peak acceleration of the drop, in 1/1000s of a g.
1395 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001396 // Duration of freefall in ms
1397 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001398}
1399
1400/**
1401 * Log bucketed battery charge cycles.
1402 *
1403 * Each bucket represents cycles of the battery past
Maggie White38c9d322018-11-20 10:07:52 -08001404 * a given charge point. For example, if 10 cycle buckets are
1405 * initialized, bucket 1 is the lowest 1/10th of the battery,
1406 * and bucket 10 is 100%.
Andrew Chant28d627e2018-02-22 15:17:05 -08001407 *
1408 * Logged from:
1409 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1410 */
1411message ChargeCyclesReported {
1412 optional int32 cycle_bucket_1 = 1;
1413 optional int32 cycle_bucket_2 = 2;
1414 optional int32 cycle_bucket_3 = 3;
1415 optional int32 cycle_bucket_4 = 4;
1416 optional int32 cycle_bucket_5 = 5;
1417 optional int32 cycle_bucket_6 = 6;
1418 optional int32 cycle_bucket_7 = 7;
1419 optional int32 cycle_bucket_8 = 8;
Maggie White38c9d322018-11-20 10:07:52 -08001420 optional int32 cycle_bucket_9 = 9;
1421 optional int32 cycle_bucket_10 = 10;
Andrew Chant28d627e2018-02-22 15:17:05 -08001422}
1423
1424/**
Howard Roa46b6582018-09-18 16:45:02 -07001425 * Log battery health snapshot.
1426 *
1427 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1428 * are snapshotted periodically over 24hrs.
1429 */
1430message BatteryHealthSnapshot {
1431 enum BatterySnapshotType {
1432 UNKNOWN = 0;
1433 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1434 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1435 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1436 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1437 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1438 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1439 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1440 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1441 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1442 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1443 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1444 }
1445 optional BatterySnapshotType type = 1;
1446 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001447 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001448 // Voltage Battery Voltage, in microVolts.
1449 optional int32 voltage_micro_volt = 3;
1450 // Current Battery current, in microAmps.
1451 optional int32 current_micro_amps = 4;
1452 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1453 optional int32 open_circuit_micro_volt = 5;
1454 // Resistance Battery Resistance, in microOhms.
1455 optional int32 resistance_micro_ohm = 6;
1456 // Level Battery Level, as % of full.
1457 optional int32 level_percent = 7;
1458}
1459
1460/**
1461 * Log slow I/O operations on the primary storage.
1462 */
1463message SlowIo {
1464 // Classifications of IO Operations.
1465 enum IoOperation {
1466 UNKNOWN = 0;
1467 READ = 1;
1468 WRITE = 2;
1469 UNMAP = 3;
1470 SYNC = 4;
1471 }
1472 optional IoOperation operation = 1;
1473
1474 // The number of slow IO operations of this type over 24 hours.
1475 optional int32 count = 2;
1476}
1477
1478/**
1479 * Log battery caused shutdown with the last recorded voltage.
1480 */
1481message BatteryCausedShutdown {
1482 // The last recorded battery voltage prior to shutdown.
1483 optional int32 last_recorded_micro_volt = 1;
1484}
1485
1486/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001487 * Logs the duration of a davey (jank of >=700ms) when it occurs
1488 *
1489 * Logged from:
1490 * frameworks/base/libs/hwui/JankTracker.cpp
1491 */
1492message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001493 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001494 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001495
Tej Singhbb8554a2018-01-26 11:59:14 -08001496 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001497 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001498}
1499
1500/**
Bookatze5885242017-10-24 20:10:31 -07001501 * Logs phone signal strength changes.
1502 *
1503 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001504 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001505 */
1506message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001507 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1508 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001509}
1510
Yangster4ccebea2018-10-09 17:09:02 -07001511
1512/**
1513 * Logs when the phone state, sim state or signal strength changes
1514 *
1515 * Logged from:
1516 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1517 */
1518message PhoneServiceStateChanged {
1519 optional android.telephony.ServiceStateEnum state = 1;
1520 optional android.telephony.SimStateEnum sim_state = 2;
1521 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1522}
1523
1524/**
1525 * Logs when the phone becomes on or off.
1526 *
1527 * Logged from:
1528 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1529 */
1530message PhoneStateChanged {
1531 enum State {
1532 OFF = 0;
1533 ON = 1;
1534 }
1535 optional State state = 1;
1536}
1537
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001538message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001539 optional android.stats.launcher.LauncherAction action = 1;
1540 optional android.stats.launcher.LauncherState src_state = 2;
1541 optional android.stats.launcher.LauncherState dst_state = 3;
1542 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001543 optional bool is_swipe_up_enabled = 5;
1544}
1545
David Chenc28b2bb2017-10-24 12:52:52 -07001546/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001547 * Logs when Settings UI has changed.
1548 *
1549 * Logged from:
1550 * packages/apps/Settings
1551 */
1552message SettingsUIChanged {
1553 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001554 * Where this SettingsUIChange event comes from. For example, if
1555 * it's a PAGE_VISIBLE event, where the page is opened from.
1556 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001557 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001558
1559 /**
1560 * What the UI action is.
1561 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001562 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001563
1564 /**
1565 * Where the action is happening
1566 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001567 optional android.app.settings.PageId page_id = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001568
1569 /**
1570 * What preference changed in this event.
1571 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001572 optional string changed_preference_key = 4;
Fan Zhang916c13b2018-10-16 22:49:45 -07001573
1574 /**
1575 * The new value of the changed preference.
1576 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001577 optional int64 changed_preference_int_value = 5;
Fan Zhang916c13b2018-10-16 22:49:45 -07001578}
1579
1580/**
David Chenc28b2bb2017-10-24 12:52:52 -07001581 * Logs that a setting was updated.
1582 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001583 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001584 * The tag and is_default allow resetting of settings to default values based on the specified
1585 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1586 */
1587message SettingChanged {
1588 // The name of the setting.
1589 optional string setting = 1;
1590
1591 // The change being imposed on this setting. May represent a number, eg "3".
1592 optional string value = 2;
1593
1594 // The new value of this setting. For most settings, this is same as value. For some settings,
1595 // value is +X or -X where X represents an element in a set. For example, if the previous value
1596 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1597 // The +/- feature is currently only used for location_providers_allowed.
1598 optional string new_value = 3;
1599
1600 // The previous value of this setting.
1601 optional string prev_value = 4;
1602
1603 // The tag used with the is_default for resetting sets of settings. This is generally null.
1604 optional string tag = 5;
1605
Bookatz90867622018-01-31 15:05:57 -08001606 // True if this setting with tag should be resettable.
1607 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001608
David Chenbd789912018-03-16 17:19:55 -07001609 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001610 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001611
1612 enum ChangeReason {
1613 UPDATED = 1; // Updated can be an insertion or an update.
1614 DELETED = 2;
1615 }
1616 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001617}
Chenjie Yub3dda412017-10-24 13:41:59 -07001618
Chenjie Yu05013b32017-11-21 10:21:41 -08001619/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001620 * Logs activity going to foreground or background
1621 *
1622 * Logged from:
1623 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1624 */
1625message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001626 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001627 optional string pkg_name = 2;
1628 optional string class_name = 3;
1629
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001630 enum State {
1631 BACKGROUND = 0;
1632 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001633 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001634 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001635}
David Chenc8a43242017-10-17 16:23:28 -07001636
1637/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001638 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001639 * Logged from:
1640 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1641 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001642message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001643 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001644
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001645 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001646
1647 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001648 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001649 optional string process_name = 3;
1650
1651 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001652 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001653
1654 optional string package_name = 5;
1655
1656 enum InstantApp {
1657 UNAVAILABLE = 0;
1658 FALSE = 1;
1659 TRUE = 2;
1660 }
1661 optional InstantApp is_instant_app = 6;
1662
1663 enum ForegroundState {
1664 UNKNOWN = 0;
1665 BACKGROUND = 1;
1666 FOREGROUND = 2;
1667 }
1668 optional ForegroundState foreground_state = 7;
Yang Lu732d6382018-11-05 07:53:12 -08001669
1670 optional android.server.ErrorSource error_source = 8;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001671}
David Chen9e3808c2017-11-20 17:25:34 -08001672
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001673/**
1674 * Logs when a WTF (What a Terrible Failure) happened.
1675 * Logged from:
1676 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1677 */
1678message WTFOccurred {
1679 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001680
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001681 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001682
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001683 // The name of the process.
1684 // system_server if it is not by an app
1685 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001686
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001687 // The pid if available. -1 means not available.
1688 optional sint32 pid = 4;
Yang Lu732d6382018-11-05 07:53:12 -08001689
1690 optional android.server.ErrorSource error_source = 5;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001691}
1692
1693/**
1694 * Logs when system server reports low memory.
1695 * Logged from:
1696 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1697 */
1698message LowMemReported {
1699}
1700
1701/**
1702 * Logs when an app ANR (App Not Responding) occurs.
1703 * Logged from:
1704 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1705 */
1706message ANROccurred {
1707 optional int32 uid = 1 [(is_uid) = true];
1708
1709 optional string process_name = 2;
1710
1711 optional string short_component_name = 3;
1712
1713 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001714
1715 enum InstantApp {
1716 UNAVAILABLE = 0;
1717 FALSE = 1;
1718 TRUE = 2;
1719 }
1720 optional InstantApp is_instant_app = 5;
1721
1722 enum ForegroundState {
1723 UNKNOWN = 0;
1724 BACKGROUND = 1;
1725 FOREGROUND = 2;
1726 }
1727 optional ForegroundState foreground_state = 6;
Yang Lu732d6382018-11-05 07:53:12 -08001728
1729 optional android.server.ErrorSource error_source = 7;
1730
1731 optional string package_name = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001732}
1733
Bookatza7020bd2018-08-28 16:29:35 -07001734/**
1735 * Logs when the vibrator state changes.
1736 * Logged from:
1737 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1738 */
1739message VibratorStateChanged {
1740 repeated AttributionNode attribution_node = 1;
1741
1742 enum State {
1743 OFF = 0;
1744 ON = 1;
1745 }
1746 optional State state = 2;
1747
1748 // Duration (in milliseconds) requested to keep the vibrator on.
1749 // Only applicable for State == ON.
1750 optional int64 duration_millis = 3;
1751}
1752
David Chen0a368b22017-12-06 16:28:16 -08001753/*
1754 * Allows other apps to push events into statsd.
1755 * Logged from:
1756 * frameworks/base/core/java/android/util/StatsLog.java
1757 */
David Chen0b5c90c2018-01-25 16:51:49 -08001758message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001759 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001760 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001761
1762 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1763 optional int32 label = 2;
1764
1765 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1766 // predicates for the metrics).
1767 enum State {
1768 UNKNOWN = 0;
1769 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1770 STOP = 2;
1771 START = 3;
1772 }
1773 optional State state = 3;
1774}
1775
David Chen9e3808c2017-11-20 17:25:34 -08001776/**
Bookatz7948c872018-09-04 12:58:33 -07001777 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1778 * For example, this could be due to the user manually changing the time.
1779 *
1780 * Logged from:
1781 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1782 */
1783message WallClockTimeShifted {
1784 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1785 optional int64 wall_clock_timestamp_millis = 1;
1786}
1787
1788/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001789 * Logs when statsd detects an anomaly.
1790 *
1791 * Logged from:
1792 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1793 */
1794message AnomalyDetected {
1795 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001796 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001797
Yangster-mac94e197c2018-01-02 16:03:03 -08001798 // Id of the config whose anomaly detection alert fired.
1799 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001800
Yangster-mac94e197c2018-01-02 16:03:03 -08001801 // Id of the alert (i.e. name of the anomaly that was detected).
1802 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001803}
1804
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001805message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001806 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001807 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001808
1809 // The app package name.
1810 optional string pkg_name = 2;
1811
1812 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001813 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001814 WARM = 1;
1815 HOT = 2;
1816 COLD = 3;
1817 }
1818 // The transition type.
1819 optional TransitionType type = 3;
1820
1821 // The activity name.
1822 optional string activity_name = 4;
1823
1824 // The name of the calling app. Empty if not set.
1825 optional string calling_pkg_name = 5;
1826
1827 // Whether the app is an instant app.
1828 optional bool is_instant_app = 6;
1829
1830 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001831 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001832
Bookatz80d11a02018-01-16 10:46:35 -08001833 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001834
David Chen0b5c90c2018-01-25 16:51:49 -08001835 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001836 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001837 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001838 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001839 optional int32 bind_application_delay_millis = 11;
1840 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001841
1842 // Empty if not set.
1843 optional string launch_token = 13;
1844
Calin Juravle759fbda2018-02-20 19:52:30 +00001845 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001846 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001847
1848 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001849 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001850}
1851
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001852message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001853 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001854 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001855
1856 // The app package name.
1857 optional string pkg_name = 2;
1858
1859 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001860 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001861 WARM = 1;
1862 HOT = 2;
1863 COLD = 3;
1864 }
1865 // The transition type.
1866 optional TransitionType type = 3;
1867
1868 // The activity name.
1869 optional string activity_name = 4;
1870}
1871
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001872message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001873 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001874 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001875
1876 // The app package name.
1877 optional string pkg_name = 2;
1878
1879 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001880 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001881 WITH_BUNDLE = 1;
1882 WITHOUT_BUNDLE = 2;
1883 }
1884 // The transition type.
1885 optional TransitionType type = 3;
1886
1887 // The activity name.
1888 optional string activity_name = 4;
1889
1890 optional bool transition_process_running = 5;
1891
1892 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001893 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001894}
1895
Bookatz8fcd09a2017-12-18 13:01:10 -08001896/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001897 * Logs a picture-in-picture action
1898 * Logged from:
1899 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1900 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1901 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1902 */
1903message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001904 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001905 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001906
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001907 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001908
Chenjie Yu52cacc62017-12-08 18:11:45 -08001909 enum State {
1910 ENTERED = 1;
1911 EXPANDED_TO_FULL_SCREEN = 2;
1912 MINIMIZED = 3;
1913 DISMISSED = 4;
1914 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001915 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001916}
1917
1918/**
Chenjie Yue8904192017-12-08 19:12:57 -08001919 * Logs overlay action
1920 * Logged from:
1921 * services/core/java/com/android/server/wm/Session.java
1922 */
1923message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001924 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001925
1926 optional string package_name = 2;
1927
1928 optional bool using_alert_window = 3;
1929
1930 enum State {
1931 ENTERED = 1;
1932 EXITED = 2;
1933 }
1934 optional State state = 4;
1935}
1936
Chenjie Yuccfe6452018-01-30 11:33:21 -08001937/*
1938 * Logs foreground service starts and stops.
1939 * Note that this is not when a service starts or stops, but when it is
1940 * considered foreground.
1941 * Logged from
1942 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1943 */
1944message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001945 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001946 // package_name + "/" + class_name
1947 optional string short_name = 2;
1948
1949 enum State {
1950 ENTER = 1;
1951 EXIT = 2;
1952 }
1953 optional State state = 3;
1954}
1955
Chenjie Yue8904192017-12-08 19:12:57 -08001956/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001957 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1958 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1959 * attributed back to the parent (host) uid. One example is Chrome.
1960 *
1961 * Logged from:
1962 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1963 */
1964message IsolatedUidChanged {
1965 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001966 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001967 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001968 optional int32 parent_uid = 1;
1969
1970 optional int32 isolated_uid = 2;
1971
1972 // We expect an isolated uid to be removed before if it's used for another parent uid.
1973 enum Event {
1974 REMOVED = 0;
1975 CREATED = 1;
1976 }
1977 optional Event event = 3;
1978}
1979
1980/*
1981 * Logs the reception of an incoming network packet causing the main system to wake up for
1982 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1983 * and processed by WakeupController.cpp.
1984 */
1985message PacketWakeupOccurred {
1986 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1987 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001988 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001989 // The interface name on which the packet was received.
1990 optional string iface = 2;
1991 // The ethertype value of the packet.
1992 optional int32 ethertype = 3;
1993 // String representation of the destination MAC address of the packet.
1994 optional string destination_hardware_address = 4;
1995 // String representation of the source address of the packet if this was an IP packet.
1996 optional string source_ip = 5;
1997 // String representation of the destination address of the packet if this was an IP packet.
1998 optional string destination_ip = 6;
1999 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
2000 // field if this was an IPv6 packet. The range of possible values is the same for both IP
2001 // families.
2002 optional int32 ip_next_header = 7;
2003 // The source port if this was a TCP or UDP packet.
2004 optional int32 source_port = 8;
2005 // The destination port if this was a TCP or UDP packet.
2006 optional int32 destination_port = 9;
2007}
2008
2009/*
2010 * Logs the memory stats for an app on startup.
2011 * Logged from:
2012 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2013 */
2014message AppStartMemoryStateCaptured {
2015 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002016 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002017
2018 // The process name.
2019 optional string process_name = 2;
2020
2021 // The activity name.
2022 optional string activity_name = 3;
2023
2024 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002025 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002026
2027 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002028 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002029
2030 // RSS
2031 optional int64 rss_in_bytes = 6;
2032
2033 // CACHE
2034 optional int64 cache_in_bytes = 7;
2035
2036 // SWAP
2037 optional int64 swap_in_bytes = 8;
2038}
2039
2040/*
2041 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
2042 * for LMK event.
2043 * Logged from:
2044 * system/core/lmkd/lmkd.c
2045 */
2046message LmkStateChanged {
2047 enum State {
2048 UNKNOWN = 0;
2049 START = 1;
2050 STOP = 2;
2051 }
2052 optional State state = 1;
2053}
2054
2055/*
2056 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
2057 * Logged from:
2058 * system/core/lmkd/lmkd.c
2059 */
2060message LmkKillOccurred {
2061 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002062 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002063
2064 // The process name.
2065 optional string process_name = 2;
2066
2067 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002068 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002069
2070 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002071 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002072
2073 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002074 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002075
2076 // RSS
2077 optional int64 rss_in_bytes = 6;
2078
2079 // CACHE
2080 optional int64 cache_in_bytes = 7;
2081
2082 // SWAP
2083 optional int64 swap_in_bytes = 8;
Jim Blackler8593d1f2018-11-21 15:24:48 +00002084
2085 // The elapsed real time of start of the process.
2086 optional int64 process_start_time_nanos = 9;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002087}
2088
Rajeev Kumar51b54602018-03-01 12:18:26 -08002089/*
2090 * Logs when the ActivityManagerService detects that an app died.
2091 *
2092 * Logged from:
2093 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2094 */
2095message AppDied {
2096 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002097 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002098}
2099
Howard Ro21a039c2018-08-06 14:55:47 -07002100/**
2101 * An atom for generic metrics logging. Available from Android Q.
2102 */
2103message GenericAtom {
2104 // The uid of the application that sent this custom atom.
2105 optional int32 uid = 1 [(is_uid) = true];
2106
2107 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002108 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002109}
2110
Tej Singhd6d6d772018-09-05 17:41:25 -07002111/**
2112 * Logs when a fingerprint acquire event occurs.
2113 *
2114 * Logged from:
2115 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2116 */
2117message FingerprintAcquired {
2118 // The associated user. Eg: 0 for owners, 10+ for others.
2119 // Defined in android/os/UserHandle.java
2120 optional int32 user = 1;
2121 // If this acquire is for a crypto fingerprint.
2122 // e.g. Secure purchases, unlock password storage.
2123 optional bool is_crypto = 2;
2124}
2125
2126/**
2127 * Logs when a fingerprint authentication event occurs.
2128 *
2129 * Logged from:
2130 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2131 */
2132message FingerprintAuthenticated {
2133 // The associated user. Eg: 0 for owners, 10+ for others.
2134 // Defined in android/os/UserHandle.java
2135 optional int32 user = 1;
2136 // If this authentication is for a crypto fingerprint.
2137 // e.g. Secure purchases, unlock password storage.
2138 optional bool is_crypto = 2;
2139 // Whether or not this authentication was successful.
2140 optional bool is_authenticated = 3;
2141}
2142
2143/**
2144 * Logs when a fingerprint error occurs.
2145 *
2146 * Logged from:
2147 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2148 */
2149message FingerprintErrorOccurred {
2150 // The associated user. Eg: 0 for owners, 10+ for others.
2151 // Defined in android/os/UserHandle.java
2152 optional int32 user = 1;
2153 // If this error is for a crypto fingerprint.
2154 // e.g. Secure purchases, unlock password storage.
2155 optional bool is_crypto = 2;
2156
2157 enum Error {
2158 UNKNOWN = 0;
2159 LOCKOUT = 1;
2160 PERMANENT_LOCKOUT = 2;
2161 }
2162 // The type of error.
2163 optional Error error = 3;
2164}
Howard Ro688ae182018-09-25 00:09:36 -07002165
2166message Notification {
2167
2168 // Type of notification event.
2169 enum Type {
2170 TYPE_UNKNOWN = 0;
2171 // Notification became visible to the user.
2172 TYPE_OPEN = 1;
2173 // Notification became hidden.
2174 TYPE_CLOSE = 2;
2175 // Notification switched to detail mode.
2176 TYPE_DETAIL = 3;
2177 // Notification was clicked.
2178 TYPE_ACTION = 4;
2179 // Notification was dismissed.
2180 TYPE_DISMISS = 5;
2181 // Notification switched to summary mode. The enum value of 14 is to
2182 // match that of metrics_constants.
2183 TYPE_COLLAPSE = 14;
2184 }
2185 optional Type type = 1;
2186
2187 // Package name associated with the notification.
2188 optional string package_name = 2;
2189
2190 // Tag associated with notification.
2191 optional string tag = 3;
2192
2193 // Application-supplied ID associated with the notification.
2194 optional int32 id = 4;
2195
2196 // Index of notification in the notification panel.
2197 optional int32 shade_index = 5;
2198
2199 // The number of notifications in the notification panel.
2200 optional int32 shade_count = 6;
2201
2202 // Importance for the notification.
2203 optional int32 importance = 7;
2204
2205 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002206 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002207
2208 // Importance for the notification channel.
2209 optional int32 channel_importance = 9;
2210
Howard Ro183c2bd2018-10-18 13:52:10 -07002211 // Application-supplied ID associated with the notifications group.
2212 optional string group_id = 10;
2213
Howard Ro688ae182018-09-25 00:09:36 -07002214 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002215 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002216
Howard Ro183c2bd2018-10-18 13:52:10 -07002217 // Reason for dismissal of a notification. This field is only meaningful for
2218 // TYPE_DISMISS events.
2219 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002220
Howard Ro183c2bd2018-10-18 13:52:10 -07002221 // The first post time of notification, stable across updates.
2222 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002223
Howard Ro183c2bd2018-10-18 13:52:10 -07002224 // The most recent interruption time, or the creation time if no updates.
2225 // Differs from update_millis because updates are filtered based on whether
2226 // they actually interrupted the user.
2227 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002228
Howard Ro183c2bd2018-10-18 13:52:10 -07002229 // The most recent update time, or the creation time if no updates.
2230 optional int64 update_millis = 15;
2231
2232 // The most recent visibility event.
2233 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002234}
2235
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002236/*
Yangster-macb89807e2018-11-15 21:10:57 -08002237 * Logs when a flag flip state changes.
2238 * Logged in P/h.
2239 */
2240message PhenotypeFlagStateChanged {
2241 // Mendel configuration name.
2242 optional string mendel_config_name = 1;
2243 // State
2244 enum State {
2245 STATE_UNKNOWN = 0;
2246 COMMITTED = 1;
2247 }
2248 optional State state = 2;
2249}
2250
2251/*
2252 * Logs when a binary push state changes.
2253 * Logged in Play store
2254 */
2255message BinaryPushStateChanged {
2256 // Binary package name.
2257 optional string binary_name = 1;
2258 // Version code.
2259 optional int64 version = 2;
2260 // State
2261 enum State {
2262 STATE_UNKNOWN = 0;
2263 DOWNLOAD_START = 1;
2264 DOWNLOAD_DONE = 2;
2265 INSTALL_START = 3;
2266 INSTALL_DONE = 4;
2267 REBOOT_START = 5;
2268 REBOOT_DONE = 6;
2269 }
2270 optional State state = 3;
2271}
2272
2273/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002274 * Logs when a connection becomes available and lost.
2275 * Logged in StatsCompanionService.java
2276 */
2277message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002278 // Id of the network.
2279 optional int32 net_id = 1;
2280
2281 enum State {
2282 UNKNOWN = 0;
2283 CONNECTED = 1;
2284 DISCONNECTED = 2;
2285 }
2286 // Connected state of a network.
2287 optional State state = 2;
2288}
2289
2290/**
2291 * Logs when a service starts and stops.
2292 * Logged from:
2293 * services/core/java/com/android/server/am/ActiveServices.java
2294 */
2295message ServiceStateChanged {
2296
2297 optional int32 uid = 1 [(is_uid) = true];
2298
2299 optional string package_name = 2;
2300
2301 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002302
2303 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002304 START = 1;
2305 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002306 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002307
2308 optional State state = 4;
2309}
2310
2311/**
2312 * Logs when a service is launched.
2313 * Logged from:
2314 * services/core/java/com/android/server/am/ActiveServices.java
2315 */
2316message ServiceLaunchReported {
2317
2318 optional int32 uid = 1 [(is_uid) = true];
2319
2320 optional string package_name = 2;
2321
2322 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002323}
Howard Ro688ae182018-09-25 00:09:36 -07002324
Chenjie Yubbcbc602018-02-05 16:51:52 -08002325//////////////////////////////////////////////////////////////////////
2326// Pulled atoms below this line //
2327//////////////////////////////////////////////////////////////////////
2328
2329/**
David Chenc8a43242017-10-17 16:23:28 -07002330 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2331 *
2332 * Pulled from:
2333 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2334 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002335message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002336 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002337
2338 optional int64 rx_bytes = 2;
2339
2340 optional int64 rx_packets = 3;
2341
2342 optional int64 tx_bytes = 4;
2343
2344 optional int64 tx_packets = 5;
2345}
2346
2347/**
2348 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2349 *
2350 * Pulled from:
2351 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2352 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002353message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002354 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002355
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002356 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2357 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002358
2359 optional int64 rx_bytes = 3;
2360
2361 optional int64 rx_packets = 4;
2362
2363 optional int64 tx_bytes = 5;
2364
2365 optional int64 tx_packets = 6;
2366}
2367
2368/**
2369 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2370 *
2371 * Pulled from:
2372 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2373 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002374message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002375 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002376
2377 optional int64 rx_bytes = 2;
2378
2379 optional int64 rx_packets = 3;
2380
2381 optional int64 tx_bytes = 4;
2382
2383 optional int64 tx_packets = 5;
2384}
2385
2386/**
2387 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2388 *
2389 * Pulled from:
2390 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2391 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002392message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002393 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002394
Yao Chenc40a19d2018-03-15 16:48:25 -07002395 // 1 denotes foreground and 0 denotes background. This is called Set in
2396 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002397 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002398
2399 optional int64 rx_bytes = 3;
2400
2401 optional int64 rx_packets = 4;
2402
2403 optional int64 tx_bytes = 5;
2404
2405 optional int64 tx_packets = 6;
2406}
2407
2408/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002409 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2410 *
2411 * Pulled from:
2412 * StatsCompanionService
2413 */
2414message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002415 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002416
2417 optional int64 rx_bytes = 2;
2418
2419 optional int64 tx_bytes = 3;
2420}
2421
2422/**
David Chenc8a43242017-10-17 16:23:28 -07002423 * Pulls the kernel wakelock durations. This atom is adapted from
2424 * android/internal/os/KernelWakelockStats.java
2425 *
2426 * Pulled from:
2427 * StatsCompanionService using KernelWakelockReader.
2428 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002429message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002430 optional string name = 1;
2431
2432 optional int32 count = 2;
2433
2434 optional int32 version = 3;
2435
Yangster-maca8a30442018-10-13 23:46:34 -07002436 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002437}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002438
Chenjie Yu05013b32017-11-21 10:21:41 -08002439/**
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002440 * Pulls low power state information. If power.stats HAL is not available, this
2441 * includes platform and subsystem sleep state information,
2442 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
2443 * as defined in:
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002444 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002445 * hardware/interfaces/power/1.1/types.hal
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002446 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
2447 * as defined in:
2448 * hardware/interfaces/power/stats/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002449 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002450message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002451 // Subsystem name
2452 optional string subsystem_name = 1;
2453 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2454 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002455 // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
2456 // powerEntityStateName from the corresponding PowerEntityStateInfo.
Chenjie Yubbcbc602018-02-05 16:51:52 -08002457 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002458 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002459 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002460 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002461 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002462}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002463
Chenjie Yu05013b32017-11-21 10:21:41 -08002464/**
Bookatz92da2832018-11-01 18:10:03 -07002465 * Pulls on-device power measurement information.
2466 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2467 * Pulled from:
2468 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2469 */
2470message OnDevicePowerMeasurement {
2471 // Name of the subsystem (to which the rail belongs).
2472 optional string subsystem_name = 1;
2473
2474 // Rail name. The rail lies within the subsystem.
2475 optional string rail_name = 2;
2476
2477 // Time (in ms since boot) at which the rail energy value was measured.
2478 // This may differ slightly from the time that statsd logs this information.
2479 optional uint64 measurement_timestamp_millis = 3;
2480
2481 // Accumulated energy used via the rail since device boot in uWs.
2482 optional uint64 energy_microwatt_secs = 4;
2483}
2484
2485/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002486 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002487 * Pulls the time the cpu spend on the frequency index. Frequency index
2488 * starts from highest to lowest. The value should be monotonically
2489 * increasing since boot. However, if there is a cpu
2490 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002491 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002492message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002493 optional uint32 cluster = 1;
2494 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002495 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002496}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002497
Chenjie Yu05013b32017-11-21 10:21:41 -08002498/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002499 * Pulls Cpu Time Per Uid.
2500 * Note that isolated process uid time should be attributed to host uids.
2501 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002502message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002503 optional int32 uid = 1 [(is_uid) = true];
Misha Wagner6bc6c912018-11-16 13:19:54 +00002504 optional uint64 user_time_micros = 2;
2505 optional uint64 sys_time_micros = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002506}
2507
2508/**
2509 * Pulls Cpu Time Per Uid per frequency.
2510 * Note that isolated process uid time should be attributed to host uids.
2511 * For each uid, we order the time by descending frequencies.
2512 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002513message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002514 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002515 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002516 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002517}
Hugo Benichi884970e2017-11-14 22:42:46 +09002518
Chenjie Yu05013b32017-11-21 10:21:41 -08002519/**
2520 * Pulls Wifi Controller Activity Energy Info
2521 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002522message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002523 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002524 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002525 // stack reported state
2526 // TODO: replace this with proto enum
2527 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002528 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002529 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002530 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002531 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002532 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002533 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002534 // product of current(mA), voltage(V) and time(ms)
2535 optional uint64 controller_energy_used = 6;
2536}
2537
2538/**
2539 * Pulls Modem Activity Energy Info
2540 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002541message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002542 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002543 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002544 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002545 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002546 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002547 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002548 /**
2549 * Tx power index
2550 * index 0 = tx_power < 0dBm
2551 * index 1 = 0dBm < tx_power < 5dBm
2552 * index 2 = 5dBm < tx_power < 15dBm
2553 * index 3 = 15dBm < tx_power < 20dBm
2554 * index 4 = tx_power > 20dBm
2555 */
2556 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002557 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002558 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002559 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002560 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002561 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002562 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002563 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002564 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002565 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002566 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002567 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002568 // product of current(mA), voltage(V) and time(ms)
2569 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002570}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002571
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002572/**
2573 * Pulls Bluetooth Activity Energy Info
2574 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2575 */
2576message BluetoothActivityInfo {
2577 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002578 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002579 // bluetooth stack state
2580 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002581 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002582 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002583 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002584 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002585 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002586 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002587 // product of current(mA), voltage(V) and time(ms)
2588 optional uint64 energy_used = 6;
2589}
2590
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002591/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002592 * Logs the memory stats for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002593 *
2594 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002595 */
2596message ProcessMemoryState {
2597 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002598 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002599
2600 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002601 // Usually package name, "system" for system server.
2602 // Provided by ActivityManagerService.
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002603 optional string process_name = 2;
2604
Rafal Slawikda51b932018-12-13 16:31:33 +00002605 // Current OOM score adjustment. Value read from ProcessRecord.
Yangster-maca8a30442018-10-13 23:46:34 -07002606 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002607
2608 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002609 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002610
2611 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002612 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002613
Rajeev Kumar90235992018-01-29 11:06:48 -08002614 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002615 // Value is read from /proc/PID/stat, field 24. Or from memory.stat, field
2616 // total_rss if per-app memory cgroups are enabled.
Rajeev Kumar90235992018-01-29 11:06:48 -08002617 optional int64 rss_in_bytes = 6;
2618
2619 // CACHE
Rafal Slawikda51b932018-12-13 16:31:33 +00002620 // Value is read from memory.stat, field total_cache if per-app memory
2621 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002622 optional int64 cache_in_bytes = 7;
2623
2624 // SWAP
Rafal Slawikda51b932018-12-13 16:31:33 +00002625 // Value is read from memory.stat, field total_swap if per-app memory
2626 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002627 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002628
Rafal Slawikd03ae422018-11-20 11:27:45 +00002629 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002630 optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
Rafal Slawik272a8162018-11-01 15:12:28 +00002631
2632 // Elapsed real time when the process started.
2633 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2634 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002635}
2636
2637/*
Rafal Slawik08621582018-10-15 14:53:07 +01002638 * Logs the memory stats for a native process (from procfs).
Rafal Slawikda51b932018-12-13 16:31:33 +00002639 *
2640 * Pulled from StatsCompanionService for selected native processes.
Rafal Slawik08621582018-10-15 14:53:07 +01002641 */
2642message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002643 // The uid if available. -1 means not available.
2644 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002645
Rafal Slawikbf67d072018-10-23 11:07:54 +01002646 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002647 // Value read from /proc/PID/cmdline.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002648 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002649
Rafal Slawikbf67d072018-10-23 11:07:54 +01002650 // # of page-faults
2651 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002652
Rafal Slawikbf67d072018-10-23 11:07:54 +01002653 // # of major page-faults
2654 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002655
Rafal Slawikbf67d072018-10-23 11:07:54 +01002656 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002657 // Value read from /proc/PID/stat, field 24.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002658 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002659
Rafal Slawikd03ae422018-11-20 11:27:45 +00002660 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002661 optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
Rafal Slawikbf67d072018-10-23 11:07:54 +01002662
2663 // Elapsed real time when the process started.
2664 // Value is read from /proc/PID/stat, field 22.
2665 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002666}
2667
2668/*
Rafal Slawik3bea8952018-11-15 12:39:33 +00002669 * Logs the memory high-water mark for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002670 *
2671 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
2672 * and for selected native processes.
Rafal Slawik44b88142018-12-15 16:48:09 +00002673 *
2674 * Pulling this atom resets high-water mark counters for all processes.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002675 */
2676message ProcessMemoryHighWaterMark {
2677 // The uid if available. -1 means not available.
2678 optional int32 uid = 1 [(is_uid) = true];
2679
Rafal Slawikda51b932018-12-13 16:31:33 +00002680 // The process name.
2681 // Usually package name or process cmdline.
2682 // Provided by ActivityManagerService or read from /proc/PID/cmdline.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002683 optional string process_name = 2;
2684
2685 // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
2686 // /proc/PID/status.
2687 optional int64 rss_high_water_mark_in_bytes = 3;
2688}
2689
2690/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002691 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002692 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002693message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002694 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002695}
2696
2697/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002698 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002699 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002700message SystemUptime {
2701 // Milliseconds since the system was booted.
2702 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2703 // for external input).
2704 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002705 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002706}
2707
2708/*
2709 * Reads from /proc/uid_concurrent_active_time which has the format:
2710 * active: X (X is # cores)
2711 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2712 * [uid1]: [time-0] [time-1] [time-2] ... ...
2713 * ...
2714 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2715 * The file contains a monotonically increasing count of time for a single boot.
2716 */
2717message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002718 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002719 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002720}
2721
2722/**
2723 * Reads from /proc/uid_concurrent_policy_time which has the format:
2724 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2725 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2726 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2727 * ...
2728 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2729 * The file contains a monotonically increasing count of time for a single boot.
2730 */
2731message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002732 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002733 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002734 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002735}
2736
2737/*
2738 * Pulls free disk space, for data, system partition and temporary directory.
2739 */
2740message DiskSpace {
2741 // available bytes in data partition
2742 optional uint64 data_available_bytes = 1;
2743 // available bytes in system partition
2744 optional uint64 system_available_bytes = 2;
2745 // available bytes in download cache or temp directories
2746 optional uint64 temp_available_bytes = 3;
2747}
Tej Singhbf972d92018-01-10 20:51:13 -08002748
2749/**
2750 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002751 * Pulled from:
2752 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002753 */
2754message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002755 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002756}
2757
2758/**
2759 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002760 * Pulled from:
2761 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002762 */
2763message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002764 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002765}
2766
2767/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002768 * Pulls battery voltage.
2769 * Pulled from:
2770 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2771 */
2772message BatteryVoltage {
2773 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002774 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002775}
2776
2777/**
Tej Singhb1dbc8b2018-11-19 15:49:47 -08002778 * Pulls battery level (percent full, from 0 to 100).
2779 *
2780 * Pulled from:
2781 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2782 */
2783message BatteryLevel {
2784 // Battery level. Should be in [0, 100].
2785 optional int32 battery_level = 1;
2786}
2787
2788/**
Tej Singhd89137e2018-03-26 14:51:40 -07002789 * Pulls the temperature of various parts of the device.
2790 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002791 *
2792 * Pulled from:
2793 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2794 */
2795message Temperature {
Tej Singhb6070b92018-12-19 19:00:12 -08002796 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
Tej Singh40298312018-02-16 00:15:09 -08002797 optional android.os.TemperatureTypeEnum sensor_location = 1;
2798
2799 // The name of the temperature source. Eg. CPU0
2800 optional string sensor_name = 2;
2801
Tej Singhd89137e2018-03-26 14:51:40 -07002802 // Temperature in tenths of a degree C.
Tej Singhb6070b92018-12-19 19:00:12 -08002803 // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
Yangster-maca8a30442018-10-13 23:46:34 -07002804 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002805}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002806
2807/**
2808 * Pulls the statistics of calls to Binder.
2809 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002810 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2811 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002812 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002813 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002814 */
2815message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002816 // UID of the process responsible for the binder transaction. It will be set if the process
2817 // executing the binder transaction attribute the transaction to another uid using
2818 // Binder.setThreadWorkSource().
2819 //
2820 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002821 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002822 // UID of the process executing the binder transaction.
2823 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002824 // Fully qualified class name of the API call.
2825 //
2826 // This is a system server class name.
2827 //
2828 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2829 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2830 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2831 // commonly used APIs.
2832 optional string service_class_name = 2;
2833 // Method name of the API call. It can also be a transaction code if we cannot
2834 // resolve it to a name. See Binder#getTransactionName.
2835 //
2836 // This is a system server method name.
2837 optional string service_method_name = 3;
2838 // Total number of API calls.
2839 optional int64 call_count = 4;
2840 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2841 optional bool screen_interactive = 13;
2842 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2843 // call_count will be equal to recorded_call_count.
2844 //
2845 // If recorded_call_count is different than call_count, it means data collection has been
2846 // sampled. All the fields below will be sampled in this case.
2847 optional int64 recorded_call_count = 12;
2848 // Number of exceptions thrown by the API.
2849 optional int64 recorded_exception_count = 5;
2850 // Total latency of all API calls.
2851 // Average can be computed using total_latency_micros / recorded_call_count.
2852 optional int64 recorded_total_latency_micros = 6;
2853 // Maximum latency of one API call.
2854 optional int64 recorded_max_latency_micros = 7;
2855 // Total CPU usage of all API calls.
2856 // Average can be computed using total_cpu_micros / recorded_call_count.
2857 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2858 optional int64 recorded_total_cpu_micros = 8;
2859 // Maximum CPU usage of one API call.
2860 optional int64 recorded_max_cpu_micros = 9;
2861 // Maximum parcel reply size of one API call.
2862 optional int64 recorded_max_reply_size_bytes = 10;
2863 // Maximum parcel request size of one API call.
2864 optional int64 recorded_max_request_size_bytes = 11;
2865}
2866
2867/**
2868 * Pulls the statistics of exceptions during calls to Binder.
2869 *
2870 * Binder stats are cumulative from boot unless somebody reset the data using
2871 * > adb shell dumpsys binder_calls_stats --reset
2872 */
2873message BinderCallsExceptions {
2874 // Exception class name, e.g. java.lang.IllegalArgumentException.
2875 //
2876 // This is an exception class name thrown by the system server.
2877 optional string exception_class_name = 1;
2878 // Total number of exceptions.
2879 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002880}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002881
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002882/**
2883 * Pulls the statistics of message dispatching on HandlerThreads.
2884 *
2885 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2886 * config on the device.
2887 *
2888 * Next tag: 11
2889 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002890message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002891 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002892 optional int32 uid = 1 [(is_uid) = true];
2893
2894 // Fully qualified class name of the handler target class.
2895 //
2896 // This field does not contain PII. This is a system server class name.
2897 optional string handler_class_name = 2;
2898
2899 // The name of the thread that runs the Looper.
2900 //
2901 // This field does not contain PII. This is a system server thread name.
2902 optional string looper_thread_name = 3;
2903
2904 // The name of the dispatched message.
2905 //
2906 // This field does not contain PII. This is a system server constant or class
2907 // name.
2908 optional string message_name = 4;
2909
2910 // Total number of successfully dispatched messages.
2911 optional int64 message_count = 5;
2912
2913 // Total number of messages that failed dispatching.
2914 optional int64 exception_count = 6;
2915
2916 // Total number of processed messages we have data recorded for. If we
2917 // collected data for all the messages, message_count will be equal to
2918 // recorded_message_count.
2919 //
2920 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002921 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002922 optional int64 recorded_message_count = 7;
2923
2924 // Total latency of all processed messages.
2925 // Average can be computed using recorded_total_latency_micros /
2926 // recorded_message_count.
2927 optional int64 recorded_total_latency_micros = 8;
2928
2929 // Total CPU usage of all processed message.
2930 // Average can be computed using recorded_total_cpu_micros /
2931 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002932 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002933 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002934
2935 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2936 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002937
2938 // Max recorded CPU usage of all processed messages.
2939 optional int64 recorded_max_cpu_micros = 11;
2940
2941 // Max recorded latency of all processed messages.
2942 optional int64 recorded_max_latency_micros = 12;
2943
2944 // Total number of messages we tracked the dispatching delay for. If we
2945 // collected data for all the messages, message_count will be equal to
2946 // recorded_delay_message_count.
2947 //
2948 // If recorded_delay_message_count is different than message_count, it means data
2949 // collection has been sampled or/and not all messages specified the target dispatch time.
2950 // The fields below will be sampled in this case.
2951 optional int64 recorded_delay_message_count = 13;
2952
2953 // Total dispatching delay of all processed messages.
2954 // Calculated as a difference between the target dispatching time (Message.when)
2955 // and the actual dispatching time.
2956 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2957 optional int64 recorded_total_delay_millis = 14;
2958
2959 // Max dispatching delay of all processed messages.
2960 // Calculated as a difference between the target dispatching time (Message.when)
2961 // and the actual dispatching time.
2962 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002963}
Tej Singh86dc9db2018-09-06 00:39:57 +00002964
2965/**
2966 * Pulls disk information, such as write speed and latency.
2967 */
2968message DiskStats {
2969 // Time taken to open, write 512B to, and close a file.
2970 // -1 if error performing the check.
2971 optional int64 data_write_latency_millis = 1;
2972
2973 optional bool file_based_encryption = 2;
2974
2975 // Recent disk write speed in kB/s.
2976 // -1 if error querying storageed.
2977 // 0 if data is unavailable.
2978 optional int32 recent_disk_write_speed = 3;
2979}
2980
2981
2982/**
2983 * Free and total bytes of the Data, Cache, and System partition.
2984 */
2985message DirectoryUsage {
2986 enum Directory {
2987 UNKNOWN = 0;
2988 DATA = 1;
2989 CACHE = 2;
2990 SYSTEM = 3;
2991 }
2992 optional Directory directory = 1;
2993 optional int64 free_bytes = 2;
2994 optional int64 total_bytes = 3;
2995}
2996
2997
2998/**
2999 * Size of an application: apk size, data size, and cache size.
3000 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
3001 * Information is only reported for apps with the primary user (user 0).
3002 * Sizes are aggregated by package name.
3003 */
3004message AppSize {
3005 // Including uids will involve modifying diskstats logic.
3006 optional string package_name = 1;
3007 // App size in bytes. -1 if unavailable.
3008 optional int64 app_size_bytes = 2;
3009 // App data size in bytes. -1 if unavailable.
3010 optional int64 app_data_size_bytes = 3;
3011 // App cache size in bytes. -1 if unavailable.
3012 optional int64 app_cache_size_bytes = 4;
3013 // Time that the cache file was produced.
3014 // Uses System.currentTimeMillis(), which is wall clock time.
3015 optional int64 cache_time_millis = 5;
3016}
3017
3018
3019/**
3020 * Size of a particular category. Eg: photos, videos.
3021 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
3022 */
3023message CategorySize {
3024 enum Category {
3025 UNKNOWN = 0;
3026 APP_SIZE = 1;
3027 APP_DATA_SIZE = 2;
3028 APP_CACHE_SIZE = 3;
3029 PHOTOS = 4;
3030 VIDEOS = 5;
3031 AUDIO = 6;
3032 DOWNLOADS = 7;
3033 SYSTEM = 8;
3034 OTHER = 9;
3035 }
3036 optional Category category = 1;
3037 // Category size in bytes.
3038 optional int64 size_bytes = 2;
3039 // Time that the cache file was produced.
3040 // Uses System.currentTimeMillis(), which is wall clock time.
3041 optional int64 cache_time_millis = 3;
3042}
Tej Singhd6d6d772018-09-05 17:41:25 -07003043
3044/**
Tej Singhe7726dc2018-09-21 11:42:12 -07003045 * Pulls per uid I/O stats. The stats are cumulative since boot.
3046 *
3047 * Read/write bytes are I/O events from a storage device
3048 * Read/write chars are data requested by read/write syscalls, and can be
3049 * satisfied by caching.
3050 *
3051 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
3052 */
3053message DiskIo {
3054 optional int32 uid = 1 [(is_uid) = true];
3055 optional int64 fg_chars_read = 2;
3056 optional int64 fg_chars_write = 3;
3057 optional int64 fg_bytes_read = 4;
3058 optional int64 fg_bytes_write = 5;
3059 optional int64 bg_chars_read = 6;
3060 optional int64 bg_chars_write = 7;
3061 optional int64 bg_bytes_read = 8;
3062 optional int64 bg_bytes_write = 9;
3063 optional int64 fg_fsync = 10;
3064 optional int64 bg_fsync= 11;
3065}
3066
3067
3068/**
Tej Singhd6d6d772018-09-05 17:41:25 -07003069 * Pulls the number of fingerprints for each user.
3070 *
3071 * Pulled from StatsCompanionService, which queries FingerprintManager.
3072 */
3073message NumFingerprints {
3074 // The associated user. Eg: 0 for owners, 10+ for others.
3075 // Defined in android/os/UserHandle.java
3076 optional int32 user = 1;
3077 // Number of fingerprints registered to that user.
3078 optional int32 num_fingerprints = 2;
3079}
Chenjie Yu12e5e672018-09-14 15:54:59 -07003080
Yangsteraf9aee72018-10-12 09:26:16 -07003081message AggStats {
3082 optional int64 min = 1;
3083
3084 optional int64 average = 2;
3085
3086 optional int64 max = 3;
3087}
3088
3089message ProcessStatsStateProto {
3090 optional android.service.procstats.ScreenState screen_state = 1;
3091
3092 optional android.service.procstats.MemoryState memory_state = 2;
3093
3094 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
3095 // and not frameworks/base/core/java/android/app/ActivityManager.java
3096 optional android.service.procstats.ProcessState process_state = 3;
3097
3098 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003099 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003100
3101 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003102 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07003103
3104 // # of samples taken
3105 optional int32 sample_size = 5;
3106
3107 // PSS is memory reserved for this process
3108 optional AggStats pss = 6;
3109
3110 // USS is memory shared between processes, divided evenly for accounting
3111 optional AggStats uss = 7;
3112
3113 // RSS is memory resident for this process
3114 optional AggStats rss = 8;
3115}
3116
3117// Next Tag: 7
3118message ProcessStatsProto {
3119 // Name of process.
3120 optional string process = 1;
3121
3122 // Uid of the process.
3123 optional int32 uid = 2;
3124
3125 // Information about how often kills occurred
3126 message Kill {
3127 // Count of excessive CPU kills
3128 optional int32 cpu = 1;
3129
3130 // Count of kills when cached
3131 optional int32 cached = 2;
3132
3133 // PSS stats during cached kill
3134 optional AggStats cached_pss = 3;
3135 }
3136 optional Kill kill = 3;
3137
3138 // Time and memory spent in various states.
3139 repeated ProcessStatsStateProto states = 5;
3140
3141 // Total time process has been running... screen_state, memory_state, and process_state
3142 // will not be set.
3143 optional ProcessStatsStateProto total_running_state = 6;
3144}
3145
3146message PackageServiceOperationStatsProto {
3147 // Operate enum: Started, Foreground, Bound, Executing
3148 optional android.service.procstats.ServiceOperationState operation = 1;
3149
3150 // Number of times the service was in this operation.
3151 optional int32 count = 2;
3152
3153 // Information about a state the service can be in.
3154 message StateStats {
3155 // Screen state enum.
3156 optional android.service.procstats.ScreenState screen_state = 1;
3157 // Memory state enum.
3158 optional android.service.procstats.MemoryState memory_state = 2;
3159
3160 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003161 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003162 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003163 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003164 }
3165 repeated StateStats state_stats = 3;
3166}
3167
3168message PackageServiceStatsProto {
3169 // Name of service component.
3170 optional string service_name = 1;
3171
3172 // The operation stats.
3173 // The package_name, package_uid, package_version, service_name will not be set to save space.
3174 repeated PackageServiceOperationStatsProto operation_stats = 2;
3175}
3176
3177message PackageAssociationSourceProcessStatsProto {
3178 // Uid of the process.
3179 optional int32 process_uid = 1;
3180 // Process name.
3181 optional string process_name = 2;
3182
3183 // Total count of the times this association appeared.
3184 optional int32 total_count = 3;
3185
3186 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003187 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003188
3189 // Total count of the times this association became actively impacting its target process.
3190 optional int32 active_count = 5;
3191
3192 // Information on one source in this association.
3193 message StateStats {
3194 // Process state enum.
3195 optional android.service.procstats.ProcessState process_state = 1;
3196 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003197 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003198 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003199 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003200 }
3201 repeated StateStats active_state_stats = 6;
3202}
3203
3204message PackageAssociationProcessStatsProto {
3205 // Name of the target component.
3206 optional string component_name = 1;
3207 // Information on one source in this association.
3208 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3209}
3210
3211
3212message ProcessStatsPackageProto {
3213 // Name of package.
3214 optional string package = 1;
3215
3216 // Uid of the package.
3217 optional int32 uid = 2;
3218
3219 // Version of the package.
3220 optional int64 version = 3;
3221
3222 // Stats for each process running with the package loaded in to it.
3223 repeated ProcessStatsProto process_stats = 4;
3224
3225 // Stats for each of the package's services.
3226 repeated PackageServiceStatsProto service_stats = 5;
3227
3228 // Stats for each association with the package.
3229 repeated PackageAssociationProcessStatsProto association_stats = 6;
3230}
3231
3232message ProcessStatsSectionProto {
3233 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003234 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003235
3236 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003237 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003238
3239 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003240 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003241
3242 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003243 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003244
3245 // System runtime library. e.g. "libdvm.so", "libart.so".
3246 optional string runtime = 5;
3247
3248 // whether kernel reports swapped pss.
3249 optional bool has_swapped_pss = 6;
3250
3251 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3252 enum Status {
3253 STATUS_UNKNOWN = 0;
3254 STATUS_COMPLETE = 1;
3255 STATUS_PARTIAL = 2;
3256 STATUS_SHUTDOWN = 3;
3257 STATUS_SYSPROPS = 4;
3258 }
3259 repeated Status status = 7;
3260
3261 // Stats for each process.
3262 repeated ProcessStatsProto process_stats = 8;
3263
3264 // Stats for each package.
3265 repeated ProcessStatsPackageProto package_stats = 9;
3266}
3267
Chenjie Yu12e5e672018-09-14 15:54:59 -07003268/**
3269 * Pulled from ProcessStatsService.java
3270 */
3271message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003272 optional ProcessStatsSectionProto proc_stats_section = 1;
3273}
3274
3275message PowerProfileProto {
3276 optional double cpu_suspend = 1;
3277
3278 optional double cpu_idle = 2;
3279
3280 optional double cpu_active = 3;
3281
3282 message CpuCluster {
3283 optional int32 id = 1;
3284 optional double cluster_power = 2;
3285 optional int32 cores = 3;
3286 repeated int64 speed = 4;
3287 repeated double core_power = 5;
3288 }
3289
3290 repeated CpuCluster cpu_cluster = 40;
3291
3292 optional double wifi_scan = 4;
3293
3294 optional double wifi_on = 5;
3295
3296 optional double wifi_active = 6;
3297
3298 optional double wifi_controller_idle = 7;
3299
3300 optional double wifi_controller_rx = 8;
3301
3302 optional double wifi_controller_tx = 9;
3303
3304 repeated double wifi_controller_tx_levels = 10;
3305
3306 optional double wifi_controller_operating_voltage = 11;
3307
3308 optional double bluetooth_controller_idle = 12;
3309
3310 optional double bluetooth_controller_rx = 13;
3311
3312 optional double bluetooth_controller_tx = 14;
3313
3314 optional double bluetooth_controller_operating_voltage = 15;
3315
3316 optional double modem_controller_sleep = 16;
3317
3318 optional double modem_controller_idle = 17;
3319
3320 optional double modem_controller_rx = 18;
3321
3322 repeated double modem_controller_tx = 19;
3323
3324 optional double modem_controller_operating_voltage = 20;
3325
3326 optional double gps_on = 21;
3327
3328 repeated double gps_signal_quality_based = 22;
3329
3330 optional double gps_operating_voltage = 23;
3331
3332 optional double bluetooth_on = 24;
3333
3334 optional double bluetooth_active = 25;
3335
3336 optional double bluetooth_at_cmd = 26;
3337
3338 optional double ambient_display = 27;
3339
3340 optional double screen_on = 28;
3341
3342 optional double radio_on = 29;
3343
3344 optional double radio_scanning = 30;
3345
3346 optional double radio_active = 31;
3347
3348 optional double screen_full = 32;
3349
3350 optional double audio = 33;
3351
3352 optional double video = 34;
3353
3354 optional double flashlight = 35;
3355
3356 optional double memory = 36;
3357
3358 optional double camera = 37;
3359
3360 optional double wifi_batched_scan = 38;
3361
3362 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003363}
Chenjie Yuab530202018-09-26 12:39:20 -07003364
3365/**
3366 * power_profile.xml and other constants for power model calculations.
3367 * Pulled from PowerProfile.java
3368 */
3369message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003370 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003371}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003372
3373/**
arangelovd5db50e2018-10-12 20:24:39 +01003374 * Logs when a user restriction was added or removed.
3375 *
3376 * Logged from:
3377 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3378 */
3379message UserRestrictionChanged {
3380 // The raw string of the user restriction as defined in UserManager.
3381 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3382 optional string restriction = 1;
3383 // Whether the restriction is enabled or disabled.
3384 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003385}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003386
3387/**
3388 * Pulls process user time and system time. Puller takes a snapshot of all pids
3389 * in the system and returns cpu stats for those that are working at the time.
3390 * Dead pids will be dropped. Kernel processes are excluded.
3391 * Min cool-down is 5 sec.
3392 */
3393message ProcessCpuTime {
3394 optional int32 uid = 1 [(is_uid) = true];
3395
3396 optional string process_name = 2;
3397 // Process cpu time in user space, cumulative from boot/process start
3398 optional int64 user_time_millis = 3;
3399 // Process cpu time in system space, cumulative from boot/process start
3400 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003401}
Misha Wagner5a51e002018-10-03 15:04:09 +01003402
3403/**
3404 * Pulls the CPU usage for each thread.
3405 *
3406 * Read from /proc/$PID/task/$TID/time_in_state files.
3407 *
3408 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3409 * time_in_state files not being present on some phones, have not been addressed. These should be
3410 * considered before a public release.
3411 */
3412message CpuTimePerThreadFreq {
3413 // UID that owns the process.
3414 optional int32 uid = 1 [(is_uid) = true];
3415 // ID of the process.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003416 optional int32 process_id = 2;
Misha Wagner5a51e002018-10-03 15:04:09 +01003417 // ID of the thread.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003418 optional int32 thread_id = 3;
Misha Wagner5a51e002018-10-03 15:04:09 +01003419 // Name of the process taken from `/proc/$PID/cmdline`.
3420 optional string process_name = 4;
3421 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3422 optional string thread_name = 5;
Misha Wagnerfde69582018-11-28 13:26:32 +00003423
3424 // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
3425 // are given in KHz, and time is given in milliseconds since the thread started. All eight
3426 // frequencies are given here as the alternative is sending eight separate atoms. This method
3427 // significantly reduces the amount of data created
3428 optional int32 frequency1_khz = 6;
3429 optional int32 time1_millis = 7;
3430 optional int32 frequency2_khz = 8;
3431 optional int32 time2_millis = 9;
3432 optional int32 frequency3_khz = 10;
3433 optional int32 time3_millis = 11;
3434 optional int32 frequency4_khz = 12;
3435 optional int32 time4_millis = 13;
3436 optional int32 frequency5_khz = 14;
3437 optional int32 time5_millis = 15;
3438 optional int32 frequency6_khz = 16;
3439 optional int32 time6_millis = 17;
3440 optional int32 frequency7_khz = 18;
3441 optional int32 time7_millis = 19;
3442 optional int32 frequency8_khz = 20;
3443 optional int32 time8_millis = 21;
Misha Wagner5a51e002018-10-03 15:04:09 +01003444}
Bookatz75ee6042018-11-09 12:27:37 -08003445
3446/**
Bookatz366a4432018-11-20 09:42:33 -08003447 * Pulls information about the device's build.
3448 */
3449message BuildInformation {
3450 // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
3451 // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
3452 optional string fingerprint = 1;
3453
3454 // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
3455 optional string brand = 2;
3456
3457 // Build.PRODUCT. The name of the overall product.
3458 optional string product = 3;
3459
3460 // Build.DEVICE. The name of the industrial design.
3461 optional string device = 4;
3462
3463 // Build.VERSION.RELEASE. The user-visible version string. E.g., "1.0" or "3.4b5" or "bananas".
3464 optional string version_release = 5;
3465
3466 // Build.ID. E.g. a label like "M4-rc20".
3467 optional string id = 6;
3468
3469 // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
3470 // represent this build.
3471 optional string version_incremental = 7;
3472
3473 // Build.TYPE. The type of build, like "user" or "eng".
3474 optional string type = 8;
3475
3476 // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
3477 optional string tags = 9;
3478}
3479
3480/**
Bookatz75ee6042018-11-09 12:27:37 -08003481 * Pulls on-device BatteryStats power use calculations for the overall device.
3482 */
3483message DeviceCalculatedPowerUse {
Bookatz3dbc13a2018-12-21 12:16:51 -08003484 // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3485 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3486 // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3487 optional int64 computed_power_nano_amp_secs = 1;
Bookatz75ee6042018-11-09 12:27:37 -08003488}
3489
3490/**
3491 * Pulls on-device BatteryStats power use calculations broken down by uid.
3492 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3493 * that is attributed to non-uid items. They must all be included to get the total power use.
3494 */
3495message DeviceCalculatedPowerBlameUid {
3496 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3497 optional int32 uid = 1 [(is_uid) = true];
3498
Bookatz3dbc13a2018-12-21 12:16:51 -08003499 // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3500 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3501 optional int64 power_nano_amp_secs = 2;
Bookatz75ee6042018-11-09 12:27:37 -08003502}
3503
3504/**
3505 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3506 * drain type.
3507 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3508 * is attributed uids. They must all be included to get the total power use.
3509 */
3510message DeviceCalculatedPowerBlameOther {
3511 // The type of item whose power use is being reported.
3512 enum DrainType {
3513 AMBIENT_DISPLAY = 0;
3514 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3515 BLUETOOTH = 2;
3516 CAMERA = 3;
3517 // Cell-standby
3518 CELL = 4;
3519 FLASHLIGHT = 5;
3520 IDLE = 6;
3521 MEMORY = 7;
3522 // Amount that total computed drain exceeded the drain estimated using the
3523 // battery level changes and capacity.
3524 OVERCOUNTED = 8;
3525 PHONE = 9;
3526 SCREEN = 10;
3527 // Amount that total computed drain was below the drain estimated using the
3528 // battery level changes and capacity.
3529 UNACCOUNTED = 11;
3530 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3531 WIFI = 13;
3532 }
3533 optional DrainType drain_type = 1;
3534
Bookatz3dbc13a2018-12-21 12:16:51 -08003535 // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3536 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3537 optional int64 power_nano_amp_secs = 2;
Rafal Slawik3bea8952018-11-15 12:39:33 +00003538}
arangelov4e994062018-11-13 16:12:38 +00003539
3540/**
3541 * Logs device policy features.
3542 *
3543 * Logged from:
3544 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3545 * packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
3546 */
3547message DevicePolicyEvent {
3548 // The event id - unique for each event.
3549 optional android.stats.devicepolicy.EventId event_id = 1;
3550 // The admin package name.
3551 optional string admin_package_name = 2;
3552 // A generic integer parameter.
3553 optional int32 integer_value = 3;
3554 // A generic boolean parameter.
3555 optional bool boolean_value = 4;
3556 // A parameter specifying a time period in milliseconds.
3557 optional uint64 time_period_millis = 5;
3558 // A parameter specifying a list of package names, bundle extras or string parameters.
3559 optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
3560}
shawnlinea5b66b2018-11-13 15:05:29 +08003561
3562/**
3563 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
3564 *
3565 * Logged from:
3566 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3567 */
3568message DocsUILaunchReported {
3569 optional android.stats.docsui.LaunchAction launch_action = 1;
3570 optional bool has_initial_uri = 2;
3571 optional android.stats.docsui.MimeType mime_type = 3;
3572 optional android.stats.docsui.Root initial_root = 4;
3573}
3574
3575/**
3576 * Logs root/app visited event in file managers/picker. Call this when the user
3577 * taps on root/app in hamburger menu.
3578 *
3579 * Logged from:
3580 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3581 */
3582message DocsUIRootVisitedReported {
3583 optional android.stats.docsui.ContextScope scope = 1;
3584 optional android.stats.docsui.Root root = 2;
3585}
3586
3587/**
3588 * Logs file operation stats. Call this when a file operation has completed.
3589 *
3590 * Logged from:
3591 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3592 */
3593message DocsUIFileOperationReported {
3594 optional android.stats.docsui.Provider provider = 1;
3595 optional android.stats.docsui.FileOperation file_op = 2;
3596}
3597
3598/**
3599 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
3600 * mode.
3601 *
3602 * Logged from:
3603 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3604 */
3605message DocsUIFileOperationCopyMoveModeReported {
3606 optional android.stats.docsui.FileOperation file_op = 1;
3607 optional android.stats.docsui.CopyMoveOpMode mode = 2;
3608}
3609
3610
3611/**
3612 * Logs file sub operation stats. Call this when a file operation has failed.
3613 *
3614 * Logged from:
3615 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3616 */
3617message DocsUIFileOperationFailureReported {
3618 optional android.stats.docsui.Authority authority = 1;
3619 optional android.stats.docsui.SubFileOperation sub_op = 2;
3620}
3621
3622/**
3623* Logs the cancellation of a file operation. Call this when a job is canceled
3624*
3625* Logged from:
3626* package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3627*/
3628message DocsUIFileOperationCanceledReported {
3629 optional android.stats.docsui.FileOperation file_op = 1;
3630}
3631
3632/**
3633 * Logs startup time in milliseconds.
3634 *
3635 * Logged from:
3636 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3637 */
3638message DocsUIStartupMsReported {
3639 optional int32 startup_millis = 1;
3640}
3641
3642/**
3643 * Logs the action that was started by user.
3644 *
3645 * Logged from:
3646 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3647 */
3648message DocsUIUserActionReported {
3649 optional android.stats.docsui.UserAction action = 1;
3650}
3651
3652/**
3653 * Logs the invalid type when invalid scoped access is requested.
3654 *
3655 * Logged from:
3656 * package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
3657 */
3658message DocsUIInvalidScopedAccessRequestReported {
3659 optional android.stats.docsui.InvalidScopedAccess type = 1;
Rafal Slawikda51b932018-12-13 16:31:33 +00003660}
Ben Murdochbab399f2018-12-06 11:01:38 +00003661
3662/**
shawnlina75e82d2019-01-07 10:31:12 +08003663 * Logs the package name that launches docsui picker mode.
3664 *
3665 * Logged from:
3666 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3667 */
3668message DocsUIPickerLaunchedFromReported {
3669 optional string package_name = 1;
3670}
3671
3672/**
3673 * Logs the search type.
3674 *
3675 * Logged from:
3676 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3677 */
3678message DocsUISearchTypeReported {
3679 optional android.stats.docsui.SearchType search_type = 1;
3680}
3681
3682/**
3683 * Logs the search mode.
3684 *
3685 * Logged from:
3686 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3687 */
3688message DocsUISearchModeReported {
3689 optional android.stats.docsui.SearchMode search_mode = 1;
3690}
3691
3692/**
3693 * Logs the pick result information.
3694 *
3695 * Logged from:
3696 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3697 */
3698message DocsUIPickResultReported {
3699 optional int32 total_action_count = 1;
3700 optional int64 duration_millis = 2;
3701 optional int32 file_count= 3;
3702 optional bool is_searching = 4;
3703 optional android.stats.docsui.Root picked_from = 5;
3704 optional android.stats.docsui.MimeType mime_type = 6;
3705 optional int32 repeatedly_pick_times = 7;
3706}
3707
3708/**
Ben Murdochbab399f2018-12-06 11:01:38 +00003709 * Logs when an app's memory is compacted.
3710 *
3711 * Logged from:
3712 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3713 */
3714message AppCompacted {
3715 // The pid of the process being compacted.
3716 optional int32 pid = 1;
3717
3718 // The name of the process being compacted.
3719 optional string process_name = 2;
3720
3721 // The type of compaction.
3722 enum Action {
3723 UNKNOWN = 0;
3724 SOME = 1;
3725 FULL = 2;
3726 }
Ben Murdoch01720b82018-12-19 18:03:44 +00003727 optional Action action = 3;
Ben Murdochbab399f2018-12-06 11:01:38 +00003728
3729 // Total RSS in kilobytes consumed by the process prior to compaction.
3730 optional int64 before_rss_total_kilobytes = 4;
3731
3732 // File RSS in kilobytes consumed by the process prior to compaction.
3733 optional int64 before_rss_file_kilobytes = 5;
3734
3735 // Anonymous RSS in kilobytes consumed by the process prior to compaction.
3736 optional int64 before_rss_anon_kilobytes = 6;
3737
3738 // Swap in kilobytes consumed by the process prior to compaction.
3739 optional int64 before_swap_kilobytes = 7;
3740
3741 // Total RSS in kilobytes consumed by the process after compaction.
3742 optional int64 after_rss_total_kilobytes = 8;
3743
3744 // File RSS in kilobytes consumed by the process after compaction.
3745 optional int64 after_rss_file_kilobytes = 9;
3746
3747 // Anonymous RSS in kilobytes consumed by the process after compaction.
3748 optional int64 after_rss_anon_kilobytes = 10;
3749
3750 // Swap in kilobytes consumed by the process after compaction.
3751 optional int64 after_swap_kilobytes = 11;
3752
3753 // The time taken to perform compaction in milliseconds.
3754 optional int64 time_to_compact_millis = 12;
3755
3756 // The last compaction action performed for this app.
3757 optional Action last_action = 13;
3758
Ben Murdoch01720b82018-12-19 18:03:44 +00003759 // The last time that compaction was attempted on this process in milliseconds
3760 // since boot, not including sleep (see SystemClock.uptimeMillis()).
3761 optional int64 last_compact_timestamp_ms_since_boot = 14;
Ben Murdochbab399f2018-12-06 11:01:38 +00003762
Ben Murdoch01720b82018-12-19 18:03:44 +00003763 // The oom_score_adj at the time of compaction.
3764 optional int32 oom_score_adj = 15;
Ben Murdochbab399f2018-12-06 11:01:38 +00003765
3766 // The process state at the time of compaction.
3767 optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
3768}
lifr157fc552018-12-12 16:38:04 +08003769
3770/**
3771 * Logs the latency period(in microseconds) and the return code of
3772 * the DNS(Domain Name System) lookups.
3773 * These 4 methods(GETADDRINFO,GETHOSTBYNAME,GETHOSTBYADDR,RES_NSEND)
3774 * to get info(address or hostname) from DNS server(or DNS cache).
3775 * Logged from:
3776 * /system/netd/server/DnsProxyListener.cpp
3777 */
3778message NetworkDnsEventReported {
3779 // The types of the DNS lookups, as defined in
3780 //system/netd/server/binder/android/net/metrics/INetdEventListener.aidl
3781 enum EventType {
3782 EVENT_UNKNOWN = 0;
3783 EVENT_GETADDRINFO = 1;
3784 EVENT_GETHOSTBYNAME = 2;
3785 EVENT_GETHOSTBYADDR = 3;
3786 EVENT_RES_NSEND = 4;
3787 }
3788 optional EventType event_type = 1;
3789
3790 // The return value of the DNS resolver for each DNS lookups.
3791 //bionic/libc/include/netdb.h
3792 //system/netd/resolv/include/netd_resolv/resolv.h
3793 enum ReturnCode {
lifr030d23a2019-01-11 16:54:51 +08003794 EAI_NO_ERR = 0;
lifr157fc552018-12-12 16:38:04 +08003795 EAI_ADDRFAMILY = 1;
3796 EAI_AGAIN = 2;
3797 EAI_BADFLAGS = 3;
3798 EAI_FAIL = 4;
3799 EAI_FAMILY = 5;
3800 EAI_MEMORY = 6;
3801 EAI_NODATA = 7;
3802 EAI_NONAME = 8;
3803 EAI_SERVICE = 9;
3804 EAI_SOCKTYPE = 10;
3805 EAI_SYSTEM = 11;
3806 EAI_BADHINTS = 12;
3807 EAI_PROTOCOL = 13;
3808 EAI_OVERFLOW = 14;
3809 RESOLV_TIMEOUT = 255;
3810 EAI_MAX = 256;
3811 }
3812 optional ReturnCode return_code = 2;
3813
3814 // The latency period(in microseconds) it took for this DNS lookup to complete.
3815 optional int32 latency_micros = 3;
3816}