blob: 0c05be1170d1cedcfcd635a02ce62026a2d70d26 [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;
Yao Chend54f9dd2017-10-17 17:37:48 +0000175 }
David Chenc8a43242017-10-17 16:23:28 -0700176
David Chen6e3e6cb2018-01-03 16:14:06 -0800177 // Pulled events will start at field 10000.
Rafal Slawik3bea8952018-11-15 12:39:33 +0000178 // Next: 10043
David Chenc8a43242017-10-17 16:23:28 -0700179 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800180 WifiBytesTransfer wifi_bytes_transfer = 10000;
181 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
182 MobileBytesTransfer mobile_bytes_transfer = 10002;
183 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800184 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800185 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800186 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800187 CpuTimePerFreq cpu_time_per_freq = 10008;
188 CpuTimePerUid cpu_time_per_uid = 10009;
189 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800190 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800191 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800192 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800193 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800194 SystemElapsedRealtime system_elapsed_realtime = 10014;
195 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800196 CpuActiveTime cpu_active_time = 10016;
197 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000198 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800199 RemainingBatteryCapacity remaining_battery_capacity = 10019;
200 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800201 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100202 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100203 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100204 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000205 DiskStats disk_stats = 10025;
206 DirectoryUsage directory_usage = 10026;
207 AppSize app_size = 10027;
208 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700209 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700210 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700211 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700212 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700213 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700214 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700215 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100216 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100217 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700218 OnDevicePowerMeasurement on_device_power_measurement = 10038;
Bookatz75ee6042018-11-09 12:27:37 -0800219 DeviceCalculatedPowerUse device_calculated_power_use = 10039;
220 DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
221 DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
Rafal Slawik3bea8952018-11-15 12:39:33 +0000222 ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
Tej Singhb1dbc8b2018-11-19 15:49:47 -0800223 BatteryLevel battery_level = 10043;
Bookatz366a4432018-11-20 09:42:33 -0800224 BuildInformation build_information = 10044;
David Chenc8a43242017-10-17 16:23:28 -0700225 }
yroa1fe77c2018-02-26 14:22:54 -0800226
Bookatz76aafcf2018-09-17 16:17:10 -0700227 // DO NOT USE field numbers above 100,000 in AOSP.
228 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
229 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700230}
231
Yao Chend54f9dd2017-10-17 17:37:48 +0000232/**
Yangster-mac20877162017-12-22 17:19:39 -0800233 * This proto represents a node of an attribution chain.
234 * Note: All attribution chains are represented as a repeated field of type
235 * AttributionNode. It is understood that in such arrays, the order is that
236 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000237 */
Yangster-mac20877162017-12-22 17:19:39 -0800238message AttributionNode {
239 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800240 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800241
Yangster-mac20877162017-12-22 17:19:39 -0800242 // The (optional) string tag for an element in the attribution chain. If the
243 // element has no tag, it is encoded as an empty string.
244 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700245}
246
Yangster-mac48b3d622018-08-18 12:38:11 -0700247message KeyValuePair {
248 optional int32 key = 1;
249 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700250 int32 value_int = 2;
251 int64 value_long = 3;
252 string value_str = 4;
253 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700254 }
255}
256
257message KeyValuePairsAtom {
258 optional int32 uid = 1;
259 repeated KeyValuePair pairs = 2;
260}
261
Yao Chend54f9dd2017-10-17 17:37:48 +0000262/*
263 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800264 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000265 *
266 * RULES:
267 * - The field ids for each atom must start at 1, and count upwards by 1.
268 * Skipping field ids is not allowed.
269 * - These form an API, so renaming, renumbering or removing fields is
270 * not allowed between android releases. (This is not currently enforced,
271 * but there will be a tool to enforce this restriction).
272 * - The types must be built-in protocol buffer types, namely, no sub-messages
273 * are allowed (yet). The bytes type is also not allowed.
274 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800275 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000276 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800277 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000278 * - A field that is a uid should be a string field, tagged with the [xxx]
279 * annotation. The generated code on android will be represented by UIDs,
280 * and those UIDs will be translated in xxx to those strings.
281 *
282 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700283 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000284 * - If there is a UID, it goes first. Think in an object-oriented fashion.
285 * *****************************************************************************
286 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700287
Yao Chend54f9dd2017-10-17 17:37:48 +0000288/**
Yangster-mace16189a2018-08-26 12:20:16 -0700289 * Logs when the Thermal service HAL notifies the throttling start/stop events.
290 *
291 * Logged from:
292 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
293 */
294message ThermalThrottlingStateChanged {
295 optional android.os.TemperatureTypeEnum sensor_type = 1;
296
297 enum State {
298 UNKNOWN = 0;
299 START = 1;
300 STOP = 2;
301 }
302
303 optional State state = 2;
304
305 optional float temperature = 3;
306}
307
308/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000309 * Logs when the screen state changes.
310 *
311 * Logged from:
312 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
313 */
314message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800315 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700316 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700317}
Yao Chend54f9dd2017-10-17 17:37:48 +0000318
319/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700320 * Logs that the process state of the uid, as determined by ActivityManager
321 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000322 *
323 * Logged from:
324 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
325 */
Bookatzc1a050a2017-10-10 15:49:28 -0700326message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700327 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000328
Bookatzdb026a22018-01-10 19:01:56 -0800329 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700330 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000331}
332
333/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700334 * Logs process state change of a process, as per the activity manager.
335 *
336 * Logged from:
337 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
338 */
339message ProcessStateChanged {
340 optional int32 uid = 1;
341 optional string process_name = 2;
342 optional string package_name = 3;
343 // TODO: remove this when validation is done
344 optional int64 version = 5;
345 // The state, from frameworks/base/core/proto/android/app/enums.proto.
346 optional android.app.ProcessStateEnum state = 4;
347}
348
349/**
350 * Logs when ActivityManagerService sleep state is changed.
351 *
352 * Logged from:
353 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
354 */
355message ActivityManagerSleepStateChanged {
356 // TODO: import frameworks proto
357 enum State {
358 UNKNOWN = 0;
359 ASLEEP = 1;
360 AWAKE = 2;
361 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700362 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700363}
364
365/**
366 * Logs when system memory state changes.
367 *
368 * Logged from:
369 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
370 */
371message MemoryFactorStateChanged {
372 // TODO: import frameworks proto
373 enum State {
374 MEMORY_UNKNOWN = 0;
375 NORMAL = 1; // normal.
376 MODERATE = 2; // moderate memory pressure.
377 LOW = 3; // low memory.
378 CRITICAL = 4; // critical memory.
379
380 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700381 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700382}
383
384/**
385 * Logs when app is using too much cpu, according to ActivityManagerService.
386 *
387 * Logged from:
388 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
389 */
390message ExcessiveCpuUsageReported {
391 optional int32 uid = 1;
392 optional string process_name = 2;
393 optional string package_name = 3;
394 // package version. TODO: remove this when validation is done
395 optional int64 version = 4;
396}
397
398/**
399 * Logs when a cached process is killed, along with its pss.
400 *
401 * Logged from:
402 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
403 */
404message CachedKillReported {
405 optional int32 uid = 1;
406 optional string process_name = 2;
407 optional string package_name = 3;
408 // TODO: remove this when validation is done
409 optional int64 version = 5;
410 optional int64 pss = 4;
411}
412
413/**
414 * Logs when memory stats of a process is reported.
415 *
416 * Logged from:
417 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
418 */
419message ProcessMemoryStatReported {
420 optional int32 uid = 1;
421 optional string process_name = 2;
422 optional string package_name = 3;
423 //TODO: remove this when validation is done
424 optional int64 version = 9;
425 optional int64 pss = 4;
426 optional int64 uss = 5;
427 optional int64 rss = 6;
428 enum Type {
429 ADD_PSS_INTERNAL_SINGLE = 0;
430 ADD_PSS_INTERNAL_ALL_MEM = 1;
431 ADD_PSS_INTERNAL_ALL_POLL = 2;
432 ADD_PSS_EXTERNAL = 3;
433 ADD_PSS_EXTERNAL_SLOW = 4;
434 }
435 optional Type type = 7;
436 optional int64 duration = 8;
437}
438
439/**
Bookatzc1a050a2017-10-10 15:49:28 -0700440 * Logs that a process started, finished, crashed, or ANRed.
441 *
442 * Logged from:
443 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
444 */
445message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700446 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700447
David Chen0b5c90c2018-01-25 16:51:49 -0800448 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800449 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700450
Bookatzddccf0a2017-11-28 16:48:14 -0800451 // What lifecycle state the process changed to.
452 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800453 enum State {
454 FINISHED = 0;
455 STARTED = 1;
456 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800457 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800458 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700459}
460
Bookatzc1a050a2017-10-10 15:49:28 -0700461/**
462 * Logs when the ble scan state changes.
463 *
464 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700465 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700466 */
467message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800468 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700469
470 enum State {
471 OFF = 0;
472 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700473 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
474 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700475 }
476 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700477
Bookatze5ec0b42018-03-26 13:34:56 -0700478 // Does the scan have a filter.
479 optional bool is_filtered = 3;
480 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
481 optional bool is_first_match = 4;
482 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
483 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700484}
485
486/**
487 * Logs reporting of a ble scan finding results.
488 *
489 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700490 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700491 */
Bookatzae6738e2018-09-13 11:38:56 -0700492// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700493message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800494 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700495
496 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800497 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700498}
499
500/**
501 * Logs when a sensor state changes.
502 *
503 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700504 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700505 */
506message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800507 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700508
Bookatzc1a050a2017-10-10 15:49:28 -0700509 // The id (int) of the sensor.
510 optional int32 sensor_id = 2;
511
512 enum State {
513 OFF = 0;
514 ON = 1;
515 }
516 optional State state = 3;
517}
518
Bookatzc1a050a2017-10-10 15:49:28 -0700519/**
520 * Logs when GPS state changes.
521 *
522 * Logged from:
523 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
524 */
525message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800526 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700527
528 enum State {
529 OFF = 0;
530 ON = 1;
531 }
532 optional State state = 2;
533}
534
Bookatz48d362e2018-11-06 15:49:08 -0800535/**
536 * Logs when GPS signal quality.
537 *
538 * Logged from:
539 * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
540 */
541message GpsSignalQualityChanged {
542 optional android.server.location.GpsSignalQualityEnum level = 1;
543}
544
Bookatzc1a050a2017-10-10 15:49:28 -0700545
546/**
547 * Logs when a sync manager sync state changes.
548 *
549 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700550 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700551 */
552message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800553 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700554
David Chen0b5c90c2018-01-25 16:51:49 -0800555 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800556 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700557
558 enum State {
559 OFF = 0;
560 ON = 1;
561 }
562 optional State state = 3;
563}
564
Yangster-mac96353002018-09-05 11:18:55 -0700565/*
566 * Deferred job stats.
567 *
568 * Logged from:
569 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
570*/
571message DeferredJobStatsReported {
572 repeated AttributionNode attribution_node = 1;
573
574 // Number of jobs deferred.
575 optional int32 num_jobs_deferred = 2;
576
577 // Time since the last job runs.
578 optional int64 time_since_last_job_millis = 3;
579}
580
Bookatzc1a050a2017-10-10 15:49:28 -0700581/**
582 * Logs when a job scheduler job state changes.
583 *
584 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700585 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700586 */
587message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800588 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700589
590 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800591 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700592
593 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800594 FINISHED = 0;
595 STARTED = 1;
596 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700597 }
598 optional State state = 3;
599
Tej Singh33a412b2018-03-16 18:43:59 -0700600 // The reason a job has stopped.
601 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700602 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700603 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700604}
605
606/**
607 * Logs when the audio state changes.
608 *
609 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700610 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700611 */
612message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800613 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700614
615 enum State {
616 OFF = 0;
617 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700618 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
619 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700620 }
621 optional State state = 2;
622}
623
624/**
625 * Logs when the video codec state changes.
626 *
627 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700628 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700629 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800630message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800631 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700632
633 enum State {
634 OFF = 0;
635 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700636 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
637 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700638 }
639 optional State state = 2;
640}
641
642/**
643 * Logs when the flashlight state changes.
644 *
645 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700646 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700647 */
648message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800649 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700650
651 enum State {
652 OFF = 0;
653 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700654 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
655 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700656 }
657 optional State state = 2;
658}
659
660/**
661 * Logs when the camera state changes.
662 *
663 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700664 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700665 */
666message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800667 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700668
669 enum State {
670 OFF = 0;
671 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700672 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
673 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700674 }
675 optional State state = 2;
676}
677
678/**
679 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000680 *
681 * Logged from:
682 * TODO
683 */
Bookatzd6746242017-10-24 18:39:35 -0700684message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800685 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000686
Bookatz1a1b0462018-01-12 11:47:03 -0800687 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
688 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700689 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700690
691 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
692 optional string tag = 3;
693
694 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800695 RELEASE = 0;
696 ACQUIRE = 1;
697 CHANGE_RELEASE = 2;
698 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700699 }
700 optional State state = 4;
701}
702
703/**
Bookatzc1a050a2017-10-10 15:49:28 -0700704 * Logs when a partial wakelock is considered 'long' (over 1 min).
705 *
706 * Logged from:
707 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
708 */
709message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800710 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700711
Yao Chend54f9dd2017-10-17 17:37:48 +0000712 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
713 optional string tag = 2;
714
Bookatzc1a050a2017-10-10 15:49:28 -0700715 // TODO: I have no idea what this is.
716 optional string history_tag = 3;
717
718 enum State {
719 OFF = 0;
720 ON = 1;
721 }
722 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000723}
724
Bookatzc1a050a2017-10-10 15:49:28 -0700725/**
Bookatza66083f2018-09-20 17:24:00 -0700726 * Logs when the device is interactive, according to the PowerManager Notifier.
727 *
728 * Logged from:
729 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
730 */
731message InteractiveStateChanged {
732 enum State {
733 OFF = 0;
734 ON = 1;
735 }
736 optional State state = 1;
737}
738
739/**
Bookatzc1a050a2017-10-10 15:49:28 -0700740 * Logs Battery Saver state change.
741 *
742 * Logged from:
743 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
744 */
745message BatterySaverModeStateChanged {
746 enum State {
747 OFF = 0;
748 ON = 1;
749 }
750 optional State state = 1;
751}
752
753/**
754 * Logs Doze mode state change.
755 *
756 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800757 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700758 */
759message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800760 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800761}
762
763
764/**
765 * Logs state change of Doze mode including maintenance windows.
766 *
767 * Logged from:
768 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
769 */
770message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800771 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700772}
773
774/**
775 * Logs screen brightness level.
776 *
777 * Logged from:
778 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
779 */
780message ScreenBrightnessChanged {
781 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
782 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700783}
784
785/**
786 * Logs battery level (percent full, from 0 to 100).
787 *
788 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700789 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700790 */
791message BatteryLevelChanged {
792 // Battery level. Should be in [0, 100].
793 optional int32 battery_level = 1;
794}
795
796/**
797 * Logs change in charging status of the device.
798 *
799 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700800 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700801 */
802message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800803 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
804 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700805}
806
807/**
808 * Logs whether the device is plugged in, and what power source it is using.
809 *
810 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700811 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700812 */
813message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800814 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
815 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700816}
817
Bookatz8c6571b2017-10-24 15:04:41 -0700818/**
819 * Logs when an app's wakeup alarm fires.
820 *
821 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700822 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700823 */
824message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800825 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800826
827 // Name of the wakeup alarm.
828 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700829
830 // Name of source package (for historical reasons, since BatteryStats tracked it).
831 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800832}
833
834/**
835 * Logs when an an app causes the mobile radio to change state.
836 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
837 *
838 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700839 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800840 */
841message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800842 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800843
Bookatz1a1b0462018-01-12 11:47:03 -0800844 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
845 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800846}
847
848/**
849 * Logs when an an app causes the wifi radio to change state.
850 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
851 *
852 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700853 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800854 */
855message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800856 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800857
Bookatz1a1b0462018-01-12 11:47:03 -0800858 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
859 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700860}
861
862/**
863 * Logs kernel wakeup reasons and aborts.
864 *
865 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700866 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700867 */
868message KernelWakeupReported {
869 // Name of the kernel wakeup reason (or abort).
870 optional string wakeup_reason_name = 1;
871
872 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800873 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700874}
875
876/**
Bookatzda1798c2018-12-13 14:16:00 -0800877 * Logs when Wifi is toggled on/off.
Bookatza0a1f8a2018-12-17 12:28:32 -0800878 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
Bookatzda1798c2018-12-13 14:16:00 -0800879 *
880 * Logged from:
881 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
882 */
883message WifiEnabledStateChanged {
884 enum State {
885 OFF = 0;
886 ON = 1;
887 }
888 optional State state = 1;
889}
890
891/**
892 * 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 -0800893 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
894 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
Bookatzda1798c2018-12-13 14:16:00 -0800895 *
896 * Logged from:
897 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
898 */
899message WifiRunningStateChanged {
900 repeated AttributionNode attribution_node = 1;
901
902 enum State {
903 OFF = 0;
904 ON = 1;
905 }
906 optional State state = 2;
907}
908
909/**
Bookatze5885242017-10-24 20:10:31 -0700910 * Logs wifi locks held by an app.
911 *
912 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700913 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700914 */
915message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800916 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700917
918 enum State {
919 OFF = 0;
920 ON = 1;
921 }
922 optional State state = 2;
923}
924
925/**
926 * Logs wifi signal strength changes.
927 *
928 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700929 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700930 */
931message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800932 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
933 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700934}
935
936/**
937 * Logs wifi scans performed by an app.
938 *
939 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700940 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700941 */
942message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800943 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700944
945 enum State {
946 OFF = 0;
947 ON = 1;
948 }
949 optional State state = 2;
950}
951
952/**
Tej Singh4503e102018-01-04 14:35:01 -0800953 * Logs wifi multicast locks held by an app
954 *
955 * Logged from:
956 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
957 */
958message WifiMulticastLockStateChanged {
959 repeated AttributionNode attribution_node = 1;
960
961 enum State {
962 OFF = 0;
963 ON = 1;
964 }
965 optional State state = 2;
966}
967
968/**
Tej Singh1ea42892018-01-19 09:27:00 -0800969 * Logs shutdown reason and duration on next boot.
970 *
971 * Logged from:
972 * frameworks/base/core/java/com/android/server/BootReceiver.java
973 */
974message ShutdownSequenceReported {
975 // True if shutdown is for a reboot. Default: false if we do not know.
976 optional bool reboot = 1;
977
978 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
979 optional string reason = 2;
980
981 // Beginning of shutdown time in ms using wall clock time since unix epoch.
982 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800983 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800984
985 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800986 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800987}
988
Tej Singh6483ea42018-01-25 17:45:49 -0800989
990/**
991 * Logs boot reason and duration.
992 *
993 * Logged from:
994 * system/core/bootstat/bootstat.cpp
995 */
996message BootSequenceReported {
997 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
998 // Default: "<EMPTY>" if not available.
999 optional string bootloader_reason = 1;
1000
1001 // Reason for system boot. Eg. bootloader, reboot,userrequested
1002 // Default: "<EMPTY>" if not available.
1003 optional string system_reason = 2;
1004
1005 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -08001006 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -08001007
1008 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001009 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -08001010
1011 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001012 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -08001013
1014 // Time since last boot in ms. Default: 0 if not available.
1015 optional int64 time_since_last_boot = 6;
1016}
1017
Tej Singhc477d9c2018-02-05 18:31:39 -08001018
1019/**
1020 * Logs call state and disconnect cause (if applicable).
1021 *
1022 * Logged from:
1023 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
1024 */
1025message CallStateChanged {
1026 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1027 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1028 optional android.telecom.CallStateEnum call_state = 1;
1029
1030 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1031 // This value is only applicable when the call_state is DISCONNECTED, and
1032 // should always be UNKNOWN if the call_state is not DISCONNECTED.
1033 // From frameworks/base/core/proto/android/telecomm/enums.proto.
1034 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1035
1036 // True if the call is self-managed, which are apps that use the
1037 // telecom infrastructure to make their own calls.
1038 optional bool self_managed = 3;
1039
1040 // True if call is external. External calls are calls on connected Wear
1041 // devices but show up in Telecom so the user can pull them onto the device.
1042 optional bool external_call = 4;
1043}
1044
Tej Singh1ea42892018-01-19 09:27:00 -08001045/**
Tej Singhdd7bd352018-02-09 19:33:15 -08001046 * Logs keyguard state. The keyguard is the lock screen.
1047 *
1048 * Logged from:
1049 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1050 */
1051message KeyguardStateChanged {
1052 enum State {
1053 UNKNOWN = 0;
1054 // The keyguard is hidden when the phone is unlocked.
1055 HIDDEN = 1;
1056 // The keyguard is shown when the phone is locked (screen turns off).
1057 SHOWN= 2;
1058 // The keyguard is occluded when something is overlaying the keyguard.
1059 // Eg. Opening the camera while on the lock screen.
1060 OCCLUDED = 3;
1061 }
1062 optional State state = 1;
1063}
1064
1065/**
1066 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1067 * prompts the user to enter a password (pattern, pin, etc).
1068 *
1069 * Logged from:
1070 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1071 */
1072
1073message KeyguardBouncerStateChanged {
1074 enum State {
1075 UNKNOWN = 0;
1076 // Bouncer is hidden, either as a result of successfully entering the
1077 // password, screen timing out, or user going back to lock screen.
1078 HIDDEN = 1;
1079 // This is when the user is being prompted to enter the password.
1080 SHOWN = 2;
1081 }
1082 optional State state = 1;
1083}
1084
1085/**
1086 * Logs the result of entering a password into the keyguard bouncer.
1087 *
1088 * Logged from:
1089 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1090 */
1091message KeyguardBouncerPasswordEntered {
1092 enum BouncerResult {
1093 UNKNOWN = 0;
1094 // The password entered was incorrect.
1095 FAILURE = 1;
1096 // The password entered was correct.
1097 SUCCESS = 2;
1098 }
1099 optional BouncerResult result = 1;
1100}
1101
Tej Singha883b372018-02-15 11:30:01 -08001102/*
1103 * Logs changes to the configuration of the device. The configuration is defined
1104 * in frameworks/base/core/java/android/content/res/Configuration.java
1105 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1106 * Please go there to interpret the possible values each field can be.
1107 *
1108 * Logged from:
1109 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1110 */
1111message ResourceConfigurationChanged {
1112 // Bit mask of color capabilities of the screen.
1113 // Contains information about the color gamut and hdr mode of the screen.
1114 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001115 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001116
1117 // The target screen density being rendered to.
1118 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001119 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001120
1121 // Current user preference for the scaling factor for fonts,
1122 // relative to the base density scaling.
1123 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001124 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001125
1126 // Flag indicating whether the hard keyboard is hidden.
1127 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001128 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001129
1130 // The type of keyboard attached to the device.
1131 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1132 optional int32 keyboard = 5;
1133
1134 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1135 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001136 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001137
1138 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1139 // 0 if undefined.
1140 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1141 optional int32 mcc = 7;
1142
1143 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1144 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1145 // MNC_ZERO symbol defined in Configuration.java.
1146 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1147 optional int32 mnc = 8;
1148
1149 // The kind of navigation available on the device.
1150 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1151 optional int32 navigation = 9;
1152
1153 // Flag indicating whether the navigation is available.
1154 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001155 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001156
1157 // Overall orientation of the screen.
1158 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1159 optional int32 orientation = 11;
1160
1161 // The current height of the available screen space, in dp units.
1162 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001163 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001164
1165 // Bit mask of overall layout of the screen.
1166 // Contains information about screen size, whether the screen is wider/taller
1167 // than normal, whether the screen layout is right-tl-left or left-to-right,
1168 // and whether the screen has a rounded shape.
1169 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001170 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001171
1172 // Current width of the available screen space, in dp units.
1173 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001174 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001175
1176 // The smallest screen size an application will see in normal operation.
1177 // This is the smallest value of both screenWidthDp and screenHeightDp
1178 // in portrait and landscape.
1179 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001180 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001181
1182 // The type of touch screen attached to the device.
1183 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1184 optional int32 touchscreen = 16;
1185
1186 // Bit mask of the ui mode.
1187 // Contains information about the overall ui mode of the device.
1188 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1189 // Also contains information about whether the device is in night mode.
1190 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001191 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001192}
1193
Tej Singheee317b2018-03-07 19:28:05 -08001194
1195/**
1196 * Logs changes in the connection state of the mobile radio.
1197 *
1198 * Logged from:
1199 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1200 */
1201message MobileConnectionStateChanged {
1202 // States are from the state machine DataConnection.java.
1203 enum State {
1204 UNKNOWN = 0;
1205 // The connection is inactive, or disconnected.
1206 INACTIVE = 1;
1207 // The connection is being activated, or connecting.
1208 ACTIVATING = 2;
1209 // The connection is active, or connected.
1210 ACTIVE = 3;
1211 // The connection is disconnecting.
1212 DISCONNECTING = 4;
1213 // The connection is disconnecting after creating a connection.
1214 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1215 }
1216 optional State state = 1;
1217 // For multi-sim phones, this distinguishes between the sim cards.
1218 optional int32 sim_slot_index = 2;
1219 // Used to identify the connection. Starts at 0 and increments by 1 for
1220 // every new network created. Resets whenever the device reboots.
1221 optional int32 data_connection_id = 3;
1222 // A bitmask for the capabilities of this connection.
1223 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1224 // Default value (if we have no information): 0
1225 optional int64 capabilities = 4;
1226 // If this connection has internet.
1227 // This just checks if the DEFAULT bit of capabilities is set.
1228 optional bool has_internet = 5;
1229}
1230
1231/**
1232 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1233 *
1234 * Logged from:
1235 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1236 */
1237message MobileRadioTechnologyChanged {
1238 optional android.telephony.NetworkTypeEnum state = 1;
1239 // For multi-sim phones, this distinguishes between the sim cards.
1240 optional int32 sim_slot_index = 2;
1241}
1242
Andrew Chantb56388b2018-03-22 21:07:33 -07001243/**
1244 * Logs the VID and PID of any connected USB devices.
1245 *
1246 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1247 *
1248 * Logged by Vendor.
1249 */
1250message UsbDeviceAttached {
1251 optional int32 vid = 1;
1252 optional int32 pid = 2;
1253 optional bool has_audio = 3;
1254 optional bool has_hid = 4;
1255 optional bool has_storage = 5;
Badhri Jagan Sridharan5ec629f2018-11-16 15:39:22 -08001256 enum State {
1257 STATE_DISCONNECTED = 0;
1258 STATE_CONNECTED = 1;
1259 }
1260 optional State state = 6;
Badhri Jagan Sridharanc2c54a22018-12-14 14:41:26 -08001261 optional int64 last_connect_duration_millis = 7;
Andrew Chantb56388b2018-03-22 21:07:33 -07001262}
1263
Tej Singheee317b2018-03-07 19:28:05 -08001264
Tej Singhdd7bd352018-02-09 19:33:15 -08001265/**
Tej Singh5d991e12018-03-09 19:48:11 -08001266 * Logs when Bluetooth is enabled and disabled.
1267 *
1268 * Logged from:
1269 * services/core/java/com/android/server/BluetoothManagerService.java
1270 */
1271message BluetoothEnabledStateChanged {
1272 repeated AttributionNode attribution_node = 1;
1273 // Whether or not bluetooth is enabled on the device.
1274 enum State {
1275 UNKNOWN = 0;
1276 ENABLED = 1;
1277 DISABLED = 2;
1278 }
1279 optional State state = 2;
1280 // The reason for being enabled/disabled.
1281 // Eg. Airplane mode, crash, application request.
1282 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1283 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001284 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001285}
1286
1287/**
1288 * Logs when a Bluetooth device connects and disconnects.
1289 *
1290 * Logged from:
1291 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1292 */
1293message BluetoothConnectionStateChanged {
1294 // The state of the connection.
1295 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1296 optional android.bluetooth.ConnectionStateEnum state = 1;
1297 // An identifier that can be used to match connect and disconnect events.
1298 // Currently is last two bytes of a hash of a device level ID and
1299 // the mac address of the bluetooth device that is connected.
1300 optional int32 obfuscated_id = 2;
1301 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1302 // From android.bluetooth.BluetoothAdapter.java
1303 optional int32 bt_profile = 3;
1304}
1305
1306/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001307 * Logs when something is plugged into or removed from the USB-C connector.
1308 *
1309 * Logged from:
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001310 * UsbService
Andrew Chant28d627e2018-02-22 15:17:05 -08001311 */
1312message UsbConnectorStateChanged {
1313 enum State {
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001314 STATE_DISCONNECTED = 0;
1315 STATE_CONNECTED = 1;
Andrew Chant28d627e2018-02-22 15:17:05 -08001316 }
1317 optional State state = 1;
Badhri Jagan Sridharan223b3c72018-11-16 16:02:35 -08001318 optional string id = 2;
Badhri Jagan Sridharanfaf62072018-11-16 17:17:03 -08001319 // Last active session in ms.
1320 // 0 when the port is in connected state.
1321 optional int64 last_connect_duration_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001322}
1323
1324/**
1325 * Logs the reported speaker impedance.
1326 *
1327 * Logged from:
1328 * Vendor audio implementation.
1329 */
1330message SpeakerImpedanceReported {
1331 optional int32 speaker_location = 1;
1332 optional int32 impedance = 2;
1333}
1334
1335/**
1336 * Logs the report of a failed hardware.
1337 *
1338 * Logged from:
1339 * Vendor HALs.
1340 *
1341 */
1342message HardwareFailed {
1343 enum HardwareType {
1344 HARDWARE_FAILED_UNKNOWN = 0;
1345 HARDWARE_FAILED_MICROPHONE = 1;
1346 HARDWARE_FAILED_CODEC = 2;
1347 HARDWARE_FAILED_SPEAKER = 3;
1348 HARDWARE_FAILED_FINGERPRINT = 4;
1349 }
1350 optional HardwareType hardware_type = 1;
1351
1352 /* hardware_location allows vendors to differentiate between multiple instances of
1353 * the same hardware_type. The specific locations are vendor defined integers,
1354 * referring to board-specific numbering schemes.
1355 */
1356 optional int32 hardware_location = 2;
1357
1358 /* failure_code is specific to the HardwareType of the failed hardware.
1359 * It should use the enum values defined below.
1360 */
1361 enum MicrophoneFailureCode {
1362 MICROPHONE_FAILURE_COMPLETE = 0;
1363 }
1364 enum CodecFailureCode {
1365 CODEC_FAILURE_COMPLETE = 0;
1366 }
1367 enum SpeakerFailureCode {
1368 SPEAKER_FAILURE_COMPLETE = 0;
1369 SPEAKER_FAILURE_HIGH_Z = 1;
1370 SPEAKER_FAILURE_SHORT = 2;
1371 }
1372 enum FingerprintFailureCode {
1373 FINGERPRINT_FAILURE_COMPLETE = 0;
1374 FINGERPRINT_SENSOR_BROKEN = 1;
1375 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1376 }
1377 optional int32 failure_code = 3;
1378}
1379
1380/**
1381 * Log an event when the device has been physically dropped.
1382 * Reported from the /vendor partition.
1383 */
1384message PhysicalDropDetected {
1385 // Confidence that the event was actually a drop, 0 -> 100
1386 optional int32 confidence_pctg = 1;
1387 // Peak acceleration of the drop, in 1/1000s of a g.
1388 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001389 // Duration of freefall in ms
1390 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001391}
1392
1393/**
1394 * Log bucketed battery charge cycles.
1395 *
1396 * Each bucket represents cycles of the battery past
Maggie White38c9d322018-11-20 10:07:52 -08001397 * a given charge point. For example, if 10 cycle buckets are
1398 * initialized, bucket 1 is the lowest 1/10th of the battery,
1399 * and bucket 10 is 100%.
Andrew Chant28d627e2018-02-22 15:17:05 -08001400 *
1401 * Logged from:
1402 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1403 */
1404message ChargeCyclesReported {
1405 optional int32 cycle_bucket_1 = 1;
1406 optional int32 cycle_bucket_2 = 2;
1407 optional int32 cycle_bucket_3 = 3;
1408 optional int32 cycle_bucket_4 = 4;
1409 optional int32 cycle_bucket_5 = 5;
1410 optional int32 cycle_bucket_6 = 6;
1411 optional int32 cycle_bucket_7 = 7;
1412 optional int32 cycle_bucket_8 = 8;
Maggie White38c9d322018-11-20 10:07:52 -08001413 optional int32 cycle_bucket_9 = 9;
1414 optional int32 cycle_bucket_10 = 10;
Andrew Chant28d627e2018-02-22 15:17:05 -08001415}
1416
1417/**
Howard Roa46b6582018-09-18 16:45:02 -07001418 * Log battery health snapshot.
1419 *
1420 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1421 * are snapshotted periodically over 24hrs.
1422 */
1423message BatteryHealthSnapshot {
1424 enum BatterySnapshotType {
1425 UNKNOWN = 0;
1426 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1427 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1428 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1429 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1430 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1431 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1432 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1433 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1434 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1435 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1436 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1437 }
1438 optional BatterySnapshotType type = 1;
1439 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001440 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001441 // Voltage Battery Voltage, in microVolts.
1442 optional int32 voltage_micro_volt = 3;
1443 // Current Battery current, in microAmps.
1444 optional int32 current_micro_amps = 4;
1445 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1446 optional int32 open_circuit_micro_volt = 5;
1447 // Resistance Battery Resistance, in microOhms.
1448 optional int32 resistance_micro_ohm = 6;
1449 // Level Battery Level, as % of full.
1450 optional int32 level_percent = 7;
1451}
1452
1453/**
1454 * Log slow I/O operations on the primary storage.
1455 */
1456message SlowIo {
1457 // Classifications of IO Operations.
1458 enum IoOperation {
1459 UNKNOWN = 0;
1460 READ = 1;
1461 WRITE = 2;
1462 UNMAP = 3;
1463 SYNC = 4;
1464 }
1465 optional IoOperation operation = 1;
1466
1467 // The number of slow IO operations of this type over 24 hours.
1468 optional int32 count = 2;
1469}
1470
1471/**
1472 * Log battery caused shutdown with the last recorded voltage.
1473 */
1474message BatteryCausedShutdown {
1475 // The last recorded battery voltage prior to shutdown.
1476 optional int32 last_recorded_micro_volt = 1;
1477}
1478
1479/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001480 * Logs the duration of a davey (jank of >=700ms) when it occurs
1481 *
1482 * Logged from:
1483 * frameworks/base/libs/hwui/JankTracker.cpp
1484 */
1485message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001486 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001487 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001488
Tej Singhbb8554a2018-01-26 11:59:14 -08001489 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001490 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001491}
1492
1493/**
Bookatze5885242017-10-24 20:10:31 -07001494 * Logs phone signal strength changes.
1495 *
1496 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001497 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001498 */
1499message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001500 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1501 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001502}
1503
Yangster4ccebea2018-10-09 17:09:02 -07001504
1505/**
1506 * Logs when the phone state, sim state or signal strength changes
1507 *
1508 * Logged from:
1509 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1510 */
1511message PhoneServiceStateChanged {
1512 optional android.telephony.ServiceStateEnum state = 1;
1513 optional android.telephony.SimStateEnum sim_state = 2;
1514 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1515}
1516
1517/**
1518 * Logs when the phone becomes on or off.
1519 *
1520 * Logged from:
1521 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1522 */
1523message PhoneStateChanged {
1524 enum State {
1525 OFF = 0;
1526 ON = 1;
1527 }
1528 optional State state = 1;
1529}
1530
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001531message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001532 optional android.stats.launcher.LauncherAction action = 1;
1533 optional android.stats.launcher.LauncherState src_state = 2;
1534 optional android.stats.launcher.LauncherState dst_state = 3;
1535 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001536 optional bool is_swipe_up_enabled = 5;
1537}
1538
David Chenc28b2bb2017-10-24 12:52:52 -07001539/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001540 * Logs when Settings UI has changed.
1541 *
1542 * Logged from:
1543 * packages/apps/Settings
1544 */
1545message SettingsUIChanged {
1546 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001547 * Where this SettingsUIChange event comes from. For example, if
1548 * it's a PAGE_VISIBLE event, where the page is opened from.
1549 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001550 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001551
1552 /**
1553 * What the UI action is.
1554 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001555 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001556
1557 /**
1558 * Where the action is happening
1559 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001560 optional android.app.settings.PageId page_id = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001561
1562 /**
1563 * What preference changed in this event.
1564 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001565 optional string changed_preference_key = 4;
Fan Zhang916c13b2018-10-16 22:49:45 -07001566
1567 /**
1568 * The new value of the changed preference.
1569 */
Fan Zhangff2332b2018-12-06 15:16:41 -08001570 optional int64 changed_preference_int_value = 5;
Fan Zhang916c13b2018-10-16 22:49:45 -07001571}
1572
1573/**
David Chenc28b2bb2017-10-24 12:52:52 -07001574 * Logs that a setting was updated.
1575 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001576 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001577 * The tag and is_default allow resetting of settings to default values based on the specified
1578 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1579 */
1580message SettingChanged {
1581 // The name of the setting.
1582 optional string setting = 1;
1583
1584 // The change being imposed on this setting. May represent a number, eg "3".
1585 optional string value = 2;
1586
1587 // The new value of this setting. For most settings, this is same as value. For some settings,
1588 // value is +X or -X where X represents an element in a set. For example, if the previous value
1589 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1590 // The +/- feature is currently only used for location_providers_allowed.
1591 optional string new_value = 3;
1592
1593 // The previous value of this setting.
1594 optional string prev_value = 4;
1595
1596 // The tag used with the is_default for resetting sets of settings. This is generally null.
1597 optional string tag = 5;
1598
Bookatz90867622018-01-31 15:05:57 -08001599 // True if this setting with tag should be resettable.
1600 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001601
David Chenbd789912018-03-16 17:19:55 -07001602 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001603 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001604
1605 enum ChangeReason {
1606 UPDATED = 1; // Updated can be an insertion or an update.
1607 DELETED = 2;
1608 }
1609 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001610}
Chenjie Yub3dda412017-10-24 13:41:59 -07001611
Chenjie Yu05013b32017-11-21 10:21:41 -08001612/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001613 * Logs activity going to foreground or background
1614 *
1615 * Logged from:
1616 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1617 */
1618message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001619 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001620 optional string pkg_name = 2;
1621 optional string class_name = 3;
1622
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001623 enum State {
1624 BACKGROUND = 0;
1625 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001626 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001627 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001628}
David Chenc8a43242017-10-17 16:23:28 -07001629
1630/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001631 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001632 * Logged from:
1633 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1634 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001635message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001636 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001637
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001638 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001639
1640 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001641 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001642 optional string process_name = 3;
1643
1644 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001645 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001646
1647 optional string package_name = 5;
1648
1649 enum InstantApp {
1650 UNAVAILABLE = 0;
1651 FALSE = 1;
1652 TRUE = 2;
1653 }
1654 optional InstantApp is_instant_app = 6;
1655
1656 enum ForegroundState {
1657 UNKNOWN = 0;
1658 BACKGROUND = 1;
1659 FOREGROUND = 2;
1660 }
1661 optional ForegroundState foreground_state = 7;
Yang Lu732d6382018-11-05 07:53:12 -08001662
1663 optional android.server.ErrorSource error_source = 8;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001664}
David Chen9e3808c2017-11-20 17:25:34 -08001665
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001666/**
1667 * Logs when a WTF (What a Terrible Failure) happened.
1668 * Logged from:
1669 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1670 */
1671message WTFOccurred {
1672 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001673
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001674 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001675
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001676 // The name of the process.
1677 // system_server if it is not by an app
1678 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001679
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001680 // The pid if available. -1 means not available.
1681 optional sint32 pid = 4;
Yang Lu732d6382018-11-05 07:53:12 -08001682
1683 optional android.server.ErrorSource error_source = 5;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001684}
1685
1686/**
1687 * Logs when system server reports low memory.
1688 * Logged from:
1689 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1690 */
1691message LowMemReported {
1692}
1693
1694/**
1695 * Logs when an app ANR (App Not Responding) occurs.
1696 * Logged from:
1697 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1698 */
1699message ANROccurred {
1700 optional int32 uid = 1 [(is_uid) = true];
1701
1702 optional string process_name = 2;
1703
1704 optional string short_component_name = 3;
1705
1706 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001707
1708 enum InstantApp {
1709 UNAVAILABLE = 0;
1710 FALSE = 1;
1711 TRUE = 2;
1712 }
1713 optional InstantApp is_instant_app = 5;
1714
1715 enum ForegroundState {
1716 UNKNOWN = 0;
1717 BACKGROUND = 1;
1718 FOREGROUND = 2;
1719 }
1720 optional ForegroundState foreground_state = 6;
Yang Lu732d6382018-11-05 07:53:12 -08001721
1722 optional android.server.ErrorSource error_source = 7;
1723
1724 optional string package_name = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001725}
1726
Bookatza7020bd2018-08-28 16:29:35 -07001727/**
1728 * Logs when the vibrator state changes.
1729 * Logged from:
1730 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1731 */
1732message VibratorStateChanged {
1733 repeated AttributionNode attribution_node = 1;
1734
1735 enum State {
1736 OFF = 0;
1737 ON = 1;
1738 }
1739 optional State state = 2;
1740
1741 // Duration (in milliseconds) requested to keep the vibrator on.
1742 // Only applicable for State == ON.
1743 optional int64 duration_millis = 3;
1744}
1745
David Chen0a368b22017-12-06 16:28:16 -08001746/*
1747 * Allows other apps to push events into statsd.
1748 * Logged from:
1749 * frameworks/base/core/java/android/util/StatsLog.java
1750 */
David Chen0b5c90c2018-01-25 16:51:49 -08001751message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001752 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001753 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001754
1755 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1756 optional int32 label = 2;
1757
1758 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1759 // predicates for the metrics).
1760 enum State {
1761 UNKNOWN = 0;
1762 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1763 STOP = 2;
1764 START = 3;
1765 }
1766 optional State state = 3;
1767}
1768
David Chen9e3808c2017-11-20 17:25:34 -08001769/**
Bookatz7948c872018-09-04 12:58:33 -07001770 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1771 * For example, this could be due to the user manually changing the time.
1772 *
1773 * Logged from:
1774 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1775 */
1776message WallClockTimeShifted {
1777 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1778 optional int64 wall_clock_timestamp_millis = 1;
1779}
1780
1781/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001782 * Logs when statsd detects an anomaly.
1783 *
1784 * Logged from:
1785 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1786 */
1787message AnomalyDetected {
1788 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001789 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001790
Yangster-mac94e197c2018-01-02 16:03:03 -08001791 // Id of the config whose anomaly detection alert fired.
1792 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001793
Yangster-mac94e197c2018-01-02 16:03:03 -08001794 // Id of the alert (i.e. name of the anomaly that was detected).
1795 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001796}
1797
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001798message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001799 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001800 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001801
1802 // The app package name.
1803 optional string pkg_name = 2;
1804
1805 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001806 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001807 WARM = 1;
1808 HOT = 2;
1809 COLD = 3;
1810 }
1811 // The transition type.
1812 optional TransitionType type = 3;
1813
1814 // The activity name.
1815 optional string activity_name = 4;
1816
1817 // The name of the calling app. Empty if not set.
1818 optional string calling_pkg_name = 5;
1819
1820 // Whether the app is an instant app.
1821 optional bool is_instant_app = 6;
1822
1823 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001824 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001825
Bookatz80d11a02018-01-16 10:46:35 -08001826 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001827
David Chen0b5c90c2018-01-25 16:51:49 -08001828 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001829 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001830 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001831 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001832 optional int32 bind_application_delay_millis = 11;
1833 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001834
1835 // Empty if not set.
1836 optional string launch_token = 13;
1837
Calin Juravle759fbda2018-02-20 19:52:30 +00001838 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001839 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001840
1841 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001842 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001843}
1844
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001845message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001846 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001847 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001848
1849 // The app package name.
1850 optional string pkg_name = 2;
1851
1852 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001853 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001854 WARM = 1;
1855 HOT = 2;
1856 COLD = 3;
1857 }
1858 // The transition type.
1859 optional TransitionType type = 3;
1860
1861 // The activity name.
1862 optional string activity_name = 4;
1863}
1864
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001865message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001866 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001867 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001868
1869 // The app package name.
1870 optional string pkg_name = 2;
1871
1872 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001873 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001874 WITH_BUNDLE = 1;
1875 WITHOUT_BUNDLE = 2;
1876 }
1877 // The transition type.
1878 optional TransitionType type = 3;
1879
1880 // The activity name.
1881 optional string activity_name = 4;
1882
1883 optional bool transition_process_running = 5;
1884
1885 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001886 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001887}
1888
Bookatz8fcd09a2017-12-18 13:01:10 -08001889/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001890 * Logs a picture-in-picture action
1891 * Logged from:
1892 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1893 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1894 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1895 */
1896message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001897 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001898 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001899
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001900 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001901
Chenjie Yu52cacc62017-12-08 18:11:45 -08001902 enum State {
1903 ENTERED = 1;
1904 EXPANDED_TO_FULL_SCREEN = 2;
1905 MINIMIZED = 3;
1906 DISMISSED = 4;
1907 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001908 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001909}
1910
1911/**
Chenjie Yue8904192017-12-08 19:12:57 -08001912 * Logs overlay action
1913 * Logged from:
1914 * services/core/java/com/android/server/wm/Session.java
1915 */
1916message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001917 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001918
1919 optional string package_name = 2;
1920
1921 optional bool using_alert_window = 3;
1922
1923 enum State {
1924 ENTERED = 1;
1925 EXITED = 2;
1926 }
1927 optional State state = 4;
1928}
1929
Chenjie Yuccfe6452018-01-30 11:33:21 -08001930/*
1931 * Logs foreground service starts and stops.
1932 * Note that this is not when a service starts or stops, but when it is
1933 * considered foreground.
1934 * Logged from
1935 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1936 */
1937message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001938 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001939 // package_name + "/" + class_name
1940 optional string short_name = 2;
1941
1942 enum State {
1943 ENTER = 1;
1944 EXIT = 2;
1945 }
1946 optional State state = 3;
1947}
1948
Chenjie Yue8904192017-12-08 19:12:57 -08001949/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001950 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1951 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1952 * attributed back to the parent (host) uid. One example is Chrome.
1953 *
1954 * Logged from:
1955 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1956 */
1957message IsolatedUidChanged {
1958 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001959 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001960 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001961 optional int32 parent_uid = 1;
1962
1963 optional int32 isolated_uid = 2;
1964
1965 // We expect an isolated uid to be removed before if it's used for another parent uid.
1966 enum Event {
1967 REMOVED = 0;
1968 CREATED = 1;
1969 }
1970 optional Event event = 3;
1971}
1972
1973/*
1974 * Logs the reception of an incoming network packet causing the main system to wake up for
1975 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1976 * and processed by WakeupController.cpp.
1977 */
1978message PacketWakeupOccurred {
1979 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1980 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001981 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001982 // The interface name on which the packet was received.
1983 optional string iface = 2;
1984 // The ethertype value of the packet.
1985 optional int32 ethertype = 3;
1986 // String representation of the destination MAC address of the packet.
1987 optional string destination_hardware_address = 4;
1988 // String representation of the source address of the packet if this was an IP packet.
1989 optional string source_ip = 5;
1990 // String representation of the destination address of the packet if this was an IP packet.
1991 optional string destination_ip = 6;
1992 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1993 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1994 // families.
1995 optional int32 ip_next_header = 7;
1996 // The source port if this was a TCP or UDP packet.
1997 optional int32 source_port = 8;
1998 // The destination port if this was a TCP or UDP packet.
1999 optional int32 destination_port = 9;
2000}
2001
2002/*
2003 * Logs the memory stats for an app on startup.
2004 * Logged from:
2005 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2006 */
2007message AppStartMemoryStateCaptured {
2008 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002009 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002010
2011 // The process name.
2012 optional string process_name = 2;
2013
2014 // The activity name.
2015 optional string activity_name = 3;
2016
2017 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002018 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002019
2020 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002021 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002022
2023 // RSS
2024 optional int64 rss_in_bytes = 6;
2025
2026 // CACHE
2027 optional int64 cache_in_bytes = 7;
2028
2029 // SWAP
2030 optional int64 swap_in_bytes = 8;
2031}
2032
2033/*
2034 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
2035 * for LMK event.
2036 * Logged from:
2037 * system/core/lmkd/lmkd.c
2038 */
2039message LmkStateChanged {
2040 enum State {
2041 UNKNOWN = 0;
2042 START = 1;
2043 STOP = 2;
2044 }
2045 optional State state = 1;
2046}
2047
2048/*
2049 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
2050 * Logged from:
2051 * system/core/lmkd/lmkd.c
2052 */
2053message LmkKillOccurred {
2054 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002055 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08002056
2057 // The process name.
2058 optional string process_name = 2;
2059
2060 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002061 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002062
2063 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002064 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002065
2066 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002067 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002068
2069 // RSS
2070 optional int64 rss_in_bytes = 6;
2071
2072 // CACHE
2073 optional int64 cache_in_bytes = 7;
2074
2075 // SWAP
2076 optional int64 swap_in_bytes = 8;
Jim Blackler8593d1f2018-11-21 15:24:48 +00002077
2078 // The elapsed real time of start of the process.
2079 optional int64 process_start_time_nanos = 9;
Chenjie Yubbcbc602018-02-05 16:51:52 -08002080}
2081
Rajeev Kumar51b54602018-03-01 12:18:26 -08002082/*
2083 * Logs when the ActivityManagerService detects that an app died.
2084 *
2085 * Logged from:
2086 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2087 */
2088message AppDied {
2089 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07002090 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002091}
2092
Howard Ro21a039c2018-08-06 14:55:47 -07002093/**
2094 * An atom for generic metrics logging. Available from Android Q.
2095 */
2096message GenericAtom {
2097 // The uid of the application that sent this custom atom.
2098 optional int32 uid = 1 [(is_uid) = true];
2099
2100 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002101 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002102}
2103
Tej Singhd6d6d772018-09-05 17:41:25 -07002104/**
2105 * Logs when a fingerprint acquire event occurs.
2106 *
2107 * Logged from:
2108 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2109 */
2110message FingerprintAcquired {
2111 // The associated user. Eg: 0 for owners, 10+ for others.
2112 // Defined in android/os/UserHandle.java
2113 optional int32 user = 1;
2114 // If this acquire is for a crypto fingerprint.
2115 // e.g. Secure purchases, unlock password storage.
2116 optional bool is_crypto = 2;
2117}
2118
2119/**
2120 * Logs when a fingerprint authentication event occurs.
2121 *
2122 * Logged from:
2123 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2124 */
2125message FingerprintAuthenticated {
2126 // The associated user. Eg: 0 for owners, 10+ for others.
2127 // Defined in android/os/UserHandle.java
2128 optional int32 user = 1;
2129 // If this authentication is for a crypto fingerprint.
2130 // e.g. Secure purchases, unlock password storage.
2131 optional bool is_crypto = 2;
2132 // Whether or not this authentication was successful.
2133 optional bool is_authenticated = 3;
2134}
2135
2136/**
2137 * Logs when a fingerprint error occurs.
2138 *
2139 * Logged from:
2140 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2141 */
2142message FingerprintErrorOccurred {
2143 // The associated user. Eg: 0 for owners, 10+ for others.
2144 // Defined in android/os/UserHandle.java
2145 optional int32 user = 1;
2146 // If this error is for a crypto fingerprint.
2147 // e.g. Secure purchases, unlock password storage.
2148 optional bool is_crypto = 2;
2149
2150 enum Error {
2151 UNKNOWN = 0;
2152 LOCKOUT = 1;
2153 PERMANENT_LOCKOUT = 2;
2154 }
2155 // The type of error.
2156 optional Error error = 3;
2157}
Howard Ro688ae182018-09-25 00:09:36 -07002158
2159message Notification {
2160
2161 // Type of notification event.
2162 enum Type {
2163 TYPE_UNKNOWN = 0;
2164 // Notification became visible to the user.
2165 TYPE_OPEN = 1;
2166 // Notification became hidden.
2167 TYPE_CLOSE = 2;
2168 // Notification switched to detail mode.
2169 TYPE_DETAIL = 3;
2170 // Notification was clicked.
2171 TYPE_ACTION = 4;
2172 // Notification was dismissed.
2173 TYPE_DISMISS = 5;
2174 // Notification switched to summary mode. The enum value of 14 is to
2175 // match that of metrics_constants.
2176 TYPE_COLLAPSE = 14;
2177 }
2178 optional Type type = 1;
2179
2180 // Package name associated with the notification.
2181 optional string package_name = 2;
2182
2183 // Tag associated with notification.
2184 optional string tag = 3;
2185
2186 // Application-supplied ID associated with the notification.
2187 optional int32 id = 4;
2188
2189 // Index of notification in the notification panel.
2190 optional int32 shade_index = 5;
2191
2192 // The number of notifications in the notification panel.
2193 optional int32 shade_count = 6;
2194
2195 // Importance for the notification.
2196 optional int32 importance = 7;
2197
2198 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002199 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002200
2201 // Importance for the notification channel.
2202 optional int32 channel_importance = 9;
2203
Howard Ro183c2bd2018-10-18 13:52:10 -07002204 // Application-supplied ID associated with the notifications group.
2205 optional string group_id = 10;
2206
Howard Ro688ae182018-09-25 00:09:36 -07002207 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002208 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002209
Howard Ro183c2bd2018-10-18 13:52:10 -07002210 // Reason for dismissal of a notification. This field is only meaningful for
2211 // TYPE_DISMISS events.
2212 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002213
Howard Ro183c2bd2018-10-18 13:52:10 -07002214 // The first post time of notification, stable across updates.
2215 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002216
Howard Ro183c2bd2018-10-18 13:52:10 -07002217 // The most recent interruption time, or the creation time if no updates.
2218 // Differs from update_millis because updates are filtered based on whether
2219 // they actually interrupted the user.
2220 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002221
Howard Ro183c2bd2018-10-18 13:52:10 -07002222 // The most recent update time, or the creation time if no updates.
2223 optional int64 update_millis = 15;
2224
2225 // The most recent visibility event.
2226 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002227}
2228
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002229/*
Yangster-macb89807e2018-11-15 21:10:57 -08002230 * Logs when a flag flip state changes.
2231 * Logged in P/h.
2232 */
2233message PhenotypeFlagStateChanged {
2234 // Mendel configuration name.
2235 optional string mendel_config_name = 1;
2236 // State
2237 enum State {
2238 STATE_UNKNOWN = 0;
2239 COMMITTED = 1;
2240 }
2241 optional State state = 2;
2242}
2243
2244/*
2245 * Logs when a binary push state changes.
2246 * Logged in Play store
2247 */
2248message BinaryPushStateChanged {
2249 // Binary package name.
2250 optional string binary_name = 1;
2251 // Version code.
2252 optional int64 version = 2;
2253 // State
2254 enum State {
2255 STATE_UNKNOWN = 0;
2256 DOWNLOAD_START = 1;
2257 DOWNLOAD_DONE = 2;
2258 INSTALL_START = 3;
2259 INSTALL_DONE = 4;
2260 REBOOT_START = 5;
2261 REBOOT_DONE = 6;
2262 }
2263 optional State state = 3;
2264}
2265
2266/*
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002267 * Logs when a connection becomes available and lost.
2268 * Logged in StatsCompanionService.java
2269 */
2270message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002271 // Id of the network.
2272 optional int32 net_id = 1;
2273
2274 enum State {
2275 UNKNOWN = 0;
2276 CONNECTED = 1;
2277 DISCONNECTED = 2;
2278 }
2279 // Connected state of a network.
2280 optional State state = 2;
2281}
2282
2283/**
2284 * Logs when a service starts and stops.
2285 * Logged from:
2286 * services/core/java/com/android/server/am/ActiveServices.java
2287 */
2288message ServiceStateChanged {
2289
2290 optional int32 uid = 1 [(is_uid) = true];
2291
2292 optional string package_name = 2;
2293
2294 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002295
2296 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002297 START = 1;
2298 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002299 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002300
2301 optional State state = 4;
2302}
2303
2304/**
2305 * Logs when a service is launched.
2306 * Logged from:
2307 * services/core/java/com/android/server/am/ActiveServices.java
2308 */
2309message ServiceLaunchReported {
2310
2311 optional int32 uid = 1 [(is_uid) = true];
2312
2313 optional string package_name = 2;
2314
2315 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002316}
Howard Ro688ae182018-09-25 00:09:36 -07002317
Chenjie Yubbcbc602018-02-05 16:51:52 -08002318//////////////////////////////////////////////////////////////////////
2319// Pulled atoms below this line //
2320//////////////////////////////////////////////////////////////////////
2321
2322/**
David Chenc8a43242017-10-17 16:23:28 -07002323 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2324 *
2325 * Pulled from:
2326 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2327 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002328message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002329 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002330
2331 optional int64 rx_bytes = 2;
2332
2333 optional int64 rx_packets = 3;
2334
2335 optional int64 tx_bytes = 4;
2336
2337 optional int64 tx_packets = 5;
2338}
2339
2340/**
2341 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2342 *
2343 * Pulled from:
2344 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2345 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002346message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002347 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002348
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002349 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2350 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002351
2352 optional int64 rx_bytes = 3;
2353
2354 optional int64 rx_packets = 4;
2355
2356 optional int64 tx_bytes = 5;
2357
2358 optional int64 tx_packets = 6;
2359}
2360
2361/**
2362 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2363 *
2364 * Pulled from:
2365 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2366 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002367message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002368 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002369
2370 optional int64 rx_bytes = 2;
2371
2372 optional int64 rx_packets = 3;
2373
2374 optional int64 tx_bytes = 4;
2375
2376 optional int64 tx_packets = 5;
2377}
2378
2379/**
2380 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2381 *
2382 * Pulled from:
2383 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2384 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002385message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002386 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002387
Yao Chenc40a19d2018-03-15 16:48:25 -07002388 // 1 denotes foreground and 0 denotes background. This is called Set in
2389 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002390 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002391
2392 optional int64 rx_bytes = 3;
2393
2394 optional int64 rx_packets = 4;
2395
2396 optional int64 tx_bytes = 5;
2397
2398 optional int64 tx_packets = 6;
2399}
2400
2401/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002402 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2403 *
2404 * Pulled from:
2405 * StatsCompanionService
2406 */
2407message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002408 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002409
2410 optional int64 rx_bytes = 2;
2411
2412 optional int64 tx_bytes = 3;
2413}
2414
2415/**
David Chenc8a43242017-10-17 16:23:28 -07002416 * Pulls the kernel wakelock durations. This atom is adapted from
2417 * android/internal/os/KernelWakelockStats.java
2418 *
2419 * Pulled from:
2420 * StatsCompanionService using KernelWakelockReader.
2421 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002422message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002423 optional string name = 1;
2424
2425 optional int32 count = 2;
2426
2427 optional int32 version = 3;
2428
Yangster-maca8a30442018-10-13 23:46:34 -07002429 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002430}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002431
Chenjie Yu05013b32017-11-21 10:21:41 -08002432/**
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002433 * Pulls low power state information. If power.stats HAL is not available, this
2434 * includes platform and subsystem sleep state information,
2435 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
2436 * as defined in:
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002437 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002438 * hardware/interfaces/power/1.1/types.hal
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002439 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
2440 * as defined in:
2441 * hardware/interfaces/power/stats/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002442 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002443message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002444 // Subsystem name
2445 optional string subsystem_name = 1;
2446 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2447 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
Benjamin Schwartz51329b72018-12-06 10:48:03 -08002448 // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
2449 // powerEntityStateName from the corresponding PowerEntityStateInfo.
Chenjie Yubbcbc602018-02-05 16:51:52 -08002450 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002451 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002452 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002453 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002454 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002455}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002456
Chenjie Yu05013b32017-11-21 10:21:41 -08002457/**
Bookatz92da2832018-11-01 18:10:03 -07002458 * Pulls on-device power measurement information.
2459 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2460 * Pulled from:
2461 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2462 */
2463message OnDevicePowerMeasurement {
2464 // Name of the subsystem (to which the rail belongs).
2465 optional string subsystem_name = 1;
2466
2467 // Rail name. The rail lies within the subsystem.
2468 optional string rail_name = 2;
2469
2470 // Time (in ms since boot) at which the rail energy value was measured.
2471 // This may differ slightly from the time that statsd logs this information.
2472 optional uint64 measurement_timestamp_millis = 3;
2473
2474 // Accumulated energy used via the rail since device boot in uWs.
2475 optional uint64 energy_microwatt_secs = 4;
2476}
2477
2478/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002479 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002480 * Pulls the time the cpu spend on the frequency index. Frequency index
2481 * starts from highest to lowest. The value should be monotonically
2482 * increasing since boot. However, if there is a cpu
2483 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002484 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002485message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002486 optional uint32 cluster = 1;
2487 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002488 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002489}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002490
Chenjie Yu05013b32017-11-21 10:21:41 -08002491/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002492 * Pulls Cpu Time Per Uid.
2493 * Note that isolated process uid time should be attributed to host uids.
2494 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002495message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002496 optional int32 uid = 1 [(is_uid) = true];
Misha Wagner6bc6c912018-11-16 13:19:54 +00002497 optional uint64 user_time_micros = 2;
2498 optional uint64 sys_time_micros = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002499}
2500
2501/**
2502 * Pulls Cpu Time Per Uid per frequency.
2503 * Note that isolated process uid time should be attributed to host uids.
2504 * For each uid, we order the time by descending frequencies.
2505 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002506message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002507 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002508 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002509 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002510}
Hugo Benichi884970e2017-11-14 22:42:46 +09002511
Chenjie Yu05013b32017-11-21 10:21:41 -08002512/**
2513 * Pulls Wifi Controller Activity Energy Info
2514 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002515message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002516 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002517 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002518 // stack reported state
2519 // TODO: replace this with proto enum
2520 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002521 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002522 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002523 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002524 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002525 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002526 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002527 // product of current(mA), voltage(V) and time(ms)
2528 optional uint64 controller_energy_used = 6;
2529}
2530
2531/**
2532 * Pulls Modem Activity Energy Info
2533 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002534message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002535 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002536 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002537 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002538 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002539 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002540 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002541 /**
2542 * Tx power index
2543 * index 0 = tx_power < 0dBm
2544 * index 1 = 0dBm < tx_power < 5dBm
2545 * index 2 = 5dBm < tx_power < 15dBm
2546 * index 3 = 15dBm < tx_power < 20dBm
2547 * index 4 = tx_power > 20dBm
2548 */
2549 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002550 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002551 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002552 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002553 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002554 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002555 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002556 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002557 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002558 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002559 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002560 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002561 // product of current(mA), voltage(V) and time(ms)
2562 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002563}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002564
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002565/**
2566 * Pulls Bluetooth Activity Energy Info
2567 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2568 */
2569message BluetoothActivityInfo {
2570 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002571 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002572 // bluetooth stack state
2573 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002574 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002575 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002576 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002577 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002578 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002579 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002580 // product of current(mA), voltage(V) and time(ms)
2581 optional uint64 energy_used = 6;
2582}
2583
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002584/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002585 * Logs the memory stats for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002586 *
2587 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002588 */
2589message ProcessMemoryState {
2590 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002591 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002592
2593 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002594 // Usually package name, "system" for system server.
2595 // Provided by ActivityManagerService.
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002596 optional string process_name = 2;
2597
Rafal Slawikda51b932018-12-13 16:31:33 +00002598 // Current OOM score adjustment. Value read from ProcessRecord.
Yangster-maca8a30442018-10-13 23:46:34 -07002599 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002600
2601 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002602 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002603
2604 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002605 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002606
Rajeev Kumar90235992018-01-29 11:06:48 -08002607 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002608 // Value is read from /proc/PID/stat, field 24. Or from memory.stat, field
2609 // total_rss if per-app memory cgroups are enabled.
Rajeev Kumar90235992018-01-29 11:06:48 -08002610 optional int64 rss_in_bytes = 6;
2611
2612 // CACHE
Rafal Slawikda51b932018-12-13 16:31:33 +00002613 // Value is read from memory.stat, field total_cache if per-app memory
2614 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002615 optional int64 cache_in_bytes = 7;
2616
2617 // SWAP
Rafal Slawikda51b932018-12-13 16:31:33 +00002618 // Value is read from memory.stat, field total_swap if per-app memory
2619 // cgroups are enabled. Otherwise, 0.
Rajeev Kumar90235992018-01-29 11:06:48 -08002620 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002621
Rafal Slawikd03ae422018-11-20 11:27:45 +00002622 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002623 optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
Rafal Slawik272a8162018-11-01 15:12:28 +00002624
2625 // Elapsed real time when the process started.
2626 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2627 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002628}
2629
2630/*
Rafal Slawik08621582018-10-15 14:53:07 +01002631 * Logs the memory stats for a native process (from procfs).
Rafal Slawikda51b932018-12-13 16:31:33 +00002632 *
2633 * Pulled from StatsCompanionService for selected native processes.
Rafal Slawik08621582018-10-15 14:53:07 +01002634 */
2635message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002636 // The uid if available. -1 means not available.
2637 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002638
Rafal Slawikbf67d072018-10-23 11:07:54 +01002639 // The process name.
Rafal Slawikda51b932018-12-13 16:31:33 +00002640 // Value read from /proc/PID/cmdline.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002641 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002642
Rafal Slawikbf67d072018-10-23 11:07:54 +01002643 // # of page-faults
2644 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002645
Rafal Slawikbf67d072018-10-23 11:07:54 +01002646 // # of major page-faults
2647 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002648
Rafal Slawikbf67d072018-10-23 11:07:54 +01002649 // RSS
Rafal Slawikda51b932018-12-13 16:31:33 +00002650 // Value read from /proc/PID/stat, field 24.
Rafal Slawikbf67d072018-10-23 11:07:54 +01002651 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002652
Rafal Slawikd03ae422018-11-20 11:27:45 +00002653 // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002654 optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
Rafal Slawikbf67d072018-10-23 11:07:54 +01002655
2656 // Elapsed real time when the process started.
2657 // Value is read from /proc/PID/stat, field 22.
2658 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002659}
2660
2661/*
Rafal Slawik3bea8952018-11-15 12:39:33 +00002662 * Logs the memory high-water mark for a process.
Rafal Slawikda51b932018-12-13 16:31:33 +00002663 *
2664 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
2665 * and for selected native processes.
Rafal Slawik44b88142018-12-15 16:48:09 +00002666 *
2667 * Pulling this atom resets high-water mark counters for all processes.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002668 */
2669message ProcessMemoryHighWaterMark {
2670 // The uid if available. -1 means not available.
2671 optional int32 uid = 1 [(is_uid) = true];
2672
Rafal Slawikda51b932018-12-13 16:31:33 +00002673 // The process name.
2674 // Usually package name or process cmdline.
2675 // Provided by ActivityManagerService or read from /proc/PID/cmdline.
Rafal Slawik3bea8952018-11-15 12:39:33 +00002676 optional string process_name = 2;
2677
2678 // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
2679 // /proc/PID/status.
2680 optional int64 rss_high_water_mark_in_bytes = 3;
2681}
2682
2683/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002684 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002685 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002686message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002687 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002688}
2689
2690/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002691 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002692 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002693message SystemUptime {
2694 // Milliseconds since the system was booted.
2695 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2696 // for external input).
2697 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002698 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002699}
2700
2701/*
2702 * Reads from /proc/uid_concurrent_active_time which has the format:
2703 * active: X (X is # cores)
2704 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2705 * [uid1]: [time-0] [time-1] [time-2] ... ...
2706 * ...
2707 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2708 * The file contains a monotonically increasing count of time for a single boot.
2709 */
2710message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002711 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002712 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002713}
2714
2715/**
2716 * Reads from /proc/uid_concurrent_policy_time which has the format:
2717 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2718 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2719 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2720 * ...
2721 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2722 * The file contains a monotonically increasing count of time for a single boot.
2723 */
2724message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002725 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002726 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002727 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002728}
2729
2730/*
2731 * Pulls free disk space, for data, system partition and temporary directory.
2732 */
2733message DiskSpace {
2734 // available bytes in data partition
2735 optional uint64 data_available_bytes = 1;
2736 // available bytes in system partition
2737 optional uint64 system_available_bytes = 2;
2738 // available bytes in download cache or temp directories
2739 optional uint64 temp_available_bytes = 3;
2740}
Tej Singhbf972d92018-01-10 20:51:13 -08002741
2742/**
2743 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002744 * Pulled from:
2745 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002746 */
2747message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002748 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002749}
2750
2751/**
2752 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002753 * Pulled from:
2754 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002755 */
2756message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002757 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002758}
2759
2760/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002761 * Pulls battery voltage.
2762 * Pulled from:
2763 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2764 */
2765message BatteryVoltage {
2766 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002767 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002768}
2769
2770/**
Tej Singhb1dbc8b2018-11-19 15:49:47 -08002771 * Pulls battery level (percent full, from 0 to 100).
2772 *
2773 * Pulled from:
2774 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2775 */
2776message BatteryLevel {
2777 // Battery level. Should be in [0, 100].
2778 optional int32 battery_level = 1;
2779}
2780
2781/**
Tej Singhd89137e2018-03-26 14:51:40 -07002782 * Pulls the temperature of various parts of the device.
2783 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002784 *
2785 * Pulled from:
2786 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2787 */
2788message Temperature {
2789 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2790 optional android.os.TemperatureTypeEnum sensor_location = 1;
2791
2792 // The name of the temperature source. Eg. CPU0
2793 optional string sensor_name = 2;
2794
Tej Singhd89137e2018-03-26 14:51:40 -07002795 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002796 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002797}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002798
2799/**
2800 * Pulls the statistics of calls to Binder.
2801 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002802 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2803 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002804 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002805 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002806 */
2807message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002808 // UID of the process responsible for the binder transaction. It will be set if the process
2809 // executing the binder transaction attribute the transaction to another uid using
2810 // Binder.setThreadWorkSource().
2811 //
2812 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002813 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002814 // UID of the process executing the binder transaction.
2815 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002816 // Fully qualified class name of the API call.
2817 //
2818 // This is a system server class name.
2819 //
2820 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2821 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2822 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2823 // commonly used APIs.
2824 optional string service_class_name = 2;
2825 // Method name of the API call. It can also be a transaction code if we cannot
2826 // resolve it to a name. See Binder#getTransactionName.
2827 //
2828 // This is a system server method name.
2829 optional string service_method_name = 3;
2830 // Total number of API calls.
2831 optional int64 call_count = 4;
2832 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2833 optional bool screen_interactive = 13;
2834 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2835 // call_count will be equal to recorded_call_count.
2836 //
2837 // If recorded_call_count is different than call_count, it means data collection has been
2838 // sampled. All the fields below will be sampled in this case.
2839 optional int64 recorded_call_count = 12;
2840 // Number of exceptions thrown by the API.
2841 optional int64 recorded_exception_count = 5;
2842 // Total latency of all API calls.
2843 // Average can be computed using total_latency_micros / recorded_call_count.
2844 optional int64 recorded_total_latency_micros = 6;
2845 // Maximum latency of one API call.
2846 optional int64 recorded_max_latency_micros = 7;
2847 // Total CPU usage of all API calls.
2848 // Average can be computed using total_cpu_micros / recorded_call_count.
2849 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2850 optional int64 recorded_total_cpu_micros = 8;
2851 // Maximum CPU usage of one API call.
2852 optional int64 recorded_max_cpu_micros = 9;
2853 // Maximum parcel reply size of one API call.
2854 optional int64 recorded_max_reply_size_bytes = 10;
2855 // Maximum parcel request size of one API call.
2856 optional int64 recorded_max_request_size_bytes = 11;
2857}
2858
2859/**
2860 * Pulls the statistics of exceptions during calls to Binder.
2861 *
2862 * Binder stats are cumulative from boot unless somebody reset the data using
2863 * > adb shell dumpsys binder_calls_stats --reset
2864 */
2865message BinderCallsExceptions {
2866 // Exception class name, e.g. java.lang.IllegalArgumentException.
2867 //
2868 // This is an exception class name thrown by the system server.
2869 optional string exception_class_name = 1;
2870 // Total number of exceptions.
2871 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002872}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002873
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002874/**
2875 * Pulls the statistics of message dispatching on HandlerThreads.
2876 *
2877 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2878 * config on the device.
2879 *
2880 * Next tag: 11
2881 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002882message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002883 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002884 optional int32 uid = 1 [(is_uid) = true];
2885
2886 // Fully qualified class name of the handler target class.
2887 //
2888 // This field does not contain PII. This is a system server class name.
2889 optional string handler_class_name = 2;
2890
2891 // The name of the thread that runs the Looper.
2892 //
2893 // This field does not contain PII. This is a system server thread name.
2894 optional string looper_thread_name = 3;
2895
2896 // The name of the dispatched message.
2897 //
2898 // This field does not contain PII. This is a system server constant or class
2899 // name.
2900 optional string message_name = 4;
2901
2902 // Total number of successfully dispatched messages.
2903 optional int64 message_count = 5;
2904
2905 // Total number of messages that failed dispatching.
2906 optional int64 exception_count = 6;
2907
2908 // Total number of processed messages we have data recorded for. If we
2909 // collected data for all the messages, message_count will be equal to
2910 // recorded_message_count.
2911 //
2912 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002913 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002914 optional int64 recorded_message_count = 7;
2915
2916 // Total latency of all processed messages.
2917 // Average can be computed using recorded_total_latency_micros /
2918 // recorded_message_count.
2919 optional int64 recorded_total_latency_micros = 8;
2920
2921 // Total CPU usage of all processed message.
2922 // Average can be computed using recorded_total_cpu_micros /
2923 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002924 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002925 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002926
2927 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2928 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002929
2930 // Max recorded CPU usage of all processed messages.
2931 optional int64 recorded_max_cpu_micros = 11;
2932
2933 // Max recorded latency of all processed messages.
2934 optional int64 recorded_max_latency_micros = 12;
2935
2936 // Total number of messages we tracked the dispatching delay for. If we
2937 // collected data for all the messages, message_count will be equal to
2938 // recorded_delay_message_count.
2939 //
2940 // If recorded_delay_message_count is different than message_count, it means data
2941 // collection has been sampled or/and not all messages specified the target dispatch time.
2942 // The fields below will be sampled in this case.
2943 optional int64 recorded_delay_message_count = 13;
2944
2945 // Total dispatching delay of all processed messages.
2946 // Calculated as a difference between the target dispatching time (Message.when)
2947 // and the actual dispatching time.
2948 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2949 optional int64 recorded_total_delay_millis = 14;
2950
2951 // Max dispatching delay of all processed messages.
2952 // Calculated as a difference between the target dispatching time (Message.when)
2953 // and the actual dispatching time.
2954 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002955}
Tej Singh86dc9db2018-09-06 00:39:57 +00002956
2957/**
2958 * Pulls disk information, such as write speed and latency.
2959 */
2960message DiskStats {
2961 // Time taken to open, write 512B to, and close a file.
2962 // -1 if error performing the check.
2963 optional int64 data_write_latency_millis = 1;
2964
2965 optional bool file_based_encryption = 2;
2966
2967 // Recent disk write speed in kB/s.
2968 // -1 if error querying storageed.
2969 // 0 if data is unavailable.
2970 optional int32 recent_disk_write_speed = 3;
2971}
2972
2973
2974/**
2975 * Free and total bytes of the Data, Cache, and System partition.
2976 */
2977message DirectoryUsage {
2978 enum Directory {
2979 UNKNOWN = 0;
2980 DATA = 1;
2981 CACHE = 2;
2982 SYSTEM = 3;
2983 }
2984 optional Directory directory = 1;
2985 optional int64 free_bytes = 2;
2986 optional int64 total_bytes = 3;
2987}
2988
2989
2990/**
2991 * Size of an application: apk size, data size, and cache size.
2992 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2993 * Information is only reported for apps with the primary user (user 0).
2994 * Sizes are aggregated by package name.
2995 */
2996message AppSize {
2997 // Including uids will involve modifying diskstats logic.
2998 optional string package_name = 1;
2999 // App size in bytes. -1 if unavailable.
3000 optional int64 app_size_bytes = 2;
3001 // App data size in bytes. -1 if unavailable.
3002 optional int64 app_data_size_bytes = 3;
3003 // App cache size in bytes. -1 if unavailable.
3004 optional int64 app_cache_size_bytes = 4;
3005 // Time that the cache file was produced.
3006 // Uses System.currentTimeMillis(), which is wall clock time.
3007 optional int64 cache_time_millis = 5;
3008}
3009
3010
3011/**
3012 * Size of a particular category. Eg: photos, videos.
3013 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
3014 */
3015message CategorySize {
3016 enum Category {
3017 UNKNOWN = 0;
3018 APP_SIZE = 1;
3019 APP_DATA_SIZE = 2;
3020 APP_CACHE_SIZE = 3;
3021 PHOTOS = 4;
3022 VIDEOS = 5;
3023 AUDIO = 6;
3024 DOWNLOADS = 7;
3025 SYSTEM = 8;
3026 OTHER = 9;
3027 }
3028 optional Category category = 1;
3029 // Category size in bytes.
3030 optional int64 size_bytes = 2;
3031 // Time that the cache file was produced.
3032 // Uses System.currentTimeMillis(), which is wall clock time.
3033 optional int64 cache_time_millis = 3;
3034}
Tej Singhd6d6d772018-09-05 17:41:25 -07003035
3036/**
Tej Singhe7726dc2018-09-21 11:42:12 -07003037 * Pulls per uid I/O stats. The stats are cumulative since boot.
3038 *
3039 * Read/write bytes are I/O events from a storage device
3040 * Read/write chars are data requested by read/write syscalls, and can be
3041 * satisfied by caching.
3042 *
3043 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
3044 */
3045message DiskIo {
3046 optional int32 uid = 1 [(is_uid) = true];
3047 optional int64 fg_chars_read = 2;
3048 optional int64 fg_chars_write = 3;
3049 optional int64 fg_bytes_read = 4;
3050 optional int64 fg_bytes_write = 5;
3051 optional int64 bg_chars_read = 6;
3052 optional int64 bg_chars_write = 7;
3053 optional int64 bg_bytes_read = 8;
3054 optional int64 bg_bytes_write = 9;
3055 optional int64 fg_fsync = 10;
3056 optional int64 bg_fsync= 11;
3057}
3058
3059
3060/**
Tej Singhd6d6d772018-09-05 17:41:25 -07003061 * Pulls the number of fingerprints for each user.
3062 *
3063 * Pulled from StatsCompanionService, which queries FingerprintManager.
3064 */
3065message NumFingerprints {
3066 // The associated user. Eg: 0 for owners, 10+ for others.
3067 // Defined in android/os/UserHandle.java
3068 optional int32 user = 1;
3069 // Number of fingerprints registered to that user.
3070 optional int32 num_fingerprints = 2;
3071}
Chenjie Yu12e5e672018-09-14 15:54:59 -07003072
Yangsteraf9aee72018-10-12 09:26:16 -07003073message AggStats {
3074 optional int64 min = 1;
3075
3076 optional int64 average = 2;
3077
3078 optional int64 max = 3;
3079}
3080
3081message ProcessStatsStateProto {
3082 optional android.service.procstats.ScreenState screen_state = 1;
3083
3084 optional android.service.procstats.MemoryState memory_state = 2;
3085
3086 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
3087 // and not frameworks/base/core/java/android/app/ActivityManager.java
3088 optional android.service.procstats.ProcessState process_state = 3;
3089
3090 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003091 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003092
3093 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003094 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07003095
3096 // # of samples taken
3097 optional int32 sample_size = 5;
3098
3099 // PSS is memory reserved for this process
3100 optional AggStats pss = 6;
3101
3102 // USS is memory shared between processes, divided evenly for accounting
3103 optional AggStats uss = 7;
3104
3105 // RSS is memory resident for this process
3106 optional AggStats rss = 8;
3107}
3108
3109// Next Tag: 7
3110message ProcessStatsProto {
3111 // Name of process.
3112 optional string process = 1;
3113
3114 // Uid of the process.
3115 optional int32 uid = 2;
3116
3117 // Information about how often kills occurred
3118 message Kill {
3119 // Count of excessive CPU kills
3120 optional int32 cpu = 1;
3121
3122 // Count of kills when cached
3123 optional int32 cached = 2;
3124
3125 // PSS stats during cached kill
3126 optional AggStats cached_pss = 3;
3127 }
3128 optional Kill kill = 3;
3129
3130 // Time and memory spent in various states.
3131 repeated ProcessStatsStateProto states = 5;
3132
3133 // Total time process has been running... screen_state, memory_state, and process_state
3134 // will not be set.
3135 optional ProcessStatsStateProto total_running_state = 6;
3136}
3137
3138message PackageServiceOperationStatsProto {
3139 // Operate enum: Started, Foreground, Bound, Executing
3140 optional android.service.procstats.ServiceOperationState operation = 1;
3141
3142 // Number of times the service was in this operation.
3143 optional int32 count = 2;
3144
3145 // Information about a state the service can be in.
3146 message StateStats {
3147 // Screen state enum.
3148 optional android.service.procstats.ScreenState screen_state = 1;
3149 // Memory state enum.
3150 optional android.service.procstats.MemoryState memory_state = 2;
3151
3152 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07003153 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003154 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003155 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003156 }
3157 repeated StateStats state_stats = 3;
3158}
3159
3160message PackageServiceStatsProto {
3161 // Name of service component.
3162 optional string service_name = 1;
3163
3164 // The operation stats.
3165 // The package_name, package_uid, package_version, service_name will not be set to save space.
3166 repeated PackageServiceOperationStatsProto operation_stats = 2;
3167}
3168
3169message PackageAssociationSourceProcessStatsProto {
3170 // Uid of the process.
3171 optional int32 process_uid = 1;
3172 // Process name.
3173 optional string process_name = 2;
3174
3175 // Total count of the times this association appeared.
3176 optional int32 total_count = 3;
3177
3178 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003179 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003180
3181 // Total count of the times this association became actively impacting its target process.
3182 optional int32 active_count = 5;
3183
3184 // Information on one source in this association.
3185 message StateStats {
3186 // Process state enum.
3187 optional android.service.procstats.ProcessState process_state = 1;
3188 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003189 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003190 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003191 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003192 }
3193 repeated StateStats active_state_stats = 6;
3194}
3195
3196message PackageAssociationProcessStatsProto {
3197 // Name of the target component.
3198 optional string component_name = 1;
3199 // Information on one source in this association.
3200 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3201}
3202
3203
3204message ProcessStatsPackageProto {
3205 // Name of package.
3206 optional string package = 1;
3207
3208 // Uid of the package.
3209 optional int32 uid = 2;
3210
3211 // Version of the package.
3212 optional int64 version = 3;
3213
3214 // Stats for each process running with the package loaded in to it.
3215 repeated ProcessStatsProto process_stats = 4;
3216
3217 // Stats for each of the package's services.
3218 repeated PackageServiceStatsProto service_stats = 5;
3219
3220 // Stats for each association with the package.
3221 repeated PackageAssociationProcessStatsProto association_stats = 6;
3222}
3223
3224message ProcessStatsSectionProto {
3225 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003226 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003227
3228 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003229 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003230
3231 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003232 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003233
3234 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003235 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003236
3237 // System runtime library. e.g. "libdvm.so", "libart.so".
3238 optional string runtime = 5;
3239
3240 // whether kernel reports swapped pss.
3241 optional bool has_swapped_pss = 6;
3242
3243 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3244 enum Status {
3245 STATUS_UNKNOWN = 0;
3246 STATUS_COMPLETE = 1;
3247 STATUS_PARTIAL = 2;
3248 STATUS_SHUTDOWN = 3;
3249 STATUS_SYSPROPS = 4;
3250 }
3251 repeated Status status = 7;
3252
3253 // Stats for each process.
3254 repeated ProcessStatsProto process_stats = 8;
3255
3256 // Stats for each package.
3257 repeated ProcessStatsPackageProto package_stats = 9;
3258}
3259
Chenjie Yu12e5e672018-09-14 15:54:59 -07003260/**
3261 * Pulled from ProcessStatsService.java
3262 */
3263message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003264 optional ProcessStatsSectionProto proc_stats_section = 1;
3265}
3266
3267message PowerProfileProto {
3268 optional double cpu_suspend = 1;
3269
3270 optional double cpu_idle = 2;
3271
3272 optional double cpu_active = 3;
3273
3274 message CpuCluster {
3275 optional int32 id = 1;
3276 optional double cluster_power = 2;
3277 optional int32 cores = 3;
3278 repeated int64 speed = 4;
3279 repeated double core_power = 5;
3280 }
3281
3282 repeated CpuCluster cpu_cluster = 40;
3283
3284 optional double wifi_scan = 4;
3285
3286 optional double wifi_on = 5;
3287
3288 optional double wifi_active = 6;
3289
3290 optional double wifi_controller_idle = 7;
3291
3292 optional double wifi_controller_rx = 8;
3293
3294 optional double wifi_controller_tx = 9;
3295
3296 repeated double wifi_controller_tx_levels = 10;
3297
3298 optional double wifi_controller_operating_voltage = 11;
3299
3300 optional double bluetooth_controller_idle = 12;
3301
3302 optional double bluetooth_controller_rx = 13;
3303
3304 optional double bluetooth_controller_tx = 14;
3305
3306 optional double bluetooth_controller_operating_voltage = 15;
3307
3308 optional double modem_controller_sleep = 16;
3309
3310 optional double modem_controller_idle = 17;
3311
3312 optional double modem_controller_rx = 18;
3313
3314 repeated double modem_controller_tx = 19;
3315
3316 optional double modem_controller_operating_voltage = 20;
3317
3318 optional double gps_on = 21;
3319
3320 repeated double gps_signal_quality_based = 22;
3321
3322 optional double gps_operating_voltage = 23;
3323
3324 optional double bluetooth_on = 24;
3325
3326 optional double bluetooth_active = 25;
3327
3328 optional double bluetooth_at_cmd = 26;
3329
3330 optional double ambient_display = 27;
3331
3332 optional double screen_on = 28;
3333
3334 optional double radio_on = 29;
3335
3336 optional double radio_scanning = 30;
3337
3338 optional double radio_active = 31;
3339
3340 optional double screen_full = 32;
3341
3342 optional double audio = 33;
3343
3344 optional double video = 34;
3345
3346 optional double flashlight = 35;
3347
3348 optional double memory = 36;
3349
3350 optional double camera = 37;
3351
3352 optional double wifi_batched_scan = 38;
3353
3354 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003355}
Chenjie Yuab530202018-09-26 12:39:20 -07003356
3357/**
3358 * power_profile.xml and other constants for power model calculations.
3359 * Pulled from PowerProfile.java
3360 */
3361message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003362 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003363}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003364
3365/**
arangelovd5db50e2018-10-12 20:24:39 +01003366 * Logs when a user restriction was added or removed.
3367 *
3368 * Logged from:
3369 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3370 */
3371message UserRestrictionChanged {
3372 // The raw string of the user restriction as defined in UserManager.
3373 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3374 optional string restriction = 1;
3375 // Whether the restriction is enabled or disabled.
3376 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003377}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003378
3379/**
3380 * Pulls process user time and system time. Puller takes a snapshot of all pids
3381 * in the system and returns cpu stats for those that are working at the time.
3382 * Dead pids will be dropped. Kernel processes are excluded.
3383 * Min cool-down is 5 sec.
3384 */
3385message ProcessCpuTime {
3386 optional int32 uid = 1 [(is_uid) = true];
3387
3388 optional string process_name = 2;
3389 // Process cpu time in user space, cumulative from boot/process start
3390 optional int64 user_time_millis = 3;
3391 // Process cpu time in system space, cumulative from boot/process start
3392 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003393}
Misha Wagner5a51e002018-10-03 15:04:09 +01003394
3395/**
3396 * Pulls the CPU usage for each thread.
3397 *
3398 * Read from /proc/$PID/task/$TID/time_in_state files.
3399 *
3400 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3401 * time_in_state files not being present on some phones, have not been addressed. These should be
3402 * considered before a public release.
3403 */
3404message CpuTimePerThreadFreq {
3405 // UID that owns the process.
3406 optional int32 uid = 1 [(is_uid) = true];
3407 // ID of the process.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003408 optional int32 process_id = 2;
Misha Wagner5a51e002018-10-03 15:04:09 +01003409 // ID of the thread.
Misha Wagnerdfa548c2018-11-16 11:18:00 +00003410 optional int32 thread_id = 3;
Misha Wagner5a51e002018-10-03 15:04:09 +01003411 // Name of the process taken from `/proc/$PID/cmdline`.
3412 optional string process_name = 4;
3413 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3414 optional string thread_name = 5;
Misha Wagnerfde69582018-11-28 13:26:32 +00003415
3416 // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
3417 // are given in KHz, and time is given in milliseconds since the thread started. All eight
3418 // frequencies are given here as the alternative is sending eight separate atoms. This method
3419 // significantly reduces the amount of data created
3420 optional int32 frequency1_khz = 6;
3421 optional int32 time1_millis = 7;
3422 optional int32 frequency2_khz = 8;
3423 optional int32 time2_millis = 9;
3424 optional int32 frequency3_khz = 10;
3425 optional int32 time3_millis = 11;
3426 optional int32 frequency4_khz = 12;
3427 optional int32 time4_millis = 13;
3428 optional int32 frequency5_khz = 14;
3429 optional int32 time5_millis = 15;
3430 optional int32 frequency6_khz = 16;
3431 optional int32 time6_millis = 17;
3432 optional int32 frequency7_khz = 18;
3433 optional int32 time7_millis = 19;
3434 optional int32 frequency8_khz = 20;
3435 optional int32 time8_millis = 21;
Misha Wagner5a51e002018-10-03 15:04:09 +01003436}
Bookatz75ee6042018-11-09 12:27:37 -08003437
3438/**
Bookatz366a4432018-11-20 09:42:33 -08003439 * Pulls information about the device's build.
3440 */
3441message BuildInformation {
3442 // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
3443 // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
3444 optional string fingerprint = 1;
3445
3446 // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
3447 optional string brand = 2;
3448
3449 // Build.PRODUCT. The name of the overall product.
3450 optional string product = 3;
3451
3452 // Build.DEVICE. The name of the industrial design.
3453 optional string device = 4;
3454
3455 // Build.VERSION.RELEASE. The user-visible version string. E.g., "1.0" or "3.4b5" or "bananas".
3456 optional string version_release = 5;
3457
3458 // Build.ID. E.g. a label like "M4-rc20".
3459 optional string id = 6;
3460
3461 // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
3462 // represent this build.
3463 optional string version_incremental = 7;
3464
3465 // Build.TYPE. The type of build, like "user" or "eng".
3466 optional string type = 8;
3467
3468 // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
3469 optional string tags = 9;
3470}
3471
3472/**
Bookatz75ee6042018-11-09 12:27:37 -08003473 * Pulls on-device BatteryStats power use calculations for the overall device.
3474 */
3475message DeviceCalculatedPowerUse {
3476 // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset
3477 // (i.e. roughly since device was last significantly charged).
3478 // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()).
3479 optional float computed_power_milli_amp_hours = 1;
3480}
3481
3482/**
3483 * Pulls on-device BatteryStats power use calculations broken down by uid.
3484 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
3485 * that is attributed to non-uid items. They must all be included to get the total power use.
3486 */
3487message DeviceCalculatedPowerBlameUid {
3488 // Uid being blamed. Note: isolated uids have already been mapped to host uid.
3489 optional int32 uid = 1 [(is_uid) = true];
3490
3491 // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset
3492 // (i.e. roughly since device was last significantly charged).
3493 optional float power_milli_amp_hours = 2;
3494}
3495
3496/**
3497 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
3498 * drain type.
3499 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
3500 * is attributed uids. They must all be included to get the total power use.
3501 */
3502message DeviceCalculatedPowerBlameOther {
3503 // The type of item whose power use is being reported.
3504 enum DrainType {
3505 AMBIENT_DISPLAY = 0;
3506 // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
3507 BLUETOOTH = 2;
3508 CAMERA = 3;
3509 // Cell-standby
3510 CELL = 4;
3511 FLASHLIGHT = 5;
3512 IDLE = 6;
3513 MEMORY = 7;
3514 // Amount that total computed drain exceeded the drain estimated using the
3515 // battery level changes and capacity.
3516 OVERCOUNTED = 8;
3517 PHONE = 9;
3518 SCREEN = 10;
3519 // Amount that total computed drain was below the drain estimated using the
3520 // battery level changes and capacity.
3521 UNACCOUNTED = 11;
3522 // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
3523 WIFI = 13;
3524 }
3525 optional DrainType drain_type = 1;
3526
3527 // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset
3528 // (i.e. roughly since device was last significantly charged).
3529 optional float power_milli_amp_hours = 2;
Rafal Slawik3bea8952018-11-15 12:39:33 +00003530}
arangelov4e994062018-11-13 16:12:38 +00003531
3532/**
3533 * Logs device policy features.
3534 *
3535 * Logged from:
3536 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3537 * packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
3538 */
3539message DevicePolicyEvent {
3540 // The event id - unique for each event.
3541 optional android.stats.devicepolicy.EventId event_id = 1;
3542 // The admin package name.
3543 optional string admin_package_name = 2;
3544 // A generic integer parameter.
3545 optional int32 integer_value = 3;
3546 // A generic boolean parameter.
3547 optional bool boolean_value = 4;
3548 // A parameter specifying a time period in milliseconds.
3549 optional uint64 time_period_millis = 5;
3550 // A parameter specifying a list of package names, bundle extras or string parameters.
3551 optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
3552}
shawnlinea5b66b2018-11-13 15:05:29 +08003553
3554/**
3555 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
3556 *
3557 * Logged from:
3558 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3559 */
3560message DocsUILaunchReported {
3561 optional android.stats.docsui.LaunchAction launch_action = 1;
3562 optional bool has_initial_uri = 2;
3563 optional android.stats.docsui.MimeType mime_type = 3;
3564 optional android.stats.docsui.Root initial_root = 4;
3565}
3566
3567/**
3568 * Logs root/app visited event in file managers/picker. Call this when the user
3569 * taps on root/app in hamburger menu.
3570 *
3571 * Logged from:
3572 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3573 */
3574message DocsUIRootVisitedReported {
3575 optional android.stats.docsui.ContextScope scope = 1;
3576 optional android.stats.docsui.Root root = 2;
3577}
3578
3579/**
3580 * Logs file operation stats. Call this when a file operation has completed.
3581 *
3582 * Logged from:
3583 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3584 */
3585message DocsUIFileOperationReported {
3586 optional android.stats.docsui.Provider provider = 1;
3587 optional android.stats.docsui.FileOperation file_op = 2;
3588}
3589
3590/**
3591 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
3592 * mode.
3593 *
3594 * Logged from:
3595 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3596 */
3597message DocsUIFileOperationCopyMoveModeReported {
3598 optional android.stats.docsui.FileOperation file_op = 1;
3599 optional android.stats.docsui.CopyMoveOpMode mode = 2;
3600}
3601
3602
3603/**
3604 * Logs file sub operation stats. Call this when a file operation has failed.
3605 *
3606 * Logged from:
3607 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3608 */
3609message DocsUIFileOperationFailureReported {
3610 optional android.stats.docsui.Authority authority = 1;
3611 optional android.stats.docsui.SubFileOperation sub_op = 2;
3612}
3613
3614/**
3615* Logs the cancellation of a file operation. Call this when a job is canceled
3616*
3617* Logged from:
3618* package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3619*/
3620message DocsUIFileOperationCanceledReported {
3621 optional android.stats.docsui.FileOperation file_op = 1;
3622}
3623
3624/**
3625 * Logs startup time in milliseconds.
3626 *
3627 * Logged from:
3628 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3629 */
3630message DocsUIStartupMsReported {
3631 optional int32 startup_millis = 1;
3632}
3633
3634/**
3635 * Logs the action that was started by user.
3636 *
3637 * Logged from:
3638 * package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
3639 */
3640message DocsUIUserActionReported {
3641 optional android.stats.docsui.UserAction action = 1;
3642}
3643
3644/**
3645 * Logs the invalid type when invalid scoped access is requested.
3646 *
3647 * Logged from:
3648 * package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
3649 */
3650message DocsUIInvalidScopedAccessRequestReported {
3651 optional android.stats.docsui.InvalidScopedAccess type = 1;
Rafal Slawikda51b932018-12-13 16:31:33 +00003652}
Ben Murdochbab399f2018-12-06 11:01:38 +00003653
3654/**
3655 * Logs when an app's memory is compacted.
3656 *
3657 * Logged from:
3658 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3659 */
3660message AppCompacted {
3661 // The pid of the process being compacted.
3662 optional int32 pid = 1;
3663
3664 // The name of the process being compacted.
3665 optional string process_name = 2;
3666
3667 // The type of compaction.
3668 enum Action {
3669 UNKNOWN = 0;
3670 SOME = 1;
3671 FULL = 2;
3672 }
3673 optional Action action = 3 [default = UNKNOWN];
3674
3675 // Total RSS in kilobytes consumed by the process prior to compaction.
3676 optional int64 before_rss_total_kilobytes = 4;
3677
3678 // File RSS in kilobytes consumed by the process prior to compaction.
3679 optional int64 before_rss_file_kilobytes = 5;
3680
3681 // Anonymous RSS in kilobytes consumed by the process prior to compaction.
3682 optional int64 before_rss_anon_kilobytes = 6;
3683
3684 // Swap in kilobytes consumed by the process prior to compaction.
3685 optional int64 before_swap_kilobytes = 7;
3686
3687 // Total RSS in kilobytes consumed by the process after compaction.
3688 optional int64 after_rss_total_kilobytes = 8;
3689
3690 // File RSS in kilobytes consumed by the process after compaction.
3691 optional int64 after_rss_file_kilobytes = 9;
3692
3693 // Anonymous RSS in kilobytes consumed by the process after compaction.
3694 optional int64 after_rss_anon_kilobytes = 10;
3695
3696 // Swap in kilobytes consumed by the process after compaction.
3697 optional int64 after_swap_kilobytes = 11;
3698
3699 // The time taken to perform compaction in milliseconds.
3700 optional int64 time_to_compact_millis = 12;
3701
3702 // The last compaction action performed for this app.
3703 optional Action last_action = 13;
3704
3705 // The last time that compaction was attempted on this process in seconds
3706 // since boot.
3707 optional int64 last_compact_timestamp = 14;
3708
3709 // The oom_adj at the time of compaction.
3710 optional int32 oom_adj = 15;
3711
3712 // The process state at the time of compaction.
3713 optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
3714}