blob: 51db2d200461e7cb73888a56074cda7edf2280ca [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;
lifr157fc552018-12-12 16:38:04 +0800175 NetworkDnsEventReported network_dns_event_Reported = 116;
Yao Chend54f9dd2017-10-17 17:37:48 +0000176 }
David Chenc8a43242017-10-17 16:23:28 -0700177
David Chen6e3e6cb2018-01-03 16:14:06 -0800178 // Pulled events will start at field 10000.
Rafal Slawik3bea8952018-11-15 12:39:33 +0000179 // Next: 10043
David Chenc8a43242017-10-17 16:23:28 -0700180 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800181 WifiBytesTransfer wifi_bytes_transfer = 10000;
182 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
183 MobileBytesTransfer mobile_bytes_transfer = 10002;
184 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800185 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800186 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800187 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800188 CpuTimePerFreq cpu_time_per_freq = 10008;
189 CpuTimePerUid cpu_time_per_uid = 10009;
190 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800191 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800192 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800193 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800194 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800195 SystemElapsedRealtime system_elapsed_realtime = 10014;
196 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800197 CpuActiveTime cpu_active_time = 10016;
198 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000199 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800200 RemainingBatteryCapacity remaining_battery_capacity = 10019;
201 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800202 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100203 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100204 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100205 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000206 DiskStats disk_stats = 10025;
207 DirectoryUsage directory_usage = 10026;
208 AppSize app_size = 10027;
209 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700210 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700211 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700212 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700213 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700214 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700215 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700216 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100217 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100218 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700219 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800220 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
221 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
222 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
Rafal Slawik3bea8952018-11-15 12:39:33 +0000223 ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
Tej Singhb1dbc8b2018-11-19 15:49:47 -0800224 BatteryLevel battery_level = 10043;
Bookatz366a4432018-11-20 09:42:33 -0800225 BuildInformation build_information = 10044;
David Chenc8a43242017-10-17 16:23:28 -0700226 }
yroa1fe77c2018-02-26 14:22:54 -0800227
Bookatz76aafcf2018-09-17 16:17:10 -0700228 // DO NOT USE field numbers above 100,000 in AOSP.
229 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
230 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700231}
232
Yao Chend54f9dd2017-10-17 17:37:48 +0000233/**
Yangster-mac20877162017-12-22 17:19:39 -0800234 * This proto represents a node of an attribution chain.
235 * Note: All attribution chains are represented as a repeated field of type
236 * AttributionNode. It is understood that in such arrays, the order is that
237 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000238 */
Yangster-mac20877162017-12-22 17:19:39 -0800239message AttributionNode {
240 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800241 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800242
Yangster-mac20877162017-12-22 17:19:39 -0800243 // The (optional) string tag for an element in the attribution chain. If the
244 // element has no tag, it is encoded as an empty string.
245 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700246}
247
Yangster-mac48b3d622018-08-18 12:38:11 -0700248message KeyValuePair {
249 optional int32 key = 1;
250 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700251 int32 value_int = 2;
252 int64 value_long = 3;
253 string value_str = 4;
254 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700255 }
256}
257
258message KeyValuePairsAtom {
259 optional int32 uid = 1;
260 repeated KeyValuePair pairs = 2;
261}
262
Yao Chend54f9dd2017-10-17 17:37:48 +0000263/*
264 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800265 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000266 *
267 * RULES:
268 * - The field ids for each atom must start at 1, and count upwards by 1.
269 * Skipping field ids is not allowed.
270 * - These form an API, so renaming, renumbering or removing fields is
271 * not allowed between android releases. (This is not currently enforced,
272 * but there will be a tool to enforce this restriction).
273 * - The types must be built-in protocol buffer types, namely, no sub-messages
274 * are allowed (yet). The bytes type is also not allowed.
275 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800276 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000277 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800278 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000279 * - A field that is a uid should be a string field, tagged with the [xxx]
280 * annotation. The generated code on android will be represented by UIDs,
281 * and those UIDs will be translated in xxx to those strings.
282 *
283 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700284 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000285 * - If there is a UID, it goes first. Think in an object-oriented fashion.
286 * *****************************************************************************
287 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700288
Yao Chend54f9dd2017-10-17 17:37:48 +0000289/**
Yangster-mace16189a2018-08-26 12:20:16 -0700290 * Logs when the Thermal service HAL notifies the throttling start/stop events.
291 *
292 * Logged from:
293 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
294 */
295message ThermalThrottlingStateChanged {
296 optional android.os.TemperatureTypeEnum sensor_type = 1;
297
298 enum State {
299 UNKNOWN = 0;
300 START = 1;
301 STOP = 2;
302 }
303
304 optional State state = 2;
305
306 optional float temperature = 3;
307}
308
309/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000310 * Logs when the screen state changes.
311 *
312 * Logged from:
313 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
314 */
315message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800316 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700317 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700318}
Yao Chend54f9dd2017-10-17 17:37:48 +0000319
320/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700321 * Logs that the process state of the uid, as determined by ActivityManager
322 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000323 *
324 * Logged from:
325 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
326 */
Bookatzc1a050a2017-10-10 15:49:28 -0700327message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700328 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000329
Bookatzdb026a22018-01-10 19:01:56 -0800330 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700331 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000332}
333
334/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700335 * Logs process state change of a process, as per the activity manager.
336 *
337 * Logged from:
338 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
339 */
340message ProcessStateChanged {
341 optional int32 uid = 1;
342 optional string process_name = 2;
343 optional string package_name = 3;
344 // TODO: remove this when validation is done
345 optional int64 version = 5;
346 // The state, from frameworks/base/core/proto/android/app/enums.proto.
347 optional android.app.ProcessStateEnum state = 4;
348}
349
350/**
351 * Logs when ActivityManagerService sleep state is changed.
352 *
353 * Logged from:
354 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
355 */
356message ActivityManagerSleepStateChanged {
357 // TODO: import frameworks proto
358 enum State {
359 UNKNOWN = 0;
360 ASLEEP = 1;
361 AWAKE = 2;
362 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700363 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700364}
365
366/**
367 * Logs when system memory state changes.
368 *
369 * Logged from:
370 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
371 */
372message MemoryFactorStateChanged {
373 // TODO: import frameworks proto
374 enum State {
375 MEMORY_UNKNOWN = 0;
376 NORMAL = 1; // normal.
377 MODERATE = 2; // moderate memory pressure.
378 LOW = 3; // low memory.
379 CRITICAL = 4; // critical memory.
380
381 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700382 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700383}
384
385/**
386 * Logs when app is using too much cpu, according to ActivityManagerService.
387 *
388 * Logged from:
389 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
390 */
391message ExcessiveCpuUsageReported {
392 optional int32 uid = 1;
393 optional string process_name = 2;
394 optional string package_name = 3;
395 // package version. TODO: remove this when validation is done
396 optional int64 version = 4;
397}
398
399/**
400 * Logs when a cached process is killed, along with its pss.
401 *
402 * Logged from:
403 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
404 */
405message CachedKillReported {
406 optional int32 uid = 1;
407 optional string process_name = 2;
408 optional string package_name = 3;
409 // TODO: remove this when validation is done
410 optional int64 version = 5;
411 optional int64 pss = 4;
412}
413
414/**
415 * Logs when memory stats of a process is reported.
416 *
417 * Logged from:
418 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
419 */
420message ProcessMemoryStatReported {
421 optional int32 uid = 1;
422 optional string process_name = 2;
423 optional string package_name = 3;
424 //TODO: remove this when validation is done
425 optional int64 version = 9;
426 optional int64 pss = 4;
427 optional int64 uss = 5;
428 optional int64 rss = 6;
429 enum Type {
430 ADD_PSS_INTERNAL_SINGLE = 0;
431 ADD_PSS_INTERNAL_ALL_MEM = 1;
432 ADD_PSS_INTERNAL_ALL_POLL = 2;
433 ADD_PSS_EXTERNAL = 3;
434 ADD_PSS_EXTERNAL_SLOW = 4;
435 }
436 optional Type type = 7;
437 optional int64 duration = 8;
438}
439
440/**
Bookatzc1a050a2017-10-10 15:49:28 -0700441 * Logs that a process started, finished, crashed, or ANRed.
442 *
443 * Logged from:
444 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
445 */
446message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700447 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700448
David Chen0b5c90c2018-01-25 16:51:49 -0800449 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800450 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700451
Bookatzddccf0a2017-11-28 16:48:14 -0800452 // What lifecycle state the process changed to.
453 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800454 enum State {
455 FINISHED = 0;
456 STARTED = 1;
457 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800458 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800459 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700460}
461
Bookatzc1a050a2017-10-10 15:49:28 -0700462/**
463 * Logs when the ble scan state changes.
464 *
465 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700466 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700467 */
468message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800469 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700470
471 enum State {
472 OFF = 0;
473 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700474 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
475 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700476 }
477 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700478
Bookatze5ec0b42018-03-26 13:34:56 -0700479 // Does the scan have a filter.
480 optional bool is_filtered = 3;
481 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
482 optional bool is_first_match = 4;
483 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
484 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700485}
486
487/**
488 * Logs reporting of a ble scan finding results.
489 *
490 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700491 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700492 */
Bookatzae6738e2018-09-13 11:38:56 -0700493// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700494message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800495 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700496
497 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800498 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700499}
500
501/**
502 * Logs when a sensor state changes.
503 *
504 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700505 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700506 */
507message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800508 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700509
Bookatzc1a050a2017-10-10 15:49:28 -0700510 // The id (int) of the sensor.
511 optional int32 sensor_id = 2;
512
513 enum State {
514 OFF = 0;
515 ON = 1;
516 }
517 optional State state = 3;
518}
519
Bookatzc1a050a2017-10-10 15:49:28 -0700520/**
521 * Logs when GPS state changes.
522 *
523 * Logged from:
524 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
525 */
526message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800527 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700528
529 enum State {
530 OFF = 0;
531 ON = 1;
532 }
533 optional State state = 2;
534}
535
Bookatz48d362e2018-11-06 15:49:08 -0800536/**
537 * Logs when GPS signal quality.
538 *
539 * Logged from:
540 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
541 */
542message GpsSignalQualityChanged {
543 optional android.server.location.GpsSignalQualityEnum level = 1;
544}
545
Bookatzc1a050a2017-10-10 15:49:28 -0700546
547/**
548 * Logs when a sync manager sync state changes.
549 *
550 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700551 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700552 */
553message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800554 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700555
David Chen0b5c90c2018-01-25 16:51:49 -0800556 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800557 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700558
559 enum State {
560 OFF = 0;
561 ON = 1;
562 }
563 optional State state = 3;
564}
565
Yangster-mac96353002018-09-05 11:18:55 -0700566/*
567 * Deferred job stats.
568 *
569 * Logged from:
570 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
571*/
572message DeferredJobStatsReported {
573 repeated AttributionNode attribution_node = 1;
574
575 // Number of jobs deferred.
576 optional int32 num_jobs_deferred = 2;
577
578 // Time since the last job runs.
579 optional int64 time_since_last_job_millis = 3;
580}
581
Bookatzc1a050a2017-10-10 15:49:28 -0700582/**
583 * Logs when a job scheduler job state changes.
584 *
585 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700586 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700587 */
588message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800589 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700590
591 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800592 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700593
594 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800595 FINISHED = 0;
596 STARTED = 1;
597 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700598 }
599 optional State state = 3;
600
Tej Singh33a412b2018-03-16 18:43:59 -0700601 // The reason a job has stopped.
602 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700603 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700604 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700605}
606
607/**
608 * Logs when the audio state changes.
609 *
610 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700611 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700612 */
613message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800614 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700615
616 enum State {
617 OFF = 0;
618 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700619 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
620 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700621 }
622 optional State state = 2;
623}
624
625/**
626 * Logs when the video codec state changes.
627 *
628 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700629 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700630 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800631message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800632 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700633
634 enum State {
635 OFF = 0;
636 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700637 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
638 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700639 }
640 optional State state = 2;
641}
642
643/**
644 * Logs when the flashlight state changes.
645 *
646 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700647 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700648 */
649message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800650 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700651
652 enum State {
653 OFF = 0;
654 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700655 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
656 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700657 }
658 optional State state = 2;
659}
660
661/**
662 * Logs when the camera state changes.
663 *
664 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700665 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700666 */
667message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800668 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700669
670 enum State {
671 OFF = 0;
672 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700673 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
674 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700675 }
676 optional State state = 2;
677}
678
679/**
680 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000681 *
682 * Logged from:
683 * TODO
684 */
Bookatzd6746242017-10-24 18:39:35 -0700685message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800686 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000687
Bookatz1a1b0462018-01-12 11:47:03 -0800688 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
689 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700690 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700691
692 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
693 optional string tag = 3;
694
695 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800696 RELEASE = 0;
697 ACQUIRE = 1;
698 CHANGE_RELEASE = 2;
699 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700700 }
701 optional State state = 4;
702}
703
704/**
Bookatzc1a050a2017-10-10 15:49:28 -0700705 * Logs when a partial wakelock is considered 'long' (over 1 min).
706 *
707 * Logged from:
708 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
709 */
710message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800711 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700712
Yao Chend54f9dd2017-10-17 17:37:48 +0000713 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
714 optional string tag = 2;
715
Bookatzc1a050a2017-10-10 15:49:28 -0700716 // TODO: I have no idea what this is.
717 optional string history_tag = 3;
718
719 enum State {
720 OFF = 0;
721 ON = 1;
722 }
723 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000724}
725
Bookatzc1a050a2017-10-10 15:49:28 -0700726/**
Bookatza66083f2018-09-20 17:24:00 -0700727 * Logs when the device is interactive, according to the PowerManager Notifier.
728 *
729 * Logged from:
730 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
731 */
732message InteractiveStateChanged {
733 enum State {
734 OFF = 0;
735 ON = 1;
736 }
737 optional State state = 1;
738}
739
740/**
Bookatzc1a050a2017-10-10 15:49:28 -0700741 * Logs Battery Saver state change.
742 *
743 * Logged from:
744 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
745 */
746message BatterySaverModeStateChanged {
747 enum State {
748 OFF = 0;
749 ON = 1;
750 }
751 optional State state = 1;
752}
753
754/**
755 * Logs Doze mode state change.
756 *
757 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800758 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700759 */
760message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800761 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800762}
763
764
765/**
766 * Logs state change of Doze mode including maintenance windows.
767 *
768 * Logged from:
769 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
770 */
771message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800772 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700773}
774
775/**
776 * Logs screen brightness level.
777 *
778 * Logged from:
779 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
780 */
781message ScreenBrightnessChanged {
782 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
783 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700784}
785
786/**
787 * Logs battery level (percent full, from 0 to 100).
788 *
789 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700790 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700791 */
792message BatteryLevelChanged {
793 // Battery level. Should be in [0, 100].
794 optional int32 battery_level = 1;
795}
796
797/**
798 * Logs change in charging status of the device.
799 *
800 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700801 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700802 */
803message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800804 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
805 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700806}
807
808/**
809 * Logs whether the device is plugged in, and what power source it is using.
810 *
811 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700812 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700813 */
814message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800815 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
816 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700817}
818
Bookatz8c6571b2017-10-24 15:04:41 -0700819/**
820 * Logs when an app's wakeup alarm fires.
821 *
822 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700823 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700824 */
825message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800826 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800827
828 // Name of the wakeup alarm.
829 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700830
831 // Name of source package (for historical reasons, since BatteryStats tracked it).
832 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800833}
834
835/**
836 * Logs when an an app causes the mobile radio to change state.
837 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
838 *
839 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700840 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800841 */
842message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800843 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800844
Bookatz1a1b0462018-01-12 11:47:03 -0800845 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
846 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800847}
848
849/**
850 * Logs when an an app causes the wifi radio to change state.
851 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
852 *
853 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700854 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800855 */
856message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800857 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800858
Bookatz1a1b0462018-01-12 11:47:03 -0800859 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
860 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700861}
862
863/**
864 * Logs kernel wakeup reasons and aborts.
865 *
866 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700867 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700868 */
869message KernelWakeupReported {
870 // Name of the kernel wakeup reason (or abort).
871 optional string wakeup_reason_name = 1;
872
873 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800874 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700875}
876
877/**
Bookatzda1798c2018-12-13 14:16:00 -0800878 * Logs when Wifi is toggled on/off.
Bookatza0a1f8a2018-12-17 12:28:32 -0800879 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
Bookatzda1798c2018-12-13 14:16:00 -0800880 *
881 * Logged from:
882 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
883 */
884message WifiEnabledStateChanged {
885 enum State {
886 OFF = 0;
887 ON = 1;
888 }
889 optional State state = 1;
890}
891
892/**
893 * 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 -0800894 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
895 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
Bookatzda1798c2018-12-13 14:16:00 -0800896 *
897 * Logged from:
898 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
899 */
900message WifiRunningStateChanged {
901 repeated AttributionNode attribution_node = 1;
902
903 enum State {
904 OFF = 0;
905 ON = 1;
906 }
907 optional State state = 2;
908}
909
910/**
Bookatze5885242017-10-24 20:10:31 -0700911 * Logs wifi locks held by an app.
912 *
913 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700914 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700915 */
916message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800917 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700918
919 enum State {
920 OFF = 0;
921 ON = 1;
922 }
923 optional State state = 2;
924}
925
926/**
927 * Logs wifi signal strength changes.
928 *
929 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700930 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700931 */
932message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800933 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
934 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700935}
936
937/**
938 * Logs wifi scans performed by an app.
939 *
940 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700941 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700942 */
943message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800944 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700945
946 enum State {
947 OFF = 0;
948 ON = 1;
949 }
950 optional State state = 2;
951}
952
953/**
Tej Singh4503e102018-01-04 14:35:01 -0800954 * Logs wifi multicast locks held by an app
955 *
956 * Logged from:
957 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
958 */
959message WifiMulticastLockStateChanged {
960 repeated AttributionNode attribution_node = 1;
961
962 enum State {
963 OFF = 0;
964 ON = 1;
965 }
966 optional State state = 2;
967}
968
969/**
Tej Singh1ea42892018-01-19 09:27:00 -0800970 * Logs shutdown reason and duration on next boot.
971 *
972 * Logged from:
973 * frameworks/base/core/java/com/android/server/BootReceiver.java
974 */
975message ShutdownSequenceReported {
976 // True if shutdown is for a reboot. Default: false if we do not know.
977 optional bool reboot = 1;
978
979 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
980 optional string reason = 2;
981
982 // Beginning of shutdown time in ms using wall clock time since unix epoch.
983 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800984 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800985
986 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800987 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800988}
989
Tej Singh6483ea42018-01-25 17:45:49 -0800990
991/**
992 * Logs boot reason and duration.
993 *
994 * Logged from:
995 * system/core/bootstat/bootstat.cpp
996 */
997message BootSequenceReported {
998 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
999 // Default: "<EMPTY>" if not available.
1000 optional string bootloader_reason = 1;
1001
1002 // Reason for system boot. Eg. bootloader, reboot,userrequested
1003 // Default: "<EMPTY>" if not available.
1004 optional string system_reason = 2;
1005
1006 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -08001007 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -08001008
1009 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001010 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -08001011
1012 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001013 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -08001014
1015 // Time since last boot in ms. Default: 0 if not available.
1016 optional int64 time_since_last_boot = 6;
1017}
1018
Tej Singhc477d9c2018-02-05 18:31:39 -08001019
1020/**
1021 * Logs call state and disconnect cause (if applicable).
1022 *
1023 * Logged from:
1024 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
1025 */
1026message CallStateChanged {
1027 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1028 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1029 optional android.telecom.CallStateEnum call_state = 1;
1030
1031 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1032 // This value is only applicable when the call_state is DISCONNECTED, and
1033 // should always be UNKNOWN if the call_state is not DISCONNECTED.
1034 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1035 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1036
1037 // True if the call is self-managed, which are apps that use the
1038 // telecom infrastructure to make their own calls.
1039 optional bool self_managed = 3;
1040
1041 // True if call is external. External calls are calls on connected Wear
1042 // devices but show up in Telecom so the user can pull them onto the device.
1043 optional bool external_call = 4;
1044}
1045
Tej Singh1ea42892018-01-19 09:27:00 -08001046/**
Tej Singhdd7bd352018-02-09 19:33:15 -08001047 * Logs keyguard state. The keyguard is the lock screen.
1048 *
1049 * Logged from:
1050 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1051 */
1052message KeyguardStateChanged {
1053 enum State {
1054 UNKNOWN = 0;
1055 // The keyguard is hidden when the phone is unlocked.
1056 HIDDEN = 1;
1057 // The keyguard is shown when the phone is locked (screen turns off).
1058 SHOWN= 2;
1059 // The keyguard is occluded when something is overlaying the keyguard.
1060 // Eg. Opening the camera while on the lock screen.
1061 OCCLUDED = 3;
1062 }
1063 optional State state = 1;
1064}
1065
1066/**
1067 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1068 * prompts the user to enter a password (pattern, pin, etc).
1069 *
1070 * Logged from:
1071 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1072 */
1073
1074message KeyguardBouncerStateChanged {
1075 enum State {
1076 UNKNOWN = 0;
1077 // Bouncer is hidden, either as a result of successfully entering the
1078 // password, screen timing out, or user going back to lock screen.
1079 HIDDEN = 1;
1080 // This is when the user is being prompted to enter the password.
1081 SHOWN = 2;
1082 }
1083 optional State state = 1;
1084}
1085
1086/**
1087 * Logs the result of entering a password into the keyguard bouncer.
1088 *
1089 * Logged from:
1090 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1091 */
1092message KeyguardBouncerPasswordEntered {
1093 enum BouncerResult {
1094 UNKNOWN = 0;
1095 // The password entered was incorrect.
1096 FAILURE = 1;
1097 // The password entered was correct.
1098 SUCCESS = 2;
1099 }
1100 optional BouncerResult result = 1;
1101}
1102
Tej Singha883b372018-02-15 11:30:01 -08001103/*
1104 * Logs changes to the configuration of the device. The configuration is defined
1105 * in frameworks/base/core/java/android/content/res/Configuration.java
1106 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1107 * Please go there to interpret the possible values each field can be.
1108 *
1109 * Logged from:
1110 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1111 */
1112message ResourceConfigurationChanged {
1113 // Bit mask of color capabilities of the screen.
1114 // Contains information about the color gamut and hdr mode of the screen.
1115 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001116 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001117
1118 // The target screen density being rendered to.
1119 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001120 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001121
1122 // Current user preference for the scaling factor for fonts,
1123 // relative to the base density scaling.
1124 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001125 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001126
1127 // Flag indicating whether the hard keyboard is hidden.
1128 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001129 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001130
1131 // The type of keyboard attached to the device.
1132 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1133 optional int32 keyboard = 5;
1134
1135 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1136 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001137 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001138
1139 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1140 // 0 if undefined.
1141 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1142 optional int32 mcc = 7;
1143
1144 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1145 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1146 // MNC_ZERO symbol defined in Configuration.java.
1147 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1148 optional int32 mnc = 8;
1149
1150 // The kind of navigation available on the device.
1151 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1152 optional int32 navigation = 9;
1153
1154 // Flag indicating whether the navigation is available.
1155 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001156 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001157
1158 // Overall orientation of the screen.
1159 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1160 optional int32 orientation = 11;
1161
1162 // The current height of the available screen space, in dp units.
1163 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001164 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001165
1166 // Bit mask of overall layout of the screen.
1167 // Contains information about screen size, whether the screen is wider/taller
1168 // than normal, whether the screen layout is right-tl-left or left-to-right,
1169 // and whether the screen has a rounded shape.
1170 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001171 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001172
1173 // Current width of the available screen space, in dp units.
1174 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001175 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001176
1177 // The smallest screen size an application will see in normal operation.
1178 // This is the smallest value of both screenWidthDp and screenHeightDp
1179 // in portrait and landscape.
1180 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001181 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001182
1183 // The type of touch screen attached to the device.
1184 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1185 optional int32 touchscreen = 16;
1186
1187 // Bit mask of the ui mode.
1188 // Contains information about the overall ui mode of the device.
1189 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1190 // Also contains information about whether the device is in night mode.
1191 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001192 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001193}
1194
Tej Singheee317b2018-03-07 19:28:05 -08001195
1196/**
1197 * Logs changes in the connection state of the mobile radio.
1198 *
1199 * Logged from:
1200 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1201 */
1202message MobileConnectionStateChanged {
1203 // States are from the state machine DataConnection.java.
1204 enum State {
1205 UNKNOWN = 0;
1206 // The connection is inactive, or disconnected.
1207 INACTIVE = 1;
1208 // The connection is being activated, or connecting.
1209 ACTIVATING = 2;
1210 // The connection is active, or connected.
1211 ACTIVE = 3;
1212 // The connection is disconnecting.
1213 DISCONNECTING = 4;
1214 // The connection is disconnecting after creating a connection.
1215 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1216 }
1217 optional State state = 1;
1218 // For multi-sim phones, this distinguishes between the sim cards.
1219 optional int32 sim_slot_index = 2;
1220 // Used to identify the connection. Starts at 0 and increments by 1 for
1221 // every new network created. Resets whenever the device reboots.
1222 optional int32 data_connection_id = 3;
1223 // A bitmask for the capabilities of this connection.
1224 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1225 // Default value (if we have no information): 0
1226 optional int64 capabilities = 4;
1227 // If this connection has internet.
1228 // This just checks if the DEFAULT bit of capabilities is set.
1229 optional bool has_internet = 5;
1230}
1231
1232/**
1233 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1234 *
1235 * Logged from:
1236 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1237 */
1238message MobileRadioTechnologyChanged {
1239 optional android.telephony.NetworkTypeEnum state = 1;
1240 // For multi-sim phones, this distinguishes between the sim cards.
1241 optional int32 sim_slot_index = 2;
1242}
1243
Andrew Chantb56388b2018-03-22 21:07:33 -07001244/**
1245 * Logs the VID and PID of any connected USB devices.
1246 *
1247 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1248 *
1249 * Logged by Vendor.
1250 */
1251message UsbDeviceAttached {
1252 optional int32 vid = 1;
1253 optional int32 pid = 2;
1254 optional bool has_audio = 3;
1255 optional bool has_hid = 4;
1256 optional bool has_storage = 5;
Badhri Jagan Sridharan5ec629f2018-11-16 15:39:22 -08001257 enum State {
1258 STATE_DISCONNECTED = 0;
1259 STATE_CONNECTED = 1;
1260 }
1261 optional State state = 6;
Badhri Jagan Sridharanc2c54a22018-12-14 14:41:26 -08001262 optional int64 last_connect_duration_millis = 7;
Andrew Chantb56388b2018-03-22 21:07:33 -07001263}
1264
Tej Singheee317b2018-03-07 19:28:05 -08001265
Tej Singhdd7bd352018-02-09 19:33:15 -08001266/**
Tej Singh5d991e12018-03-09 19:48:11 -08001267 * Logs when Bluetooth is enabled and disabled.
1268 *
1269 * Logged from:
1270 * services/core/java/com/android/server/BluetoothManagerService.java
1271 */
1272message BluetoothEnabledStateChanged {
1273 repeated AttributionNode attribution_node = 1;
1274 // Whether or not bluetooth is enabled on the device.
1275 enum State {
1276 UNKNOWN = 0;
1277 ENABLED = 1;
1278 DISABLED = 2;
1279 }
1280 optional State state = 2;
1281 // The reason for being enabled/disabled.
1282 // Eg. Airplane mode, crash, application request.
1283 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1284 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001285 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001286}
1287
1288/**
1289 * Logs when a Bluetooth device connects and disconnects.
1290 *
1291 * Logged from:
1292 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1293 */
1294message BluetoothConnectionStateChanged {
1295 // The state of the connection.
1296 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1297 optional android.bluetooth.ConnectionStateEnum state = 1;
1298 // An identifier that can be used to match connect and disconnect events.
1299 // Currently is last two bytes of a hash of a device level ID and
1300 // the mac address of the bluetooth device that is connected.
1301 optional int32 obfuscated_id = 2;
1302 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1303 // From android.bluetooth.BluetoothAdapter.java
1304 optional int32 bt_profile = 3;
1305}
1306
1307/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001308 * Logs when something is plugged into or removed from the USB-C connector.
1309 *
1310 * Logged from:
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001311 * UsbService
Andrew Chant28d627e2018-02-22 15:17:05 -08001312 */
1313message UsbConnectorStateChanged {
1314 enum State {
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001315 STATE_DISCONNECTED = 0;
1316 STATE_CONNECTED = 1;
Andrew Chant28d627e2018-02-22 15:17:05 -08001317 }
1318 optional State state = 1;
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001319 optional string id = 2;
Badhri Jagan Sridharanfaf62072018-11-16 17:17:03 -08001320 // Last active session in ms.
1321 // 0 when the port is in connected state.
1322 optional int64 last_connect_duration_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001323}
1324
1325/**
1326 * Logs the reported speaker impedance.
1327 *
1328 * Logged from:
1329 * Vendor audio implementation.
1330 */
1331message SpeakerImpedanceReported {
1332 optional int32 speaker_location = 1;
1333 optional int32 impedance = 2;
1334}
1335
1336/**
1337 * Logs the report of a failed hardware.
1338 *
1339 * Logged from:
1340 * Vendor HALs.
1341 *
1342 */
1343message HardwareFailed {
1344 enum HardwareType {
1345 HARDWARE_FAILED_UNKNOWN = 0;
1346 HARDWARE_FAILED_MICROPHONE = 1;
1347 HARDWARE_FAILED_CODEC = 2;
1348 HARDWARE_FAILED_SPEAKER = 3;
1349 HARDWARE_FAILED_FINGERPRINT = 4;
1350 }
1351 optional HardwareType hardware_type = 1;
1352
1353 /* hardware_location allows vendors to differentiate between multiple instances of
1354 * the same hardware_type. The specific locations are vendor defined integers,
1355 * referring to board-specific numbering schemes.
1356 */
1357 optional int32 hardware_location = 2;
1358
1359 /* failure_code is specific to the HardwareType of the failed hardware.
1360 * It should use the enum values defined below.
1361 */
1362 enum MicrophoneFailureCode {
1363 MICROPHONE_FAILURE_COMPLETE = 0;
1364 }
1365 enum CodecFailureCode {
1366 CODEC_FAILURE_COMPLETE = 0;
1367 }
1368 enum SpeakerFailureCode {
1369 SPEAKER_FAILURE_COMPLETE = 0;
1370 SPEAKER_FAILURE_HIGH_Z = 1;
1371 SPEAKER_FAILURE_SHORT = 2;
1372 }
1373 enum FingerprintFailureCode {
1374 FINGERPRINT_FAILURE_COMPLETE = 0;
1375 FINGERPRINT_SENSOR_BROKEN = 1;
1376 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1377 }
1378 optional int32 failure_code = 3;
1379}
1380
1381/**
1382 * Log an event when the device has been physically dropped.
1383 * Reported from the /vendor partition.
1384 */
1385message PhysicalDropDetected {
1386 // Confidence that the event was actually a drop, 0 -> 100
1387 optional int32 confidence_pctg = 1;
1388 // Peak acceleration of the drop, in 1/1000s of a g.
1389 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001390 // Duration of freefall in ms
1391 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001392}
1393
1394/**
1395 * Log bucketed battery charge cycles.
1396 *
1397 * Each bucket represents cycles of the battery past
Maggie White38c9d322018-11-20 10:07:52 -08001398 * a given charge point. For example, if 10 cycle buckets are
1399 * initialized, bucket 1 is the lowest 1/10th of the battery,
1400 * and bucket 10 is 100%.
Andrew Chant28d627e2018-02-22 15:17:05 -08001401 *
1402 * Logged from:
1403 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1404 */
1405message ChargeCyclesReported {
1406 optional int32 cycle_bucket_1 = 1;
1407 optional int32 cycle_bucket_2 = 2;
1408 optional int32 cycle_bucket_3 = 3;
1409 optional int32 cycle_bucket_4 = 4;
1410 optional int32 cycle_bucket_5 = 5;
1411 optional int32 cycle_bucket_6 = 6;
1412 optional int32 cycle_bucket_7 = 7;
1413 optional int32 cycle_bucket_8 = 8;
Maggie White38c9d322018-11-20 10:07:52 -08001414 optional int32 cycle_bucket_9 = 9;
1415 optional int32 cycle_bucket_10 = 10;
Andrew Chant28d627e2018-02-22 15:17:05 -08001416}
1417
1418/**
Howard Roa46b6582018-09-18 16:45:02 -07001419 * Log battery health snapshot.
1420 *
1421 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1422 * are snapshotted periodically over 24hrs.
1423 */
1424message BatteryHealthSnapshot {
1425 enum BatterySnapshotType {
1426 UNKNOWN = 0;
1427 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1428 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1429 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1430 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1431 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1432 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1433 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1434 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1435 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1436 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1437 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1438 }
1439 optional BatterySnapshotType type = 1;
1440 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001441 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001442 // Voltage Battery Voltage, in microVolts.
1443 optional int32 voltage_micro_volt = 3;
1444 // Current Battery current, in microAmps.
1445 optional int32 current_micro_amps = 4;
1446 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1447 optional int32 open_circuit_micro_volt = 5;
1448 // Resistance Battery Resistance, in microOhms.
1449 optional int32 resistance_micro_ohm = 6;
1450 // Level Battery Level, as % of full.
1451 optional int32 level_percent = 7;
1452}
1453
1454/**
1455 * Log slow I/O operations on the primary storage.
1456 */
1457message SlowIo {
1458 // Classifications of IO Operations.
1459 enum IoOperation {
1460 UNKNOWN = 0;
1461 READ = 1;
1462 WRITE = 2;
1463 UNMAP = 3;
1464 SYNC = 4;
1465 }
1466 optional IoOperation operation = 1;
1467
1468 // The number of slow IO operations of this type over 24 hours.
1469 optional int32 count = 2;
1470}
1471
1472/**
1473 * Log battery caused shutdown with the last recorded voltage.
1474 */
1475message BatteryCausedShutdown {
1476 // The last recorded battery voltage prior to shutdown.
1477 optional int32 last_recorded_micro_volt = 1;
1478}
1479
1480/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001481 * Logs the duration of a davey (jank of >=700ms) when it occurs
1482 *
1483 * Logged from:
1484 * frameworks/base/libs/hwui/JankTracker.cpp
1485 */
1486message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001487 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001488 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001489
Tej Singhbb8554a2018-01-26 11:59:14 -08001490 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001491 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001492}
1493
1494/**
Bookatze5885242017-10-24 20:10:31 -07001495 * Logs phone signal strength changes.
1496 *
1497 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001498 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001499 */
1500message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001501 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1502 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001503}
1504
Yangster4ccebea2018-10-09 17:09:02 -07001505
1506/**
1507 * Logs when the phone state, sim state or signal strength changes
1508 *
1509 * Logged from:
1510 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1511 */
1512message PhoneServiceStateChanged {
1513 optional android.telephony.ServiceStateEnum state = 1;
1514 optional android.telephony.SimStateEnum sim_state = 2;
1515 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1516}
1517
1518/**
1519 * Logs when the phone becomes on or off.
1520 *
1521 * Logged from:
1522 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1523 */
1524message PhoneStateChanged {
1525 enum State {
1526 OFF = 0;
1527 ON = 1;
1528 }
1529 optional State state = 1;
1530}
1531
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001532message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001533 optional android.stats.launcher.LauncherAction action = 1;
1534 optional android.stats.launcher.LauncherState src_state = 2;
1535 optional android.stats.launcher.LauncherState dst_state = 3;
1536 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001537 optional bool is_swipe_up_enabled = 5;
1538}
1539
David Chenc28b2bb2017-10-24 12:52:52 -07001540/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001541 * Logs when Settings UI has changed.
1542 *
1543 * Logged from:
1544 * packages/apps/Settings
1545 */
1546message SettingsUIChanged {
1547 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001548 * Where this SettingsUIChange event comes from. For example, if
1549 * it's a PAGE_VISIBLE event, where the page is opened from.
1550 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001551 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001552
1553 /**
1554 * What the UI action is.
1555 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001556 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001557
1558 /**
1559 * Where the action is happening
1560 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001561 optional android.app.settings.PageId page_id = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001562
1563 /**
1564 * What preference changed in this event.
1565 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001566 optional string changed_preference_key = 4;
Fan Zhang916c13b2018-10-16 22:49:45 -07001567
1568 /**
1569 * The new value of the changed preference.
1570 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001571 optional int64 changed_preference_int_value = 5;
Fan Zhang916c13b2018-10-16 22:49:45 -07001572}
1573
1574/**
David Chenc28b2bb2017-10-24 12:52:52 -07001575 * Logs that a setting was updated.
1576 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001577 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001578 * The tag and is_default allow resetting of settings to default values based on the specified
1579 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1580 */
1581message SettingChanged {
1582 // The name of the setting.
1583 optional string setting = 1;
1584
1585 // The change being imposed on this setting. May represent a number, eg "3".
1586 optional string value = 2;
1587
1588 // The new value of this setting. For most settings, this is same as value. For some settings,
1589 // value is +X or -X where X represents an element in a set. For example, if the previous value
1590 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1591 // The +/- feature is currently only used for location_providers_allowed.
1592 optional string new_value = 3;
1593
1594 // The previous value of this setting.
1595 optional string prev_value = 4;
1596
1597 // The tag used with the is_default for resetting sets of settings. This is generally null.
1598 optional string tag = 5;
1599
Bookatz90867622018-01-31 15:05:57 -08001600 // True if this setting with tag should be resettable.
1601 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001602
David Chenbd789912018-03-16 17:19:55 -07001603 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001604 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001605
1606 enum ChangeReason {
1607 UPDATED = 1; // Updated can be an insertion or an update.
1608 DELETED = 2;
1609 }
1610 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001611}
Chenjie Yub3dda412017-10-24 13:41:59 -07001612
Chenjie Yu05013b32017-11-21 10:21:41 -08001613/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001614 * Logs activity going to foreground or background
1615 *
1616 * Logged from:
1617 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1618 */
1619message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001620 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001621 optional string pkg_name = 2;
1622 optional string class_name = 3;
1623
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001624 enum State {
1625 BACKGROUND = 0;
1626 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001627 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001628 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001629}
David Chenc8a43242017-10-17 16:23:28 -07001630
1631/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001632 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001633 * Logged from:
1634 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1635 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001636message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001637 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001638
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001639 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001640
1641 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001642 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001643 optional string process_name = 3;
1644
1645 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001646 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001647
1648 optional string package_name = 5;
1649
1650 enum InstantApp {
1651 UNAVAILABLE = 0;
1652 FALSE = 1;
1653 TRUE = 2;
1654 }
1655 optional InstantApp is_instant_app = 6;
1656
1657 enum ForegroundState {
1658 UNKNOWN = 0;
1659 BACKGROUND = 1;
1660 FOREGROUND = 2;
1661 }
1662 optional ForegroundState foreground_state = 7;
Yang Lu732d6382018-11-05 07:53:12 -08001663
1664 optional android.server.ErrorSource error_source = 8;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001665}
David Chen9e3808c2017-11-20 17:25:34 -08001666
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001667/**
1668 * Logs when a WTF (What a Terrible Failure) happened.
1669 * Logged from:
1670 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1671 */
1672message WTFOccurred {
1673 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001674
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001675 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001676
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001677 // The name of the process.
1678 // system_server if it is not by an app
1679 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001680
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001681 // The pid if available. -1 means not available.
1682 optional sint32 pid = 4;
Yang Lu732d6382018-11-05 07:53:12 -08001683
1684 optional android.server.ErrorSource error_source = 5;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001685}
1686
1687/**
1688 * Logs when system server reports low memory.
1689 * Logged from:
1690 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1691 */
1692message LowMemReported {
1693}
1694
1695/**
1696 * Logs when an app ANR (App Not Responding) occurs.
1697 * Logged from:
1698 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1699 */
1700message ANROccurred {
1701 optional int32 uid = 1 [(is_uid) = true];
1702
1703 optional string process_name = 2;
1704
1705 optional string short_component_name = 3;
1706
1707 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001708
1709 enum InstantApp {
1710 UNAVAILABLE = 0;
1711 FALSE = 1;
1712 TRUE = 2;
1713 }
1714 optional InstantApp is_instant_app = 5;
1715
1716 enum ForegroundState {
1717 UNKNOWN = 0;
1718 BACKGROUND = 1;
1719 FOREGROUND = 2;
1720 }
1721 optional ForegroundState foreground_state = 6;
Yang Lu732d6382018-11-05 07:53:12 -08001722
1723 optional android.server.ErrorSource error_source = 7;
1724
1725 optional string package_name = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001726}
1727
Bookatza7020bd2018-08-28 16:29:35 -07001728/**
1729 * Logs when the vibrator state changes.
1730 * Logged from:
1731 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1732 */
1733message VibratorStateChanged {
1734 repeated AttributionNode attribution_node = 1;
1735
1736 enum State {
1737 OFF = 0;
1738 ON = 1;
1739 }
1740 optional State state = 2;
1741
1742 // Duration (in milliseconds) requested to keep the vibrator on.
1743 // Only applicable for State == ON.
1744 optional int64 duration_millis = 3;
1745}
1746
David Chen0a368b22017-12-06 16:28:16 -08001747/*
1748 * Allows other apps to push events into statsd.
1749 * Logged from:
1750 * frameworks/base/core/java/android/util/StatsLog.java
1751 */
David Chen0b5c90c2018-01-25 16:51:49 -08001752message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001753 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001754 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001755
1756 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1757 optional int32 label = 2;
1758
1759 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1760 // predicates for the metrics).
1761 enum State {
1762 UNKNOWN = 0;
1763 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1764 STOP = 2;
1765 START = 3;
1766 }
1767 optional State state = 3;
1768}
1769
David Chen9e3808c2017-11-20 17:25:34 -08001770/**
Bookatz7948c872018-09-04 12:58:33 -07001771 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1772 * For example, this could be due to the user manually changing the time.
1773 *
1774 * Logged from:
1775 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1776 */
1777message WallClockTimeShifted {
1778 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1779 optional int64 wall_clock_timestamp_millis = 1;
1780}
1781
1782/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001783 * Logs when statsd detects an anomaly.
1784 *
1785 * Logged from:
1786 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1787 */
1788message AnomalyDetected {
1789 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001790 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001791
Yangster-mac94e197c2018-01-02 16:03:03 -08001792 // Id of the config whose anomaly detection alert fired.
1793 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001794
Yangster-mac94e197c2018-01-02 16:03:03 -08001795 // Id of the alert (i.e. name of the anomaly that was detected).
1796 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001797}
1798
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001799message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001800 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001801 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001802
1803 // The app package name.
1804 optional string pkg_name = 2;
1805
1806 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001807 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001808 WARM = 1;
1809 HOT = 2;
1810 COLD = 3;
1811 }
1812 // The transition type.
1813 optional TransitionType type = 3;
1814
1815 // The activity name.
1816 optional string activity_name = 4;
1817
1818 // The name of the calling app. Empty if not set.
1819 optional string calling_pkg_name = 5;
1820
1821 // Whether the app is an instant app.
1822 optional bool is_instant_app = 6;
1823
1824 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001825 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001826
Bookatz80d11a02018-01-16 10:46:35 -08001827 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001828
David Chen0b5c90c2018-01-25 16:51:49 -08001829 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001830 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001831 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001832 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001833 optional int32 bind_application_delay_millis = 11;
1834 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001835
1836 // Empty if not set.
1837 optional string launch_token = 13;
1838
Calin Juravle759fbda2018-02-20 19:52:30 +00001839 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001840 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001841
1842 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001843 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001844}
1845
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001846message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001847 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001848 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001849
1850 // The app package name.
1851 optional string pkg_name = 2;
1852
1853 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001854 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001855 WARM = 1;
1856 HOT = 2;
1857 COLD = 3;
1858 }
1859 // The transition type.
1860 optional TransitionType type = 3;
1861
1862 // The activity name.
1863 optional string activity_name = 4;
1864}
1865
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001866message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001867 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001868 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001869
1870 // The app package name.
1871 optional string pkg_name = 2;
1872
1873 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001874 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001875 WITH_BUNDLE = 1;
1876 WITHOUT_BUNDLE = 2;
1877 }
1878 // The transition type.
1879 optional TransitionType type = 3;
1880
1881 // The activity name.
1882 optional string activity_name = 4;
1883
1884 optional bool transition_process_running = 5;
1885
1886 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001887 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001888}
1889
Bookatz8fcd09a2017-12-18 13:01:10 -08001890/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001891 * Logs a picture-in-picture action
1892 * Logged from:
1893 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1894 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1895 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1896 */
1897message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001898 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001899 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001900
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001901 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001902
Chenjie Yu52cacc62017-12-08 18:11:45 -08001903 enum State {
1904 ENTERED = 1;
1905 EXPANDED_TO_FULL_SCREEN = 2;
1906 MINIMIZED = 3;
1907 DISMISSED = 4;
1908 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001909 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001910}
1911
1912/**
Chenjie Yue8904192017-12-08 19:12:57 -08001913 * Logs overlay action
1914 * Logged from:
1915 * services/core/java/com/android/server/wm/Session.java
1916 */
1917message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001918 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001919
1920 optional string package_name = 2;
1921
1922 optional bool using_alert_window = 3;
1923
1924 enum State {
1925 ENTERED = 1;
1926 EXITED = 2;
1927 }
1928 optional State state = 4;
1929}
1930
Chenjie Yuccfe6452018-01-30 11:33:21 -08001931/*
1932 * Logs foreground service starts and stops.
1933 * Note that this is not when a service starts or stops, but when it is
1934 * considered foreground.
1935 * Logged from
1936 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1937 */
1938message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001939 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001940 // package_name + "/" + class_name
1941 optional string short_name = 2;
1942
1943 enum State {
1944 ENTER = 1;
1945 EXIT = 2;
1946 }
1947 optional State state = 3;
1948}
1949
Chenjie Yue8904192017-12-08 19:12:57 -08001950/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001951 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1952 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1953 * attributed back to the parent (host) uid. One example is Chrome.
1954 *
1955 * Logged from:
1956 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1957 */
1958message IsolatedUidChanged {
1959 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001960 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001961 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001962 optional int32 parent_uid = 1;
1963
1964 optional int32 isolated_uid = 2;
1965
1966 // We expect an isolated uid to be removed before if it's used for another parent uid.
1967 enum Event {
1968 REMOVED = 0;
1969 CREATED = 1;
1970 }
1971 optional Event event = 3;
1972}
1973
1974/*
1975 * Logs the reception of an incoming network packet causing the main system to wake up for
1976 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1977 * and processed by WakeupController.cpp.
1978 */
1979message PacketWakeupOccurred {
1980 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1981 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001982 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001983 // The interface name on which the packet was received.
1984 optional string iface = 2;
1985 // The ethertype value of the packet.
1986 optional int32 ethertype = 3;
1987 // String representation of the destination MAC address of the packet.
1988 optional string destination_hardware_address = 4;
1989 // String representation of the source address of the packet if this was an IP packet.
1990 optional string source_ip = 5;
1991 // String representation of the destination address of the packet if this was an IP packet.
1992 optional string destination_ip = 6;
1993 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1994 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1995 // families.
1996 optional int32 ip_next_header = 7;
1997 // The source port if this was a TCP or UDP packet.
1998 optional int32 source_port = 8;
1999 // The destination port if this was a TCP or UDP packet.
2000 optional int32 destination_port = 9;
2001}
2002
2003/*
2004 * Logs the memory stats for an app on startup.
2005 * Logged from:
2006 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2007 */
2008message AppStartMemoryStateCaptured {
2009 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002010 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002011
2012 // The process name.
2013 optional string process_name = 2;
2014
2015 // The activity name.
2016 optional string activity_name = 3;
2017
2018 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002019 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002020
2021 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002022 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002023
2024 // RSS
2025 optional int64 rss_in_bytes = 6;
2026
2027 // CACHE
2028 optional int64 cache_in_bytes = 7;
2029
2030 // SWAP
2031 optional int64 swap_in_bytes = 8;
2032}
2033
2034/*
2035 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
2036 * for LMK event.
2037 * Logged from:
2038 * system/core/lmkd/lmkd.c
2039 */
2040message LmkStateChanged {
2041 enum State {
2042 UNKNOWN = 0;
2043 START = 1;
2044 STOP = 2;
2045 }
2046 optional State state = 1;
2047}
2048
2049/*
2050 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
2051 * Logged from:
2052 * system/core/lmkd/lmkd.c
2053 */
2054message LmkKillOccurred {
2055 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002056 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002057
2058 // The process name.
2059 optional string process_name = 2;
2060
2061 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002062 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002063
2064 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002065 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002066
2067 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002068 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002069
2070 // RSS
2071 optional int64 rss_in_bytes = 6;
2072
2073 // CACHE
2074 optional int64 cache_in_bytes = 7;
2075
2076 // SWAP
2077 optional int64 swap_in_bytes = 8;
Jim Blackler8593d1f2018-11-21 15:24:48 +00002078
2079 // The elapsed real time of start of the process.
2080 optional int64 process_start_time_nanos = 9;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002081}
2082
Rajeev Kumar51b54602018-03-01 12:18:26 -08002083/*
2084 * Logs when the ActivityManagerService detects that an app died.
2085 *
2086 * Logged from:
2087 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2088 */
2089message AppDied {
2090 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002091 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002092}
2093
Howard Ro21a039c2018-08-06 14:55:47 -07002094/**
2095 * An atom for generic metrics logging. Available from Android Q.
2096 */
2097message GenericAtom {
2098 // The uid of the application that sent this custom atom.
2099 optional int32 uid = 1 [(is_uid) = true];
2100
2101 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002102 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002103}
2104
Tej Singhd6d6d772018-09-05 17:41:25 -07002105/**
2106 * Logs when a fingerprint acquire event occurs.
2107 *
2108 * Logged from:
2109 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2110 */
2111message FingerprintAcquired {
2112 // The associated user. Eg: 0 for owners, 10+ for others.
2113 // Defined in android/os/UserHandle.java
2114 optional int32 user = 1;
2115 // If this acquire is for a crypto fingerprint.
2116 // e.g. Secure purchases, unlock password storage.
2117 optional bool is_crypto = 2;
2118}
2119
2120/**
2121 * Logs when a fingerprint authentication event occurs.
2122 *
2123 * Logged from:
2124 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2125 */
2126message FingerprintAuthenticated {
2127 // The associated user. Eg: 0 for owners, 10+ for others.
2128 // Defined in android/os/UserHandle.java
2129 optional int32 user = 1;
2130 // If this authentication is for a crypto fingerprint.
2131 // e.g. Secure purchases, unlock password storage.
2132 optional bool is_crypto = 2;
2133 // Whether or not this authentication was successful.
2134 optional bool is_authenticated = 3;
2135}
2136
2137/**
2138 * Logs when a fingerprint error occurs.
2139 *
2140 * Logged from:
2141 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2142 */
2143message FingerprintErrorOccurred {
2144 // The associated user. Eg: 0 for owners, 10+ for others.
2145 // Defined in android/os/UserHandle.java
2146 optional int32 user = 1;
2147 // If this error is for a crypto fingerprint.
2148 // e.g. Secure purchases, unlock password storage.
2149 optional bool is_crypto = 2;
2150
2151 enum Error {
2152 UNKNOWN = 0;
2153 LOCKOUT = 1;
2154 PERMANENT_LOCKOUT = 2;
2155 }
2156 // The type of error.
2157 optional Error error = 3;
2158}
Howard Ro688ae182018-09-25 00:09:36 -07002159
2160message Notification {
2161
2162 // Type of notification event.
2163 enum Type {
2164 TYPE_UNKNOWN = 0;
2165 // Notification became visible to the user.
2166 TYPE_OPEN = 1;
2167 // Notification became hidden.
2168 TYPE_CLOSE = 2;
2169 // Notification switched to detail mode.
2170 TYPE_DETAIL = 3;
2171 // Notification was clicked.
2172 TYPE_ACTION = 4;
2173 // Notification was dismissed.
2174 TYPE_DISMISS = 5;
2175 // Notification switched to summary mode. The enum value of 14 is to
2176 // match that of metrics_constants.
2177 TYPE_COLLAPSE = 14;
2178 }
2179 optional Type type = 1;
2180
2181 // Package name associated with the notification.
2182 optional string package_name = 2;
2183
2184 // Tag associated with notification.
2185 optional string tag = 3;
2186
2187 // Application-supplied ID associated with the notification.
2188 optional int32 id = 4;
2189
2190 // Index of notification in the notification panel.
2191 optional int32 shade_index = 5;
2192
2193 // The number of notifications in the notification panel.
2194 optional int32 shade_count = 6;
2195
2196 // Importance for the notification.
2197 optional int32 importance = 7;
2198
2199 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002200 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002201
2202 // Importance for the notification channel.
2203 optional int32 channel_importance = 9;
2204
Howard Ro183c2bd2018-10-18 13:52:10 -07002205 // Application-supplied ID associated with the notifications group.
2206 optional string group_id = 10;
2207
Howard Ro688ae182018-09-25 00:09:36 -07002208 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002209 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002210
Howard Ro183c2bd2018-10-18 13:52:10 -07002211 // Reason for dismissal of a notification. This field is only meaningful for
2212 // TYPE_DISMISS events.
2213 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002214
Howard Ro183c2bd2018-10-18 13:52:10 -07002215 // The first post time of notification, stable across updates.
2216 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002217
Howard Ro183c2bd2018-10-18 13:52:10 -07002218 // The most recent interruption time, or the creation time if no updates.
2219 // Differs from update_millis because updates are filtered based on whether
2220 // they actually interrupted the user.
2221 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002222
Howard Ro183c2bd2018-10-18 13:52:10 -07002223 // The most recent update time, or the creation time if no updates.
2224 optional int64 update_millis = 15;
2225
2226 // The most recent visibility event.
2227 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002228}
2229
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002230/*
Yangster-macb89807e2018-11-15 21:10:57 -08002231 * Logs when a flag flip state changes.
2232 * Logged in P/h.
2233 */
2234message PhenotypeFlagStateChanged {
2235 // Mendel configuration name.
2236 optional string mendel_config_name = 1;
2237 // State
2238 enum State {
2239 STATE_UNKNOWN = 0;
2240 COMMITTED = 1;
2241 }
2242 optional State state = 2;
2243}
2244
2245/*
2246 * Logs when a binary push state changes.
2247 * Logged in Play store
2248 */
2249message BinaryPushStateChanged {
2250 // Binary package name.
2251 optional string binary_name = 1;
2252 // Version code.
2253 optional int64 version = 2;
2254 // State
2255 enum State {
2256 STATE_UNKNOWN = 0;
2257 DOWNLOAD_START = 1;
2258 DOWNLOAD_DONE = 2;
2259 INSTALL_START = 3;
2260 INSTALL_DONE = 4;
2261 REBOOT_START = 5;
2262 REBOOT_DONE = 6;
2263 }
2264 optional State state = 3;
2265}
2266
2267/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002268 * Logs when a connection becomes available and lost.
2269 * Logged in StatsCompanionService.java
2270 */
2271message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002272 // Id of the network.
2273 optional int32 net_id = 1;
2274
2275 enum State {
2276 UNKNOWN = 0;
2277 CONNECTED = 1;
2278 DISCONNECTED = 2;
2279 }
2280 // Connected state of a network.
2281 optional State state = 2;
2282}
2283
2284/**
2285 * Logs when a service starts and stops.
2286 * Logged from:
2287 * services/core/java/com/android/server/am/ActiveServices.java
2288 */
2289message ServiceStateChanged {
2290
2291 optional int32 uid = 1 [(is_uid) = true];
2292
2293 optional string package_name = 2;
2294
2295 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002296
2297 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002298 START = 1;
2299 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002300 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002301
2302 optional State state = 4;
2303}
2304
2305/**
2306 * Logs when a service is launched.
2307 * Logged from:
2308 * services/core/java/com/android/server/am/ActiveServices.java
2309 */
2310message ServiceLaunchReported {
2311
2312 optional int32 uid = 1 [(is_uid) = true];
2313
2314 optional string package_name = 2;
2315
2316 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002317}
Howard Ro688ae182018-09-25 00:09:36 -07002318
Chenjie Yubbcbc602018-02-05 16:51:52 -08002319//////////////////////////////////////////////////////////////////////
2320// Pulled atoms below this line //
2321//////////////////////////////////////////////////////////////////////
2322
2323/**
David Chenc8a43242017-10-17 16:23:28 -07002324 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2325 *
2326 * Pulled from:
2327 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2328 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002329message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002330 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002331
2332 optional int64 rx_bytes = 2;
2333
2334 optional int64 rx_packets = 3;
2335
2336 optional int64 tx_bytes = 4;
2337
2338 optional int64 tx_packets = 5;
2339}
2340
2341/**
2342 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2343 *
2344 * Pulled from:
2345 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2346 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002347message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002348 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002349
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002350 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2351 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002352
2353 optional int64 rx_bytes = 3;
2354
2355 optional int64 rx_packets = 4;
2356
2357 optional int64 tx_bytes = 5;
2358
2359 optional int64 tx_packets = 6;
2360}
2361
2362/**
2363 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2364 *
2365 * Pulled from:
2366 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2367 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002368message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002369 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002370
2371 optional int64 rx_bytes = 2;
2372
2373 optional int64 rx_packets = 3;
2374
2375 optional int64 tx_bytes = 4;
2376
2377 optional int64 tx_packets = 5;
2378}
2379
2380/**
2381 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2382 *
2383 * Pulled from:
2384 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2385 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002386message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002387 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002388
Yao Chenc40a19d2018-03-15 16:48:25 -07002389 // 1 denotes foreground and 0 denotes background. This is called Set in
2390 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002391 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002392
2393 optional int64 rx_bytes = 3;
2394
2395 optional int64 rx_packets = 4;
2396
2397 optional int64 tx_bytes = 5;
2398
2399 optional int64 tx_packets = 6;
2400}
2401
2402/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002403 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2404 *
2405 * Pulled from:
2406 * StatsCompanionService
2407 */
2408message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002409 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002410
2411 optional int64 rx_bytes = 2;
2412
2413 optional int64 tx_bytes = 3;
2414}
2415
2416/**
David Chenc8a43242017-10-17 16:23:28 -07002417 * Pulls the kernel wakelock durations. This atom is adapted from
2418 * android/internal/os/KernelWakelockStats.java
2419 *
2420 * Pulled from:
2421 * StatsCompanionService using KernelWakelockReader.
2422 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002423message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002424 optional string name = 1;
2425
2426 optional int32 count = 2;
2427
2428 optional int32 version = 3;
2429
Yangster-maca8a30442018-10-13 23:46:34 -07002430 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002431}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002432
Chenjie Yu05013b32017-11-21 10:21:41 -08002433/**
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002434 * Pulls low power state information. If power.stats HAL is not available, this
2435 * includes platform and subsystem sleep state information,
2436 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
2437 * as defined in:
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002438 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002439 * hardware/interfaces/power/1.1/types.hal
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002440 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
2441 * as defined in:
2442 * hardware/interfaces/power/stats/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002443 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002444message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002445 // Subsystem name
2446 optional string subsystem_name = 1;
2447 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2448 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002449 // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
2450 // powerEntityStateName from the corresponding PowerEntityStateInfo.
Chenjie Yubbcbc602018-02-05 16:51:52 -08002451 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002452 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002453 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002454 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002455 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002456}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002457
Chenjie Yu05013b32017-11-21 10:21:41 -08002458/**
Bookatz92da2832018-11-01 18:10:03 -07002459 * Pulls on-device power measurement information.
2460 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2461 * Pulled from:
2462 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2463 */
2464message OnDevicePowerMeasurement {
2465 // Name of the subsystem (to which the rail belongs).
2466 optional string subsystem_name = 1;
2467
2468 // Rail name. The rail lies within the subsystem.
2469 optional string rail_name = 2;
2470
2471 // Time (in ms since boot) at which the rail energy value was measured.
2472 // This may differ slightly from the time that statsd logs this information.
2473 optional uint64 measurement_timestamp_millis = 3;
2474
2475 // Accumulated energy used via the rail since device boot in uWs.
2476 optional uint64 energy_microwatt_secs = 4;
2477}
2478
2479/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002480 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002481 * Pulls the time the cpu spend on the frequency index. Frequency index
2482 * starts from highest to lowest. The value should be monotonically
2483 * increasing since boot. However, if there is a cpu
2484 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002485 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002486message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002487 optional uint32 cluster = 1;
2488 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002489 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002490}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002491
Chenjie Yu05013b32017-11-21 10:21:41 -08002492/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002493 * Pulls Cpu Time Per Uid.
2494 * Note that isolated process uid time should be attributed to host uids.
2495 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002496message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002497 optional int32 uid = 1 [(is_uid) = true];
Misha Wagner6bc6c912018-11-16 13:19:54 +00002498 optional uint64 user_time_micros = 2;
2499 optional uint64 sys_time_micros = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002500}
2501
2502/**
2503 * Pulls Cpu Time Per Uid per frequency.
2504 * Note that isolated process uid time should be attributed to host uids.
2505 * For each uid, we order the time by descending frequencies.
2506 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002507message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002508 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002509 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002510 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002511}
Hugo Benichi884970e2017-11-14 22:42:46 +09002512
Chenjie Yu05013b32017-11-21 10:21:41 -08002513/**
2514 * Pulls Wifi Controller Activity Energy Info
2515 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002516message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002517 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002518 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002519 // stack reported state
2520 // TODO: replace this with proto enum
2521 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002522 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002523 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002524 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002525 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002526 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002527 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002528 // product of current(mA), voltage(V) and time(ms)
2529 optional uint64 controller_energy_used = 6;
2530}
2531
2532/**
2533 * Pulls Modem Activity Energy Info
2534 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002535message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002536 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002537 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002538 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002539 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002540 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002541 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002542 /**
2543 * Tx power index
2544 * index 0 = tx_power < 0dBm
2545 * index 1 = 0dBm < tx_power < 5dBm
2546 * index 2 = 5dBm < tx_power < 15dBm
2547 * index 3 = 15dBm < tx_power < 20dBm
2548 * index 4 = tx_power > 20dBm
2549 */
2550 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002551 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002552 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002553 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002554 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002555 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002556 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002557 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002558 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002559 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002560 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002561 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002562 // product of current(mA), voltage(V) and time(ms)
2563 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002564}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002565
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002566/**
2567 * Pulls Bluetooth Activity Energy Info
2568 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2569 */
2570message BluetoothActivityInfo {
2571 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002572 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002573 // bluetooth stack state
2574 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002575 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002576 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002577 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002578 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002579 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002580 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002581 // product of current(mA), voltage(V) and time(ms)
2582 optional uint64 energy_used = 6;
2583}
2584
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002585/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002586 * Logs the memory stats for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002587 *
2588 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002589 */
2590message ProcessMemoryState {
2591 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002592 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002593
2594 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002595 // Usually package name, "system" for system server.
2596 // Provided by ActivityManagerService.
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002597 optional string process_name = 2;
2598
Rafal Slawikda51b932018-12-13 16:31:33 +00002599 // Current OOM score adjustment. Value read from ProcessRecord.
Yangster-maca8a30442018-10-13 23:46:34 -07002600 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002601
2602 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002603 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002604
2605 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002606 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002607
Rajeev Kumar90235992018-01-29 11:06:48 -08002608 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002609 // Value is read from /proc/PID/stat, field 24. Or from memory.stat, field
2610 // total_rss if per-app memory cgroups are enabled.
Rajeev Kumar90235992018-01-29 11:06:48 -08002611 optional int64 rss_in_bytes = 6;
2612
2613 // CACHE
Rafal Slawikda51b932018-12-13 16:31:33 +00002614 // Value is read from memory.stat, field total_cache if per-app memory
2615 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002616 optional int64 cache_in_bytes = 7;
2617
2618 // SWAP
Rafal Slawikda51b932018-12-13 16:31:33 +00002619 // Value is read from memory.stat, field total_swap if per-app memory
2620 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002621 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002622
Rafal Slawikd03ae422018-11-20 11:27:45 +00002623 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002624 optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
Rafal Slawik272a8162018-11-01 15:12:28 +00002625
2626 // Elapsed real time when the process started.
2627 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2628 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002629}
2630
2631/*
Rafal Slawik08621582018-10-15 14:53:07 +01002632 * Logs the memory stats for a native process (from procfs).
Rafal Slawikda51b932018-12-13 16:31:33 +00002633 *
2634 * Pulled from StatsCompanionService for selected native processes.
Rafal Slawik08621582018-10-15 14:53:07 +01002635 */
2636message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002637 // The uid if available. -1 means not available.
2638 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002639
Rafal Slawikbf67d072018-10-23 11:07:54 +01002640 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002641 // Value read from /proc/PID/cmdline.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002642 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002643
Rafal Slawikbf67d072018-10-23 11:07:54 +01002644 // # of page-faults
2645 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002646
Rafal Slawikbf67d072018-10-23 11:07:54 +01002647 // # of major page-faults
2648 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002649
Rafal Slawikbf67d072018-10-23 11:07:54 +01002650 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002651 // Value read from /proc/PID/stat, field 24.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002652 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002653
Rafal Slawikd03ae422018-11-20 11:27:45 +00002654 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002655 optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
Rafal Slawikbf67d072018-10-23 11:07:54 +01002656
2657 // Elapsed real time when the process started.
2658 // Value is read from /proc/PID/stat, field 22.
2659 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002660}
2661
2662/*
Rafal Slawik3bea8952018-11-15 12:39:33 +00002663 * Logs the memory high-water mark for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002664 *
2665 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
2666 * and for selected native processes.
Rafal Slawik44b88142018-12-15 16:48:09 +00002667 *
2668 * Pulling this atom resets high-water mark counters for all processes.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002669 */
2670message ProcessMemoryHighWaterMark {
2671 // The uid if available. -1 means not available.
2672 optional int32 uid = 1 [(is_uid) = true];
2673
Rafal Slawikda51b932018-12-13 16:31:33 +00002674 // The process name.
2675 // Usually package name or process cmdline.
2676 // Provided by ActivityManagerService or read from /proc/PID/cmdline.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002677 optional string process_name = 2;
2678
2679 // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
2680 // /proc/PID/status.
2681 optional int64 rss_high_water_mark_in_bytes = 3;
2682}
2683
2684/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002685 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002686 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002687message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002688 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002689}
2690
2691/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002692 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002693 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002694message SystemUptime {
2695 // Milliseconds since the system was booted.
2696 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2697 // for external input).
2698 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002699 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002700}
2701
2702/*
2703 * Reads from /proc/uid_concurrent_active_time which has the format:
2704 * active: X (X is # cores)
2705 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2706 * [uid1]: [time-0] [time-1] [time-2] ... ...
2707 * ...
2708 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2709 * The file contains a monotonically increasing count of time for a single boot.
2710 */
2711message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002712 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002713 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002714}
2715
2716/**
2717 * Reads from /proc/uid_concurrent_policy_time which has the format:
2718 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2719 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2720 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2721 * ...
2722 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2723 * The file contains a monotonically increasing count of time for a single boot.
2724 */
2725message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002726 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002727 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002728 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002729}
2730
2731/*
2732 * Pulls free disk space, for data, system partition and temporary directory.
2733 */
2734message DiskSpace {
2735 // available bytes in data partition
2736 optional uint64 data_available_bytes = 1;
2737 // available bytes in system partition
2738 optional uint64 system_available_bytes = 2;
2739 // available bytes in download cache or temp directories
2740 optional uint64 temp_available_bytes = 3;
2741}
Tej Singhbf972d92018-01-10 20:51:13 -08002742
2743/**
2744 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002745 * Pulled from:
2746 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002747 */
2748message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002749 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002750}
2751
2752/**
2753 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002754 * Pulled from:
2755 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002756 */
2757message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002758 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002759}
2760
2761/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002762 * Pulls battery voltage.
2763 * Pulled from:
2764 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2765 */
2766message BatteryVoltage {
2767 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002768 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002769}
2770
2771/**
Tej Singhb1dbc8b2018-11-19 15:49:47 -08002772 * Pulls battery level (percent full, from 0 to 100).
2773 *
2774 * Pulled from:
2775 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2776 */
2777message BatteryLevel {
2778 // Battery level. Should be in [0, 100].
2779 optional int32 battery_level = 1;
2780}
2781
2782/**
Tej Singhd89137e2018-03-26 14:51:40 -07002783 * Pulls the temperature of various parts of the device.
2784 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002785 *
2786 * Pulled from:
2787 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2788 */
2789message Temperature {
2790 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2791 optional android.os.TemperatureTypeEnum sensor_location = 1;
2792
2793 // The name of the temperature source. Eg. CPU0
2794 optional string sensor_name = 2;
2795
Tej Singhd89137e2018-03-26 14:51:40 -07002796 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002797 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002798}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002799
2800/**
2801 * Pulls the statistics of calls to Binder.
2802 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002803 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2804 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002805 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002806 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002807 */
2808message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002809 // UID of the process responsible for the binder transaction. It will be set if the process
2810 // executing the binder transaction attribute the transaction to another uid using
2811 // Binder.setThreadWorkSource().
2812 //
2813 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002814 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002815 // UID of the process executing the binder transaction.
2816 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002817 // Fully qualified class name of the API call.
2818 //
2819 // This is a system server class name.
2820 //
2821 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2822 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2823 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2824 // commonly used APIs.
2825 optional string service_class_name = 2;
2826 // Method name of the API call. It can also be a transaction code if we cannot
2827 // resolve it to a name. See Binder#getTransactionName.
2828 //
2829 // This is a system server method name.
2830 optional string service_method_name = 3;
2831 // Total number of API calls.
2832 optional int64 call_count = 4;
2833 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2834 optional bool screen_interactive = 13;
2835 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2836 // call_count will be equal to recorded_call_count.
2837 //
2838 // If recorded_call_count is different than call_count, it means data collection has been
2839 // sampled. All the fields below will be sampled in this case.
2840 optional int64 recorded_call_count = 12;
2841 // Number of exceptions thrown by the API.
2842 optional int64 recorded_exception_count = 5;
2843 // Total latency of all API calls.
2844 // Average can be computed using total_latency_micros / recorded_call_count.
2845 optional int64 recorded_total_latency_micros = 6;
2846 // Maximum latency of one API call.
2847 optional int64 recorded_max_latency_micros = 7;
2848 // Total CPU usage of all API calls.
2849 // Average can be computed using total_cpu_micros / recorded_call_count.
2850 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2851 optional int64 recorded_total_cpu_micros = 8;
2852 // Maximum CPU usage of one API call.
2853 optional int64 recorded_max_cpu_micros = 9;
2854 // Maximum parcel reply size of one API call.
2855 optional int64 recorded_max_reply_size_bytes = 10;
2856 // Maximum parcel request size of one API call.
2857 optional int64 recorded_max_request_size_bytes = 11;
2858}
2859
2860/**
2861 * Pulls the statistics of exceptions during calls to Binder.
2862 *
2863 * Binder stats are cumulative from boot unless somebody reset the data using
2864 * > adb shell dumpsys binder_calls_stats --reset
2865 */
2866message BinderCallsExceptions {
2867 // Exception class name, e.g. java.lang.IllegalArgumentException.
2868 //
2869 // This is an exception class name thrown by the system server.
2870 optional string exception_class_name = 1;
2871 // Total number of exceptions.
2872 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002873}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002874
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002875/**
2876 * Pulls the statistics of message dispatching on HandlerThreads.
2877 *
2878 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2879 * config on the device.
2880 *
2881 * Next tag: 11
2882 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002883message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002884 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002885 optional int32 uid = 1 [(is_uid) = true];
2886
2887 // Fully qualified class name of the handler target class.
2888 //
2889 // This field does not contain PII. This is a system server class name.
2890 optional string handler_class_name = 2;
2891
2892 // The name of the thread that runs the Looper.
2893 //
2894 // This field does not contain PII. This is a system server thread name.
2895 optional string looper_thread_name = 3;
2896
2897 // The name of the dispatched message.
2898 //
2899 // This field does not contain PII. This is a system server constant or class
2900 // name.
2901 optional string message_name = 4;
2902
2903 // Total number of successfully dispatched messages.
2904 optional int64 message_count = 5;
2905
2906 // Total number of messages that failed dispatching.
2907 optional int64 exception_count = 6;
2908
2909 // Total number of processed messages we have data recorded for. If we
2910 // collected data for all the messages, message_count will be equal to
2911 // recorded_message_count.
2912 //
2913 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002914 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002915 optional int64 recorded_message_count = 7;
2916
2917 // Total latency of all processed messages.
2918 // Average can be computed using recorded_total_latency_micros /
2919 // recorded_message_count.
2920 optional int64 recorded_total_latency_micros = 8;
2921
2922 // Total CPU usage of all processed message.
2923 // Average can be computed using recorded_total_cpu_micros /
2924 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002925 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002926 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002927
2928 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2929 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002930
2931 // Max recorded CPU usage of all processed messages.
2932 optional int64 recorded_max_cpu_micros = 11;
2933
2934 // Max recorded latency of all processed messages.
2935 optional int64 recorded_max_latency_micros = 12;
2936
2937 // Total number of messages we tracked the dispatching delay for. If we
2938 // collected data for all the messages, message_count will be equal to
2939 // recorded_delay_message_count.
2940 //
2941 // If recorded_delay_message_count is different than message_count, it means data
2942 // collection has been sampled or/and not all messages specified the target dispatch time.
2943 // The fields below will be sampled in this case.
2944 optional int64 recorded_delay_message_count = 13;
2945
2946 // Total dispatching delay of all processed messages.
2947 // Calculated as a difference between the target dispatching time (Message.when)
2948 // and the actual dispatching time.
2949 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2950 optional int64 recorded_total_delay_millis = 14;
2951
2952 // Max dispatching delay of all processed messages.
2953 // Calculated as a difference between the target dispatching time (Message.when)
2954 // and the actual dispatching time.
2955 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002956}
Tej Singh86dc9db2018-09-06 00:39:57 +00002957
2958/**
2959 * Pulls disk information, such as write speed and latency.
2960 */
2961message DiskStats {
2962 // Time taken to open, write 512B to, and close a file.
2963 // -1 if error performing the check.
2964 optional int64 data_write_latency_millis = 1;
2965
2966 optional bool file_based_encryption = 2;
2967
2968 // Recent disk write speed in kB/s.
2969 // -1 if error querying storageed.
2970 // 0 if data is unavailable.
2971 optional int32 recent_disk_write_speed = 3;
2972}
2973
2974
2975/**
2976 * Free and total bytes of the Data, Cache, and System partition.
2977 */
2978message DirectoryUsage {
2979 enum Directory {
2980 UNKNOWN = 0;
2981 DATA = 1;
2982 CACHE = 2;
2983 SYSTEM = 3;
2984 }
2985 optional Directory directory = 1;
2986 optional int64 free_bytes = 2;
2987 optional int64 total_bytes = 3;
2988}
2989
2990
2991/**
2992 * Size of an application: apk size, data size, and cache size.
2993 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2994 * Information is only reported for apps with the primary user (user 0).
2995 * Sizes are aggregated by package name.
2996 */
2997message AppSize {
2998 // Including uids will involve modifying diskstats logic.
2999 optional string package_name = 1;
3000 // App size in bytes. -1 if unavailable.
3001 optional int64 app_size_bytes = 2;
3002 // App data size in bytes. -1 if unavailable.
3003 optional int64 app_data_size_bytes = 3;
3004 // App cache size in bytes. -1 if unavailable.
3005 optional int64 app_cache_size_bytes = 4;
3006 // Time that the cache file was produced.
3007 // Uses System.currentTimeMillis(), which is wall clock time.
3008 optional int64 cache_time_millis = 5;
3009}
3010
3011
3012/**
3013 * Size of a particular category. Eg: photos, videos.
3014 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
3015 */
3016message CategorySize {
3017 enum Category {
3018 UNKNOWN = 0;
3019 APP_SIZE = 1;
3020 APP_DATA_SIZE = 2;
3021 APP_CACHE_SIZE = 3;
3022 PHOTOS = 4;
3023 VIDEOS = 5;
3024 AUDIO = 6;
3025 DOWNLOADS = 7;
3026 SYSTEM = 8;
3027 OTHER = 9;
3028 }
3029 optional Category category = 1;
3030 // Category size in bytes.
3031 optional int64 size_bytes = 2;
3032 // Time that the cache file was produced.
3033 // Uses System.currentTimeMillis(), which is wall clock time.
3034 optional int64 cache_time_millis = 3;
3035}
Tej Singhd6d6d772018-09-05 17:41:25 -07003036
3037/**
Tej Singhe7726dc2018-09-21 11:42:12 -07003038 * Pulls per uid I/O stats. The stats are cumulative since boot.
3039 *
3040 * Read/write bytes are I/O events from a storage device
3041 * Read/write chars are data requested by read/write syscalls, and can be
3042 * satisfied by caching.
3043 *
3044 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
3045 */
3046message DiskIo {
3047 optional int32 uid = 1 [(is_uid) = true];
3048 optional int64 fg_chars_read = 2;
3049 optional int64 fg_chars_write = 3;
3050 optional int64 fg_bytes_read = 4;
3051 optional int64 fg_bytes_write = 5;
3052 optional int64 bg_chars_read = 6;
3053 optional int64 bg_chars_write = 7;
3054 optional int64 bg_bytes_read = 8;
3055 optional int64 bg_bytes_write = 9;
3056 optional int64 fg_fsync = 10;
3057 optional int64 bg_fsync= 11;
3058}
3059
3060
3061/**
Tej Singhd6d6d772018-09-05 17:41:25 -07003062 * Pulls the number of fingerprints for each user.
3063 *
3064 * Pulled from StatsCompanionService, which queries FingerprintManager.
3065 */
3066message NumFingerprints {
3067 // The associated user. Eg: 0 for owners, 10+ for others.
3068 // Defined in android/os/UserHandle.java
3069 optional int32 user = 1;
3070 // Number of fingerprints registered to that user.
3071 optional int32 num_fingerprints = 2;
3072}
Chenjie Yu12e5e672018-09-14 15:54:59 -07003073
Yangsteraf9aee72018-10-12 09:26:16 -07003074message AggStats {
3075 optional int64 min = 1;
3076
3077 optional int64 average = 2;
3078
3079 optional int64 max = 3;
3080}
3081
3082message ProcessStatsStateProto {
3083 optional android.service.procstats.ScreenState screen_state = 1;
3084
3085 optional android.service.procstats.MemoryState memory_state = 2;
3086
3087 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
3088 // and not frameworks/base/core/java/android/app/ActivityManager.java
3089 optional android.service.procstats.ProcessState process_state = 3;
3090
3091 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003092 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003093
3094 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003095 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07003096
3097 // # of samples taken
3098 optional int32 sample_size = 5;
3099
3100 // PSS is memory reserved for this process
3101 optional AggStats pss = 6;
3102
3103 // USS is memory shared between processes, divided evenly for accounting
3104 optional AggStats uss = 7;
3105
3106 // RSS is memory resident for this process
3107 optional AggStats rss = 8;
3108}
3109
3110// Next Tag: 7
3111message ProcessStatsProto {
3112 // Name of process.
3113 optional string process = 1;
3114
3115 // Uid of the process.
3116 optional int32 uid = 2;
3117
3118 // Information about how often kills occurred
3119 message Kill {
3120 // Count of excessive CPU kills
3121 optional int32 cpu = 1;
3122
3123 // Count of kills when cached
3124 optional int32 cached = 2;
3125
3126 // PSS stats during cached kill
3127 optional AggStats cached_pss = 3;
3128 }
3129 optional Kill kill = 3;
3130
3131 // Time and memory spent in various states.
3132 repeated ProcessStatsStateProto states = 5;
3133
3134 // Total time process has been running... screen_state, memory_state, and process_state
3135 // will not be set.
3136 optional ProcessStatsStateProto total_running_state = 6;
3137}
3138
3139message PackageServiceOperationStatsProto {
3140 // Operate enum: Started, Foreground, Bound, Executing
3141 optional android.service.procstats.ServiceOperationState operation = 1;
3142
3143 // Number of times the service was in this operation.
3144 optional int32 count = 2;
3145
3146 // Information about a state the service can be in.
3147 message StateStats {
3148 // Screen state enum.
3149 optional android.service.procstats.ScreenState screen_state = 1;
3150 // Memory state enum.
3151 optional android.service.procstats.MemoryState memory_state = 2;
3152
3153 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003154 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003155 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003156 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003157 }
3158 repeated StateStats state_stats = 3;
3159}
3160
3161message PackageServiceStatsProto {
3162 // Name of service component.
3163 optional string service_name = 1;
3164
3165 // The operation stats.
3166 // The package_name, package_uid, package_version, service_name will not be set to save space.
3167 repeated PackageServiceOperationStatsProto operation_stats = 2;
3168}
3169
3170message PackageAssociationSourceProcessStatsProto {
3171 // Uid of the process.
3172 optional int32 process_uid = 1;
3173 // Process name.
3174 optional string process_name = 2;
3175
3176 // Total count of the times this association appeared.
3177 optional int32 total_count = 3;
3178
3179 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003180 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003181
3182 // Total count of the times this association became actively impacting its target process.
3183 optional int32 active_count = 5;
3184
3185 // Information on one source in this association.
3186 message StateStats {
3187 // Process state enum.
3188 optional android.service.procstats.ProcessState process_state = 1;
3189 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003190 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003191 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003192 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003193 }
3194 repeated StateStats active_state_stats = 6;
3195}
3196
3197message PackageAssociationProcessStatsProto {
3198 // Name of the target component.
3199 optional string component_name = 1;
3200 // Information on one source in this association.
3201 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3202}
3203
3204
3205message ProcessStatsPackageProto {
3206 // Name of package.
3207 optional string package = 1;
3208
3209 // Uid of the package.
3210 optional int32 uid = 2;
3211
3212 // Version of the package.
3213 optional int64 version = 3;
3214
3215 // Stats for each process running with the package loaded in to it.
3216 repeated ProcessStatsProto process_stats = 4;
3217
3218 // Stats for each of the package's services.
3219 repeated PackageServiceStatsProto service_stats = 5;
3220
3221 // Stats for each association with the package.
3222 repeated PackageAssociationProcessStatsProto association_stats = 6;
3223}
3224
3225message ProcessStatsSectionProto {
3226 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003227 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003228
3229 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003230 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003231
3232 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003233 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003234
3235 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003236 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003237
3238 // System runtime library. e.g. "libdvm.so", "libart.so".
3239 optional string runtime = 5;
3240
3241 // whether kernel reports swapped pss.
3242 optional bool has_swapped_pss = 6;
3243
3244 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3245 enum Status {
3246 STATUS_UNKNOWN = 0;
3247 STATUS_COMPLETE = 1;
3248 STATUS_PARTIAL = 2;
3249 STATUS_SHUTDOWN = 3;
3250 STATUS_SYSPROPS = 4;
3251 }
3252 repeated Status status = 7;
3253
3254 // Stats for each process.
3255 repeated ProcessStatsProto process_stats = 8;
3256
3257 // Stats for each package.
3258 repeated ProcessStatsPackageProto package_stats = 9;
3259}
3260
Chenjie Yu12e5e672018-09-14 15:54:59 -07003261/**
3262 * Pulled from ProcessStatsService.java
3263 */
3264message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003265 optional ProcessStatsSectionProto proc_stats_section = 1;
3266}
3267
3268message PowerProfileProto {
3269 optional double cpu_suspend = 1;
3270
3271 optional double cpu_idle = 2;
3272
3273 optional double cpu_active = 3;
3274
3275 message CpuCluster {
3276 optional int32 id = 1;
3277 optional double cluster_power = 2;
3278 optional int32 cores = 3;
3279 repeated int64 speed = 4;
3280 repeated double core_power = 5;
3281 }
3282
3283 repeated CpuCluster cpu_cluster = 40;
3284
3285 optional double wifi_scan = 4;
3286
3287 optional double wifi_on = 5;
3288
3289 optional double wifi_active = 6;
3290
3291 optional double wifi_controller_idle = 7;
3292
3293 optional double wifi_controller_rx = 8;
3294
3295 optional double wifi_controller_tx = 9;
3296
3297 repeated double wifi_controller_tx_levels = 10;
3298
3299 optional double wifi_controller_operating_voltage = 11;
3300
3301 optional double bluetooth_controller_idle = 12;
3302
3303 optional double bluetooth_controller_rx = 13;
3304
3305 optional double bluetooth_controller_tx = 14;
3306
3307 optional double bluetooth_controller_operating_voltage = 15;
3308
3309 optional double modem_controller_sleep = 16;
3310
3311 optional double modem_controller_idle = 17;
3312
3313 optional double modem_controller_rx = 18;
3314
3315 repeated double modem_controller_tx = 19;
3316
3317 optional double modem_controller_operating_voltage = 20;
3318
3319 optional double gps_on = 21;
3320
3321 repeated double gps_signal_quality_based = 22;
3322
3323 optional double gps_operating_voltage = 23;
3324
3325 optional double bluetooth_on = 24;
3326
3327 optional double bluetooth_active = 25;
3328
3329 optional double bluetooth_at_cmd = 26;
3330
3331 optional double ambient_display = 27;
3332
3333 optional double screen_on = 28;
3334
3335 optional double radio_on = 29;
3336
3337 optional double radio_scanning = 30;
3338
3339 optional double radio_active = 31;
3340
3341 optional double screen_full = 32;
3342
3343 optional double audio = 33;
3344
3345 optional double video = 34;
3346
3347 optional double flashlight = 35;
3348
3349 optional double memory = 36;
3350
3351 optional double camera = 37;
3352
3353 optional double wifi_batched_scan = 38;
3354
3355 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003356}
Chenjie Yuab530202018-09-26 12:39:20 -07003357
3358/**
3359 * power_profile.xml and other constants for power model calculations.
3360 * Pulled from PowerProfile.java
3361 */
3362message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003363 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003364}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003365
3366/**
arangelovd5db50e2018-10-12 20:24:39 +01003367 * Logs when a user restriction was added or removed.
3368 *
3369 * Logged from:
3370 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3371 */
3372message UserRestrictionChanged {
3373 // The raw string of the user restriction as defined in UserManager.
3374 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3375 optional string restriction = 1;
3376 // Whether the restriction is enabled or disabled.
3377 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003378}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003379
3380/**
3381 * Pulls process user time and system time. Puller takes a snapshot of all pids
3382 * in the system and returns cpu stats for those that are working at the time.
3383 * Dead pids will be dropped. Kernel processes are excluded.
3384 * Min cool-down is 5 sec.
3385 */
3386message ProcessCpuTime {
3387 optional int32 uid = 1 [(is_uid) = true];
3388
3389 optional string process_name = 2;
3390 // Process cpu time in user space, cumulative from boot/process start
3391 optional int64 user_time_millis = 3;
3392 // Process cpu time in system space, cumulative from boot/process start
3393 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003394}
Misha Wagner5a51e002018-10-03 15:04:09 +01003395
3396/**
3397 * Pulls the CPU usage for each thread.
3398 *
3399 * Read from /proc/$PID/task/$TID/time_in_state files.
3400 *
3401 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3402 * time_in_state files not being present on some phones, have not been addressed. These should be
3403 * considered before a public release.
3404 */
3405message CpuTimePerThreadFreq {
3406 // UID that owns the process.
3407 optional int32 uid = 1 [(is_uid) = true];
3408 // ID of the process.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003409 optional int32 process_id = 2;
Misha Wagner5a51e002018-10-03 15:04:09 +01003410 // ID of the thread.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003411 optional int32 thread_id = 3;
Misha Wagner5a51e002018-10-03 15:04:09 +01003412 // Name of the process taken from `/proc/$PID/cmdline`.
3413 optional string process_name = 4;
3414 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3415 optional string thread_name = 5;
Misha Wagnerfde69582018-11-28 13:26:32 +00003416
3417 // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
3418 // are given in KHz, and time is given in milliseconds since the thread started. All eight
3419 // frequencies are given here as the alternative is sending eight separate atoms. This method
3420 // significantly reduces the amount of data created
3421 optional int32 frequency1_khz = 6;
3422 optional int32 time1_millis = 7;
3423 optional int32 frequency2_khz = 8;
3424 optional int32 time2_millis = 9;
3425 optional int32 frequency3_khz = 10;
3426 optional int32 time3_millis = 11;
3427 optional int32 frequency4_khz = 12;
3428 optional int32 time4_millis = 13;
3429 optional int32 frequency5_khz = 14;
3430 optional int32 time5_millis = 15;
3431 optional int32 frequency6_khz = 16;
3432 optional int32 time6_millis = 17;
3433 optional int32 frequency7_khz = 18;
3434 optional int32 time7_millis = 19;
3435 optional int32 frequency8_khz = 20;
3436 optional int32 time8_millis = 21;
Misha Wagner5a51e002018-10-03 15:04:09 +01003437}
Bookatz75ee6042018-11-09 12:27:37 -08003438
3439/**
Bookatz366a4432018-11-20 09:42:33 -08003440 * Pulls information about the device's build.
3441 */
3442message BuildInformation {
3443 // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
3444 // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
3445 optional string fingerprint = 1;
3446
3447 // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
3448 optional string brand = 2;
3449
3450 // Build.PRODUCT. The name of the overall product.
3451 optional string product = 3;
3452
3453 // Build.DEVICE. The name of the industrial design.
3454 optional string device = 4;
3455
3456 // Build.VERSION.RELEASE. The user-visible version string. E.g., "1.0" or "3.4b5" or "bananas".
3457 optional string version_release = 5;
3458
3459 // Build.ID. E.g. a label like "M4-rc20".
3460 optional string id = 6;
3461
3462 // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
3463 // represent this build.
3464 optional string version_incremental = 7;
3465
3466 // Build.TYPE. The type of build, like "user" or "eng".
3467 optional string type = 8;
3468
3469 // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
3470 optional string tags = 9;
3471}
3472
3473/**
Bookatz75ee6042018-11-09 12:27:37 -08003474 * Pulls on-device BatteryStats power use calculations for the overall device.
3475 */
3476message DeviceCalculatedPowerUse {
Bookatz3dbc13a2018-12-21 12:16:51 -08003477 // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3478 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3479 // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3480 optional int64 computed_power_nano_amp_secs = 1;
Bookatz75ee6042018-11-09 12:27:37 -08003481}
3482
3483/**
3484 * Pulls on-device BatteryStats power use calculations broken down by uid.
3485 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3486 * that is attributed to non-uid items. They must all be included to get the total power use.
3487 */
3488message DeviceCalculatedPowerBlameUid {
3489 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3490 optional int32 uid = 1 [(is_uid) = true];
3491
Bookatz3dbc13a2018-12-21 12:16:51 -08003492 // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3493 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3494 optional int64 power_nano_amp_secs = 2;
Bookatz75ee6042018-11-09 12:27:37 -08003495}
3496
3497/**
3498 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3499 * drain type.
3500 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3501 * is attributed uids. They must all be included to get the total power use.
3502 */
3503message DeviceCalculatedPowerBlameOther {
3504 // The type of item whose power use is being reported.
3505 enum DrainType {
3506 AMBIENT_DISPLAY = 0;
3507 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3508 BLUETOOTH = 2;
3509 CAMERA = 3;
3510 // Cell-standby
3511 CELL = 4;
3512 FLASHLIGHT = 5;
3513 IDLE = 6;
3514 MEMORY = 7;
3515 // Amount that total computed drain exceeded the drain estimated using the
3516 // battery level changes and capacity.
3517 OVERCOUNTED = 8;
3518 PHONE = 9;
3519 SCREEN = 10;
3520 // Amount that total computed drain was below the drain estimated using the
3521 // battery level changes and capacity.
3522 UNACCOUNTED = 11;
3523 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3524 WIFI = 13;
3525 }
3526 optional DrainType drain_type = 1;
3527
Bookatz3dbc13a2018-12-21 12:16:51 -08003528 // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
3529 // BatteryStats last reset (i.e. roughly since device was last significantly charged).
3530 optional int64 power_nano_amp_secs = 2;
Rafal Slawik3bea8952018-11-15 12:39:33 +00003531}
arangelov4e994062018-11-13 16:12:38 +00003532
3533/**
3534 * Logs device policy features.
3535 *
3536 * Logged from:
3537 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3538 * packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
3539 */
3540message DevicePolicyEvent {
3541 // The event id - unique for each event.
3542 optional android.stats.devicepolicy.EventId event_id = 1;
3543 // The admin package name.
3544 optional string admin_package_name = 2;
3545 // A generic integer parameter.
3546 optional int32 integer_value = 3;
3547 // A generic boolean parameter.
3548 optional bool boolean_value = 4;
3549 // A parameter specifying a time period in milliseconds.
3550 optional uint64 time_period_millis = 5;
3551 // A parameter specifying a list of package names, bundle extras or string parameters.
3552 optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
3553}
shawnlinea5b66b2018-11-13 15:05:29 +08003554
3555/**
3556 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
3557 *
3558 * Logged from:
3559 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3560 */
3561message DocsUILaunchReported {
3562 optional android.stats.docsui.LaunchAction launch_action = 1;
3563 optional bool has_initial_uri = 2;
3564 optional android.stats.docsui.MimeType mime_type = 3;
3565 optional android.stats.docsui.Root initial_root = 4;
3566}
3567
3568/**
3569 * Logs root/app visited event in file managers/picker. Call this when the user
3570 * taps on root/app in hamburger menu.
3571 *
3572 * Logged from:
3573 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3574 */
3575message DocsUIRootVisitedReported {
3576 optional android.stats.docsui.ContextScope scope = 1;
3577 optional android.stats.docsui.Root root = 2;
3578}
3579
3580/**
3581 * Logs file operation stats. Call this when a file operation has completed.
3582 *
3583 * Logged from:
3584 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3585 */
3586message DocsUIFileOperationReported {
3587 optional android.stats.docsui.Provider provider = 1;
3588 optional android.stats.docsui.FileOperation file_op = 2;
3589}
3590
3591/**
3592 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
3593 * mode.
3594 *
3595 * Logged from:
3596 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3597 */
3598message DocsUIFileOperationCopyMoveModeReported {
3599 optional android.stats.docsui.FileOperation file_op = 1;
3600 optional android.stats.docsui.CopyMoveOpMode mode = 2;
3601}
3602
3603
3604/**
3605 * Logs file sub operation stats. Call this when a file operation has failed.
3606 *
3607 * Logged from:
3608 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3609 */
3610message DocsUIFileOperationFailureReported {
3611 optional android.stats.docsui.Authority authority = 1;
3612 optional android.stats.docsui.SubFileOperation sub_op = 2;
3613}
3614
3615/**
3616* Logs the cancellation of a file operation. Call this when a job is canceled
3617*
3618* Logged from:
3619* package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3620*/
3621message DocsUIFileOperationCanceledReported {
3622 optional android.stats.docsui.FileOperation file_op = 1;
3623}
3624
3625/**
3626 * Logs startup time in milliseconds.
3627 *
3628 * Logged from:
3629 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3630 */
3631message DocsUIStartupMsReported {
3632 optional int32 startup_millis = 1;
3633}
3634
3635/**
3636 * Logs the action that was started by user.
3637 *
3638 * Logged from:
3639 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3640 */
3641message DocsUIUserActionReported {
3642 optional android.stats.docsui.UserAction action = 1;
3643}
3644
3645/**
3646 * Logs the invalid type when invalid scoped access is requested.
3647 *
3648 * Logged from:
3649 * package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
3650 */
3651message DocsUIInvalidScopedAccessRequestReported {
3652 optional android.stats.docsui.InvalidScopedAccess type = 1;
Rafal Slawikda51b932018-12-13 16:31:33 +00003653}
Ben Murdochbab399f2018-12-06 11:01:38 +00003654
3655/**
3656 * Logs when an app's memory is compacted.
3657 *
3658 * Logged from:
3659 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3660 */
3661message AppCompacted {
3662 // The pid of the process being compacted.
3663 optional int32 pid = 1;
3664
3665 // The name of the process being compacted.
3666 optional string process_name = 2;
3667
3668 // The type of compaction.
3669 enum Action {
3670 UNKNOWN = 0;
3671 SOME = 1;
3672 FULL = 2;
3673 }
Ben Murdoch01720b82018-12-19 18:03:44 +00003674 optional Action action = 3;
Ben Murdochbab399f2018-12-06 11:01:38 +00003675
3676 // Total RSS in kilobytes consumed by the process prior to compaction.
3677 optional int64 before_rss_total_kilobytes = 4;
3678
3679 // File RSS in kilobytes consumed by the process prior to compaction.
3680 optional int64 before_rss_file_kilobytes = 5;
3681
3682 // Anonymous RSS in kilobytes consumed by the process prior to compaction.
3683 optional int64 before_rss_anon_kilobytes = 6;
3684
3685 // Swap in kilobytes consumed by the process prior to compaction.
3686 optional int64 before_swap_kilobytes = 7;
3687
3688 // Total RSS in kilobytes consumed by the process after compaction.
3689 optional int64 after_rss_total_kilobytes = 8;
3690
3691 // File RSS in kilobytes consumed by the process after compaction.
3692 optional int64 after_rss_file_kilobytes = 9;
3693
3694 // Anonymous RSS in kilobytes consumed by the process after compaction.
3695 optional int64 after_rss_anon_kilobytes = 10;
3696
3697 // Swap in kilobytes consumed by the process after compaction.
3698 optional int64 after_swap_kilobytes = 11;
3699
3700 // The time taken to perform compaction in milliseconds.
3701 optional int64 time_to_compact_millis = 12;
3702
3703 // The last compaction action performed for this app.
3704 optional Action last_action = 13;
3705
Ben Murdoch01720b82018-12-19 18:03:44 +00003706 // The last time that compaction was attempted on this process in milliseconds
3707 // since boot, not including sleep (see SystemClock.uptimeMillis()).
3708 optional int64 last_compact_timestamp_ms_since_boot = 14;
Ben Murdochbab399f2018-12-06 11:01:38 +00003709
Ben Murdoch01720b82018-12-19 18:03:44 +00003710 // The oom_score_adj at the time of compaction.
3711 optional int32 oom_score_adj = 15;
Ben Murdochbab399f2018-12-06 11:01:38 +00003712
3713 // The process state at the time of compaction.
3714 optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
3715}
lifr157fc552018-12-12 16:38:04 +08003716
3717/**
3718 * Logs the latency period(in microseconds) and the return code of
3719 * the DNS(Domain Name System) lookups.
3720 * These 4 methods(GETADDRINFO,GETHOSTBYNAME,GETHOSTBYADDR,RES_NSEND)
3721 * to get info(address or hostname) from DNS server(or DNS cache).
3722 * Logged from:
3723 * /system/netd/server/DnsProxyListener.cpp
3724 */
3725message NetworkDnsEventReported {
3726 // The types of the DNS lookups, as defined in
3727 //system/netd/server/binder/android/net/metrics/INetdEventListener.aidl
3728 enum EventType {
3729 EVENT_UNKNOWN = 0;
3730 EVENT_GETADDRINFO = 1;
3731 EVENT_GETHOSTBYNAME = 2;
3732 EVENT_GETHOSTBYADDR = 3;
3733 EVENT_RES_NSEND = 4;
3734 }
3735 optional EventType event_type = 1;
3736
3737 // The return value of the DNS resolver for each DNS lookups.
3738 //bionic/libc/include/netdb.h
3739 //system/netd/resolv/include/netd_resolv/resolv.h
3740 enum ReturnCode {
3741 EAI_NOERR = 0;
3742 EAI_ADDRFAMILY = 1;
3743 EAI_AGAIN = 2;
3744 EAI_BADFLAGS = 3;
3745 EAI_FAIL = 4;
3746 EAI_FAMILY = 5;
3747 EAI_MEMORY = 6;
3748 EAI_NODATA = 7;
3749 EAI_NONAME = 8;
3750 EAI_SERVICE = 9;
3751 EAI_SOCKTYPE = 10;
3752 EAI_SYSTEM = 11;
3753 EAI_BADHINTS = 12;
3754 EAI_PROTOCOL = 13;
3755 EAI_OVERFLOW = 14;
3756 RESOLV_TIMEOUT = 255;
3757 EAI_MAX = 256;
3758 }
3759 optional ReturnCode return_code = 2;
3760
3761 // The latency period(in microseconds) it took for this DNS lookup to complete.
3762 optional int32 latency_micros = 3;
3763}