1/*
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";
18
19package android.os.statsd;
20option java_package = "com.android.os";
21option java_outer_classname = "AtomsProto";
22
23import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
24import "frameworks/base/core/proto/android/app/enums.proto";
25import "frameworks/base/core/proto/android/app/job/enums.proto";
26import "frameworks/base/core/proto/android/app/settings_enums.proto";
27import "frameworks/base/core/proto/android/bluetooth/a2dp/enums.proto";
28import "frameworks/base/core/proto/android/bluetooth/enums.proto";
29import "frameworks/base/core/proto/android/bluetooth/hci/enums.proto";
30import "frameworks/base/core/proto/android/bluetooth/hfp/enums.proto";
31import "frameworks/base/core/proto/android/bluetooth/smp/enums.proto";
32import "frameworks/base/core/proto/android/debug/enums.proto";
33import "frameworks/base/core/proto/android/hardware/biometrics/enums.proto";
34import "frameworks/base/core/proto/android/hardware/sensor/assist/enums.proto";
35import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
36import "frameworks/base/core/proto/android/os/enums.proto";
37import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
38import "frameworks/base/core/proto/android/server/enums.proto";
39import "frameworks/base/core/proto/android/server/job/enums.proto";
40import "frameworks/base/core/proto/android/server/location/enums.proto";
41import "frameworks/base/core/proto/android/service/procstats_enum.proto";
42import "frameworks/base/core/proto/android/service/usb.proto";
43import "frameworks/base/core/proto/android/stats/connectivity/network_stack.proto";
44import "frameworks/base/core/proto/android/stats/connectivity/tethering.proto";
45import "frameworks/base/core/proto/android/stats/dnsresolver/dns_resolver.proto";
46import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
47import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
48import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
49import "frameworks/base/core/proto/android/stats/enums.proto";
50import "frameworks/base/core/proto/android/stats/intelligence/enums.proto";
51import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
52import "frameworks/base/core/proto/android/stats/location/location_enums.proto";
53import "frameworks/base/core/proto/android/stats/mediametrics/mediametrics.proto";
54import "frameworks/base/core/proto/android/stats/otaupdate/updateengine_enums.proto";
55import "frameworks/base/core/proto/android/stats/storage/storage_enums.proto";
56import "frameworks/base/core/proto/android/stats/style/style_enums.proto";
57import "frameworks/base/core/proto/android/telecomm/enums.proto";
58import "frameworks/base/core/proto/android/telephony/enums.proto";
59import "frameworks/base/core/proto/android/view/enums.proto";
60import "frameworks/base/core/proto/android/wifi/enums.proto";
61
62/**
63 * The primary atom class. This message defines all of the available
64 * raw stats log events from the Android system, also known as "atoms."
65 *
66 * This field contains a single oneof with all of the available messages.
67 * The stats-log-api-gen tool runs as part of the Android build and
68 * generates the android.util.StatsLog class, which contains the constants
69 * and methods that Android uses to log.
70 *
71 * This Atom class is not actually built into the Android system.
72 * Instead, statsd on Android constructs these messages synthetically,
73 * in the format defined here and in stats_log.proto.
74 */
75message Atom {
76    // Pushed atoms start at 2.
77    oneof pushed {
78        // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
79        BleScanStateChanged ble_scan_state_changed = 2 [(log_from_module) = "bluetooth"];
80        ProcessStateChanged process_state_changed = 3;
81        BleScanResultReceived ble_scan_result_received = 4 [(log_from_module) = "bluetooth"];
82        SensorStateChanged sensor_state_changed = 5;
83        GpsScanStateChanged gps_scan_state_changed = 6;
84        SyncStateChanged sync_state_changed = 7;
85        ScheduledJobStateChanged scheduled_job_state_changed = 8;
86        ScreenBrightnessChanged screen_brightness_changed = 9;
87        WakelockStateChanged wakelock_state_changed = 10;
88        LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
89        MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12 [(log_from_module) = "framework"];
90        WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13 [(log_from_module) = "framework"];
91        ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
92        MemoryFactorStateChanged memory_factor_state_changed = 15;
93        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
94        CachedKillReported cached_kill_reported = 17;
95        ProcessMemoryStatReported process_memory_stat_reported = 18;
96        LauncherUIChanged launcher_event = 19;
97        BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
98        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
99        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
100        AudioStateChanged audio_state_changed = 23;
101        MediaCodecStateChanged media_codec_state_changed = 24;
102        CameraStateChanged camera_state_changed = 25;
103        FlashlightStateChanged flashlight_state_changed = 26;
104        UidProcessStateChanged uid_process_state_changed = 27;
105        ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
106        ScreenStateChanged screen_state_changed = 29;
107        BatteryLevelChanged battery_level_changed = 30;
108        ChargingStateChanged charging_state_changed = 31;
109        PluggedStateChanged plugged_state_changed = 32;
110        InteractiveStateChanged interactive_state_changed = 33;
111        TouchEventReported touch_event_reported = 34;
112        WakeupAlarmOccurred wakeup_alarm_occurred = 35;
113        KernelWakeupReported kernel_wakeup_reported = 36;
114        WifiLockStateChanged wifi_lock_state_changed = 37;
115        WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
116        WifiScanStateChanged wifi_scan_state_changed = 39;
117        PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
118        SettingChanged setting_changed = 41;
119        ActivityForegroundStateChanged activity_foreground_state_changed = 42;
120        IsolatedUidChanged isolated_uid_changed = 43;
121        PacketWakeupOccurred packet_wakeup_occurred = 44 [(log_from_module) = "framework"];
122        WallClockTimeShifted wall_clock_time_shifted = 45;
123        AnomalyDetected anomaly_detected = 46;
124        AppBreadcrumbReported app_breadcrumb_reported = 47 [(allow_from_any_uid) = true];
125        AppStartOccurred app_start_occurred = 48;
126        AppStartCanceled app_start_canceled = 49;
127        AppStartFullyDrawn app_start_fully_drawn = 50;
128        LmkKillOccurred lmk_kill_occurred = 51 [(log_from_module) = "lmkd"];
129        PictureInPictureStateChanged picture_in_picture_state_changed = 52;
130        WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
131        LmkStateChanged lmk_state_changed = 54 [(log_from_module) = "lmkd"];
132        AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
133        ShutdownSequenceReported shutdown_sequence_reported = 56;
134        BootSequenceReported boot_sequence_reported = 57;
135        DaveyOccurred davey_occurred = 58 [(allow_from_any_uid) = true];
136        OverlayStateChanged overlay_state_changed = 59;
137        ForegroundServiceStateChanged foreground_service_state_changed = 60;
138        CallStateChanged call_state_changed = 61;
139        KeyguardStateChanged keyguard_state_changed = 62;
140        KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
141        KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
142        AppDied app_died = 65;
143        ResourceConfigurationChanged resource_configuration_changed = 66;
144        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
145        BluetoothConnectionStateChanged bluetooth_connection_state_changed =
146                68 [(log_from_module) = "bluetooth"];
147        GpsSignalQualityChanged gps_signal_quality_changed = 69;
148        UsbConnectorStateChanged usb_connector_state_changed = 70;
149        SpeakerImpedanceReported speaker_impedance_reported = 71;
150        HardwareFailed hardware_failed = 72;
151        PhysicalDropDetected physical_drop_detected = 73;
152        ChargeCyclesReported charge_cycles_reported = 74;
153        MobileConnectionStateChanged mobile_connection_state_changed =
154                75 [(log_from_module) = "telephony"];
155        MobileRadioTechnologyChanged mobile_radio_technology_changed =
156                76 [(log_from_module) = "telephony"];
157        UsbDeviceAttached usb_device_attached = 77;
158        AppCrashOccurred app_crash_occurred = 78;
159        ANROccurred anr_occurred = 79;
160        WTFOccurred wtf_occurred = 80;
161        LowMemReported low_mem_reported = 81;
162        GenericAtom generic_atom = 82;
163        KeyValuePairsAtom key_value_pairs_atom = 83 [(allow_from_any_uid) = true];
164        VibratorStateChanged vibrator_state_changed = 84;
165        DeferredJobStatsReported deferred_job_stats_reported = 85;
166        ThermalThrottlingStateChanged thermal_throttling = 86 [deprecated=true];
167        BiometricAcquired biometric_acquired = 87;
168        BiometricAuthenticated biometric_authenticated = 88;
169        BiometricErrorOccurred biometric_error_occurred = 89;
170        // Atom number 90 is available for use.
171        BatteryHealthSnapshot battery_health_snapshot = 91;
172        SlowIo slow_io = 92;
173        BatteryCausedShutdown battery_caused_shutdown = 93;
174        PhoneServiceStateChanged phone_service_state_changed = 94;
175        PhoneStateChanged phone_state_changed = 95;
176        UserRestrictionChanged user_restriction_changed = 96;
177        SettingsUIChanged settings_ui_changed = 97;
178        ConnectivityStateChanged connectivity_state_changed = 98;
179        // TODO: service state change is very noisy shortly after boot, as well
180        // as at other transitions - coming out of doze, device plugged in, etc.
181        // Consider removing this if it becomes a problem
182        ServiceStateChanged service_state_changed = 99;
183        ServiceLaunchReported service_launch_reported = 100;
184        FlagFlipUpdateOccurred flag_flip_update_occurred = 101;
185        BinaryPushStateChanged binary_push_state_changed = 102;
186        DevicePolicyEvent device_policy_event = 103;
187        DocsUIFileOperationCanceledReported docs_ui_file_op_canceled =
188            104 [(log_from_module) = "docsui"];
189        DocsUIFileOperationCopyMoveModeReported
190            docs_ui_file_op_copy_move_mode_reported =
191            105 [(log_from_module) = "docsui"];
192        DocsUIFileOperationFailureReported docs_ui_file_op_failure =
193            106 [(log_from_module) = "docsui"];
194        DocsUIFileOperationReported docs_ui_provider_file_op =
195            107 [(log_from_module) = "docsui"];
196        DocsUIInvalidScopedAccessRequestReported
197            docs_ui_invalid_scoped_access_request =
198            108 [(log_from_module) = "docsui"];
199        DocsUILaunchReported docs_ui_launch_reported =
200            109 [(log_from_module) = "docsui"];
201        DocsUIRootVisitedReported docs_ui_root_visited =
202            110 [(log_from_module) = "docsui"];
203        DocsUIStartupMsReported docs_ui_startup_ms =
204            111 [(log_from_module) = "docsui"];
205        DocsUIUserActionReported docs_ui_user_action_reported =
206            112 [(log_from_module) = "docsui"];
207        WifiEnabledStateChanged wifi_enabled_state_changed = 113;
208        WifiRunningStateChanged wifi_running_state_changed = 114;
209        AppCompacted app_compacted = 115;
210        NetworkDnsEventReported network_dns_event_reported = 116 [(log_from_module) = "resolv"];
211        DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported =
212            117 [(log_from_module) = "docsui"];
213        DocsUIPickResultReported docs_ui_pick_result_reported =
214            118 [(log_from_module) = "docsui"];
215        DocsUISearchModeReported docs_ui_search_mode_reported =
216            119 [(log_from_module) = "docsui"];
217        DocsUISearchTypeReported docs_ui_search_type_reported =
218            120 [(log_from_module) = "docsui"];
219        DataStallEvent data_stall_event = 121 [(log_from_module) = "network_stack"];
220        RescuePartyResetReported rescue_party_reset_reported = 122;
221        SignedConfigReported signed_config_reported = 123;
222        GnssNiEventReported gnss_ni_event_reported = 124;
223        BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event =
224                125 [(log_from_module) = "bluetooth"];
225        BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed =
226                126 [(log_from_module) = "bluetooth"];
227        BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed =
228                127 [(log_from_module) = "bluetooth"];
229        AppDowngraded app_downgraded = 128;
230        AppOptimizedAfterDowngraded app_optimized_after_downgraded = 129;
231        LowStorageStateChanged low_storage_state_changed = 130;
232        GnssNfwNotificationReported gnss_nfw_notification_reported = 131;
233        GnssConfigurationReported gnss_configuration_reported = 132;
234        UsbPortOverheatEvent usb_port_overheat_event_reported = 133;
235        NfcErrorOccurred nfc_error_occurred = 134;
236        NfcStateChanged nfc_state_changed = 135;
237        NfcBeamOccurred nfc_beam_occurred = 136;
238        NfcCardemulationOccurred nfc_cardemulation_occurred = 137;
239        NfcTagOccurred nfc_tag_occurred = 138;
240        NfcHceTransactionOccurred nfc_hce_transaction_occurred = 139;
241        SeStateChanged se_state_changed = 140;
242        SeOmapiReported se_omapi_reported = 141;
243        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported = 142;
244        AttentionManagerServiceResultReported attention_manager_service_result_reported = 143;
245        AdbConnectionChanged adb_connection_changed = 144;
246        SpeechDspStatReported speech_dsp_stat_reported = 145;
247        UsbContaminantReported usb_contaminant_reported = 146;
248        WatchdogRollbackOccurred watchdog_rollback_occurred = 147;
249        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected = 148;
250        BubbleUIChanged bubble_ui_changed = 149;
251        ScheduledJobConstraintChanged scheduled_job_constraint_changed = 150;
252        BluetoothActiveDeviceChanged bluetooth_active_device_changed =
253                151 [(log_from_module) = "bluetooth"];
254        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed =
255                152 [(log_from_module) = "bluetooth"];
256        BluetoothA2dpCodecConfigChanged bluetooth_a2dp_codec_config_changed =
257                153 [(log_from_module) = "bluetooth"];
258        BluetoothA2dpCodecCapabilityChanged bluetooth_a2dp_codec_capability_changed =
259                154 [(log_from_module) = "bluetooth"];
260        BluetoothA2dpAudioUnderrunReported bluetooth_a2dp_audio_underrun_reported =
261                155 [(log_from_module) = "bluetooth"];
262        BluetoothA2dpAudioOverrunReported bluetooth_a2dp_audio_overrun_reported =
263                156 [(log_from_module) = "bluetooth"];
264        BluetoothDeviceRssiReported bluetooth_device_rssi_reported =
265                157 [(log_from_module) = "bluetooth"];
266        BluetoothDeviceFailedContactCounterReported
267                bluetooth_device_failed_contact_counter_reported = 158 [(log_from_module) = "bluetooth"];
268        BluetoothDeviceTxPowerLevelReported bluetooth_device_tx_power_level_reported =
269                159 [(log_from_module) = "bluetooth"];
270        BluetoothHciTimeoutReported bluetooth_hci_timeout_reported =
271                160 [(log_from_module) = "bluetooth"];
272        BluetoothQualityReportReported bluetooth_quality_report_reported =
273                161 [(log_from_module) = "bluetooth"];
274        BluetoothDeviceInfoReported bluetooth_device_info_reported =
275                162 [(log_from_module) = "bluetooth"];
276        BluetoothRemoteVersionInfoReported bluetooth_remote_version_info_reported =
277                163 [(log_from_module) = "bluetooth"];
278        BluetoothSdpAttributeReported bluetooth_sdp_attribute_reported =
279                164 [(log_from_module) = "bluetooth"];
280        BluetoothBondStateChanged bluetooth_bond_state_changed =
281                165 [(log_from_module) = "bluetooth"];
282        BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported =
283                166 [(log_from_module) = "bluetooth"];
284        BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported =
285                167 [(log_from_module) = "bluetooth"];
286        ScreenTimeoutExtensionReported screen_timeout_extension_reported = 168;
287        ProcessStartTime process_start_time = 169;
288        PermissionGrantRequestResultReported permission_grant_request_result_reported =
289            170 [(log_from_module) = "permissioncontroller"];
290        BluetoothSocketConnectionStateChanged bluetooth_socket_connection_state_changed = 171;
291        DeviceIdentifierAccessDenied device_identifier_access_denied = 172;
292        BubbleDeveloperErrorReported bubble_developer_error_reported = 173;
293        AssistGestureStageReported assist_gesture_stage_reported = 174;
294        AssistGestureFeedbackReported assist_gesture_feedback_reported = 175;
295        AssistGestureProgressReported assist_gesture_progress_reported = 176;
296        TouchGestureClassified touch_gesture_classified = 177;
297        HiddenApiUsed hidden_api_used = 178 [(allow_from_any_uid) = true];
298        StyleUIChanged style_ui_changed = 179 [(log_from_module) = "style"];
299        PrivacyIndicatorsInteracted privacy_indicators_interacted =
300            180 [(log_from_module) = "permissioncontroller"];
301        AppInstallOnExternalStorageReported app_install_on_external_storage_reported = 181;
302        NetworkStackReported network_stack_reported = 182 [(log_from_module) = "network_stack"];
303        AppMovedStorageReported app_moved_storage_reported = 183;
304        BiometricEnrolled biometric_enrolled = 184;
305        SystemServerWatchdogOccurred system_server_watchdog_occurred = 185;
306        TombStoneOccurred tomb_stone_occurred = 186;
307        BluetoothClassOfDeviceReported bluetooth_class_of_device_reported =
308                187 [(log_from_module) = "bluetooth"];
309        IntelligenceEventReported intelligence_event_reported =
310            188 [(log_from_module) = "intelligence"];
311        ThermalThrottlingSeverityStateChanged thermal_throttling_severity_state_changed = 189;
312        RoleRequestResultReported role_request_result_reported =
313            190 [(log_from_module) = "permissioncontroller"];
314        MediametricsAudiopolicyReported mediametrics_audiopolicy_reported = 191;
315        MediametricsAudiorecordReported mediametrics_audiorecord_reported = 192;
316        MediametricsAudiothreadReported mediametrics_audiothread_reported = 193;
317        MediametricsAudiotrackReported mediametrics_audiotrack_reported = 194;
318        MediametricsCodecReported mediametrics_codec_reported = 195;
319        MediametricsDrmWidevineReported mediametrics_drm_widevine_reported = 196;
320        MediametricsExtractorReported mediametrics_extractor_reported = 197;
321        MediametricsMediadrmReported mediametrics_mediadrm_reported = 198;
322        MediametricsNuPlayerReported mediametrics_nuplayer_reported = 199;
323        MediametricsRecorderReported mediametrics_recorder_reported = 200;
324        CarPowerStateChanged car_power_state_changed = 203;
325        GarageModeInfo garage_mode_info = 204;
326        TestAtomReported test_atom_reported = 205 [(log_from_module) = "cts"];
327        ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported = 206;
328        ContentCaptureServiceEvents content_capture_service_events = 207;
329        ContentCaptureSessionEvents content_capture_session_events = 208;
330        ContentCaptureFlushed content_capture_flushed = 209;
331        LocationManagerApiUsageReported location_manager_api_usage_reported = 210;
332        ReviewPermissionsFragmentResultReported review_permissions_fragment_result_reported =
333            211 [(log_from_module) = "permissioncontroller"];
334        RuntimePermissionsUpgradeResult runtime_permissions_upgrade_result =
335            212 [(log_from_module) = "permissioncontroller"];
336        GrantPermissionsActivityButtonActions grant_permissions_activity_button_actions =
337            213 [(log_from_module) = "permissioncontroller"];
338        LocationAccessCheckNotificationAction location_access_check_notification_action =
339            214 [(log_from_module) = "permissioncontroller"];
340        AppPermissionFragmentActionReported app_permission_fragment_action_reported =
341            215 [(log_from_module) = "permissioncontroller"];
342        AppPermissionFragmentViewed app_permission_fragment_viewed =
343            216 [(log_from_module) = "permissioncontroller"];
344        AppPermissionsFragmentViewed app_permissions_fragment_viewed =
345            217 [(log_from_module) = "permissioncontroller"];
346        PermissionAppsFragmentViewed permission_apps_fragment_viewed =
347            218  [(log_from_module) = "permissioncontroller"];
348        ExclusionRectStateChanged exclusion_rect_state_changed = 223;
349        BackGesture back_gesture_reported_reported = 224;
350
351        UpdateEngineUpdateAttemptReported update_engine_update_attempt_reported = 225;
352        UpdateEngineSuccessfulUpdateReported update_engine_successful_update_reported = 226;
353        AppCompatibilityChangeReported app_compatibility_change_reported =
354            228 [(allow_from_any_uid) = true];
355        PerfettoUploaded perfetto_uploaded =
356            229 [(log_from_module) = "perfetto"];
357        VmsClientConnectionStateChanged vms_client_connection_state_changed = 230;
358        BootTimeEventDuration boot_time_event_duration_reported = 239;
359        BootTimeEventElapsedTime boot_time_event_elapsed_time_reported = 240;
360        BootTimeEventUtcTime boot_time_event_utc_time_reported = 241;
361        BootTimeEventErrorCode boot_time_event_error_code_reported = 242;
362        UserspaceRebootReported userspace_reboot_reported = 243 [(log_from_module) = "framework"];
363        SnapshotMergeReported snapshot_merge_reported = 255;
364        NetworkIpProvisioningReported network_ip_provisioning_reported = 290 [(log_from_module) = "network_stack"];
365        NetworkDhcpRenewReported network_dhcp_renew_reported = 291 [(log_from_module) = "network_stack"];
366        NetworkValidationReported network_validation_reported = 292 [(log_from_module) = "network_stack"];
367        NetworkStackQuirkReported network_stack_quirk_reported = 293 [(log_from_module) = "network_stack"];
368        NetworkTetheringReported  network_tethering_reported = 303 [(log_from_module) =  "network_tethering"];
369    }
370
371    // Pulled events will start at field 10000.
372    // Next: 10080
373    oneof pulled {
374        WifiBytesTransfer wifi_bytes_transfer = 10000;
375        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
376        MobileBytesTransfer mobile_bytes_transfer = 10002;
377        MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
378        BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
379        KernelWakelock kernel_wakelock = 10004;
380        SubsystemSleepState subsystem_sleep_state = 10005;
381        CpuTimePerFreq cpu_time_per_freq = 10008;
382        CpuTimePerUid cpu_time_per_uid = 10009;
383        CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
384        WifiActivityInfo wifi_activity_info = 10011;
385        ModemActivityInfo modem_activity_info = 10012;
386        BluetoothActivityInfo bluetooth_activity_info = 10007;
387        ProcessMemoryState process_memory_state = 10013;
388        SystemElapsedRealtime system_elapsed_realtime = 10014;
389        SystemUptime system_uptime = 10015;
390        CpuActiveTime cpu_active_time = 10016;
391        CpuClusterTime cpu_cluster_time = 10017;
392        DiskSpace disk_space = 10018 [deprecated=true];
393        RemainingBatteryCapacity remaining_battery_capacity = 10019;
394        FullBatteryCapacity full_battery_capacity = 10020;
395        Temperature temperature = 10021;
396        BinderCalls binder_calls = 10022;
397        BinderCallsExceptions binder_calls_exceptions = 10023;
398        LooperStats looper_stats = 10024;
399        DiskStats disk_stats = 10025;
400        DirectoryUsage directory_usage = 10026;
401        AppSize app_size = 10027;
402        CategorySize category_size = 10028;
403        ProcStats proc_stats = 10029;
404        BatteryVoltage battery_voltage = 10030;
405        NumFingerprintsEnrolled num_fingerprints_enrolled = 10031;
406        DiskIo disk_io = 10032;
407        PowerProfile power_profile = 10033;
408        ProcStatsPkgProc proc_stats_pkg_proc = 10034;
409        ProcessCpuTime process_cpu_time = 10035;
410        NativeProcessMemoryState native_process_memory_state = 10036;
411        CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
412        OnDevicePowerMeasurement on_device_power_measurement = 10038;
413        DeviceCalculatedPowerUse device_calculated_power_use = 10039;
414        DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
415        DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
416        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
417        BatteryLevel battery_level = 10043;
418        BuildInformation build_information = 10044;
419        BatteryCycleCount battery_cycle_count = 10045;
420        DebugElapsedClock debug_elapsed_clock = 10046;
421        DebugFailingElapsedClock debug_failing_elapsed_clock = 10047;
422        NumFacesEnrolled num_faces_enrolled = 10048;
423        RoleHolder role_holder = 10049;
424        DangerousPermissionState dangerous_permission_state = 10050;
425        TrainInfo train_info = 10051;
426        TimeZoneDataInfo time_zone_data_info = 10052;
427        ExternalStorageInfo external_storage_info = 10053;
428        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
429        GpuStatsAppInfo gpu_stats_app_info = 10055;
430        SystemIonHeapSize system_ion_heap_size = 10056;
431        AppsOnExternalStorageInfo apps_on_external_storage_info = 10057;
432        FaceSettings face_settings = 10058;
433        CoolingDevice cooling_device = 10059;
434        AppOps app_ops = 10060;
435        ProcessSystemIonHeapSize process_system_ion_heap_size = 10061;
436        VmsClientStats vms_client_stats = 10065;
437        NotificationRemoteViews notification_remote_views = 10066;
438        VoiceCallSession voice_call_session = 10076 [(log_from_module) = "telephony"];
439        VoiceCallRatUsage voice_call_rat_usage = 10077 [(log_from_module) = "telephony"];
440        SimSlotState sim_slot_state = 10078 [(log_from_module) = "telephony"];
441        SupportedRadioAccessFamily supported_radio_access_family =
442            10079 [(log_from_module) = "telephony"];
443    }
444
445    // DO NOT USE field numbers above 100,000 in AOSP.
446    // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
447    // Field numbers 200,000 and above are reserved for future use; do not use them at all.
448}
449
450/**
451 * This proto represents a node of an attribution chain.
452 * Note: All attribution chains are represented as a repeated field of type
453 * AttributionNode. It is understood that in such arrays, the order is that
454 * of calls, that is [A, B, C] if A calls B that calls C.
455 */
456message AttributionNode {
457    // The uid for a given element in the attribution chain.
458    optional int32 uid = 1;
459
460    // The (optional) string tag for an element in the attribution chain. If the
461    // element has no tag, it is encoded as an empty string.
462    optional string tag = 2;
463}
464
465message KeyValuePair {
466    optional int32 key = 1;
467    oneof value {
468        int32 value_int = 2;
469        int64 value_long = 3;
470        string value_str = 4;
471        float value_float = 5;
472    }
473}
474
475message KeyValuePairsAtom {
476    optional int32 uid = 1;
477    repeated KeyValuePair pairs = 2;
478}
479
480/*
481 * *****************************************************************************
482 * Below are all of the individual atoms that are logged by Android via statsd.
483 *
484 * RULES:
485 *   - The field ids for each atom must start at 1, and count upwards by 1.
486 *     Skipping field ids is not allowed.
487 *   - These form an API, so renaming, renumbering or removing fields is
488 *     not allowed between android releases.  (This is not currently enforced,
489 *     but there will be a tool to enforce this restriction).
490 *   - The types must be built-in protocol buffer types, namely, no sub-messages
491 *     are allowed (yet).  The bytes type is also not allowed.
492 *   - The CamelCase name of the message type should match the
493 *     underscore_separated name as defined in Atom.
494 *   - If an atom represents work that can be attributed to an app, there can
495 *     be exactly one AttributionChain field. It must be field number 1.
496 *   - A field that is a uid should be a string field, tagged with the [xxx]
497 *     annotation. The generated code on android will be represented by UIDs,
498 *     and those UIDs will be translated in xxx to those strings.
499 *
500 * CONVENTIONS:
501 *   - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
502 *   - If there is a UID, it goes first. Think in an object-oriented fashion.
503 * *****************************************************************************
504 */
505
506/**
507 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
508 * Logs when the Thermal service HAL notifies the throttling start/stop events.
509 *
510 * Logged from:
511 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
512 */
513message ThermalThrottlingStateChanged {
514    // The type of temperature being reported (CPU, GPU, SKIN, etc)
515    optional android.os.TemperatureTypeEnum sensor_type = 1;
516
517    // Throttling state, this field is DEPRECATED
518    enum State {
519        UNKNOWN = 0;
520        START = 1; // START indicated that throttling was triggered.
521        STOP = 2; // STOP indicates that throttling was cleared.
522    }
523    optional State state = 2;
524
525    optional float temperature = 3;
526}
527
528/**
529 * Logs when the screen state changes.
530 *
531 * Logged from:
532 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
533 */
534message ScreenStateChanged {
535    // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
536    optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
537}
538
539/**
540 * Logs that the process state of the uid, as determined by ActivityManager
541 * (i.e. the highest process state of that uid's processes) has changed.
542 *
543 * Logged from:
544 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
545 */
546message UidProcessStateChanged {
547    optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
548
549    // The state, from frameworks/base/core/proto/android/app/enums.proto.
550    optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
551}
552
553/**
554 * Logs process state change of a process, as per the activity manager.
555 *
556 * Logged from:
557 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
558 */
559message ProcessStateChanged {
560    optional int32 uid = 1;
561    optional string process_name = 2;
562    optional string package_name = 3;
563    // TODO: remove this when validation is done
564    optional int64 version = 5;
565    // The state, from frameworks/base/core/proto/android/app/enums.proto.
566    optional android.app.ProcessStateEnum state = 4;
567}
568
569/**
570 * Logs when ActivityManagerService sleep state is changed.
571 *
572 * Logged from:
573 *   frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
574 */
575message ActivityManagerSleepStateChanged {
576    // TODO: import frameworks proto
577    enum State {
578        UNKNOWN = 0;
579        ASLEEP = 1;
580        AWAKE = 2;
581    }
582    optional State state = 1 [(state_field_option).option = EXCLUSIVE];
583}
584
585/**
586 * Logs when system memory state changes.
587 *
588 * Logged from:
589 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
590 */
591message MemoryFactorStateChanged {
592    // TODO: import frameworks proto
593    enum State {
594        MEMORY_UNKNOWN = 0;
595        NORMAL = 1;     // normal.
596        MODERATE = 2;   // moderate memory pressure.
597        LOW = 3;        // low memory.
598        CRITICAL = 4;   // critical memory.
599
600    }
601    optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
602}
603
604/**
605 * Logs when app is using too much cpu, according to ActivityManagerService.
606 *
607 * Logged from:
608 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
609 */
610message ExcessiveCpuUsageReported {
611    optional int32 uid = 1;
612    optional string process_name = 2;
613    optional string package_name = 3;
614    // package version. TODO: remove this when validation is done
615    optional int64 version = 4;
616}
617
618/**
619 * Logs when a cached process is killed, along with its pss.
620 *
621 * Logged from:
622 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
623 */
624message CachedKillReported {
625    optional int32 uid = 1;
626    optional string process_name = 2;
627    optional string package_name = 3;
628    // TODO: remove this when validation is done
629    optional int64 version = 5;
630    optional int64 pss = 4;
631}
632
633/**
634 * Logs when memory stats of a process is reported.
635 *
636 * Logged from:
637 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
638 */
639message ProcessMemoryStatReported {
640    optional int32 uid = 1;
641    optional string process_name = 2;
642    optional string package_name = 3;
643    //TODO: remove this when validation is done
644    optional int64 version = 9;
645    optional int64 pss = 4;
646    optional int64 uss = 5;
647    optional int64 rss = 6;
648    enum Type {
649        ADD_PSS_INTERNAL_SINGLE = 0;
650        ADD_PSS_INTERNAL_ALL_MEM = 1;
651        ADD_PSS_INTERNAL_ALL_POLL = 2;
652        ADD_PSS_EXTERNAL = 3;
653        ADD_PSS_EXTERNAL_SLOW = 4;
654    }
655    optional Type type = 7;
656    optional int64 duration_millis = 8;
657}
658
659/**
660 * Logs that a process started, finished, crashed, or ANRed.
661 *
662 * Logged from:
663 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
664 */
665message ProcessLifeCycleStateChanged {
666    optional int32 uid = 1 [(is_uid) = true];
667
668    // The process name (usually same as the app name).
669    optional string process_name = 2;
670
671    // What lifecycle state the process changed to.
672    // This enum is specific to atoms.proto.
673    enum State {
674        FINISHED = 0;
675        STARTED = 1;
676        CRASHED = 2;
677    }
678    optional State state = 3;
679}
680
681/**
682 * Logs when the ble scan state changes.
683 *
684 * Logged from:
685 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
686 */
687message BleScanStateChanged {
688    repeated AttributionNode attribution_node = 1;
689
690    enum State {
691        OFF = 0;
692        ON = 1;
693        // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
694        RESET = 2;
695    }
696    optional State state = 2;
697
698    // Does the scan have a filter.
699    optional bool is_filtered = 3;
700    // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
701    optional bool is_first_match = 4;
702    // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
703    optional bool is_opportunistic = 5;
704}
705
706/**
707 * Logs reporting of a ble scan finding results.
708 *
709 * Logged from:
710 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
711 */
712// TODO: Consider also tracking per-scanner-id.
713message BleScanResultReceived {
714    repeated AttributionNode attribution_node = 1;
715
716    // Number of ble scan results returned.
717    optional int32 num_results = 2;
718}
719
720/**
721 * Logs when a sensor state changes.
722 *
723 * Logged from:
724 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
725 */
726message SensorStateChanged {
727    repeated AttributionNode attribution_node = 1;
728
729    // The id (int) of the sensor.
730    optional int32 sensor_id = 2;
731
732    enum State {
733        OFF = 0;
734        ON = 1;
735    }
736    optional State state = 3;
737}
738
739/**
740 * Logs when GPS state changes.
741 *
742 * Logged from:
743 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
744 */
745message GpsScanStateChanged {
746    repeated AttributionNode attribution_node = 1;
747
748    enum State {
749        OFF = 0;
750        ON = 1;
751    }
752    optional State state = 2;
753}
754
755/**
756 * Logs when GPS signal quality.
757 *
758 * Logged from:
759 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
760 */
761message GpsSignalQualityChanged {
762    optional android.server.location.GpsSignalQualityEnum level = 1;
763}
764
765
766/**
767 * Logs when a sync manager sync state changes.
768 *
769 * Logged from:
770 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
771 */
772message SyncStateChanged {
773    repeated AttributionNode attribution_node = 1;
774
775    // Name of the sync (as named in the app). Can be chosen at run-time.
776    optional string sync_name = 2;
777
778    enum State {
779        OFF = 0;
780        ON = 1;
781    }
782    optional State state = 3;
783}
784
785/*
786 * Deferred job stats.
787 *
788 * Logged from:
789 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
790*/
791message DeferredJobStatsReported {
792    repeated AttributionNode attribution_node = 1;
793
794    // Number of jobs deferred.
795    optional int32 num_jobs_deferred = 2;
796
797    // Time since the last job runs.
798    optional int64 time_since_last_job_millis = 3;
799}
800
801/**
802 * Logs when a job scheduler job state changes.
803 *
804 * Logged from:
805 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
806 */
807message ScheduledJobStateChanged {
808    repeated AttributionNode attribution_node = 1;
809
810    // Name of the job (as named in the app)
811    optional string job_name = 2;
812
813    enum State {
814        FINISHED = 0;
815        STARTED = 1;
816        SCHEDULED = 2;
817    }
818    optional State state = 3;
819
820    // The reason a job has stopped.
821    // This is only applicable when the state is FINISHED.
822    // The default value is STOP_REASON_UNKNOWN.
823    optional android.app.job.StopReasonEnum stop_reason = 4;
824
825    // The standby bucket of the app that scheduled the job. These match the framework constants
826    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
827    // already assigned 0.
828    enum Bucket {
829        UNKNOWN = -1;
830        ACTIVE = 0;
831        WORKING_SET = 1;
832        FREQUENT = 2;
833        RARE = 3;
834        NEVER = 4;
835    }
836    optional Bucket standby_bucket = 5 [default = UNKNOWN];
837
838    // The job id (as assigned by the app).
839    optional int32 job_id = 6;
840}
841
842/**
843 * Logs when the audio state changes.
844 *
845 * Logged from:
846 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
847 */
848message AudioStateChanged {
849    repeated AttributionNode attribution_node = 1;
850
851    enum State {
852        OFF = 0;
853        ON = 1;
854        // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
855        RESET = 2;
856    }
857    optional State state = 2;
858}
859
860/**
861 * Logs when the video codec state changes.
862 *
863 * Logged from:
864 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
865 */
866message MediaCodecStateChanged {
867    repeated AttributionNode attribution_node = 1;
868
869    enum State {
870        OFF = 0;
871        ON = 1;
872        // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
873        RESET = 2;
874    }
875    optional State state = 2;
876}
877
878/**
879 * Logs when the flashlight state changes.
880 *
881 * Logged from:
882 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
883 */
884message FlashlightStateChanged {
885    repeated AttributionNode attribution_node = 1;
886
887    enum State {
888        OFF = 0;
889        ON = 1;
890        // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
891        RESET = 2;
892    }
893    optional State state = 2;
894}
895
896/**
897 * Logs when the camera state changes.
898 *
899 * Logged from:
900 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
901 */
902message CameraStateChanged {
903    repeated AttributionNode attribution_node = 1;
904
905    enum State {
906        OFF = 0;
907        ON = 1;
908        // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
909        RESET = 2;
910    }
911    optional State state = 2;
912}
913
914/**
915 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
916 *
917 * Logged from:
918 *   TODO
919 */
920message WakelockStateChanged {
921    repeated AttributionNode attribution_node = 1;
922
923    // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
924    // From frameworks/base/core/proto/android/os/enums.proto.
925    optional android.os.WakeLockLevelEnum type = 2;
926
927    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
928    optional string tag = 3;
929
930    enum State {
931        RELEASE = 0;
932        ACQUIRE = 1;
933        CHANGE_RELEASE = 2;
934        CHANGE_ACQUIRE = 3;
935    }
936    optional State state = 4;
937}
938
939/**
940 * Logs when a partial wakelock is considered 'long' (over 1 min).
941 *
942 * Logged from:
943 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
944 */
945message LongPartialWakelockStateChanged {
946    repeated AttributionNode attribution_node = 1;
947
948    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
949    optional string tag = 2;
950
951    // TODO: I have no idea what this is.
952    optional string history_tag = 3;
953
954    enum State {
955        OFF = 0;
956        ON = 1;
957    }
958    optional State state = 4;
959}
960
961/**
962 * Logs when the device is interactive, according to the PowerManager Notifier.
963 *
964 * Logged from:
965 *   frameworks/base/services/core/java/com/android/server/power/Notifier.java
966 */
967message InteractiveStateChanged {
968    enum State {
969        OFF = 0;
970        ON = 1;
971    }
972    optional State state = 1;
973}
974
975/**
976 * Logs Battery Saver state change.
977 *
978 * Logged from:
979 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
980 */
981message BatterySaverModeStateChanged {
982    enum State {
983        OFF = 0;
984        ON = 1;
985    }
986    optional State state = 1;
987}
988
989/**
990 * Logs Doze mode state change.
991 *
992 * Logged from:
993 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
994 */
995message DeviceIdleModeStateChanged {
996    optional android.server.DeviceIdleModeEnum state = 1;
997}
998
999
1000/**
1001 * Logs state change of Doze mode including maintenance windows.
1002 *
1003 * Logged from:
1004 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1005 */
1006message DeviceIdlingModeStateChanged {
1007    optional android.server.DeviceIdleModeEnum state = 1;
1008}
1009
1010/**
1011 * Logs screen brightness level.
1012 *
1013 * Logged from:
1014 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1015 */
1016message ScreenBrightnessChanged {
1017    // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
1018    optional int32 level = 1;
1019}
1020
1021/**
1022 * Logs battery level (percent full, from 0 to 100).
1023 *
1024 * Logged from:
1025 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1026 */
1027message BatteryLevelChanged {
1028    // Battery level. Should be in [0, 100].
1029    optional int32 battery_level = 1;
1030}
1031
1032/**
1033 * Logs change in charging status of the device.
1034 *
1035 * Logged from:
1036 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1037 */
1038message ChargingStateChanged {
1039    // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
1040    optional android.os.BatteryStatusEnum state = 1;
1041}
1042
1043/**
1044 * Logs whether the device is plugged in, and what power source it is using.
1045 *
1046 * Logged from:
1047 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1048 */
1049message PluggedStateChanged {
1050    // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
1051    optional android.os.BatteryPluggedStateEnum state = 1;
1052}
1053
1054/**
1055 * Logs when an app's wakeup alarm fires.
1056 *
1057 * Logged from:
1058 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1059 */
1060message WakeupAlarmOccurred {
1061    repeated AttributionNode attribution_node = 1;
1062
1063    // Name of the wakeup alarm.
1064    optional string tag = 2;
1065
1066    // Name of source package (for historical reasons, since BatteryStats tracked it).
1067    optional string package_name = 3;
1068
1069    // These enum values match the STANDBY_BUCKET_XXX constants defined in UsageStatsManager.java.
1070    enum Bucket {
1071        UNKNOWN = 0;
1072        EXEMPTED = 5;
1073        ACTIVE = 10;
1074        WORKING_SET = 20;
1075        FREQUENT = 30;
1076        RARE = 40;
1077        NEVER = 50;
1078    }
1079    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
1080    optional Bucket app_standby_bucket = 4;
1081}
1082
1083/**
1084 * Logs when an an app causes the mobile radio to change state.
1085 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
1086 *
1087 * Logged from:
1088 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1089 */
1090message MobileRadioPowerStateChanged {
1091    repeated AttributionNode attribution_node = 1;
1092
1093    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
1094    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1095}
1096
1097/**
1098 * Logs when an an app causes the wifi radio to change state.
1099 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
1100 *
1101 * Logged from:
1102 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1103 */
1104message WifiRadioPowerStateChanged {
1105    repeated AttributionNode attribution_node = 1;
1106
1107    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
1108    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1109}
1110
1111/**
1112 * Logs kernel wakeup reasons and aborts.
1113 *
1114 * Logged from:
1115 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1116 */
1117message KernelWakeupReported {
1118    // Name of the kernel wakeup reason (or abort).
1119    optional string wakeup_reason_name = 1;
1120
1121    // Duration (in microseconds) for the wake-up interrupt to be serviced.
1122    optional int64 duration_micros = 2;
1123}
1124
1125/**
1126 * Logs when Wifi is toggled on/off.
1127 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
1128 *
1129 * Logged from:
1130 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1131 */
1132message WifiEnabledStateChanged {
1133    enum State {
1134        OFF = 0;
1135        ON = 1;
1136    }
1137    optional State state = 1;
1138}
1139
1140/**
1141 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
1142 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
1143 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
1144 *
1145 * Logged from:
1146 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1147 */
1148message WifiRunningStateChanged {
1149    repeated AttributionNode attribution_node = 1;
1150
1151    enum State {
1152        OFF = 0;
1153        ON = 1;
1154    }
1155    optional State state = 2;
1156}
1157
1158/**
1159 * Logs wifi locks held by an app.
1160 *
1161 * Logged from:
1162 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1163 */
1164message WifiLockStateChanged {
1165    repeated AttributionNode attribution_node = 1;
1166
1167    enum State {
1168        OFF = 0;
1169        ON = 1;
1170    }
1171    optional State state = 2;
1172
1173    // WifiLock type, from frameworks/base/core/proto/android/wifi/enums.proto.
1174    optional android.net.wifi.WifiModeEnum mode = 3;
1175}
1176
1177/**
1178 * Logs wifi signal strength changes.
1179 *
1180 * Logged from:
1181 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
1182 */
1183message WifiSignalStrengthChanged {
1184    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1185    optional android.telephony.SignalStrengthEnum signal_strength = 1;
1186}
1187
1188/**
1189 * Logs wifi scans performed by an app.
1190 *
1191 * Logged from:
1192 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
1193 */
1194message WifiScanStateChanged {
1195    repeated AttributionNode attribution_node = 1;
1196
1197    enum State {
1198        OFF = 0;
1199        ON = 1;
1200    }
1201    optional State state = 2;
1202}
1203
1204/**
1205 * Logs wifi multicast locks held by an app
1206 *
1207 * Logged from:
1208 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
1209 */
1210message WifiMulticastLockStateChanged {
1211    repeated AttributionNode attribution_node = 1;
1212
1213    enum State {
1214        OFF = 0;
1215        ON = 1;
1216    }
1217    optional State state = 2;
1218
1219    optional string tag = 3;
1220}
1221
1222/**
1223 * Logs shutdown reason and duration on next boot.
1224 *
1225 * Logged from:
1226 *   frameworks/base/core/java/com/android/server/BootReceiver.java
1227 */
1228message ShutdownSequenceReported {
1229    // True if shutdown is for a reboot. Default: false if we do not know.
1230    optional bool reboot = 1;
1231
1232    // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
1233    optional string reason = 2;
1234
1235    // Beginning of shutdown time in ms using wall clock time since unix epoch.
1236    // Default: 0 if no start time received.
1237    optional int64 start_time_millis = 3;
1238
1239    // Duration of shutdown in ms. Default: 0 if no duration received.
1240    optional int64 duration_millis = 4;
1241}
1242
1243
1244/**
1245 * Logs boot reason and duration.
1246 *
1247 * Logged from:
1248 *   system/core/bootstat/bootstat.cpp
1249 */
1250message BootSequenceReported {
1251    // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
1252    // Default: "<EMPTY>" if not available.
1253    optional string bootloader_reason = 1;
1254
1255    // Reason for system boot. Eg. bootloader, reboot,userrequested
1256    // Default: "<EMPTY>" if not available.
1257    optional string system_reason = 2;
1258
1259    // End of boot time in ms from unix epoch using system wall clock.
1260    optional int64 end_time_millis = 3;
1261
1262    // Total boot duration in ms.
1263    optional int64 total_duration_millis = 4;
1264
1265    // Bootloader duration in ms.
1266    optional int64 bootloader_duration_millis = 5;
1267
1268    // Time since last boot in ms. Default: 0 if not available.
1269    optional int64 time_since_last_boot = 6;
1270}
1271
1272
1273/**
1274 * Logs call state and disconnect cause (if applicable).
1275 *
1276 * Logged from:
1277 *   packages/services/Telecomm/src/com/android/server/telecom/Call.java
1278 */
1279message CallStateChanged {
1280    // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1281    // From frameworks/base/core/proto/android/telecomm/enums.proto.
1282    optional android.telecom.CallStateEnum call_state = 1;
1283
1284    // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1285    // This value is only applicable when the call_state is DISCONNECTED, and
1286    // should always be UNKNOWN if the call_state is not DISCONNECTED.
1287    // From frameworks/base/core/proto/android/telecomm/enums.proto.
1288    optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1289
1290    // True if the call is self-managed, which are apps that use the
1291    // telecom infrastructure to make their own calls.
1292    optional bool self_managed = 3;
1293
1294    // True if call is external. External calls are calls on connected Wear
1295    // devices but show up in Telecom so the user can pull them onto the device.
1296    optional bool external_call = 4;
1297}
1298
1299/**
1300 * Logs keyguard state. The keyguard is the lock screen.
1301 *
1302 * Logged from:
1303 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1304 */
1305message KeyguardStateChanged {
1306    enum State {
1307        UNKNOWN = 0;
1308        // The keyguard is hidden when the phone is unlocked.
1309        HIDDEN = 1;
1310        // The keyguard is shown when the phone is locked (screen turns off).
1311        SHOWN= 2;
1312        // The keyguard is occluded when something is overlaying the keyguard.
1313        // Eg. Opening the camera while on the lock screen.
1314        OCCLUDED = 3;
1315    }
1316    optional State state = 1;
1317}
1318
1319/**
1320 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1321 * prompts the user to enter a password (pattern, pin, etc).
1322 *
1323 * Logged from:
1324 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1325 */
1326
1327message KeyguardBouncerStateChanged {
1328    enum State {
1329        UNKNOWN = 0;
1330        // Bouncer is hidden, either as a result of successfully entering the
1331        // password, screen timing out, or user going back to lock screen.
1332        HIDDEN = 1;
1333        // This is when the user is being prompted to enter the password.
1334        SHOWN = 2;
1335    }
1336    optional State state = 1;
1337}
1338
1339/**
1340 * Logs the result of entering a password into the keyguard bouncer.
1341 *
1342 * Logged from:
1343 *   frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1344 */
1345message KeyguardBouncerPasswordEntered {
1346    enum BouncerResult {
1347        UNKNOWN = 0;
1348        // The password entered was incorrect.
1349        FAILURE = 1;
1350        // The password entered was correct.
1351        SUCCESS = 2;
1352    }
1353    optional BouncerResult result = 1;
1354}
1355
1356/*
1357 * Logs changes to the configuration of the device. The configuration is defined
1358 * in frameworks/base/core/java/android/content/res/Configuration.java
1359 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1360 * Please go there to interpret the possible values each field can be.
1361 *
1362 * Logged from:
1363 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1364 */
1365message ResourceConfigurationChanged {
1366    // Bit mask of color capabilities of the screen.
1367    // Contains information about the color gamut and hdr mode of the screen.
1368    // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1369    optional int32 color_mode = 1;
1370
1371    // The target screen density being rendered to.
1372    // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1373    optional int32 density_dpi = 2;
1374
1375    // Current user preference for the scaling factor for fonts,
1376    // relative to the base density scaling.
1377    // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1378    optional float font_scale = 3;
1379
1380    // Flag indicating whether the hard keyboard is hidden.
1381    // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1382    optional int32 hard_keyboard_hidden = 4;
1383
1384    // The type of keyboard attached to the device.
1385    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1386    optional int32 keyboard = 5;
1387
1388    // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1389    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1390    optional int32 keyboard_hidden = 6;
1391
1392    // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1393    // 0 if undefined.
1394    // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1395    optional int32 mcc = 7;
1396
1397    // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1398    // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1399    // MNC_ZERO symbol defined in Configuration.java.
1400    // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1401    optional int32 mnc = 8;
1402
1403    // The kind of navigation available on the device.
1404    // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1405    optional int32 navigation = 9;
1406
1407    // Flag indicating whether the navigation is available.
1408    // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1409    optional int32 navigation_hidden = 10;
1410
1411    // Overall orientation of the screen.
1412    // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1413    optional int32 orientation = 11;
1414
1415    // The current height of the available screen space, in dp units.
1416    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1417    optional int32 screen_height_dp = 12;
1418
1419    // Bit mask of overall layout of the screen.
1420    // Contains information about screen size, whether the screen is wider/taller
1421    // than normal, whether the screen layout is right-tl-left or left-to-right,
1422    // and whether the screen has a rounded shape.
1423    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1424    optional int32 screen_layout = 13;
1425
1426    // Current width of the available screen space, in dp units.
1427    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1428    optional int32 screen_width_dp = 14;
1429
1430    // The smallest screen size an application will see in normal operation.
1431    // This is the smallest value of both screenWidthDp and screenHeightDp
1432    // in portrait and landscape.
1433    // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1434    optional int32 smallest_screen_width_dp = 15;
1435
1436    // The type of touch screen attached to the device.
1437    // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1438    optional int32 touchscreen = 16;
1439
1440    // Bit mask of the ui mode.
1441    // Contains information about the overall ui mode of the device.
1442    // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1443    // Also contains information about whether the device is in night mode.
1444    // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1445    optional int32 ui_mode = 17;
1446}
1447
1448
1449/**
1450 * Logs changes in the connection state of the mobile radio.
1451 *
1452 * Logged from:
1453 *    frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1454 */
1455message MobileConnectionStateChanged {
1456    // States are from the state machine DataConnection.java.
1457    enum State {
1458        UNKNOWN = 0;
1459        // The connection is inactive, or disconnected.
1460        INACTIVE = 1;
1461        // The connection is being activated, or connecting.
1462        ACTIVATING = 2;
1463        // The connection is active, or connected.
1464        ACTIVE = 3;
1465        // The connection is disconnecting.
1466        DISCONNECTING = 4;
1467        // The connection is disconnecting after creating a connection.
1468        DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1469    }
1470    optional State state  = 1;
1471    // For multi-sim phones, this distinguishes between the sim cards.
1472    optional int32 sim_slot_index = 2;
1473    // Used to identify the connection. Starts at 0 and increments by 1 for
1474    // every new network created. Resets whenever the device reboots.
1475    optional int32 data_connection_id = 3;
1476    // A bitmask for the capabilities of this connection.
1477    // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1478    // Default value (if we have no information): 0
1479    optional int64 capabilities = 4;
1480    // If this connection has internet.
1481    // This just checks if the DEFAULT bit of capabilities is set.
1482    optional bool has_internet = 5;
1483}
1484
1485/**
1486 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1487 *
1488 * Logged from:
1489 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1490 */
1491message MobileRadioTechnologyChanged {
1492    optional android.telephony.NetworkTypeEnum state = 1;
1493    // For multi-sim phones, this distinguishes between the sim cards.
1494    optional int32 sim_slot_index = 2;
1495}
1496
1497/**
1498 * Logs the VID and PID of any connected USB devices.
1499 *
1500 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1501 *
1502 * Logged by Vendor.
1503 */
1504message UsbDeviceAttached {
1505    optional int32 vid = 1;
1506    optional int32 pid = 2;
1507    optional bool has_audio = 3;
1508    optional bool has_hid = 4;
1509    optional bool has_storage = 5;
1510    enum State {
1511        STATE_DISCONNECTED = 0;
1512        STATE_CONNECTED = 1;
1513    }
1514    optional State state = 6;
1515    optional int64 last_connect_duration_millis = 7;
1516}
1517
1518
1519/**
1520 * Logs when Bluetooth is enabled and disabled.
1521 *
1522 * Logged from:
1523 *   services/core/java/com/android/server/BluetoothManagerService.java
1524 */
1525message BluetoothEnabledStateChanged {
1526    repeated AttributionNode attribution_node = 1;
1527    // Whether or not bluetooth is enabled on the device.
1528    enum State {
1529        UNKNOWN = 0;
1530        ENABLED = 1;
1531        DISABLED = 2;
1532    }
1533    optional State state = 2;
1534    // The reason for being enabled/disabled.
1535    // Eg. Airplane mode, crash, application request.
1536    optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1537    // If the reason is an application request, this will be the package name.
1538    optional string pkg_name = 4;
1539}
1540
1541/**
1542 * Logs when profiles on a Bluetooth device connects and disconnects.
1543 *
1544 * Logged from:
1545 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
1546 *
1547 * Next Tag: 6
1548 */
1549message BluetoothConnectionStateChanged {
1550    // The state of the connection.
1551    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1552    optional android.bluetooth.ConnectionStateEnum state = 1;
1553    // An identifier that can be used to match connect and disconnect events.
1554    // Currently is last two bytes of a hash of a device level ID and
1555    // the mac address of the bluetooth device that is connected.
1556    // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
1557    optional int32 obfuscated_id = 2 [deprecated = true];
1558    // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1559    // From android.bluetooth.BluetoothAdapter.java
1560    // Default: 0 when not used
1561    optional int32 bt_profile = 3;
1562    // An identifier that can be used to match events for this device.
1563    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1564    // Salt: Randomly generated 256 bit value
1565    // Hash algorithm: HMAC-SHA256
1566    // Size: 32 byte
1567    // Default: null or empty if the device identifier is not known
1568    optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
1569    // An identifier that can be used to match events for this device.
1570    // The incremental identifier is locally generated and guaranteed not derived
1571    // from any globally unique hardware id.
1572    // For paired devices, it stays consistent between Bluetooth toggling for the
1573    // same remote device.
1574    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1575    // session for the same remote device.
1576    // Default: 0 if the device's metric id is unknown.
1577    optional int32 metric_id = 5;
1578}
1579
1580/**
1581 * Logs when a Bluetooth device connects and disconnects over ACL
1582 *
1583 * Logged from:
1584 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1585 *
1586 * Next Tag: 4
1587 */
1588message BluetoothAclConnectionStateChanged {
1589    // An identifier that can be used to match events for this device.
1590    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1591    // Salt: Randomly generated 256 bit value
1592    // Hash algorithm: HMAC-SHA256
1593    // Size: 32 byte
1594    // Default: null or empty if the device identifier is not known
1595    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1596    // The state of the connection.
1597    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1598    optional android.bluetooth.ConnectionStateEnum state = 2;
1599    // An identifier that can be used to match events for this device.
1600    // The incremental identifier is locally generated and guaranteed not derived
1601    // from any globally unique hardware id.
1602    // For paired devices, it stays consistent between Bluetooth toggling for the
1603    // same remote device.
1604    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1605    // session for the same remote device.
1606    // Default: 0 if the device's metric id is unknown.
1607    optional int32 metric_id = 3;
1608}
1609
1610/**
1611 * Logs when a Bluetooth device connects and disconnects over SCO
1612 *
1613 * Logged from:
1614 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
1615 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
1616 *
1617 * Next Tag: 5
1618 */
1619message BluetoothScoConnectionStateChanged {
1620    // An identifier that can be used to match events for this device.
1621    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1622    // Salt: Randomly generated 256 bit value
1623    // Hash algorithm: HMAC-SHA256
1624    // Size: 32 byte
1625    // Default: null or empty if the device identifier is not known
1626    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1627    // The state of the connection.
1628    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1629    optional android.bluetooth.ConnectionStateEnum state = 2;
1630    // Codec used for this SCO connection
1631    // Default: UNKNOWN
1632    optional android.bluetooth.hfp.ScoCodec codec = 3;
1633    // An identifier that can be used to match events for this device.
1634    // The incremental identifier is locally generated and guaranteed not derived
1635    // from any globally unique hardware id.
1636    // For paired devices, it stays consistent between Bluetooth toggling for the
1637    // same remote device.
1638    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1639    // session for the same remote device.
1640    // Default: 0 if the device's metric id is unknown.
1641    optional int32 metric_id = 4;
1642}
1643
1644/**
1645 * Logged when active device of a profile changes
1646 *
1647 * Logged from:
1648 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1649 *     packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetService.java
1650 *     packages/apps/Bluetooth/src/com/android/bluetooth/hearingaid/HearingAidService.java
1651 */
1652message BluetoothActiveDeviceChanged {
1653    // The profile whose active device has changed. Eg. A2DP, HEADSET, HEARING_AID
1654    // From android.bluetooth.BluetoothProfile
1655    optional int32 bt_profile = 1;
1656    // An identifier that can be used to match events for this new active device.
1657    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1658    // Salt: Randomly generated 256 bit value
1659    // Hash algorithm: HMAC-SHA256
1660    // Size: 32 byte
1661    // Default: null or empty if there is no active device for this profile
1662    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
1663    // An identifier that can be used to match events for this device.
1664    // The incremental identifier is locally generated and guaranteed not derived
1665    // from any globally unique hardware id.
1666    // For paired devices, it stays consistent between Bluetooth toggling for the
1667    // same remote device.
1668    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1669    // session for the same remote device.
1670    // Default: 0 if the device's metric id is unknown.
1671    optional int32 metric_id = 3;
1672}
1673
1674// Logs when there is an event affecting Bluetooth device's link layer connection.
1675// - This event is triggered when there is a related HCI command or event
1676// - Users of this metrics can deduce Bluetooth device's connection state from these events
1677// - HCI commands are logged before the command is sent, after receiving command status, and after
1678//   receiving command complete
1679// - HCI events are logged when they arrive
1680//
1681// Low level log from system/bt
1682//
1683// Bluetooth classic commands:
1684// - CMD_CREATE_CONNECTION
1685// - CMD_DISCONNECT
1686// - CMD_CREATE_CONNECTION_CANCEL
1687// - CMD_ACCEPT_CONNECTION_REQUEST
1688// - CMD_REJECT_CONNECTION_REQUEST
1689// - CMD_SETUP_ESCO_CONNECTION
1690// - CMD_ACCEPT_ESCO_CONNECTION
1691// - CMD_REJECT_ESCO_CONNECTION
1692// - CMD_ENH_SETUP_ESCO_CONNECTION
1693// - CMD_ENH_ACCEPT_ESCO_CONNECTION
1694//
1695// Bluetooth low energy commands:
1696// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
1697// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
1698// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
1699// - CMD_BLE_CLEAR_WHITE_LIST
1700// - CMD_BLE_ADD_WHITE_LIST
1701// - CMD_BLE_REMOVE_WHITE_LIST
1702//
1703// Bluetooth classic events:
1704// - EVT_CONNECTION_COMP
1705// - EVT_CONNECTION_REQUEST
1706// - EVT_DISCONNECTION_COMP
1707// - EVT_ESCO_CONNECTION_COMP
1708// - EVT_ESCO_CONNECTION_CHANGED
1709//
1710// Bluetooth low energy meta events:
1711// - BLE_EVT_CONN_COMPLETE_EVT
1712// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
1713//
1714// Next tag: 10
1715message BluetoothLinkLayerConnectionEvent {
1716    // An identifier that can be used to match events for this device.
1717    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1718    // Salt: Randomly generated 256 bit value
1719    // Hash algorithm: HMAC-SHA256
1720    // Size: 32 byte
1721    // Default: null or empty if the device identifier is not known
1722    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1723    // Connection handle of this connection if available
1724    // Range: 0x0000 - 0x0EFF (12 bits)
1725    // Default: 0xFFFF if the handle is unknown
1726    optional int32 connection_handle = 2;
1727    // Direction of the link
1728    // Default: DIRECTION_UNKNOWN
1729    optional android.bluetooth.DirectionEnum direction = 3;
1730    // Type of this link
1731    // Default: LINK_TYPE_UNKNOWN
1732    optional android.bluetooth.LinkTypeEnum type = 4;
1733
1734    // Reason metadata for this link layer connection event, rules for interpretation:
1735    // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
1736    //    EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
1737    // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
1738    //    set and valid, ignore hci_ble_event
1739
1740    // HCI command associated with this event
1741    // Default: CMD_UNKNOWN
1742    optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
1743    // HCI event associated with this event
1744    // Default: EVT_UNKNOWN
1745    optional android.bluetooth.hci.EventEnum hci_event = 6;
1746    // HCI BLE meta event associated with this event
1747    // Default: BLE_EVT_UNKNOWN
1748    optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
1749    // HCI command status code if this is triggerred by hci_cmd
1750    // Default: STATUS_UNKNOWN
1751    optional android.bluetooth.hci.StatusEnum cmd_status = 8;
1752    // HCI reason code associated with this event
1753    // Default: STATUS_UNKNOWN
1754    optional android.bluetooth.hci.StatusEnum reason_code = 9;
1755    // An identifier that can be used to match events for this device.
1756    // The incremental identifier is locally generated and guaranteed not derived
1757    // from any globally unique hardware id.
1758    // For paired devices, it stays consistent between Bluetooth toggling for the
1759    // same remote device.
1760    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1761    // session for the same remote device.
1762    // Default: 0 if the device's metric id is unknown.
1763    optional int32 metric_id = 10;
1764}
1765
1766/**
1767 * Logs when a module is rolled back by Watchdog.
1768 *
1769 * Logged from: Rollback Manager
1770 */
1771message WatchdogRollbackOccurred {
1772    enum RollbackType {
1773        UNKNOWN = 0;
1774        ROLLBACK_INITIATE = 1;
1775        ROLLBACK_SUCCESS = 2;
1776        ROLLBACK_FAILURE = 3;
1777        ROLLBACK_BOOT_TRIGGERED = 4;
1778    }
1779    optional RollbackType rollback_type = 1;
1780
1781    optional string package_name = 2;
1782
1783    optional int32 package_version_code = 3;
1784
1785    enum RollbackReasonType {
1786        REASON_UNKNOWN = 0;
1787        REASON_NATIVE_CRASH = 1;
1788        REASON_EXPLICIT_HEALTH_CHECK = 2;
1789        REASON_APP_CRASH = 3;
1790        REASON_APP_NOT_RESPONDING = 4;
1791    }
1792    optional RollbackReasonType rollback_reason = 4;
1793
1794    // Set by RollbackPackageHealthObserver to be the package that is failing when a rollback
1795    // is initiated. Empty if the package is unknown.
1796    optional string failing_package_name = 5;
1797}
1798
1799/**
1800 * Logs when there is a change in Bluetooth A2DP playback state
1801 *
1802 * Logged from:
1803 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1804 */
1805message BluetoothA2dpPlaybackStateChanged {
1806    // An identifier that can be used to match events for this device.
1807    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1808    // Salt: Randomly generated 256 bit value
1809    // Hash algorithm: HMAC-SHA256
1810    // Size: 32 byte
1811    // Default: null or empty if the device identifier is not known
1812    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1813    // Current playback state
1814    // Default: PLAYBACK_STATE_UNKNOWN
1815    optional android.bluetooth.a2dp.PlaybackStateEnum playback_state = 2;
1816    // Current audio coding mode
1817    // Default: AUDIO_CODING_MODE_UNKNOWN
1818    optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
1819    // An identifier that can be used to match events for this device.
1820    // The incremental identifier is locally generated and guaranteed not derived
1821    // from any globally unique hardware id.
1822    // For paired devices, it stays consistent between Bluetooth toggling for the
1823    // same remote device.
1824    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1825    // session for the same remote device.
1826    // Default: 0 if the device's metric id is unknown.
1827    optional int32 metric_id = 4;
1828}
1829
1830/**
1831 * Logs when there is a change in A2DP codec config for a particular remote device
1832 *
1833 * Logged from:
1834 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
1835 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1836 */
1837message BluetoothA2dpCodecConfigChanged {
1838    // An identifier that can be used to match events for this device.
1839    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1840    // Salt: Randomly generated 256 bit value
1841    // Hash algorithm: HMAC-SHA256
1842    // Size: 32 byte
1843    // Default: null or empty if the device identifier is not known
1844    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1845    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
1846    // Default SOURCE_CODEC_TYPE_INVALID
1847    optional int32 codec_type = 2;
1848    // Codec priroity, the higher the more preferred, -1 for disabled
1849    // Default: CODEC_PRIORITY_DEFAULT
1850    optional int32 codec_priority = 3;
1851    // Sample rate in Hz as defined by various SAMPLE_RATE_* constants in BluetoothCodecConfig
1852    // Default: SAMPLE_RATE_NONE
1853    optional int32 sample_rate = 4;
1854    // Bits per sample as defined by various BITS_PER_SAMPLE_* constants in BluetoothCodecConfig
1855    // Default: BITS_PER_SAMPLE_NONE
1856    optional int32 bits_per_sample = 5;
1857    // Channel mode as defined by various CHANNEL_MODE_* constants in BluetoothCodecConfig
1858    // Default: CHANNEL_MODE_NONE
1859    optional int32 channel_mode = 6;
1860    // Codec specific values
1861    // Default 0
1862    optional int64 codec_specific_1 = 7;
1863    optional int64 codec_specific_2 = 8;
1864    optional int64 codec_specific_3 = 9;
1865    optional int64 codec_specific_4 = 10;
1866    // An identifier that can be used to match events for this device.
1867    // The incremental identifier is locally generated and guaranteed not derived
1868    // from any globally unique hardware id.
1869    // For paired devices, it stays consistent between Bluetooth toggling for the
1870    // same remote device.
1871    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1872    // session for the same remote device.
1873    // Default: 0 if the device's metric id is unknown.
1874    optional int32 metric_id = 11;
1875}
1876
1877/**
1878 * Logs when there is a change in selectable A2DP codec capability for a paricular remote device
1879 * Each codec's capability is logged separately due to statsd restriction
1880 *
1881 * Logged from:
1882 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
1883 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1884 */
1885message BluetoothA2dpCodecCapabilityChanged {
1886    // An identifier that can be used to match events for this device.
1887    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1888    // Salt: Randomly generated 256 bit value
1889    // Hash algorithm: HMAC-SHA256
1890    // Size: 32 byte
1891    // Default: null or empty if the device identifier is not known
1892    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1893    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
1894    // Default SOURCE_CODEC_TYPE_INVALID
1895    optional int32 codec_type = 2;
1896    // Codec priroity, the higher the more preferred, -1 for disabled
1897    // Default: CODEC_PRIORITY_DEFAULT
1898    optional int32 codec_priority = 3;
1899    // A bit field of supported sample rates as defined by various SAMPLE_RATE_* constants
1900    // in BluetoothCodecConfig
1901    // Default: empty and SAMPLE_RATE_NONE for individual item
1902    optional int32 sample_rate = 4;
1903    // A bit field of supported bits per sample as defined by various BITS_PER_SAMPLE_* constants
1904    // in BluetoothCodecConfig
1905    // Default: empty and BITS_PER_SAMPLE_NONE for individual item
1906    optional int32 bits_per_sample = 5;
1907    // A bit field of supported channel mode as defined by various CHANNEL_MODE_* constants in
1908    // BluetoothCodecConfig
1909    // Default: empty and CHANNEL_MODE_NONE for individual item
1910    optional int32 channel_mode = 6;
1911    // Codec specific values
1912    // Default 0
1913    optional int64 codec_specific_1 = 7;
1914    optional int64 codec_specific_2 = 8;
1915    optional int64 codec_specific_3 = 9;
1916    optional int64 codec_specific_4 = 10;
1917    // An identifier that can be used to match events for this device.
1918    // The incremental identifier is locally generated and guaranteed not derived
1919    // from any globally unique hardware id.
1920    // For paired devices, it stays consistent between Bluetooth toggling for the
1921    // same remote device.
1922    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1923    // session for the same remote device.
1924    // Default: 0 if the device's metric id is unknown.
1925    optional int32 metric_id = 11;
1926}
1927
1928/**
1929 * Logs when A2DP failed to read from PCM source.
1930 * This typically happens when audio HAL cannot supply A2DP with data fast enough for encoding.
1931 *
1932 * Logged from:
1933 *     system/bt
1934 */
1935message BluetoothA2dpAudioUnderrunReported {
1936    // An identifier that can be used to match events for this device.
1937    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1938    // Salt: Randomly generated 256 bit value
1939    // Hash algorithm: HMAC-SHA256
1940    // Size: 32 byte
1941    // Default: null or empty if the device identifier is not known
1942    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1943    // Encoding interval in nanoseconds
1944    // Default: 0
1945    optional int64 encoding_interval_nanos = 2;
1946    // Number of bytes of PCM data that could not be read from the source
1947    // Default: 0
1948    optional int32 num_missing_pcm_bytes = 3;
1949    // An identifier that can be used to match events for this device.
1950    // The incremental identifier is locally generated and guaranteed not derived
1951    // from any globally unique hardware id.
1952    // For paired devices, it stays consistent between Bluetooth toggling for the
1953    // same remote device.
1954    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1955    // session for the same remote device.
1956    // Default: 0 if the device's metric id is unknown.
1957    optional int32 metric_id = 4;
1958}
1959
1960/**
1961 * Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit
1962 * buffer queue is full and we have to drop data
1963 *
1964 * Logged from:
1965 *     system/bt
1966 */
1967message BluetoothA2dpAudioOverrunReported {
1968    // An identifier that can be used to match events for this device.
1969    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1970    // Salt: Randomly generated 256 bit value
1971    // Hash algorithm: HMAC-SHA256
1972    // Size: 32 byte
1973    // Default: null or empty if the device identifier is not known
1974    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1975    // Encoding interval in nanoseconds
1976    // Default: 0
1977    optional int64 encoding_interval_nanos = 2;
1978    // Number of buffers dropped in this event
1979    // Each buffer is encoded in one encoding interval and consists of multiple encoded frames
1980    // Default: 0
1981    optional int32 num_dropped_buffers = 3;
1982    // Number of encoded buffers dropped in this event
1983    // Default 0
1984    optional int32 num_dropped_encoded_frames = 4;
1985    // Number of encoded bytes dropped in this event
1986    // Default: 0
1987    optional int32 num_dropped_encoded_bytes = 5;
1988    // An identifier that can be used to match events for this device.
1989    // The incremental identifier is locally generated and guaranteed not derived
1990    // from any globally unique hardware id.
1991    // For paired devices, it stays consistent between Bluetooth toggling for the
1992    // same remote device.
1993    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1994    // session for the same remote device.
1995    // Default: 0 if the device's metric id is unknown.
1996    optional int32 metric_id = 6;
1997}
1998
1999/**
2000 * Logs when we receive reports regarding a device's RSSI value
2001 *
2002 * Logged from:
2003 *     system/bt
2004 */
2005message BluetoothDeviceRssiReported {
2006    // An identifier that can be used to match events for this device.
2007    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2008    // Salt: Randomly generated 256 bit value
2009    // Hash algorithm: HMAC-SHA256
2010    // Size: 32 byte
2011    // Default: null or empty if the device identifier is not known
2012    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2013    // Connection handle of this connection if available
2014    // Range: 0x0000 - 0x0EFF (12 bits)
2015    // Default: 0xFFFF if the handle is unknown
2016    optional int32 connection_handle = 2;
2017    // HCI command status code if this is triggerred by hci_cmd
2018    // Default: STATUS_UNKNOWN
2019    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2020    // BR/EDR
2021    //   Range: -128 ≤ N ≤ 127 (signed integer)
2022    //   Units: dB
2023    // LE:
2024    //   Range: -127 to 20, 127 (signed integer)
2025    //   Units: dBm
2026    // Invalid when an out of range value is reported
2027    optional int32 rssi = 4;
2028    // An identifier that can be used to match events for this device.
2029    // The incremental identifier is locally generated and guaranteed not derived
2030    // from any globally unique hardware id.
2031    // For paired devices, it stays consistent between Bluetooth toggling for the
2032    // same remote device.
2033    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2034    // session for the same remote device.
2035    // Default: 0 if the device's metric id is unknown.
2036    optional int32 metric_id = 5;
2037}
2038
2039/**
2040 * Logs when we receive reports regarding how many consecutive failed contacts for a connection
2041 *
2042 * Logged from:
2043 *     system/bt
2044 */
2045message BluetoothDeviceFailedContactCounterReported {
2046    // An identifier that can be used to match events for this device.
2047    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2048    // Salt: Randomly generated 256 bit value
2049    // Hash algorithm: HMAC-SHA256
2050    // Size: 32 byte
2051    // Default: null or empty if the device identifier is not known
2052    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2053    // Connection handle of this connection if available
2054    // Range: 0x0000 - 0x0EFF (12 bits)
2055    // Default: 0xFFFF if the handle is unknown
2056    optional int32 connection_handle = 2;
2057    // HCI command status code if this is triggerred by hci_cmd
2058    // Default: STATUS_UNKNOWN
2059    optional android.bluetooth.hci.StatusEnum cmd_status = 3;
2060    // Number of consecutive failed contacts for a connection corresponding to the Handle
2061    // Range: uint16_t, 0-0xFFFF
2062    // Default: 0xFFFFF
2063    optional int32 failed_contact_counter = 4;
2064    // An identifier that can be used to match events for this device.
2065    // The incremental identifier is locally generated and guaranteed not derived
2066    // from any globally unique hardware id.
2067    // For paired devices, it stays consistent between Bluetooth toggling for the
2068    // same remote device.
2069    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2070    // session for the same remote device.
2071    // Default: 0 if the device's metric id is unknown.
2072    optional int32 metric_id = 5;
2073}
2074
2075/**
2076 * Logs when we receive reports regarding the tranmit power level used for a specific connection
2077 *
2078 * Logged from:
2079 *     system/bt
2080 */
2081message BluetoothDeviceTxPowerLevelReported {
2082    // An identifier that can be used to match events for this device.
2083    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2084    // Salt: Randomly generated 256 bit value
2085    // Hash algorithm: HMAC-SHA256
2086    // Size: 32 byte
2087    // Default: null or empty if the device identifier is not known
2088    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2089    // Connection handle of this connection if available
2090    // Range: 0x0000 - 0x0EFF (12 bits)
2091    // Default: 0xFFFF if the handle is unknown
2092    optional int32 connection_handle = 2;
2093    // HCI command status code if this is triggered by hci_cmd
2094    // Default: STATUS_UNKNOWN
2095    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2096    // Range: -30 ≤ N ≤ 20
2097    // Units: dBm
2098    // Invalid when an out of range value is reported
2099    optional int32 transmit_power_level = 4;
2100    // An identifier that can be used to match events for this device.
2101    // The incremental identifier is locally generated and guaranteed not derived
2102    // from any globally unique hardware id.
2103    // For paired devices, it stays consistent between Bluetooth toggling for the
2104    // same remote device.
2105    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2106    // session for the same remote device.
2107    // Default: 0 if the device's metric id is unknown.
2108    optional int32 metric_id = 5;
2109}
2110
2111/**
2112 * Logs when Bluetooth controller failed to reply with command status within a timeout period after
2113 * receiving an HCI command from the host
2114 *
2115 * Logged from: system/bt
2116 */
2117message BluetoothHciTimeoutReported {
2118    // HCI command associated with this event
2119    // Default: CMD_UNKNOWN
2120    optional android.bluetooth.hci.CommandEnum hci_command = 1;
2121}
2122
2123/**
2124 * Logs when we receive Bluetooth Link Quality Report event from the controller
2125 * See Android Bluetooth HCI specification for more details
2126 *
2127 * Note: all count and bytes field are counted since last event
2128 *
2129 * Logged from: system/bt
2130 */
2131message BluetoothQualityReportReported {
2132    // Quality report ID
2133    // Original type: uint8_t
2134    // Default: BQR_ID_UNKNOWN
2135    optional android.bluetooth.hci.BqrIdEnum quality_report_id = 1;
2136    // Packet type of the connection
2137    // Original type: uint8_t
2138    // Default: BQR_PACKET_TYPE_UNKNOWN
2139    optional android.bluetooth.hci.BqrPacketTypeEnum packet_types = 2;
2140    // Connection handle of the connection
2141    // Original type: uint16_t
2142    optional int32 connection_handle = 3;
2143    // Performing Role for the connection
2144    // Original type: uint8_t
2145    optional int32 connection_role = 4;
2146    // Current Transmit Power Level for the connection. This value is the same as the controller's
2147    // response to the HCI_Read_Transmit_Power_Level HCI command
2148    // Original type: uint8_t
2149    optional int32 tx_power_level = 5;
2150    // Received Signal Strength Indication (RSSI) value for the connection. This value is an
2151    // absolute receiver signal strength value
2152    // Original type: int8_t
2153    optional int32 rssi = 6;
2154    // Signal-to-Noise Ratio (SNR) value for the connection. It is the average SNR of all the
2155    // channels used by the link currently
2156    // Original type: uint8_t
2157    optional int32 snr = 7;
2158    // Indicates the number of unused channels in AFH_channel_map
2159    // Original type: uint8_t
2160    optional int32 unused_afh_channel_count = 8;
2161    // Indicates the number of the channels which are interfered and quality is bad but are still
2162    // selected for AFH
2163    // Original type: uint8_t
2164    optional int32 afh_select_unideal_channel_count = 9;
2165    // Current Link Supervision Timeout Setting
2166    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2167    // Original type: uint16_t
2168    optional int32 lsto = 10;
2169    // Piconet Clock for the specified Connection_Handle. This value is the same as the controller's
2170    // response to HCI_Read_Clock HCI command with the parameter "Which_Clock" of
2171    // 0x01 (Piconet Clock)
2172    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2173    // Original type: uint32_t
2174    optional int64 connection_piconet_clock = 11;
2175    // The count of retransmission
2176    // Original type: uint32_t
2177    optional int64 retransmission_count = 12;
2178    // The count of no RX
2179    // Original type: uint32_t
2180    optional int64 no_rx_count = 13;
2181    // The count of NAK (Negative Acknowledge)
2182    // Original type: uint32_t
2183    optional int64 nak_count = 14;
2184    // Controller timestamp of last TX ACK
2185    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2186    // Original type: uint32_t
2187    optional int64 last_tx_ack_timestamp = 15;
2188    // The count of Flow-off (STOP)
2189    // Original type: uint32_t
2190    optional int64 flow_off_count = 16;
2191    // Controller timestamp of last Flow-on (GO)
2192    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2193    // Original type: uint32_t
2194    optional int64 last_flow_on_timestamp = 17;
2195    // Buffer overflow count (how many bytes of TX data are dropped) since the last event
2196    // Original type: uint32_t
2197    optional int64 buffer_overflow_bytes = 18;
2198    // Buffer underflow count (in byte) since last event
2199    // Original type: uint32_t
2200    optional int64 buffer_underflow_bytes = 19;
2201}
2202
2203/**
2204 * Logs when a Bluetooth device's manufacturer information is learnt by the Bluetooth stack
2205 *
2206 * Notes:
2207 * - Each event can be partially filled as we might learn different pieces of device
2208 *   information at different time
2209 * - Multiple device info events can be combined to give more complete picture
2210 * - When multiple device info events tries to describe the same information, the
2211 *   later one wins
2212 *
2213 * Logged from:
2214 *     packages/apps/Bluetooth
2215 */
2216message BluetoothDeviceInfoReported {
2217    // An identifier that can be used to match events for this device.
2218    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2219    // Salt: Randomly generated 256 bit value
2220    // Hash algorithm: HMAC-SHA256
2221    // Size: 32 byte
2222    // Default: null or empty if the device identifier is not known
2223    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2224    // Where is this device info obtained from
2225    optional android.bluetooth.DeviceInfoSrcEnum source_type = 2;
2226    // Name of the data source
2227    // For EXTERNAL: package name of the data source
2228    // For INTERNAL: null for general case, component name otherwise
2229    optional string source_name = 3;
2230    // Name of the manufacturer of this device
2231    optional string manufacturer = 4;
2232    // Model of this device
2233    optional string model = 5;
2234    // Hardware version of this device
2235    optional string hardware_version = 6;
2236    // Software version of this device
2237    optional string software_version = 7;
2238    // An identifier that can be used to match events for this device.
2239    // The incremental identifier is locally generated and guaranteed not derived
2240    // from any globally unique hardware id.
2241    // For paired devices, it stays consistent between Bluetooth toggling for the
2242    // same remote device.
2243    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2244    // session for the same remote device.
2245    // Default: 0 if the device's metric id is unknown.
2246    optional int32 metric_id = 8;
2247}
2248
2249/**
2250 * Logs when we receive Bluetooth Read Remote Version Information Complete Event from the remote
2251 * device, as documented by the Bluetooth Core HCI specification
2252 * Reference: https://www.bluetooth.com/specifications/bluetooth-core-specification
2253 * Vol 2, Part E, Page 1118
2254 *
2255 * Logged from:
2256 *     system/bt
2257 */
2258message BluetoothRemoteVersionInfoReported {
2259    // Connection handle of the connection
2260    // Original type: uint16_t
2261    optional int32 connection_handle = 1;
2262    // HCI command status code
2263    // Default: STATUS_UNKNOWN
2264    optional android.bluetooth.hci.StatusEnum hci_status = 2;
2265    // 1 byte Version of current LMP in the remote controller
2266    optional int32 lmp_version = 3;
2267    // 2 bytes LMP manufacturer code of the remote controller
2268    // https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
2269    optional int32 lmp_manufacturer_code = 4;
2270    // 4 bytes subversion of the LMP in the remote controller
2271    optional int32 lmp_subversion = 5;
2272}
2273
2274/**
2275 * Logs when certain Bluetooth SDP attributes are discovered
2276 * Constant definitions are from:
2277 *     https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
2278 *
2279 * Current logged attributes:
2280 * - BluetoothProfileDescriptorList
2281 * - Supported Features Bitmask
2282 *
2283 * Logged from:
2284 *     system/bt
2285 */
2286message BluetoothSdpAttributeReported {
2287    // An identifier that can be used to match events for this device.
2288    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2289    // Salt: Randomly generated 256 bit value
2290    // Hash algorithm: HMAC-SHA256
2291    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2292    // Short form UUIDs used to identify Bluetooth protocols, profiles, and service classes
2293    // Original type: uint16_t
2294    optional int32 protocol_uuid = 2;
2295    // Short form UUIDs used to identify Bluetooth SDP attribute types
2296    // Original type: uint16_t
2297    optional int32 attribute_id = 3;
2298    // Attribute value for the particular attribute
2299    optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
2300    // An identifier that can be used to match events for this device.
2301    // The incremental identifier is locally generated and guaranteed not derived
2302    // from any globally unique hardware id.
2303    // For paired devices, it stays consistent between Bluetooth toggling for the
2304    // same remote device.
2305    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2306    // session for the same remote device.
2307    // Default: 0 if the device's metric id is unknown.
2308    optional int32 metric_id = 5;
2309}
2310
2311/**
2312 * Logs when bond state of a Bluetooth device changes
2313 *
2314 * Logged from:
2315 *     frameworks/base/core/java/android/bluetooth/BluetoothDevice.java
2316 *     packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2317 */
2318message BluetoothBondStateChanged {
2319    // An identifier that can be used to match events for this device.
2320    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2321    // Salt: Randomly generated 256 bit value
2322    // Hash algorithm: HMAC-SHA256
2323    // Size: 32 byte
2324    // Default: null or empty if the device identifier is not known
2325    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2326    // Preferred transport type to remote dual mode device
2327    // Default: TRANSPORT_AUTO means no preference
2328    optional android.bluetooth.TransportTypeEnum transport = 2;
2329    // The type of this Bluetooth device (Classic, LE, or Dual mode)
2330    // Default: UNKNOWN
2331    optional android.bluetooth.DeviceTypeEnum type = 3;
2332    // Current bond state (NONE, BONDING, BONDED)
2333    // Default: BOND_STATE_UNKNOWN
2334    optional android.bluetooth.BondStateEnum bond_state = 4;
2335    // Bonding sub state
2336    // Default: BOND_SUB_STATE_UNKNOWN
2337    optional android.bluetooth.BondSubStateEnum bonding_sub_state = 5;
2338    // Unbond Reason
2339    // Default: UNBOND_REASON_UNKNOWN
2340    optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
2341    // An identifier that can be used to match events for this device.
2342    // The incremental identifier is locally generated and guaranteed not derived
2343    // from any globally unique hardware id.
2344    // For paired devices, it stays consistent between Bluetooth toggling for the
2345    // same remote device.
2346    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2347    // session for the same remote device.
2348    // Default: 0 if the device's metric id is unknown.
2349    optional int32 metric_id = 7;
2350}
2351
2352/**
2353 * Logs there is an event related Bluetooth classic pairing
2354 *
2355 * Logged from:
2356 *     system/bt
2357 */
2358message BluetoothClassicPairingEventReported {
2359    // An identifier that can be used to match events for this device.
2360    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2361    // Salt: Randomly generated 256 bit value
2362    // Hash algorithm: HMAC-SHA256
2363    // Size: 32 byte
2364    // Default: null or empty if the device identifier is not known
2365    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2366    // Connection handle of this connection if available
2367    // Range: 0x0000 - 0x0EFF (12 bits)
2368    // Default: 0xFFFF if the handle is unknown
2369    optional int32 connection_handle = 2;
2370    // HCI command associated with this event
2371    // Default: CMD_UNKNOWN
2372    optional android.bluetooth.hci.CommandEnum hci_cmd = 3;
2373    // HCI event associated with this event
2374    // Default: EVT_UNKNOWN
2375    optional android.bluetooth.hci.EventEnum hci_event = 4;
2376    // HCI command status code if this is triggerred by hci_cmd
2377    // Default: STATUS_UNKNOWN
2378    optional android.bluetooth.hci.StatusEnum cmd_status = 5;
2379    // HCI reason code associated with this event
2380    // Default: STATUS_UNKNOWN
2381    optional android.bluetooth.hci.StatusEnum reason_code = 6;
2382    // A status value related to this specific event
2383    // Default: 0
2384    optional int64 event_value = 7;
2385    // An identifier that can be used to match events for this device.
2386    // The incremental identifier is locally generated and guaranteed not derived
2387    // from any globally unique hardware id.
2388    // For paired devices, it stays consistent between Bluetooth toggling for the
2389    // same remote device.
2390    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2391    // session for the same remote device.
2392    // Default: 0 if the device's metric id is unknown.
2393    optional int32 metric_id = 8;
2394}
2395
2396/**
2397 * Logs when there is an event related to Bluetooth Security Manager Protocol (SMP)
2398 *
2399 * Logged from:
2400 *     system/bt
2401 */
2402message BluetoothSmpPairingEventReported {
2403    // An identifier that can be used to match events for this device.
2404    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2405    // Salt: Randomly generated 256 bit value
2406    // Hash algorithm: HMAC-SHA256
2407    // Size: 32 byte
2408    // Default: null or empty if the device identifier is not known
2409    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2410    // SMP command sent or received over L2CAP
2411    // Default: CMD_UNKNOWN
2412    optional android.bluetooth.smp.CommandEnum smp_command = 2;
2413    // Whether this command is sent or received
2414    // Default: DIRECTION_UNKNOWN
2415    optional android.bluetooth.DirectionEnum direction = 3;
2416    // SMP failure reason code
2417    // Default: PAIRING_FAIL_REASON_DEFAULT
2418    optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
2419    // An identifier that can be used to match events for this device.
2420    // The incremental identifier is locally generated and guaranteed not derived
2421    // from any globally unique hardware id.
2422    // For paired devices, it stays consistent between Bluetooth toggling for the
2423    // same remote device.
2424    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2425    // session for the same remote device.
2426    // Default: 0 if the device's metric id is unknown.
2427    optional int32 metric_id = 5;
2428}
2429
2430/**
2431 * Logs when a Bluetooth socket’s connection state changed
2432 *
2433 * Logged from:
2434 *   system/bt
2435 */
2436message BluetoothSocketConnectionStateChanged {
2437    // An identifier that can be used to match events for this device.
2438    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2439    // Salt: Randomly generated 256 bit value
2440    // Hash algorithm: HMAC-SHA256
2441    // Size: 32 byte
2442    // Default: null or empty if this is a server listener socket
2443    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2444    // Temporary port of this socket for the current connection or session only
2445    // Default 0 when unknown or don't care
2446    optional int32 port = 2;
2447    // Socket type as mentioned in
2448    // frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
2449    // Default: SOCKET_TYPE_UNKNOWN
2450    optional android.bluetooth.SocketTypeEnum type = 3;
2451    // Socket connection state
2452    // Default: SOCKET_CONNECTION_STATE_UNKNOWN
2453    optional android.bluetooth.SocketConnectionstateEnum state = 4;
2454    // Number of bytes sent to remote device during this connection
2455    optional int64 tx_bytes = 5;
2456    // Number of bytes received from remote device during this connection
2457    optional int64 rx_bytes = 6;
2458    // Socket owner's UID
2459    optional int32 uid = 7 [(is_uid) = true];
2460    // Server port of this socket, if any. When both |server_port| and |port| fields are populated,
2461    // |port| must be spawned by |server_port|
2462    // Default 0 when unknown or don't care
2463    optional int32 server_port = 8;
2464    // Whether this is a server listener socket
2465    optional android.bluetooth.SocketRoleEnum is_server = 9;
2466    // An identifier that can be used to match events for this device.
2467    // The incremental identifier is locally generated and guaranteed not derived
2468    // from any globally unique hardware id.
2469    // For paired devices, it stays consistent between Bluetooth toggling for the
2470    // same remote device.
2471    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2472    // session for the same remote device.
2473    // Default: 0 if the device's metric id is unknown.
2474    optional int32 metric_id = 10;
2475}
2476
2477/**
2478 * Logs when Class of Device (CoD) value is learnt for a device during pairing or connection
2479 *
2480 * Logged from:
2481 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2482 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
2483 *
2484 */
2485message BluetoothClassOfDeviceReported {
2486    // An identifier that can be used to match events for this device.
2487    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2488    // Salt: Randomly generated 256 bit value
2489    // Hash algorithm: HMAC-SHA256
2490    // Size: 32 byte
2491    // Default: null or empty if this is a server listener socket
2492    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2493    // Class of Device (CoD) value including both Major, Minor device class and service class
2494    // Defined in: https://www.bluetooth.com/specifications/assigned-numbers/baseband
2495    // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
2496    // Default: 0
2497    optional int32 class_of_device = 2;
2498    // An identifier that can be used to match events for this device.
2499    // The incremental identifier is locally generated and guaranteed not derived
2500    // from any globally unique hardware id.
2501    // For paired devices, it stays consistent between Bluetooth toggling for the
2502    // same remote device.
2503    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2504    // session for the same remote device.
2505    // Default: 0 if the device's metric id is unknown.
2506    optional int32 metric_id = 3;
2507}
2508
2509/**
2510 * Logs when something is plugged into or removed from the USB-C connector.
2511 *
2512 * Logged from:
2513 *  UsbService
2514 */
2515message UsbConnectorStateChanged {
2516    enum State {
2517        STATE_DISCONNECTED = 0;
2518        STATE_CONNECTED = 1;
2519    }
2520    optional State state = 1;
2521    optional string id = 2;
2522    // Last active session in ms.
2523    // 0 when the port is in connected state.
2524    optional int64 last_connect_duration_millis = 3;
2525}
2526
2527/**
2528 * Logs the reported speaker impedance.
2529 *
2530 * Logged from:
2531 *  Vendor audio implementation.
2532 */
2533message SpeakerImpedanceReported {
2534    optional int32 speaker_location = 1;
2535    optional int32 impedance = 2;
2536}
2537
2538/**
2539 * Logs the report of a failed hardware.
2540 *
2541 * Logged from:
2542 *  Vendor HALs.
2543 *
2544 */
2545message HardwareFailed {
2546    enum HardwareType {
2547        HARDWARE_FAILED_UNKNOWN = 0;
2548        HARDWARE_FAILED_MICROPHONE = 1;
2549        HARDWARE_FAILED_CODEC = 2;
2550        HARDWARE_FAILED_SPEAKER = 3;
2551        HARDWARE_FAILED_FINGERPRINT = 4;
2552    }
2553    optional HardwareType hardware_type = 1;
2554
2555   /**
2556    * hardware_location allows vendors to differentiate between multiple instances of
2557    * the same hardware_type.  The specific locations are vendor defined integers,
2558    * referring to board-specific numbering schemes.
2559    */
2560    optional int32 hardware_location = 2;
2561
2562    /**
2563     * failure_code is specific to the HardwareType of the failed hardware.
2564     * It should use one of the enum values defined below.
2565     */
2566    enum HardwareErrorCode {
2567        UNKNOWN = 0;
2568        COMPLETE = 1;
2569        SPEAKER_HIGH_Z = 2;
2570        SPEAKER_SHORT = 3;
2571        FINGERPRINT_SENSOR_BROKEN = 4;
2572        FINGERPRINT_TOO_MANY_DEAD_PIXELS = 5;
2573        DEGRADE = 6;
2574    }
2575    optional int32 failure_code = 3;
2576}
2577
2578/**
2579 * Log an event when the device has been physically dropped.
2580 * Reported from the /vendor partition.
2581 */
2582message PhysicalDropDetected {
2583    // Confidence that the event was actually a drop, 0 -> 100
2584    optional int32 confidence_pctg = 1;
2585    // Peak acceleration of the drop, in 1/1000s of a g.
2586    optional int32 accel_peak_thousandths_g = 2;
2587    // Duration of freefall in ms
2588    optional int32 freefall_time_millis = 3;
2589}
2590
2591/**
2592 * Log bucketed battery charge cycles.
2593 *
2594 * Each bucket represents cycles of the battery past
2595 * a given charge point.  For example, if 10 cycle buckets are
2596 * initialized, bucket 1 is the lowest 1/10th of the battery,
2597 * and bucket 10 is 100%.
2598 *
2599 * Logged from:
2600 * /sys/class/power_supply/bms/cycle_count, via Vendor.
2601 */
2602message ChargeCyclesReported {
2603    optional int32 cycle_bucket_1 = 1;
2604    optional int32 cycle_bucket_2 = 2;
2605    optional int32 cycle_bucket_3 = 3;
2606    optional int32 cycle_bucket_4 = 4;
2607    optional int32 cycle_bucket_5 = 5;
2608    optional int32 cycle_bucket_6 = 6;
2609    optional int32 cycle_bucket_7 = 7;
2610    optional int32 cycle_bucket_8 = 8;
2611    optional int32 cycle_bucket_9 = 9;
2612    optional int32 cycle_bucket_10 = 10;
2613}
2614
2615/**
2616 * Log battery health snapshot.
2617 *
2618 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
2619 * are snapshotted periodically over 24hrs.
2620 */
2621message BatteryHealthSnapshot {
2622    enum BatterySnapshotType {
2623        UNKNOWN = 0;
2624        MIN_TEMP = 1;         // Snapshot at min batt temp over 24hrs.
2625        MAX_TEMP = 2;         // Snapshot at max batt temp over 24hrs.
2626        MIN_RESISTANCE = 3;   // Snapshot at min batt resistance over 24hrs.
2627        MAX_RESISTANCE = 4;   // Snapshot at max batt resistance over 24hrs.
2628        MIN_VOLTAGE = 5;      // Snapshot at min batt voltage over 24hrs.
2629        MAX_VOLTAGE = 6;      // Snapshot at max batt voltage over 24hrs.
2630        MIN_CURRENT = 7;      // Snapshot at min batt current over 24hrs.
2631        MAX_CURRENT = 8;      // Snapshot at max batt current over 24hrs.
2632        MIN_BATT_LEVEL = 9;   // Snapshot at min battery level (SoC) over 24hrs.
2633        MAX_BATT_LEVEL = 10;  // Snapshot at max battery level (SoC) over 24hrs.
2634        AVG_RESISTANCE = 11;  // Snapshot at average battery resistance over 24hrs.
2635    }
2636    optional BatterySnapshotType type = 1;
2637    // Temperature, in 1/10ths of degree C.
2638    optional int32 temperature_deci_celsius = 2;
2639    // Voltage Battery Voltage, in microVolts.
2640    optional int32 voltage_micro_volt = 3;
2641    // Current Battery current, in microAmps.
2642    optional int32 current_micro_amps = 4;
2643    // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
2644    optional int32 open_circuit_micro_volt = 5;
2645    // Resistance Battery Resistance, in microOhms.
2646    optional int32 resistance_micro_ohm = 6;
2647    // Level Battery Level, as % of full.
2648    optional int32 level_percent = 7;
2649}
2650
2651/**
2652 * Log slow I/O operations on the primary storage.
2653 */
2654message SlowIo {
2655    // Classifications of IO Operations.
2656    enum IoOperation {
2657        UNKNOWN = 0;
2658        READ = 1;
2659        WRITE = 2;
2660        UNMAP = 3;
2661        SYNC = 4;
2662    }
2663    optional IoOperation operation = 1;
2664
2665    // The number of slow IO operations of this type over 24 hours.
2666    optional int32 count = 2;
2667}
2668
2669/**
2670 * Log battery caused shutdown with the last recorded voltage.
2671 */
2672message BatteryCausedShutdown {
2673    // The last recorded battery voltage prior to shutdown.
2674    optional int32 last_recorded_micro_volt = 1;
2675}
2676
2677/**
2678 * Logs when ThermalService receives throttling events.
2679 *
2680 * Logged from:
2681 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
2682 */
2683message ThermalThrottlingSeverityStateChanged {
2684    // The type of temperature being reported (CPU, GPU, SKIN, etc)
2685    optional android.os.TemperatureTypeEnum sensor_type = 1;
2686
2687    // The name of the temperature source. Eg. CPU0
2688    optional string sensor_name = 2;
2689
2690    // Temperature in tenths of a degree C.
2691    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
2692    optional int32 temperature_deci_celsius = 3;
2693
2694    // Relative severity of the throttling, see enum definition.
2695    optional android.os.ThrottlingSeverityEnum severity = 4;
2696}
2697
2698/**
2699 * Logs the duration of a davey (jank of >=700ms) when it occurs
2700 *
2701 * Logged from:
2702 *   frameworks/base/libs/hwui/JankTracker.cpp
2703 */
2704message DaveyOccurred {
2705    // The UID that logged this atom.
2706    optional int32 uid = 1 [(is_uid) = true];
2707
2708    // Amount of time it took to render the frame. Should be >=700ms.
2709    optional int64 jank_duration_millis = 2;
2710}
2711
2712/**
2713 * Logs phone signal strength changes.
2714 *
2715 * Logged from:
2716 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2717 */
2718message PhoneSignalStrengthChanged {
2719    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
2720    optional android.telephony.SignalStrengthEnum signal_strength = 1;
2721}
2722
2723
2724/**
2725 * Logs when the phone state, sim state or signal strength changes
2726 *
2727 * Logged from:
2728 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2729 */
2730message PhoneServiceStateChanged {
2731    optional android.telephony.ServiceStateEnum state = 1;
2732    optional android.telephony.SimStateEnum sim_state = 2;
2733    optional android.telephony.SignalStrengthEnum signal_strength = 3;
2734}
2735
2736/**
2737 * Logs when the phone becomes on or off.
2738 *
2739 * Logged from:
2740 *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
2741 */
2742message PhoneStateChanged {
2743    enum State {
2744        OFF = 0;
2745        ON = 1;
2746    }
2747    optional State state = 1;
2748}
2749
2750message BackGesture {
2751    enum BackType {
2752          DEFAULT_BACK_TYPE = 0;
2753          COMPLETED = 1;
2754          COMPLETED_REJECTED = 2; // successful because coming from rejected area
2755          INCOMPLETE_EXCLUDED = 3; // would have been successful but in the exclusion area
2756          INCOMPLETE = 4;
2757    }
2758    optional BackType type = 1;
2759
2760    optional int32 y_coordinate = 2; // y coordinate for ACTION_DOWN event
2761    enum WindowHorizontalLocation {
2762        DEFAULT_LOCATION = 0;
2763        LEFT = 1;
2764        RIGHT = 2;
2765    }
2766    optional WindowHorizontalLocation x_location = 3;
2767}
2768
2769message ExclusionRectStateChanged {
2770    optional string component_name = 1;    // if not available, simply packageName
2771    optional int32 requested_height = 2;   // px
2772    optional int32 rejected_height = 3;    // px
2773
2774    enum WindowHorizontalLocation {
2775        DEFAULT_LOCATION = 0;
2776        LEFT = 1;
2777        RIGHT = 2;
2778    }
2779    optional WindowHorizontalLocation x_location = 4;
2780    optional bool landscape = 5;
2781    optional bool splitscreen = 6;
2782    optional int32 duration_millis = 7;
2783}
2784
2785message LauncherUIChanged {
2786    optional android.stats.launcher.LauncherAction action = 1;
2787    optional android.stats.launcher.LauncherState src_state = 2;
2788    optional android.stats.launcher.LauncherState dst_state = 3;
2789    optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
2790    optional bool is_swipe_up_enabled = 5;
2791}
2792
2793message StyleUIChanged {
2794    optional android.stats.style.Action action = 1;
2795    optional int32 color_package_hash = 2;
2796    optional int32 font_package_hash  = 3;
2797    optional int32 shape_package_hash = 4;
2798    optional int32 clock_package_hash = 5;
2799    optional int32 launcher_grid = 6;
2800    optional int32 wallpaper_category_hash = 7;
2801    optional int32 wallpaper_id_hash = 8;
2802    optional int32 color_preference = 9;
2803    optional android.stats.style.LocationPreference location_preference = 10;
2804}
2805
2806/**
2807 * Logs when Settings UI has changed.
2808 *
2809 * Logged from:
2810 *   packages/apps/Settings
2811 */
2812message SettingsUIChanged {
2813    /**
2814     * Where this SettingsUIChange event comes from. For example, if
2815     * it's a PAGE_VISIBLE event, where the page is opened from.
2816     */
2817    optional android.app.settings.PageId attribution = 1;
2818
2819    /**
2820     * What the UI action is.
2821     */
2822    optional android.app.settings.Action action = 2;
2823
2824    /**
2825     * Where the action is happening
2826     */
2827    optional android.app.settings.PageId page_id = 3;
2828
2829    /**
2830     * What preference changed in this event.
2831     */
2832    optional string changed_preference_key = 4;
2833
2834    /**
2835     * The new value of the changed preference.
2836     */
2837    optional int64 changed_preference_int_value = 5;
2838}
2839
2840/**
2841 * Logs basic timing information about touch events.
2842 * Reported at most every 5 minutes while device is being interacted with.
2843 *
2844 * Logged from:
2845 *   frameworks/native/services/inputflinger
2846 */
2847message TouchEventReported {
2848    /**
2849     * The fields latency_{min|max|mean|stdev} represent minimum, maximum, mean,
2850     * and the standard deviation of latency between the kernel and framework
2851     * for touchscreen events. The units are microseconds.
2852     *
2853     * The number is measured as the difference between the time at which
2854     * the input event was received in the evdev driver,
2855     * and the time at which the input event was received in EventHub.
2856     */
2857    // Minimum value
2858    optional float latency_min_micros = 1;
2859    // Maximum value
2860    optional float latency_max_micros = 2;
2861    // Average value
2862    optional float latency_mean_micros = 3;
2863    // Standard deviation
2864    optional float latency_stdev_micros = 4;
2865    // Number of touch events (input_event) in this report
2866    optional int32 count = 5;
2867}
2868
2869/**
2870 * Logs gesture classification and timing information for touch events.
2871 *
2872 * Logged from:
2873 *   frameworks/base/core/java/android/view/GestureDetector.java
2874 *   frameworks/base/core/java/android/view/View.java
2875 */
2876message TouchGestureClassified {
2877    // The source of the classification (e.g. Java class name).
2878    optional string source = 1;
2879
2880    enum Classification {
2881        UNKNOWN_CLASSIFICATION = 0;
2882        SINGLE_TAP = 1;
2883        DOUBLE_TAP = 2;
2884        LONG_PRESS = 3;
2885        DEEP_PRESS = 4;
2886        SCROLL = 5;
2887    }
2888    // The classification of the gesture.
2889    optional Classification classification = 2;
2890
2891    // The interval from the start of a touch event stream until the
2892    // classification was made.
2893    optional int32 latency_millis = 3;
2894
2895    // The distance from the location of the first touch event to the
2896    // location of the touch event when the classification was made.
2897    optional float displacement_px = 4;
2898}
2899
2900/**
2901 * Logs that a setting was updated.
2902 * Logged from:
2903 *   frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
2904 * The tag and is_default allow resetting of settings to default values based on the specified
2905 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
2906 */
2907message SettingChanged {
2908    // The name of the setting.
2909    optional string setting = 1;
2910
2911    // The change being imposed on this setting. May represent a number, eg "3".
2912    optional string value = 2;
2913
2914    // The new value of this setting. For most settings, this is same as value. For some settings,
2915    // value is +X or -X where X represents an element in a set. For example, if the previous value
2916    // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
2917    // The +/- feature is currently only used for location_providers_allowed.
2918    optional string new_value = 3;
2919
2920    // The previous value of this setting.
2921    optional string prev_value = 4;
2922
2923    // The tag used with the is_default for resetting sets of settings. This is generally null.
2924    optional string tag = 5;
2925
2926    // True if this setting with tag should be resettable.
2927    optional bool is_default = 6;
2928
2929    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
2930    optional int32 user = 7;
2931
2932    enum ChangeReason {
2933        UPDATED = 1; // Updated can be an insertion or an update.
2934        DELETED = 2;
2935    }
2936    optional ChangeReason reason = 8;
2937}
2938
2939/**
2940 * Logs activity going to foreground or background
2941 *
2942 * Logged from:
2943  *   frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
2944 */
2945message ActivityForegroundStateChanged {
2946    optional int32 uid = 1 [(is_uid) = true];
2947    optional string pkg_name = 2;
2948    optional string class_name = 3;
2949
2950    enum State {
2951        BACKGROUND = 0;
2952        FOREGROUND = 1;
2953    }
2954    optional State state = 4;
2955}
2956
2957/**
2958 * Logs when a volume entered low Storage state.
2959 * Logged from:
2960 *      frameworks/base/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
2961 */
2962message LowStorageStateChanged {
2963    // Volume that ran out of storage.
2964    optional string volume_description = 1;
2965
2966    enum State {
2967        UNKNOWN = 0;
2968        OFF = 1;
2969        ON = 2;
2970    }
2971    optional State state = 2;
2972}
2973
2974/**
2975 * Logs when an app is downgraded.
2976 * Logged from:
2977 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
2978 */
2979message AppDowngraded {
2980    optional string package_name = 1;
2981    // Size of the package (all data) before being downgraded.
2982    optional int64 size_in_bytes_before = 2;
2983    // Size of the package (all data) after being downgraded.
2984    optional int64 size_in_bytes_after = 3;
2985
2986    optional bool aggressive = 4;
2987}
2988
2989/**
2990 * Logs when an app is optimized after being downgraded.
2991 * Logged from:
2992 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
2993 */
2994message AppOptimizedAfterDowngraded {
2995    optional string package_name = 1;
2996}
2997
2998/**
2999 * Logs whenever an app is installed on external storage.
3000 * Logged from:
3001        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
3002 */
3003message AppInstallOnExternalStorageReported {
3004    // The type of external storage.
3005    optional android.stats.storage.ExternalStorageType storage_type = 1;
3006    // The name of the package that is installed on the sd card.
3007    optional string package_name = 2;
3008}
3009
3010/**
3011 * Logs when an app crashes.
3012 * Logged from:
3013 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3014 */
3015message AppCrashOccurred {
3016    optional int32 uid = 1 [(is_uid) = true];
3017
3018    optional string event_type = 2;
3019
3020    // The name of the process.
3021    // system_server if it is not by an app
3022    optional string process_name = 3;
3023
3024    // The pid if available. -1 means not available.
3025    optional sint32 pid = 4;
3026
3027    optional string package_name = 5;
3028
3029    enum InstantApp {
3030        UNAVAILABLE = 0;
3031        FALSE = 1;
3032        TRUE = 2;
3033    }
3034    optional InstantApp is_instant_app = 6;
3035
3036    enum ForegroundState {
3037        UNKNOWN = 0;
3038        BACKGROUND = 1;
3039        FOREGROUND = 2;
3040    }
3041    optional ForegroundState foreground_state = 7;
3042
3043    optional android.server.ErrorSource error_source = 8;
3044}
3045
3046/**
3047 * Logs when a WTF (What a Terrible Failure) happened.
3048 * Logged from:
3049 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3050 */
3051message WTFOccurred {
3052    optional int32 uid = 1 [(is_uid) = true];
3053
3054    optional string tag = 2;
3055
3056    // The name of the process.
3057    // system_server if it is not by an app
3058    optional string process_name = 3;
3059
3060    // The pid if available. -1 means not available.
3061    optional sint32 pid = 4;
3062
3063    optional android.server.ErrorSource error_source = 5;
3064}
3065
3066/**
3067 * Logs when system server reports low memory.
3068 * Logged from:
3069 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3070 */
3071message LowMemReported {
3072}
3073
3074/**
3075 * Logs when an app ANR (App Not Responding) occurs.
3076 * Logged from:
3077 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
3078 */
3079message ANROccurred {
3080    optional int32 uid = 1 [(is_uid) = true];
3081
3082    optional string process_name = 2;
3083
3084    optional string short_component_name = 3;
3085
3086    optional string reason = 4;
3087
3088    enum InstantApp {
3089        UNAVAILABLE = 0;
3090        FALSE = 1;
3091        TRUE = 2;
3092    }
3093    optional InstantApp is_instant_app = 5;
3094
3095    enum ForegroundState {
3096        UNKNOWN = 0;
3097        BACKGROUND = 1;
3098        FOREGROUND = 2;
3099    }
3100    optional ForegroundState foreground_state = 6;
3101
3102    optional android.server.ErrorSource error_source = 7;
3103
3104    optional string package_name = 8;
3105}
3106
3107/**
3108 * Logs when the vibrator state changes.
3109 * Logged from:
3110 *      frameworks/base/services/core/java/com/android/server/VibratorService.java
3111 */
3112message VibratorStateChanged {
3113    repeated AttributionNode attribution_node = 1;
3114
3115    enum State {
3116        OFF = 0;
3117        ON = 1;
3118    }
3119    optional State state = 2;
3120
3121    // Duration (in milliseconds) requested to keep the vibrator on.
3122    // Only applicable for State == ON.
3123    optional int64 duration_millis = 3;
3124}
3125
3126/*
3127 * Allows other apps to push events into statsd.
3128 * Logged from:
3129 *      frameworks/base/core/java/android/util/StatsLog.java
3130 */
3131message AppBreadcrumbReported {
3132    // The uid of the application that sent this custom atom.
3133    optional int32 uid = 1 [(is_uid) = true];
3134
3135    // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
3136    optional int32 label = 2;
3137
3138    // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
3139    // predicates for the metrics).
3140    enum State {
3141        UNKNOWN = 0;
3142        UNSPECIFIED = 1;  // For events that are known to not represent START/STOP.
3143        STOP = 2;
3144        START = 3;
3145    }
3146    optional State state = 3;
3147}
3148
3149/**
3150 * Logs the wall-clock time when a significant wall-clock time shift occurs.
3151 * For example, this could be due to the user manually changing the time.
3152 *
3153 * Logged from:
3154 *   frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
3155 */
3156message WallClockTimeShifted {
3157    // New wall-clock time in milliseconds, according to System.currentTimeMillis().
3158    optional int64 wall_clock_timestamp_millis = 1;
3159}
3160
3161/**
3162 * Logs when statsd detects an anomaly.
3163 *
3164 * Logged from:
3165 *   frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
3166 */
3167message AnomalyDetected {
3168    // Uid that owns the config whose anomaly detection alert fired.
3169    optional int32 config_uid = 1 [(is_uid) = true];
3170
3171    // Id of the config whose anomaly detection alert fired.
3172    optional int64 config_id = 2;
3173
3174    // Id of the alert (i.e. name of the anomaly that was detected).
3175    optional int64 alert_id = 3;
3176}
3177
3178message AppStartOccurred {
3179    // The uid if available. -1 means not available.
3180    optional int32 uid = 1 [(is_uid) = true];
3181
3182    // The app package name.
3183    optional string pkg_name = 2;
3184
3185    enum TransitionType {
3186        UNKNOWN = 0;
3187        WARM = 1;
3188        HOT = 2;
3189        COLD = 3;
3190    }
3191    // The transition type.
3192    optional TransitionType type = 3;
3193
3194    // The activity name.
3195    optional string activity_name = 4;
3196
3197    // The name of the calling app. Empty if not set.
3198    optional string calling_pkg_name = 5;
3199
3200    // Whether the app is an instant app.
3201    optional bool is_instant_app = 6;
3202
3203    // Device uptime when activity started.
3204    optional int64 activity_start_millis = 7;
3205
3206    optional android.app.AppTransitionReasonEnum reason = 8;
3207
3208    optional int32 transition_delay_millis = 9;
3209    // -1 if not set.
3210    optional int32 starting_window_delay_millis = 10;
3211    // -1 if not set.
3212    optional int32 bind_application_delay_millis = 11;
3213    optional int32 windows_drawn_delay_millis = 12;
3214
3215    // Empty if not set.
3216    optional string launch_token = 13;
3217
3218    // The compiler filter used when when the package was optimized.
3219    optional int32 package_optimization_compilation_filter = 14;
3220
3221    // The reason why the package was optimized.
3222    optional int32 package_optimization_compilation_reason = 15;
3223}
3224
3225message AppStartCanceled {
3226    // The uid if available. -1 means not available.
3227    optional int32 uid = 1 [(is_uid) = true];
3228
3229    // The app package name.
3230    optional string pkg_name = 2;
3231
3232    enum TransitionType {
3233        UNKNOWN = 0;
3234        WARM = 1;
3235        HOT = 2;
3236        COLD = 3;
3237    }
3238    // The transition type.
3239    optional TransitionType type = 3;
3240
3241    // The activity name.
3242    optional string activity_name = 4;
3243}
3244
3245message AppStartFullyDrawn {
3246    // The uid if available. -1 means not available.
3247    optional int32 uid = 1 [(is_uid) = true];
3248
3249    // The app package name.
3250    optional string pkg_name = 2;
3251
3252    enum TransitionType {
3253        UNKNOWN = 0;
3254        WITH_BUNDLE = 1;
3255        WITHOUT_BUNDLE = 2;
3256    }
3257    // The transition type.
3258    optional TransitionType type = 3;
3259
3260    // The activity name.
3261    optional string activity_name = 4;
3262
3263    optional bool transition_process_running = 5;
3264
3265    // App startup time (until call to Activity#reportFullyDrawn()).
3266    optional int64 app_startup_time_millis = 6;
3267}
3268
3269/**
3270 * Logs a picture-in-picture action
3271 * Logged from:
3272 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3273 *      frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
3274 *      frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
3275 */
3276message PictureInPictureStateChanged {
3277    // -1 if it is not available
3278    optional int32 uid = 1 [(is_uid) = true];
3279
3280    optional string short_name = 2;
3281
3282    enum State {
3283        ENTERED = 1;
3284        EXPANDED_TO_FULL_SCREEN = 2;
3285        MINIMIZED = 3;
3286        DISMISSED = 4;
3287    }
3288    optional State state = 3;
3289}
3290
3291/**
3292 * Logs overlay action
3293 * Logged from:
3294 *     services/core/java/com/android/server/wm/Session.java
3295 */
3296message OverlayStateChanged {
3297    optional int32 uid = 1 [(is_uid) = true];
3298
3299    optional string package_name = 2;
3300
3301    optional bool using_alert_window = 3;
3302
3303    enum State {
3304        ENTERED = 1;
3305        EXITED = 2;
3306    }
3307    optional State state = 4;
3308}
3309
3310/*
3311 * Logs foreground service starts and stops.
3312 * Note that this is not when a service starts or stops, but when it is
3313 * considered foreground.
3314 * Logged from
3315 *     //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
3316 */
3317message ForegroundServiceStateChanged {
3318    optional int32 uid = 1 [(is_uid) = true];
3319    // package_name + "/" + class_name
3320    optional string short_name = 2;
3321
3322    enum State {
3323        ENTER = 1;
3324        EXIT = 2;
3325    }
3326    optional State state = 3;
3327}
3328
3329/**
3330 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
3331 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
3332 * attributed back to the parent (host) uid. One example is Chrome.
3333 *
3334 * Logged from:
3335 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3336 */
3337message IsolatedUidChanged {
3338    // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
3339    // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
3340    // This field is ignored when event == REMOVED.
3341    optional int32 parent_uid = 1;
3342
3343    optional int32 isolated_uid = 2;
3344
3345    // We expect an isolated uid to be removed before if it's used for another parent uid.
3346    enum Event {
3347        REMOVED = 0;
3348        CREATED = 1;
3349    }
3350    optional Event event = 3;
3351}
3352
3353/*
3354 * Logs the reception of an incoming network packet causing the main system to wake up for
3355 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
3356 * and processed by WakeupController.cpp.
3357 */
3358message PacketWakeupOccurred {
3359    // The uid owning the socket into which the packet was delivered, or -1 if the packet was
3360    // delivered nowhere.
3361    optional int32 uid = 1 [(is_uid) = true];
3362    // The interface name on which the packet was received.
3363    optional string iface = 2;
3364    // The ethertype value of the packet.
3365    optional int32 ethertype = 3;
3366    // String representation of the destination MAC address of the packet.
3367    optional string destination_hardware_address = 4;
3368    // String representation of the source address of the packet if this was an IP packet.
3369    optional string source_ip = 5;
3370    // String representation of the destination address of the packet if this was an IP packet.
3371    optional string destination_ip = 6;
3372    // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
3373    // field if this was an IPv6 packet. The range of possible values is the same for both IP
3374    // families.
3375    optional int32 ip_next_header = 7;
3376    // The source port if this was a TCP or UDP packet.
3377    optional int32 source_port = 8;
3378    // The destination port if this was a TCP or UDP packet.
3379    optional int32 destination_port = 9;
3380}
3381
3382/*
3383 * Logs the memory stats for an app on startup.
3384 * Logged from:
3385 *     frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3386 */
3387message AppStartMemoryStateCaptured {
3388    // The uid if available. -1 means not available.
3389    optional int32 uid = 1 [(is_uid) = true];
3390
3391    // The process name.
3392    optional string process_name = 2;
3393
3394    // The activity name.
3395    optional string activity_name = 3;
3396
3397    // # of page-faults
3398    optional int64 page_fault = 4;
3399
3400    // # of major page-faults
3401    optional int64 page_major_fault = 5;
3402
3403    // RSS
3404    optional int64 rss_in_bytes = 6;
3405
3406    // CACHE
3407    optional int64 cache_in_bytes = 7;
3408
3409    // SWAP
3410    optional int64 swap_in_bytes = 8;
3411}
3412
3413/*
3414 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
3415 * for LMK event.
3416 * Logged from:
3417 *      system/core/lmkd/lmkd.c
3418 */
3419message LmkStateChanged {
3420    enum State {
3421        UNKNOWN = 0;
3422        START = 1;
3423        STOP = 2;
3424    }
3425    optional State state = 1;
3426}
3427
3428/*
3429 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
3430 * Logged from:
3431 *      system/core/lmkd/lmkd.c
3432 */
3433message LmkKillOccurred {
3434    // The uid if available. -1 means not available.
3435    optional int32 uid = 1 [(is_uid) = true];
3436
3437    // The process name.
3438    optional string process_name = 2;
3439
3440    // oom adj score.
3441    optional int32 oom_adj_score = 3;
3442
3443    // # of page-faults
3444    optional int64 page_fault = 4;
3445
3446    // # of major page-faults
3447    optional int64 page_major_fault = 5;
3448
3449    // RSS
3450    optional int64 rss_in_bytes = 6;
3451
3452    // CACHE
3453    optional int64 cache_in_bytes = 7;
3454
3455    // SWAP
3456    optional int64 swap_in_bytes = 8;
3457
3458    // The elapsed real time of start of the process.
3459    optional int64 process_start_time_nanos = 9;
3460
3461    // Min oom adj score considered by lmkd.
3462    optional int32 min_oom_score = 10;
3463}
3464
3465/*
3466 * Logs when the ActivityManagerService detects that an app died.
3467 *
3468 * Logged from:
3469 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3470 */
3471message AppDied {
3472    // timestamp(elapsedRealtime) of record creation
3473    optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
3474}
3475
3476/**
3477 * An atom for generic metrics logging. Available from Android Q.
3478 */
3479message GenericAtom {
3480    // The uid of the application that sent this custom atom.
3481    optional int32 uid = 1 [(is_uid) = true];
3482
3483    // An event_id indicates the type of event.
3484    optional android.stats.EventType event_id = 2;
3485}
3486
3487/**
3488 * Logs when a biometric acquire event occurs.
3489 *
3490 * Logged from:
3491 *   frameworks/base/services/core/java/com/android/server/biometrics
3492 */
3493message BiometricAcquired {
3494    // Biometric modality that was acquired.
3495    optional android.hardware.biometrics.ModalityEnum modality = 1;
3496    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java.
3497    optional int32 user = 2;
3498    // If this acquire is for a crypto operation. e.g. Secure purchases, unlock password storage.
3499    optional bool is_crypto = 3;
3500    // Action that the device is performing. Acquired messages are only expected for enroll and
3501    // authenticate. Other actions may indicate an error.
3502    optional android.hardware.biometrics.ActionEnum action = 4;
3503    // The client that this acquisition was received for.
3504    optional android.hardware.biometrics.ClientEnum client = 5;
3505    // Acquired constants, e.g. ACQUIRED_GOOD. See constants defined by <Biometric>Manager.
3506    optional int32 acquire_info = 6;
3507    // Vendor-specific acquire info. Valid only if acquire_info == ACQUIRED_VENDOR.
3508    optional int32 acquire_info_vendor = 7;
3509    // Dictates if this message should trigger additional debugging.
3510    optional bool debug = 8;
3511}
3512
3513/**
3514 * Logs when a biometric authentication event occurs.
3515 *
3516 * Logged from:
3517 *   frameworks/base/services/core/java/com/android/server/biometrics
3518 */
3519message BiometricAuthenticated {
3520    // Biometric modality that was used.
3521    optional android.hardware.biometrics.ModalityEnum modality = 1;
3522    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
3523    optional int32 user = 2;
3524    // If this authentication is for a crypto operation. e.g. Secure purchases, unlock password
3525    // storage.
3526    optional bool is_crypto = 3;
3527    // The client that this acquisition was received for.
3528    optional android.hardware.biometrics.ClientEnum client = 4;
3529    // If authentication requires user confirmation. See BiometricPrompt's
3530    // setRequireConfirmation(bool) method.
3531    optional bool require_confirmation = 5;
3532
3533    enum State {
3534        UNKNOWN = 0;
3535        REJECTED = 1;
3536        PENDING_CONFIRMATION = 2;
3537        CONFIRMED = 3;
3538    }
3539
3540    // State of the current auth attempt.
3541    optional State state = 6;
3542    // Time it took to authenticate. For BiometricPrompt where setRequireConfirmation(false) is
3543    // specified and supported by the biometric modality, this is from the first ACQUIRED_GOOD to
3544    // AUTHENTICATED. for setRequireConfirmation(true), this is from PENDING_CONFIRMATION to
3545    // CONFIRMED.
3546    optional int64 latency_millis = 7;
3547    // Dictates if this message should trigger additional debugging.
3548    optional bool debug = 8;
3549}
3550
3551/**
3552 * Logs when a biometric error occurs.
3553 *
3554 * Logged from:
3555 *   frameworks/base/services/core/java/com/android/server/biometrics
3556 */
3557message BiometricErrorOccurred {
3558    // Biometric modality that was used.
3559    optional android.hardware.biometrics.ModalityEnum modality = 1;
3560    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
3561    optional int32 user = 2;
3562    // If this error is for a crypto operation. e.g. Secure purchases, unlock password storage.
3563    optional bool is_crypto = 3;
3564    // Action that the device is performing.
3565    optional android.hardware.biometrics.ActionEnum action = 4;
3566    // The client that this acquisition was received for.
3567    optional android.hardware.biometrics.ClientEnum client = 5;
3568    // Error constants. See constants defined by <Biometric>Manager. Enums won't work since errors
3569    // are unique to modality.
3570    optional int32 error_info = 6;
3571    // Vendor-specific error info. Valid only if acquire_info == ACQUIRED_VENDOR. These are defined
3572    // by the vendor and not specified by the HIDL interface.
3573    optional int32 error_info_vendor = 7;
3574    // Dictates if this message should trigger additional debugging.
3575    optional bool debug = 8;
3576    // Time spent during the authentication attempt.
3577    optional int64 latency_millis = 9;
3578}
3579
3580/**
3581 * Logs when a system health issue is detected.
3582 * Logged from:
3583 *   frameworks/base/services/core/java/com/android/server/biometrics
3584 */
3585message BiometricSystemHealthIssueDetected {
3586    // Biometric modality.
3587    optional android.hardware.biometrics.ModalityEnum modality = 1;
3588    // Type of issue detected.
3589    optional android.hardware.biometrics.IssueEnum issue = 2;
3590    // Dictates if this message should trigger additional debugging.
3591    optional bool debug = 3;
3592}
3593
3594/**
3595 * Logs when a biometric enrollment occurs.
3596 *
3597 * Logged from:
3598 *   frameworks/base/services/core/java/com/android/server/biometrics
3599 */
3600message BiometricEnrolled {
3601    // Biometric modality that was used.
3602    optional android.hardware.biometrics.ModalityEnum modality = 1;
3603    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
3604    optional int32 user = 2;
3605    // The amount of time the enrollment took in milliseconds.
3606    optional int64 latency_millis = 3;
3607    // Whether or not the enrollment was successful.
3608    optional bool success = 4;
3609}
3610
3611/*
3612 * Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
3613 */
3614message FlagFlipUpdateOccurred {
3615    // If the event is from a flag config package, specify the package name.
3616    optional string flag_flip_package_name = 1;
3617
3618    // The order id of the package
3619    optional int64 order_id = 2;
3620}
3621
3622/**
3623 * Potential experiment ids that goes with a train install.
3624 */
3625message TrainExperimentIds {
3626    repeated int64 experiment_id = 1;
3627}
3628
3629/*
3630 * Logs when a binary push state changes.
3631 * Logged by the installer via public api.
3632 */
3633message BinaryPushStateChanged {
3634    // Name of the train.
3635    optional string train_name = 1;
3636    // Version code for a "train" of packages that need to be installed atomically
3637    optional int64 train_version_code = 2;
3638    // After installation of this package, device requires a restart.
3639    optional bool requires_staging = 3;
3640    // Rollback should be enabled for this install.
3641    optional bool rollback_enabled = 4;
3642    // Requires low latency monitoring if possible.
3643    optional bool requires_low_latency_monitor = 5;
3644
3645    enum State {
3646        UNKNOWN = 0;
3647        INSTALL_REQUESTED = 1;
3648        INSTALL_STARTED = 2;
3649        INSTALL_STAGED_NOT_READY = 3;
3650        INSTALL_STAGED_READY = 4;
3651        INSTALL_SUCCESS = 5;
3652        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
3653        // and INSTALL_FAILURE_COMMIT.
3654        INSTALL_FAILURE = 6  [deprecated = true];
3655        // This enum is for installs that are manually cancelled via the Manual Update UI.
3656        INSTALL_CANCELLED = 7;
3657        INSTALLER_ROLLBACK_REQUESTED = 8;
3658        INSTALLER_ROLLBACK_INITIATED = 9;
3659        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
3660        INSTALLER_ROLLBACK_STAGED = 11;
3661        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
3662        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
3663        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
3664        INSTALLER_ROLLBACK_SUCCESS = 15;
3665        INSTALLER_ROLLBACK_FAILURE = 16;
3666        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
3667        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
3668        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
3669        INSTALL_STAGED_CANCEL_REQUESTED = 20;
3670        INSTALL_STAGED_CANCEL_SUCCESS = 21;
3671        INSTALL_STAGED_CANCEL_FAILURE = 22;
3672        INSTALL_FAILURE_DOWNLOAD = 23;
3673        INSTALL_FAILURE_STATE_MISMATCH = 24;
3674        INSTALL_FAILURE_COMMIT = 25;
3675    }
3676    optional State state = 6;
3677    // Possible experiment ids for monitoring this push.
3678    optional TrainExperimentIds experiment_ids = 7 [(log_mode) = MODE_BYTES];
3679    // user id
3680    optional int32 user_id = 8;
3681}
3682
3683/* Test atom, is not logged anywhere */
3684message TestAtomReported {
3685    repeated AttributionNode attribution_node = 1;
3686    optional int32 int_field = 2;
3687    optional int64 long_field = 3;
3688    optional float float_field = 4;
3689    optional string string_field = 5;
3690    optional bool boolean_field = 6;
3691    enum State {
3692        UNKNOWN = 0;
3693        OFF = 1;
3694        ON = 2;
3695    }
3696    optional State state = 7;
3697    optional TrainExperimentIds bytes_field = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
3698}
3699
3700/** Represents USB port overheat event. */
3701message UsbPortOverheatEvent {
3702    /* Temperature of USB port at USB plug event, in 1/10ths of degree C. */
3703    optional int32 plug_temperature_deci_c = 1;
3704
3705    /* Maximum temperature of USB port during overheat event, in 1/10ths of degree C. */
3706    optional int32 max_temperature_deci_c = 2;
3707
3708    /* Time between USB plug event and overheat threshold trip, in seconds. */
3709    optional int32 time_to_overheat_secs = 3;
3710
3711    /* Time between overheat threshold trip and hysteresis, in seconds. */
3712    optional int32 time_to_hysteresis_secs = 4;
3713
3714    /* Time between hysteresis and active mitigation ending, in seconds. */
3715    optional int32 time_to_inactive_secs = 5;
3716};
3717
3718/**
3719 * Logs total effective full charge and discharge cycles on a battery.
3720 * Here are some examples of one effective cycle:
3721 *   1) the battery charges from 0% to 100% and drains back to 0%,
3722 *   2) charging from 50% to 100% and draining back to 50% twice.
3723 * Pulled from:
3724 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
3725 */
3726message BatteryCycleCount {
3727    /* Number of total charge and discharge cycles on the system battery. */
3728    optional int32 cycle_count = 1;
3729}
3730
3731/**
3732 * Logs that external storage is mounted and information about it, the storage type (sd card/usb/
3733 * others), its type (public or private) and the size in bytes.
3734 * Pulled from:
3735 *   StatsCompanionService
3736 */
3737
3738message ExternalStorageInfo {
3739
3740    enum VolumeType {
3741        UNKNOWN = 0;
3742        PUBLIC = 1;
3743        PRIVATE = 2;
3744        OTHER = 3;
3745    }
3746
3747    // The type of external storage.
3748    optional android.stats.storage.ExternalStorageType storage_type = 1;
3749    // Type of the volume: TYPE_PUBLIC if portable and TYPE_PRIVATE if internal.
3750    optional VolumeType volume_type = 2;
3751    // Total size of the sd card in bytes.
3752    optional int64 size_bytes = 3;
3753}
3754
3755/*
3756 * Logs when a connection becomes available and lost.
3757 * Logged in StatsCompanionService.java
3758 */
3759message ConnectivityStateChanged {
3760  // Id of the network.
3761  optional int32 net_id = 1;
3762
3763  enum State {
3764    UNKNOWN = 0;
3765    CONNECTED = 1;
3766    DISCONNECTED = 2;
3767  }
3768  // Connected state of a network.
3769  optional State state = 2;
3770}
3771
3772/**
3773 * Logs when a service starts and stops.
3774 * Logged from:
3775 *   services/core/java/com/android/server/am/ActiveServices.java
3776 */
3777message ServiceStateChanged {
3778
3779    optional int32 uid = 1 [(is_uid) = true];
3780
3781    optional string package_name = 2;
3782
3783    optional string service_name = 3;
3784
3785    enum State {
3786        START = 1;
3787        STOP = 2;
3788    }
3789
3790    optional State state = 4;
3791}
3792
3793/**
3794 * Logs when a service is launched.
3795 * Logged from:
3796 *   services/core/java/com/android/server/am/ActiveServices.java
3797 */
3798message ServiceLaunchReported {
3799
3800    optional int32 uid = 1 [(is_uid) = true];
3801
3802    optional string package_name = 2;
3803
3804    optional string service_name = 3;
3805}
3806
3807/**
3808 * Logs when a hidden API is used.
3809 *
3810 * Logged from:
3811 *     libcore/libart/src/main/java/dalvik/system/VMRuntime.java
3812 */
3813message HiddenApiUsed {
3814    // The uid of the app making the hidden access.
3815    optional int32 uid = 1 [(is_uid) = true];
3816
3817    // Signature of the method or field accessed.
3818    optional string signature = 2;
3819
3820    enum AccessMethod {
3821        NONE = 0;
3822        REFLECTION = 1;
3823        JNI = 2;
3824        LINKING = 3;
3825    }
3826
3827    // Type of access.
3828    optional AccessMethod access_method = 3;
3829
3830    // Whether the access was prevented or not.
3831    optional bool access_denied = 4;
3832}
3833
3834/**
3835 * Logs user interaction with the Privacy Indicators added in Q. In particular:
3836 * - When user sees privacy chip
3837 * - When user clicks privacy chip
3838 * - How does the user exit the Privacy Dialog
3839 * Logged from:
3840 *   packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
3841 */
3842message PrivacyIndicatorsInteracted {
3843
3844    enum Type {
3845        UNKNOWN = 0;
3846        CHIP_VIEWED = 1;
3847        CHIP_CLICKED = 2;
3848        DIALOG_PRIVACY_SETTINGS = 3;
3849        DIALOG_DISMISS = 4;
3850        DIALOG_LINE_ITEM = 5;
3851    }
3852
3853    optional Type type = 1 [(state_field_option).option = EXCLUSIVE];
3854
3855    // Used if the type is LINE_ITEM
3856    optional string package_name = 2;
3857}
3858
3859/**
3860 * Logs information about a package that is moved from the internal to external storage and vice
3861 * versa.
3862 * It logs the package name, the type of the external storage where the package is installed
3863 * (if moved to external storage, or UNKNOWN if moved to internal storage),
3864 * and the move type: if it's from internal to external or the other way around.
3865 *
3866 * Logged from:
3867        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
3868 */
3869message AppMovedStorageReported {
3870    enum MoveType {
3871        UNKNOWN = 0;
3872        TO_EXTERNAL = 1;
3873        TO_INTERNAL = 2;
3874    }
3875    // The type of the external storage.
3876    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
3877    // The type of move.
3878    optional MoveType move_type = 2;
3879    // The name of the package that was moved.
3880    optional string package_name = 3;
3881}
3882
3883/**
3884 * Logs when system server watchdog occurs.
3885 * Logged from:
3886 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
3887 */
3888message SystemServerWatchdogOccurred {
3889    optional string subject = 1;
3890}
3891
3892/**
3893 * Logs when new file added to tombstones.
3894 * Logged from:
3895 *      frameworks/base/core/java/com/android/server/BootReceiver.java
3896 */
3897message TombStoneOccurred {
3898}
3899
3900/*
3901 * Information about a role request
3902 *
3903 * Logged from:
3904 *   packages/apps/PermissionController/src/com/android/packageinstaller/role/ui/RequestRoleFragment.java
3905 */
3906message RoleRequestResultReported {
3907    // UID of application requesting the role
3908    optional int32 requesting_uid = 1;
3909
3910    // Package name of application requesting the role
3911    optional string requesting_package_name = 2;
3912
3913    // The role to be granted
3914    optional string role_name = 3;
3915
3916    // The count of applications qualifying for the role
3917    optional int32 qualifying_count = 4;
3918
3919    // UID of application current granted the role
3920    optional int32 current_uid = 5;
3921
3922    // Package name of application current granted the role
3923    optional string current_package_name = 6;
3924
3925    // UID of another application that user chose to grant the role to, instead of the requesting
3926    // application
3927    optional int32 granted_another_uid = 7;
3928
3929    // Package name of another application that user chose to grant the role to, instead of the
3930    // requesting application
3931    optional string granted_another_package_name = 8;
3932
3933    enum Result {
3934        UNDEFINED = 0;
3935        // role request was ignored
3936        IGNORED = 1;
3937        // role request was ignored because it's already granted
3938        IGNORED_ALREADY_GRANTED = 2;
3939        // role request was ignored because the application isn't qualified
3940        IGNORED_NOT_QUALIFIED = 3;
3941        // role request was ignored because user said it should be always denied
3942        IGNORED_USER_ALWAYS_DENIED = 4;
3943        // role was granted by user action
3944        USER_GRANTED = 5;
3945        // role was denied by user action
3946        USER_DENIED = 6;
3947        // role was denied by user granting another application the role
3948        USER_DENIED_GRANTED_ANOTHER = 7;
3949        // role was denied and set to be always denied by the user
3950        USER_DENIED_WITH_ALWAYS = 8;
3951    }
3952    // The result of the role request
3953    optional Result result = 9;
3954}
3955
3956/**
3957 * Logs when a Vehicle Maps Service client's connection state has changed
3958 *
3959 * Logged from:
3960 *   packages/services/Car/service/src/com/android/car/stats/VmsClientLog.java
3961 */
3962message VmsClientConnectionStateChanged {
3963    // The UID of the VMS client app
3964    optional int32 uid = 1 [(is_uid) = true];
3965
3966    enum State {
3967        UNKNOWN = 0;
3968        // Attempting to connect to the client
3969        CONNECTING = 1;
3970        // Client connection established
3971        CONNECTED = 2;
3972        // Client connection closed unexpectedly
3973        DISCONNECTED = 3;
3974        // Client connection closed by VMS
3975        TERMINATED = 4;
3976        // Error establishing the client connection
3977        CONNECTION_ERROR = 5;
3978    }
3979
3980    optional State state  = 2;
3981}
3982
3983/**
3984 * Represents boot time event with duration in ms.
3985 *
3986 * Logged from: bootstat and various system server components. Check each enums for details.
3987 */
3988message BootTimeEventDuration {
3989    enum DurationEvent {
3990        UNKNOWN = 0;
3991        // Bootloader time excluding BOOTLOADER_UI_WAIT + boot complete time. Logged from bootstat.
3992        ABSOLUTE_BOOT_TIME = 1;
3993        // Bootloader's 1st stage execution time.
3994        // Logged from bootstat.
3995        BOOTLOADER_FIRST_STAGE_EXEC = 2;
3996        // Bootloader's 1st stage loading time.
3997        // Logged from bootstat.
3998        BOOTLOADER_FIRST_STAGE_LOAD = 3;
3999        // Bootloader's kernel loading time.
4000        // Logged from bootstat.
4001        BOOTLOADER_KERNEL_LOAD = 4;
4002        // Bootloader's 2nd stage execution time.
4003        // Logged from bootstat.
4004        BOOTLOADER_SECOND_STAGE_EXEC = 5;
4005        // Bootloader's 2nd stage loading time.
4006        // Logged from bootstat.
4007        BOOTLOADER_SECOND_STAGE_LOAD = 6;
4008        // Duration for Bootloader to show unlocked device's warning UI. This should not happen
4009        // for locked device.
4010        // Logged from bootstat.
4011        BOOTLOADER_UI_WAIT = 7;
4012        // Total time spend in bootloader. This is the sum of all BOOTLOADER_* listed above.
4013        // Logged from bootstat.
4014        BOOTLOADER_TOTAL = 8;
4015        // Shutdown duration inside init for the reboot before the current boot up.
4016        // Logged from f/b/services/.../BootReceiver.java.
4017        SHUTDOWN_DURATION = 9;
4018        // Total time for mounting of disk devices during bootup.
4019        // Logged from f/b/services/.../BootReceiver.java.
4020        MOUNT_DEFAULT_DURATION = 10;
4021        // Total time for early stage mounting of disk devices during bootup.
4022        // Logged from f/b/services/.../BootReceiver.java.
4023        MOUNT_EARLY_DURATION = 11;
4024        // Total time for late stage mounting of disk devices during bootup.
4025        // Logged from f/b/services/.../BootReceiver.java.
4026        MOUNT_LATE_DURATION = 12;
4027        // Average time to scan non-system app after OTA
4028        // Logged from f/b/services/.../PackageManagerService.java
4029        OTA_PACKAGE_MANAGER_INIT_TIME = 13;
4030        // Time to initialize Package manager after OTA
4031        // Logged from f/b/services/.../PackageManagerService.java
4032        OTA_PACKAGE_MANAGER_DATA_APP_AVG_SCAN_TIME = 14;
4033        // Time to scan all system app from Package manager after OTA
4034        // Logged from f/b/services/.../PackageManagerService.java
4035        OTA_PACKAGE_MANAGER_SYSTEM_APP_AVG_SCAN_TIME = 15;
4036        // Init's total time for cold boot stage.
4037        // Logged from bootstat.
4038        COLDBOOT_WAIT = 16;
4039        // Init's total time for initializing selinux.
4040        // Logged from bootstat.
4041        SELINUX_INIT = 17;
4042        // Time since last factory reset.
4043        // Logged from bootstat.
4044        FACTORY_RESET_TIME_SINCE_RESET = 18;
4045        // Init's total time spent for completing the 1st stage.
4046        // Logged from bootstat.
4047        ANDROID_INIT_STAGE_1 = 19;
4048    }
4049
4050    // Type of the event.
4051    optional DurationEvent event = 1;
4052    // Duration of the event in ms.
4053    optional int64 duration_millis = 2;
4054}
4055
4056/**
4057 * Represents the start of specific boot time event during bootup in ms. This is usually a time
4058 * since boot-up.
4059 *
4060 * Logged from: bootstat and various system server components. Check each enums for details.
4061 */
4062message BootTimeEventElapsedTime {
4063    enum ElapsedTimeEvent {
4064        UNKNOWN = 0;
4065        // Time when init starts 1st stage. Logged from bootstat.
4066        ANDROID_INIT_STAGE_1 = 1;
4067        // Time when sys.boot_completed prop is set.
4068        // Logged from bootstat.
4069        BOOT_COMPLETE = 2;
4070        // BOOT_COMPLETE for encrypted device.
4071        BOOT_COMPLETE_ENCRYPTION = 3;
4072        // BOOT_COMPLETE for device with no encryption.
4073        BOOT_COMPLETE_NO_ENCRYPTION = 4;
4074        // Adjusted BOOT_COMPLETE for encrypted device extracting decryption time.
4075        BOOT_COMPLETE_POST_DECRYPT = 5;
4076        // BOOT_COMPLETE after factory reset.
4077        FACTORY_RESET_BOOT_COMPLETE = 6;
4078        // BOOT_COMPLETE_NO_ENCRYPTION after factory reset.
4079        FACTORY_RESET_BOOT_COMPLETE_NO_ENCRYPTION = 7;
4080        // BOOT_COMPLETE_POST_DECRYPT after factory reset.
4081        FACTORY_RESET_BOOT_COMPLETE_POST_DECRYPT = 8;
4082        // BOOT_COMPLETE after OTA.
4083        OTA_BOOT_COMPLETE = 9;
4084        // BOOT_COMPLETE_NO_ENCRYPTION after OTA.
4085        OTA_BOOT_COMPLETE_NO_ENCRYPTION = 10;
4086        // BOOT_COMPLETE_POST_DECRYPT after OTA.
4087        OTA_BOOT_COMPLETE_POST_DECRYPT = 11;
4088        // Time when the system starts sending LOCKED_BOOT_COMPLETED broadcast.
4089        // Logged from  f/b/services/.../UserController.java
4090        FRAMEWORK_LOCKED_BOOT_COMPLETED = 12;
4091        // Time when the system starts sending BOOT_COMPLETED broadcast.
4092        // Logged from  f/b/services/.../UserController.java
4093        FRAMEWORK_BOOT_COMPLETED = 13;
4094        // Time when the package manager starts init.
4095        // Logged from f/b/services/.../SystemServer.java
4096        PACKAGE_MANAGER_INIT_START = 14;
4097        // Time when package manager is ready
4098        // Logged from f/b/services/.../SystemServer.java
4099        PACKAGE_MANAGER_INIT_READY = 15;
4100        // Represents the time when user has entered unlock credential for system with user pin.
4101        // Logged from bootstat.
4102        POST_DECRYPT = 16;
4103        // Represents the start of zygote's init.
4104        // Logged from zygote itself.
4105        ZYGOTE_INIT_START = 17;
4106        // Represents the start of secondary zygote's init.
4107        // TODO: add logging to zygote
4108        SECONDARY_ZYGOTE_INIT_START = 18;
4109        // Represents the start of system server's init.
4110        // Logged from f/b/services/.../SystemServer.java
4111        SYSTEM_SERVER_INIT_START = 19;
4112        // Represents the completion of system server's init.
4113        // Logged from f/b/services/.../SystemServer.java
4114        SYSTEM_SERVER_READY = 20;
4115        // Represents the start of launcher during boot-up.
4116        // TODO: add logging
4117        LAUNCHER_START = 21;
4118        // Represents the completion of launcher's initial rendering. User can use other apps from
4119        // launcher from this point.
4120        // TODO: add logging
4121        LAUNCHER_SHOWN = 22;
4122    }
4123
4124    // Type of the event.
4125    optional ElapsedTimeEvent event = 1;
4126    // Time since bootup for the event.
4127    // It should be acquired from SystemClock elapsedRealtime() call or equivalent.
4128    optional int64 time_millis = 2;
4129}
4130
4131/**
4132 * Boot time events with UTC time.
4133 *
4134 * Logged from: bootstat and various system server components. Check each enums for details.
4135 */
4136message BootTimeEventUtcTime {
4137    enum UtcTimeEvent {
4138        UNKNOWN = 0;
4139        // Time of the bootstat's marking of 1st boot after the last factory reset.
4140        // Logged from bootstat.
4141        FACTORY_RESET_RESET_TIME = 1;
4142        // The time when bootstat records FACTORY_RESET_* events. This is close to
4143        // BOOT_COMPLETE time for the current bootup.
4144        // Logged from bootstat.
4145        FACTORY_RESET_CURRENT_TIME = 2;
4146        // DUplicate of FACTORY_RESET_RESET_TIME added for debugging purpose.
4147        // Logged from bootstat.
4148        FACTORY_RESET_RECORD_VALUE = 3;
4149    }
4150
4151    // Type of the event.
4152    optional UtcTimeEvent event = 1;
4153    // UTC time for the event.
4154    optional int64 utc_time_secs = 2;
4155}
4156
4157/**
4158 * Boot time events representing specific error code during bootup.
4159 * Meaning of error code can be different per each event type.
4160 *
4161 * Logged from: bootstat and various system server components. Check each enums for details.
4162 */
4163message BootTimeEventErrorCode {
4164    enum ErrorCodeEvent {
4165        UNKNOWN = 0;
4166        // Linux error code for time() call to get the current UTC time.
4167        // Logged from bootstat.
4168        FACTORY_RESET_CURRENT_TIME_FAILURE = 1;
4169        // Represents UmountStat before the reboot for the current boot up. Error codes defined
4170        // as UMOUNT_STAT_* from init/reboot.cpp.
4171        // Logged from f/b/services/.../BootReceiver.java.
4172        SHUTDOWN_UMOUNT_STAT = 2;
4173        // Reprepsents fie system mounting error code of /data partition for the current boot.
4174        // Error codes defined as combination of FsStatFlags from system/core/fs_mgr/fs_mgr.cpp.
4175        // Logged from f/b/services/.../BootReceiver.java.
4176        FS_MGR_FS_STAT_DATA_PARTITION = 3;
4177    }
4178
4179    // Type of the event.
4180    optional ErrorCodeEvent event = 1;
4181    // error code defined per each event type.
4182    // For example, this can have a value of FsStatFlags.FS_STAT_FULL_MOUNT_FAILED for the event of
4183    // FS_MGR_FS_STAT.
4184    optional int32 error_code = 2;
4185}
4186
4187/**
4188 * Collects Virtual A/B statistics related to the use of dm-snapshot performed
4189 * after an OTA.
4190 *
4191 * Logged from:
4192 *  - system/core/fs_mgr/libsnapshot/snapshot.cpp
4193 *  - system/core/fs_mgr/libsnapshot/snapshotctl.cpp
4194 */
4195message SnapshotMergeReported {
4196    // Keep in sync with
4197    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
4198    enum UpdateState {
4199        // No update or merge is in progress.
4200        NONE = 0;
4201        // An update is applying; snapshots may already exist.
4202        INITIATED = 1;
4203        // An update is pending, but has not been successfully booted yet.
4204        UNVERIFIED = 2;
4205        // The kernel is merging in the background.
4206        MERGING = 3;
4207        // Post-merge cleanup steps could not be completed due to a transient
4208        // error, but the next reboot will finish any pending operations.
4209        MERGE_NEEDS_REBOOT = 4;
4210        // Merging is complete, and needs to be acknowledged.
4211        MERGE_COMPLETED = 5;
4212        // Merging failed due to an unrecoverable error.
4213        MERGE_FAILED = 6;
4214        // The update was implicitly cancelled, either by a rollback or a flash
4215        // operation via fastboot. This state can only be returned by WaitForMerge.
4216        CANCELLED = 7;
4217    };
4218
4219    // Status of the update after the merge attempts.
4220    optional UpdateState final_state = 1;
4221
4222    // Time to complete a merge operation in milliseconds.
4223    // A negative value corresponds to the case in which the merge operation
4224    // was interrupted and resumed (e.g. in case of a system reboot during the
4225    // merge).
4226    optional int64 duration_millis = 2;
4227
4228    // Number of reboots that occurred after issuing and before completing the
4229    // merge of all the snapshot devices.
4230    optional int32 intermediate_reboots = 3;
4231}
4232
4233//////////////////////////////////////////////////////////////////////
4234// Pulled atoms below this line //
4235//////////////////////////////////////////////////////////////////////
4236
4237/**
4238 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
4239 *
4240 * Pulled from:
4241 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
4242 */
4243message WifiBytesTransfer {
4244    optional int32 uid = 1 [(is_uid) = true];
4245
4246    optional int64 rx_bytes = 2;
4247
4248    optional int64 rx_packets = 3;
4249
4250    optional int64 tx_bytes = 4;
4251
4252    optional int64 tx_packets = 5;
4253}
4254
4255/**
4256 * Pulls bytes transferred via wifi (separated by foreground and background usage).
4257 *
4258 * Pulled from:
4259 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
4260 */
4261message WifiBytesTransferByFgBg {
4262    optional int32 uid = 1 [(is_uid) = true];
4263
4264    // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
4265    optional bool is_foreground = 2;
4266
4267    optional int64 rx_bytes = 3;
4268
4269    optional int64 rx_packets = 4;
4270
4271    optional int64 tx_bytes = 5;
4272
4273    optional int64 tx_packets = 6;
4274}
4275
4276/**
4277 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
4278 *
4279 * Pulled from:
4280 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
4281 */
4282message MobileBytesTransfer {
4283    optional int32 uid = 1 [(is_uid) = true];
4284
4285    optional int64 rx_bytes = 2;
4286
4287    optional int64 rx_packets = 3;
4288
4289    optional int64 tx_bytes = 4;
4290
4291    optional int64 tx_packets = 5;
4292}
4293
4294/**
4295 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
4296 *
4297 * Pulled from:
4298 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
4299 */
4300message MobileBytesTransferByFgBg {
4301    optional int32 uid = 1 [(is_uid) = true];
4302
4303    // 1 denotes foreground and 0 denotes background. This is called Set in
4304    // NetworkStats.
4305    optional bool is_foreground = 2;
4306
4307    optional int64 rx_bytes = 3;
4308
4309    optional int64 rx_packets = 4;
4310
4311    optional int64 tx_bytes = 5;
4312
4313    optional int64 tx_packets = 6;
4314}
4315
4316/**
4317 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
4318 *
4319 * Pulled from:
4320 *   StatsCompanionService
4321 */
4322message BluetoothBytesTransfer {
4323    optional int32 uid = 1 [(is_uid) = true];
4324
4325    optional int64 rx_bytes = 2;
4326
4327    optional int64 tx_bytes = 3;
4328}
4329
4330/**
4331 * Pulls the kernel wakelock durations. This atom is adapted from
4332 * android/internal/os/KernelWakelockStats.java
4333 *
4334 * Pulled from:
4335 *   StatsCompanionService using KernelWakelockReader.
4336 */
4337message KernelWakelock {
4338    optional string name = 1;
4339
4340    optional int32 count = 2;
4341
4342    optional int32 version = 3;
4343
4344    optional int64 time_micros = 4;
4345}
4346
4347/**
4348 * Pulls low power state information. If power.stats HAL is not available, this
4349 * includes platform and subsystem sleep state information,
4350 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
4351 * as defined in:
4352 *   hardware/interfaces/power/1.0/types.hal
4353 *   hardware/interfaces/power/1.1/types.hal
4354 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
4355 * as defined in:
4356 *   hardware/interfaces/power/stats/1.0/types.hal
4357 */
4358message SubsystemSleepState {
4359    // Subsystem name
4360    optional string subsystem_name = 1;
4361    // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
4362    // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
4363    // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
4364    //    powerEntityStateName from the corresponding PowerEntityStateInfo.
4365    optional string subname = 2;
4366    // The number of times it entered, or voted for entering the sleep state
4367    optional uint64 count = 3;
4368    // The length of time spent in, or spent voting for, the sleep state
4369    optional uint64 time_millis = 4;
4370}
4371
4372/**
4373 * Pulls on-device power measurement information.
4374 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
4375 * Pulled from:
4376 *   frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
4377 */
4378message OnDevicePowerMeasurement {
4379    // Name of the subsystem (to which the rail belongs).
4380    optional string subsystem_name = 1;
4381
4382    // Rail name. The rail lies within the subsystem.
4383    optional string rail_name = 2;
4384
4385    // Time (in ms since boot) at which the rail energy value was measured.
4386    // This may differ slightly from the time that statsd logs this information.
4387    optional uint64 measurement_timestamp_millis = 3;
4388
4389    // Accumulated energy used via the rail since device boot in uWs.
4390    optional uint64 energy_microwatt_secs = 4;
4391}
4392
4393/**
4394 * Pulls Cpu time per frequency.
4395 * Pulls the time the cpu spend on the frequency index. Frequency index
4396 * starts from highest to lowest. The value should be monotonically
4397 * increasing since boot. However, if there is a cpu
4398 * hotplug event, the value would be reset as well.
4399 */
4400message CpuTimePerFreq {
4401    optional uint32 cluster = 1;
4402    optional uint32 freq_index = 2;
4403    optional uint64 time_millis = 3;
4404}
4405
4406/**
4407 * Pulls Cpu Time Per Uid.
4408 * Note that isolated process uid time should be attributed to host uids.
4409 */
4410message CpuTimePerUid {
4411    optional int32 uid = 1 [(is_uid) = true];
4412    optional uint64 user_time_micros = 2;
4413    optional uint64 sys_time_micros = 3;
4414}
4415
4416/**
4417 * Pulls Cpu Time Per Uid per frequency.
4418 * Note that isolated process uid time should be attributed to host uids.
4419 * For each uid, we order the time by descending frequencies.
4420 */
4421message CpuTimePerUidFreq {
4422    optional int32 uid = 1 [(is_uid) = true];
4423    optional uint32 freq_index = 2;
4424    optional uint64 time_millis = 3;
4425}
4426
4427/**
4428 * Pulls Wifi Controller Activity Energy Info
4429 */
4430message WifiActivityInfo {
4431    // timestamp(wall clock) of record creation
4432    optional uint64 timestamp_millis = 1;
4433    // stack reported state
4434    // TODO: replace this with proto enum
4435    optional int32 stack_state = 2;
4436    // tx time in millis
4437    optional uint64 controller_tx_time_millis = 3;
4438    // rx time in millis
4439    optional uint64 controller_rx_time_millis = 4;
4440    // idle time in millis
4441    optional uint64 controller_idle_time_millis = 5;
4442    // product of current(mA), voltage(V) and time(ms)
4443    optional uint64 controller_energy_used = 6;
4444}
4445
4446/**
4447 * Pulls Modem Activity Energy Info
4448 */
4449message ModemActivityInfo {
4450    // timestamp(wall clock) of record creation
4451    optional uint64 timestamp_millis = 1;
4452    // sleep time in millis.
4453    optional uint64 sleep_time_millis = 2;
4454    // idle time in millis
4455    optional uint64 controller_idle_time_millis = 3;
4456    /**
4457     * Tx power index
4458     * index 0 = tx_power < 0dBm
4459     * index 1 = 0dBm < tx_power < 5dBm
4460     * index 2 = 5dBm < tx_power < 15dBm
4461     * index 3 = 15dBm < tx_power < 20dBm
4462     * index 4 = tx_power > 20dBm
4463     */
4464    // tx time in ms at power level 0
4465    optional uint64 controller_tx_time_pl0_millis = 4;
4466    // tx time in ms at power level 1
4467    optional uint64 controller_tx_time_pl1_millis = 5;
4468    // tx time in ms at power level 2
4469    optional uint64 controller_tx_time_pl2_millis = 6;
4470    // tx time in ms at power level 3
4471    optional uint64 controller_tx_time_pl3_millis = 7;
4472    // tx time in ms at power level 4
4473    optional uint64 controller_tx_time_pl4_millis = 8;
4474    // rx time in ms at power level 5
4475    optional uint64 controller_rx_time_millis = 9;
4476    // product of current(mA), voltage(V) and time(ms)
4477    optional uint64 energy_used = 10 [deprecated=true];
4478}
4479
4480/**
4481 * Pulls Bluetooth Activity Energy Info
4482 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
4483 */
4484message BluetoothActivityInfo {
4485    // timestamp(wall clock) of record creation
4486    optional uint64 timestamp_millis = 1;
4487    // bluetooth stack state
4488    optional int32 bluetooth_stack_state = 2;
4489    // tx time in millis
4490    optional uint64 controller_tx_time_millis = 3;
4491    // rx time in millis
4492    optional uint64 controller_rx_time_millis = 4;
4493    // idle time in millis
4494    optional uint64 controller_idle_time_millis = 5;
4495    // product of current(mA), voltage(V) and time(ms)
4496    optional uint64 energy_used = 6;
4497}
4498
4499/*
4500 * Logs the memory stats for a process.
4501 *
4502 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
4503 */
4504message ProcessMemoryState {
4505    // The uid if available. -1 means not available.
4506    optional int32 uid = 1 [(is_uid) = true];
4507
4508    // The process name.
4509    // Usually package name, "system" for system server.
4510    // Provided by ActivityManagerService.
4511    optional string process_name = 2;
4512
4513    // Current OOM score adjustment. Value read from ProcessRecord.
4514    optional int32 oom_adj_score = 3;
4515
4516    // # of page-faults
4517    optional int64 page_fault = 4;
4518
4519    // # of major page-faults
4520    optional int64 page_major_fault = 5;
4521
4522    // RSS
4523    // Value is read from /proc/PID/status. Or from memory.stat, field
4524    // total_rss if per-app memory cgroups are enabled.
4525    optional int64 rss_in_bytes = 6;
4526
4527    // CACHE
4528    // Value is read from memory.stat, field total_cache if per-app memory
4529    // cgroups are enabled. Otherwise, 0.
4530    optional int64 cache_in_bytes = 7;
4531
4532    // SWAP
4533    // Value is read from memory.stat, field total_swap if per-app memory
4534    // cgroups are enabled. Otherwise, VmSwap from /proc/PID/status.
4535    optional int64 swap_in_bytes = 8;
4536
4537    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
4538    optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
4539
4540    // Elapsed real time when the process started.
4541    // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
4542    optional int64 start_time_nanos = 10;
4543
4544    // Anonymous page size plus swap size. Values are read from /proc/PID/status.
4545    optional int32 anon_rss_and_swap_in_kilobytes = 11;
4546}
4547
4548/*
4549 * Logs the memory stats for a native process (from procfs).
4550 *
4551 * Pulled from StatsCompanionService for selected native processes.
4552 */
4553message NativeProcessMemoryState {
4554    // The uid if available. -1 means not available.
4555    optional int32 uid = 1 [(is_uid) = true];
4556
4557    // The process name.
4558    // Value read from /proc/PID/cmdline.
4559    optional string process_name = 2;
4560
4561    // # of page-faults
4562    optional int64 page_fault = 3;
4563
4564    // # of major page-faults
4565    optional int64 page_major_fault = 4;
4566
4567    // RSS
4568    // Value read from /proc/PID/status.
4569    optional int64 rss_in_bytes = 5;
4570
4571    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
4572    optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
4573
4574    // Elapsed real time when the process started.
4575    // Value is read from /proc/PID/stat, field 22.
4576    optional int64 start_time_nanos = 7;
4577
4578    // SWAP
4579    // Value read from /proc/PID/status, field VmSwap.
4580    optional int64 swap_in_bytes = 8;
4581
4582    // Anonymous page size plus swap size. Values are read from /proc/PID/status.
4583    optional int32 anon_rss_and_swap_in_kilobytes = 9;
4584}
4585
4586/*
4587 * Logs the memory high-water mark for a process.
4588 *
4589 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
4590 * and for selected native processes.
4591 *
4592 * Pulling this atom resets high-water mark counters for all processes.
4593 */
4594message ProcessMemoryHighWaterMark {
4595    // The uid if available. -1 means not available.
4596    optional int32 uid = 1 [(is_uid) = true];
4597
4598    // The process name.
4599    // Usually package name or process cmdline.
4600    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
4601    optional string process_name = 2;
4602
4603    // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
4604    // /proc/PID/status.
4605    optional int64 rss_high_water_mark_in_bytes = 3;
4606}
4607
4608/*
4609 * Elapsed real time from SystemClock.
4610 */
4611message SystemElapsedRealtime {
4612    optional uint64 time_millis = 1;
4613}
4614
4615/*
4616 * Up time from SystemClock.
4617 */
4618message SystemUptime {
4619    // Milliseconds since the system was booted.
4620    // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
4621    // for external input).
4622    // It is not affected by clock scaling, idle, or other power saving mechanisms.
4623    optional uint64 uptime_millis = 1;
4624}
4625
4626/*
4627 * Reads from /proc/uid_concurrent_active_time which has the format:
4628 * active: X (X is # cores)
4629 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
4630 * [uid1]: [time-0] [time-1] [time-2] ... ...
4631 * ...
4632 * Time-N means the CPU time a UID spent running concurrently with N other processes.
4633 * The file contains a monotonically increasing count of time for a single boot.
4634 */
4635message CpuActiveTime {
4636    optional int32 uid = 1 [(is_uid) = true];
4637    optional uint64 time_millis = 2;
4638}
4639
4640/**
4641 * Reads from /proc/uid_concurrent_policy_time which has the format:
4642 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
4643 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
4644 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
4645 * ...
4646 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
4647 * The file contains a monotonically increasing count of time for a single boot.
4648 */
4649message CpuClusterTime {
4650    optional int32 uid = 1 [(is_uid) = true];
4651    optional int32 cluster_index = 2;
4652    optional uint64 time_millis = 3;
4653}
4654
4655/*
4656 * Pulls free disk space, for data, system partition and temporary directory.
4657 */
4658message DiskSpace {
4659    // available bytes in data partition
4660    optional uint64 data_available_bytes = 1;
4661    // available bytes in system partition
4662    optional uint64 system_available_bytes = 2;
4663    // available bytes in download cache or temp directories
4664    optional uint64 temp_available_bytes = 3;
4665}
4666
4667/**
4668 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
4669 *
4670 * Pulled from StatsCompanionService.java
4671 */
4672message RemainingBatteryCapacity {
4673    optional int32 charge_micro_ampere_hour = 1;
4674}
4675
4676/**
4677 * Pulls battery capacity, which is the battery capacity when full in uAh.
4678 * Pulled from:
4679 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
4680 */
4681message FullBatteryCapacity {
4682    optional int32 capacity_micro_ampere_hour = 1;
4683}
4684
4685/**
4686 * Pulls battery voltage.
4687 * Pulled from:
4688 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
4689 */
4690message BatteryVoltage {
4691    // The voltage of the battery, in millivolts.
4692    optional int32 voltage_millivolt = 1;
4693}
4694
4695/**
4696 * Pulls battery level (percent full, from 0 to 100).
4697 *
4698 * Pulled from:
4699 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
4700 */
4701message BatteryLevel {
4702    // Battery level. Should be in [0, 100].
4703    optional int32 battery_level = 1;
4704}
4705
4706/**
4707 * Pulls the temperature of various parts of the device.
4708 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
4709 *
4710 * Pulled from StatsCompanionService.java
4711 */
4712message Temperature {
4713    // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
4714    optional android.os.TemperatureTypeEnum sensor_location = 1;
4715
4716    // The name of the temperature source. Eg. CPU0
4717    optional string sensor_name = 2;
4718
4719    // Temperature in tenths of a degree C.
4720    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
4721    optional int32 temperature_deci_celsius = 3;
4722
4723    // Relative severity of the throttling, see enum definition.
4724    optional android.os.ThrottlingSeverityEnum severity = 4;
4725}
4726
4727/**
4728 * Pulls the statistics of calls to Binder.
4729 *
4730 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
4731 * config on the device.
4732 *
4733 * Next tag: 15
4734 */
4735message BinderCalls {
4736    // UID of the process responsible for the binder transaction. It will be set if the process
4737    // executing the binder transaction attribute the transaction to another uid using
4738    // Binder.setThreadWorkSource().
4739    //
4740    // If not set, the value will be -1.
4741    optional int32 uid = 1 [(is_uid) = true];
4742    // UID of the process executing the binder transaction.
4743    optional int32 direct_caller_uid = 14;
4744    // Fully qualified class name of the API call.
4745    //
4746    // This is a system server class name.
4747    //
4748    // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
4749    // gets recycled and we have isolated uids, we might attribute the data incorrectly.
4750    // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
4751    // commonly used APIs.
4752    optional string service_class_name = 2;
4753    // Method name of the API call. It can also be a transaction code if we cannot
4754    // resolve it to a name. See Binder#getTransactionName.
4755    //
4756    // This is a system server method name.
4757    optional string service_method_name = 3;
4758    // Total number of API calls.
4759    optional int64 call_count = 4;
4760    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
4761    optional bool screen_interactive = 13;
4762    // Total number of API calls we have data recorded for. If we collected data for all the calls,
4763    // call_count will be equal to recorded_call_count.
4764    //
4765    // If recorded_call_count is different than call_count, it means data collection has been
4766    // sampled. All the fields below will be sampled in this case.
4767    optional int64 recorded_call_count = 12;
4768    // Number of exceptions thrown by the API.
4769    optional int64 recorded_exception_count = 5;
4770    // Total latency of all API calls.
4771    // Average can be computed using total_latency_micros / recorded_call_count.
4772    optional int64 recorded_total_latency_micros = 6;
4773    // Maximum latency of one API call.
4774    optional int64 recorded_max_latency_micros = 7;
4775    // Total CPU usage of all API calls.
4776    // Average can be computed using total_cpu_micros / recorded_call_count.
4777    // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
4778    optional int64 recorded_total_cpu_micros = 8;
4779    // Maximum CPU usage of one API call.
4780    optional int64 recorded_max_cpu_micros = 9;
4781    // Maximum parcel reply size of one API call.
4782    optional int64 recorded_max_reply_size_bytes = 10;
4783    // Maximum parcel request size of one API call.
4784    optional int64 recorded_max_request_size_bytes = 11;
4785}
4786
4787/**
4788 * Pulls the statistics of exceptions during calls to Binder.
4789 *
4790 * Binder stats are cumulative from boot unless somebody reset the data using
4791 * > adb shell dumpsys binder_calls_stats --reset
4792 */
4793message BinderCallsExceptions {
4794    // Exception class name, e.g. java.lang.IllegalArgumentException.
4795    //
4796    // This is an exception class name thrown by the system server.
4797    optional string exception_class_name = 1;
4798    // Total number of exceptions.
4799    optional int64 exception_count = 2;
4800}
4801
4802/**
4803 * Pulls the statistics of message dispatching on HandlerThreads.
4804 *
4805 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
4806 * config on the device.
4807 *
4808 * Next tag: 11
4809 */
4810message LooperStats {
4811    // The uid that made a call to the System Server and caused the message to be enqueued.
4812    optional int32 uid = 1 [(is_uid) = true];
4813
4814    // Fully qualified class name of the handler target class.
4815    //
4816    // This field does not contain PII. This is a system server class name.
4817    optional string handler_class_name = 2;
4818
4819    // The name of the thread that runs the Looper.
4820    //
4821    // This field does not contain PII. This is a system server thread name.
4822    optional string looper_thread_name = 3;
4823
4824    // The name of the dispatched message.
4825    //
4826    // This field does not contain PII. This is a system server constant or class
4827    // name.
4828    optional string message_name = 4;
4829
4830    // Total number of successfully dispatched messages.
4831    optional int64 message_count = 5;
4832
4833    // Total number of messages that failed dispatching.
4834    optional int64 exception_count = 6;
4835
4836    // Total number of processed messages we have data recorded for. If we
4837    // collected data for all the messages, message_count will be equal to
4838    // recorded_message_count.
4839    //
4840    // If recorded_message_count is different than message_count, it means data
4841    // collection has been sampled. The fields below will be sampled in this case.
4842    optional int64 recorded_message_count = 7;
4843
4844    // Total latency of all processed messages.
4845    // Average can be computed using recorded_total_latency_micros /
4846    // recorded_message_count.
4847    optional int64 recorded_total_latency_micros = 8;
4848
4849    // Total CPU usage of all processed message.
4850    // Average can be computed using recorded_total_cpu_micros /
4851    // recorded_message_count. Total can be computed using
4852    // recorded_total_cpu_micros / recorded_message_count * message_count.
4853    optional int64 recorded_total_cpu_micros = 9;
4854
4855    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
4856    optional bool screen_interactive = 10;
4857
4858    // Max recorded CPU usage of all processed messages.
4859    optional int64 recorded_max_cpu_micros = 11;
4860
4861    // Max recorded latency of all processed messages.
4862    optional int64 recorded_max_latency_micros = 12;
4863
4864    // Total number of messages we tracked the dispatching delay for. If we
4865    // collected data for all the messages, message_count will be equal to
4866    // recorded_delay_message_count.
4867    //
4868    // If recorded_delay_message_count is different than message_count, it means data
4869    // collection has been sampled or/and not all messages specified the target dispatch time.
4870    // The fields below will be sampled in this case.
4871    optional int64 recorded_delay_message_count = 13;
4872
4873    // Total dispatching delay of all processed messages.
4874    // Calculated as a difference between the target dispatching time (Message.when)
4875    // and the actual dispatching time.
4876    // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
4877    optional int64 recorded_total_delay_millis = 14;
4878
4879    // Max dispatching delay of all processed messages.
4880    // Calculated as a difference between the target dispatching time (Message.when)
4881    // and the actual dispatching time.
4882    optional int64 recorded_max_delay_millis = 15;
4883}
4884
4885/**
4886 * Pulls disk information, such as write speed and latency.
4887 */
4888message DiskStats {
4889    // Time taken to open, write 512B to, and close a file.
4890    // -1 if error performing the check.
4891    optional int64 data_write_latency_millis = 1;
4892
4893    optional bool file_based_encryption = 2;
4894
4895    // Recent disk write speed in kB/s.
4896    // -1 if error querying storageed.
4897    // 0 if data is unavailable.
4898    optional int32 recent_disk_write_speed = 3;
4899}
4900
4901
4902/**
4903 * Free and total bytes of the Data, Cache, and System partition.
4904 */
4905message DirectoryUsage {
4906    enum Directory {
4907        UNKNOWN = 0;
4908        DATA = 1;
4909        CACHE = 2;
4910        SYSTEM = 3;
4911    }
4912    optional Directory directory = 1;
4913    optional int64 free_bytes = 2;
4914    optional int64 total_bytes = 3;
4915}
4916
4917
4918/**
4919 * Size of an application: apk size, data size, and cache size.
4920 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
4921 * Information is only reported for apps with the primary user (user 0).
4922 * Sizes are aggregated by package name.
4923 */
4924message AppSize {
4925    // Including uids will involve modifying diskstats logic.
4926    optional string package_name = 1;
4927    // App size in bytes. -1 if unavailable.
4928    optional int64 app_size_bytes = 2;
4929    // App data size in bytes. -1 if unavailable.
4930    optional int64 app_data_size_bytes = 3;
4931    // App cache size in bytes. -1 if unavailable.
4932    optional int64 app_cache_size_bytes = 4;
4933    // Time that the cache file was produced.
4934    // Uses System.currentTimeMillis(), which is wall clock time.
4935    optional int64 cache_time_millis = 5;
4936}
4937
4938
4939/**
4940 * Size of a particular category. Eg: photos, videos.
4941 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
4942 */
4943message CategorySize {
4944    enum Category {
4945        UNKNOWN = 0;
4946        APP_SIZE = 1;
4947        APP_DATA_SIZE = 2;
4948        APP_CACHE_SIZE = 3;
4949        PHOTOS = 4;
4950        VIDEOS = 5;
4951        AUDIO = 6;
4952        DOWNLOADS = 7;
4953        SYSTEM = 8;
4954        OTHER = 9;
4955    }
4956    optional Category category = 1;
4957    // Category size in bytes.
4958    optional int64 size_bytes = 2;
4959    // Time that the cache file was produced.
4960    // Uses System.currentTimeMillis(), which is wall clock time.
4961    optional int64 cache_time_millis = 3;
4962}
4963
4964/**
4965 * Pulls per uid I/O stats. The stats are cumulative since boot.
4966 *
4967 * Read/write bytes are I/O events from a storage device
4968 * Read/write chars are data requested by read/write syscalls, and can be
4969 *   satisfied by caching.
4970 *
4971 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
4972 */
4973message DiskIo {
4974    optional int32 uid = 1 [(is_uid) = true];
4975    optional int64 fg_chars_read = 2;
4976    optional int64 fg_chars_write = 3;
4977    optional int64 fg_bytes_read = 4;
4978    optional int64 fg_bytes_write = 5;
4979    optional int64 bg_chars_read = 6;
4980    optional int64 bg_chars_write = 7;
4981    optional int64 bg_bytes_read = 8;
4982    optional int64 bg_bytes_write = 9;
4983    optional int64 fg_fsync = 10;
4984    optional int64 bg_fsync= 11;
4985}
4986
4987
4988/**
4989 * Pulls the number of fingerprints for each user.
4990 *
4991 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
4992 */
4993message NumFingerprintsEnrolled {
4994    // The associated user. Eg: 0 for owners, 10+ for others.
4995    // Defined in android/os/UserHandle.java
4996    optional int32 user = 1;
4997    // Number of fingerprints registered to that user.
4998    optional int32 num_fingerprints_enrolled = 2;
4999}
5000
5001/**
5002 * Pulls the number of faces for each user.
5003 *
5004 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
5005 */
5006message NumFacesEnrolled {
5007    // The associated user. Eg: 0 for owners, 10+ for others.
5008    // Defined in android/os/UserHandle.java
5009    optional int32 user = 1;
5010    // Number of faces registered to that user.
5011    optional int32 num_faces_enrolled = 2;
5012}
5013/**
5014 * A mapping of role holder -> role
5015 */
5016message RoleHolder {
5017    // uid of the role holder
5018    optional int32 uid = 1 [(is_uid) = true];
5019
5020    // package name of the role holder
5021    optional string package_name = 2;
5022
5023    // the role held
5024    optional string role = 3;
5025}
5026
5027message AggStats {
5028    optional int64 min = 1;
5029
5030    optional int64 average = 2;
5031
5032    optional int64 max = 3;
5033}
5034
5035message ProcessStatsStateProto {
5036    optional android.service.procstats.ScreenState screen_state = 1;
5037
5038    optional android.service.procstats.MemoryState memory_state = 2;
5039
5040    // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
5041    // and not frameworks/base/core/java/android/app/ActivityManager.java
5042    optional android.service.procstats.ProcessState process_state = 3;
5043
5044    // Millisecond uptime duration spent in this state
5045    optional int64 duration_millis = 4;
5046
5047    // Millisecond elapsed realtime duration spent in this state
5048    optional int64 realtime_duration_millis = 9;
5049
5050    // # of samples taken
5051    optional int32 sample_size = 5;
5052
5053    // PSS is memory reserved for this process
5054    optional AggStats pss = 6;
5055
5056    // USS is memory shared between processes, divided evenly for accounting
5057    optional AggStats uss = 7;
5058
5059    // RSS is memory resident for this process
5060    optional AggStats rss = 8;
5061}
5062
5063// Next Tag: 7
5064message ProcessStatsProto {
5065    // Name of process.
5066    optional string process = 1;
5067
5068    // Uid of the process.
5069    optional int32 uid = 2;
5070
5071    // Information about how often kills occurred
5072    message Kill {
5073        // Count of excessive CPU kills
5074        optional int32 cpu = 1;
5075
5076        // Count of kills when cached
5077        optional int32 cached = 2;
5078
5079        // PSS stats during cached kill
5080        optional AggStats cached_pss = 3;
5081    }
5082    optional Kill kill = 3;
5083
5084    // Time and memory spent in various states.
5085    repeated ProcessStatsStateProto states = 5;
5086
5087    // Total time process has been running...  screen_state, memory_state, and process_state
5088    // will not be set.
5089    optional ProcessStatsStateProto total_running_state = 6;
5090}
5091
5092message PackageServiceOperationStatsProto {
5093    // Operate enum: Started, Foreground, Bound, Executing
5094    optional android.service.procstats.ServiceOperationState operation = 1;
5095
5096    // Number of times the service was in this operation.
5097    optional int32 count = 2;
5098
5099    // Information about a state the service can be in.
5100    message StateStats {
5101        // Screen state enum.
5102        optional android.service.procstats.ScreenState screen_state = 1;
5103        // Memory state enum.
5104        optional android.service.procstats.MemoryState memory_state = 2;
5105
5106        // duration in milliseconds.
5107        optional int64 duration_millis = 3;
5108        // Millisecond elapsed realtime duration spent in this state
5109        optional int64 realtime_duration_millis = 4;
5110    }
5111    repeated StateStats state_stats = 3;
5112}
5113
5114message PackageServiceStatsProto {
5115    // Name of service component.
5116    optional string service_name = 1;
5117
5118    // The operation stats.
5119    // The package_name, package_uid, package_version, service_name will not be set to save space.
5120    repeated PackageServiceOperationStatsProto operation_stats = 2;
5121}
5122
5123message PackageAssociationSourceProcessStatsProto {
5124    // Uid of the process.
5125    optional int32 process_uid = 1;
5126    // Process name.
5127    optional string process_name = 2;
5128    // Package name.
5129    optional string package_name = 7;
5130    // Total count of the times this association appeared.
5131    optional int32 total_count = 3;
5132
5133    // Millisecond uptime total duration this association was around.
5134    optional int64 total_duration_millis = 4;
5135
5136    // Total count of the times this association became actively impacting its target process.
5137    optional int32 active_count = 5;
5138
5139    // Information on one source in this association.
5140    message StateStats {
5141        // Process state enum.
5142        optional android.service.procstats.ProcessState process_state = 1;
5143        // Millisecond uptime duration spent in this state
5144        optional int64 duration_millis = 2;
5145        // Millisecond elapsed realtime duration spent in this state
5146        optional int64 realtime_duration_mmillis = 3;
5147    }
5148    repeated StateStats active_state_stats = 6;
5149}
5150
5151message PackageAssociationProcessStatsProto {
5152    // Name of the target component.
5153    optional string component_name = 1;
5154    // Information on one source in this association.
5155    repeated PackageAssociationSourceProcessStatsProto sources = 2;
5156}
5157
5158
5159message ProcessStatsPackageProto {
5160    // Name of package.
5161    optional string package = 1;
5162
5163    // Uid of the package.
5164    optional int32 uid = 2;
5165
5166    // Version of the package.
5167    optional int64 version = 3;
5168
5169    // Stats for each process running with the package loaded in to it.
5170    repeated ProcessStatsProto process_stats = 4;
5171
5172    // Stats for each of the package's services.
5173    repeated PackageServiceStatsProto service_stats = 5;
5174
5175    // Stats for each association with the package.
5176    repeated PackageAssociationProcessStatsProto association_stats = 6;
5177}
5178
5179message ProcessStatsSectionProto {
5180    // Elapsed realtime at start of report.
5181    optional int64 start_realtime_millis = 1;
5182
5183    // Elapsed realtime at end of report.
5184    optional int64 end_realtime_millis = 2;
5185
5186    // CPU uptime at start of report.
5187    optional int64 start_uptime_millis = 3;
5188
5189    // CPU uptime at end of report.
5190    optional int64 end_uptime_millis = 4;
5191
5192    // System runtime library. e.g. "libdvm.so", "libart.so".
5193    optional string runtime = 5;
5194
5195    // whether kernel reports swapped pss.
5196    optional bool has_swapped_pss = 6;
5197
5198    // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
5199    enum Status {
5200        STATUS_UNKNOWN = 0;
5201        STATUS_COMPLETE = 1;
5202        STATUS_PARTIAL = 2;
5203        STATUS_SHUTDOWN = 3;
5204        STATUS_SYSPROPS = 4;
5205    }
5206    repeated Status status = 7;
5207
5208    // Number of pages available of various types and sizes, representation fragmentation.
5209    repeated ProcessStatsAvailablePagesProto available_pages = 10;
5210
5211    // Stats for each process.
5212    repeated ProcessStatsProto process_stats = 8;
5213
5214    // Stats for each package.
5215    repeated ProcessStatsPackageProto package_stats = 9;
5216}
5217
5218message ProcessStatsAvailablePagesProto {
5219    // Node these pages are in (as per /proc/pagetypeinfo)
5220    optional int32 node = 1;
5221
5222    // Zone these pages are in (as per /proc/pagetypeinfo)
5223    optional string zone = 2;
5224
5225    // Label for the type of these pages (as per /proc/pagetypeinfo)
5226    optional string label = 3;
5227
5228    // Distribution of number of pages available by order size.  First entry in array is
5229    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
5230    repeated int32 pages_per_order = 4;
5231}
5232
5233/**
5234 * Pulled from ProcessStatsService.java
5235 */
5236message ProcStats {
5237    optional ProcessStatsSectionProto proc_stats_section = 1;
5238}
5239
5240/**
5241 * Pulled from ProcessStatsService.java
5242 */
5243message ProcStatsPkgProc {
5244    optional ProcessStatsSectionProto proc_stats_section = 1;
5245}
5246
5247// Next Tag: 2
5248message PackageRemoteViewInfoProto {
5249    optional string package_name = 1;
5250    // add per-package additional info here (like channels)
5251}
5252
5253// Next Tag: 2
5254message NotificationRemoteViewsProto {
5255    repeated PackageRemoteViewInfoProto package_remote_view_info = 1;
5256}
5257
5258/**
5259 * Pulled from NotificationManagerService.java
5260 */
5261message NotificationRemoteViews {
5262    optional NotificationRemoteViewsProto notification_remote_views = 1;
5263}
5264
5265message PowerProfileProto {
5266    optional double cpu_suspend = 1;
5267
5268    optional double cpu_idle = 2;
5269
5270    optional double cpu_active = 3;
5271
5272    message CpuCluster {
5273        optional int32 id = 1;
5274        optional double cluster_power = 2;
5275        optional int32 cores = 3;
5276        repeated int64 speed = 4;
5277        repeated double core_power = 5;
5278    }
5279
5280    repeated CpuCluster cpu_cluster = 40;
5281
5282    optional double wifi_scan = 4;
5283
5284    optional double wifi_on = 5;
5285
5286    optional double wifi_active = 6;
5287
5288    optional double wifi_controller_idle = 7;
5289
5290    optional double wifi_controller_rx = 8;
5291
5292    optional double wifi_controller_tx = 9;
5293
5294    repeated double wifi_controller_tx_levels = 10;
5295
5296    optional double wifi_controller_operating_voltage = 11;
5297
5298    optional double bluetooth_controller_idle = 12;
5299
5300    optional double bluetooth_controller_rx = 13;
5301
5302    optional double bluetooth_controller_tx = 14;
5303
5304    optional double bluetooth_controller_operating_voltage = 15;
5305
5306    optional double modem_controller_sleep = 16;
5307
5308    optional double modem_controller_idle = 17;
5309
5310    optional double modem_controller_rx = 18;
5311
5312    repeated double modem_controller_tx = 19;
5313
5314    optional double modem_controller_operating_voltage = 20;
5315
5316    optional double gps_on = 21;
5317
5318    repeated double gps_signal_quality_based = 22;
5319
5320    optional double gps_operating_voltage = 23;
5321
5322    optional double bluetooth_on = 24;
5323
5324    optional double bluetooth_active = 25;
5325
5326    optional double bluetooth_at_cmd = 26;
5327
5328    optional double ambient_display = 27;
5329
5330    optional double screen_on = 28;
5331
5332    optional double radio_on = 29;
5333
5334    optional double radio_scanning = 30;
5335
5336    optional double radio_active = 31;
5337
5338    optional double screen_full = 32;
5339
5340    optional double audio = 33;
5341
5342    optional double video = 34;
5343
5344    optional double flashlight = 35;
5345
5346    optional double memory = 36;
5347
5348    optional double camera = 37;
5349
5350    optional double wifi_batched_scan = 38;
5351
5352    optional double battery_capacity = 39;
5353}
5354
5355/**
5356 * power_profile.xml and other constants for power model calculations.
5357 * Pulled from PowerProfile.java
5358 */
5359message PowerProfile {
5360    optional PowerProfileProto power_profile = 1;
5361}
5362
5363/**
5364 * Logs when a user restriction was added or removed.
5365 *
5366 * Logged from:
5367 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
5368 */
5369message UserRestrictionChanged {
5370    // The raw string of the user restriction as defined in UserManager.
5371    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
5372    optional string restriction = 1;
5373    // Whether the restriction is enabled or disabled.
5374    optional bool enabled = 2;
5375}
5376
5377/**
5378 * Pulls process user time and system time. Puller takes a snapshot of all pids
5379 * in the system and returns cpu stats for those that are working at the time.
5380 * Dead pids will be dropped. Kernel processes are excluded.
5381 * Min cool-down is 5 sec.
5382 */
5383message ProcessCpuTime {
5384    optional int32 uid = 1 [(is_uid) = true];
5385
5386    optional string process_name = 2;
5387    // Process cpu time in user space, cumulative from boot/process start
5388    optional int64 user_time_millis = 3;
5389    // Process cpu time in system space, cumulative from boot/process start
5390    optional int64 system_time_millis = 4;
5391}
5392
5393/**
5394 * Pulls the CPU usage for each thread.
5395 *
5396 * Read from /proc/$PID/task/$TID/time_in_state files.
5397 *
5398 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
5399 * time_in_state files not being present on some phones, have not been addressed. These should be
5400 * considered before a public release.
5401 */
5402message CpuTimePerThreadFreq {
5403    // UID that owns the process.
5404    optional int32 uid = 1 [(is_uid) = true];
5405    // ID of the process.
5406    optional int32 process_id = 2;
5407    // ID of the thread.
5408    optional int32 thread_id = 3;
5409    // Name of the process taken from `/proc/$PID/cmdline`.
5410    optional string process_name = 4;
5411    // Name of the thread taken from `/proc/$PID/task/$TID/comm`
5412    optional string thread_name = 5;
5413
5414    // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
5415    // are given in KHz, and time is given in milliseconds since the thread started. All eight
5416    // frequencies are given here as the alternative is sending eight separate atoms. This method
5417    // significantly reduces the amount of data created
5418    optional int32 frequency1_khz = 6;
5419    optional int32 time1_millis = 7;
5420    optional int32 frequency2_khz = 8;
5421    optional int32 time2_millis = 9;
5422    optional int32 frequency3_khz = 10;
5423    optional int32 time3_millis = 11;
5424    optional int32 frequency4_khz = 12;
5425    optional int32 time4_millis = 13;
5426    optional int32 frequency5_khz = 14;
5427    optional int32 time5_millis = 15;
5428    optional int32 frequency6_khz = 16;
5429    optional int32 time6_millis = 17;
5430    optional int32 frequency7_khz = 18;
5431    optional int32 time7_millis = 19;
5432    optional int32 frequency8_khz = 20;
5433    optional int32 time8_millis = 21;
5434}
5435
5436/**
5437 * Pulls information about the device's build.
5438 */
5439message BuildInformation {
5440    // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
5441    // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
5442    optional string fingerprint = 1;
5443
5444    // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
5445    optional string brand = 2;
5446
5447    // Build.PRODUCT. The name of the overall product.
5448    optional string product = 3;
5449
5450    // Build.DEVICE. The name of the industrial design.
5451    optional string device = 4;
5452
5453    // Build.VERSION.RELEASE. The user-visible version string.  E.g., "1.0" or "3.4b5" or "bananas".
5454    optional string version_release = 5;
5455
5456    // Build.ID. E.g. a label like "M4-rc20".
5457    optional string id = 6;
5458
5459    // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
5460    // represent this build.
5461    optional string version_incremental = 7;
5462
5463    // Build.TYPE. The type of build, like "user" or "eng".
5464    optional string type = 8;
5465
5466    // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
5467    optional string tags = 9;
5468}
5469
5470/**
5471 * Logs information about mismatched caller for content capture.
5472 *
5473 * Logged from:
5474 *   frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java
5475 */
5476message ContentCaptureCallerMismatchReported {
5477    optional string intended_package = 1;
5478    optional string calling_package = 2;
5479}
5480
5481/**
5482 * Logs information about content capture service events.
5483 *
5484 * Logged from:
5485 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
5486 */
5487message ContentCaptureServiceEvents {
5488    // The type of event.
5489    enum Event {
5490        UNKNOWN = 0;
5491        ON_CONNECTED = 1;
5492        ON_DISCONNECTED = 2;
5493        SET_WHITELIST = 3;
5494        SET_DISABLED = 4;
5495        ON_USER_DATA_REMOVED = 5;
5496    }
5497    optional Event event = 1;
5498    // component/package of content capture service.
5499    optional string service_info = 2;
5500    // component/package of target.
5501    // it's a concatenated list of component/package for SET_WHITELIST event
5502    // separated by " ".
5503    optional string target_info = 3;
5504}
5505
5506/**
5507 * Logs information about content capture session events.
5508 *
5509 * Logged from:
5510 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
5511 */
5512message ContentCaptureSessionEvents {
5513    // The type of event.
5514    enum Event {
5515        UNKNOWN = 0;
5516        ON_SESSION_STARTED = 1;
5517        ON_SESSION_FINISHED = 2;
5518        SESSION_NOT_CREATED = 3;
5519    }
5520    optional int32 session_id = 1;
5521    optional Event event = 2;
5522    // (n/a on session finished)
5523    optional int32 state_flags = 3;
5524    // component/package of content capture service.
5525    optional string service_info = 4;
5526    // component/package of app.
5527    // (n/a on session finished)
5528    optional string app_info = 5;
5529    optional bool is_child_session = 6;
5530}
5531
5532/**
5533 * Logs information about session being flushed.
5534 *
5535 * Logged from:
5536 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
5537 */
5538message ContentCaptureFlushed {
5539    optional int32 session_id = 1;
5540    // component/package of content capture service.
5541    optional string service_info = 2;
5542    // component/package of app.
5543    optional string app_info = 3;
5544    // session start/finish events
5545    optional int32 child_session_started = 4;
5546    optional int32 child_session_finished = 5;
5547    // count of view events.
5548    optional int32 view_appeared_count = 6;
5549    optional int32 view_disappeared_count = 7;
5550    optional int32 view_text_changed_count = 8;
5551
5552    // Flush stats.
5553    optional int32 max_events = 9;
5554    optional int32 idle_flush_freq = 10;
5555    optional int32 text_flush_freq = 11;
5556    optional int32 flush_reason = 12;
5557}
5558
5559/**
5560 * Pulls on-device BatteryStats power use calculations for the overall device.
5561 */
5562message DeviceCalculatedPowerUse {
5563    // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
5564    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
5565    // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
5566    optional int64 computed_power_nano_amp_secs = 1;
5567}
5568
5569/**
5570 * Pulls on-device BatteryStats power use calculations broken down by uid.
5571 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
5572 * that is attributed to non-uid items. They must all be included to get the total power use.
5573 */
5574message DeviceCalculatedPowerBlameUid {
5575    // Uid being blamed. Note: isolated uids have already been mapped to host uid.
5576    optional int32 uid = 1 [(is_uid) = true];
5577
5578    // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
5579    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
5580    optional int64 power_nano_amp_secs = 2;
5581}
5582
5583/**
5584 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
5585 * drain type.
5586 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
5587 * is attributed uids. They must all be included to get the total power use.
5588 */
5589message DeviceCalculatedPowerBlameOther {
5590    // The type of item whose power use is being reported.
5591    enum DrainType {
5592        AMBIENT_DISPLAY = 0;
5593        // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
5594        BLUETOOTH = 2;
5595        CAMERA = 3;
5596        // Cell-standby
5597        CELL = 4;
5598        FLASHLIGHT = 5;
5599        IDLE = 6;
5600        MEMORY = 7;
5601        // Amount that total computed drain exceeded the drain estimated using the
5602        // battery level changes and capacity.
5603        OVERCOUNTED = 8;
5604        PHONE = 9;
5605        SCREEN = 10;
5606        // Amount that total computed drain was below the drain estimated using the
5607        // battery level changes and capacity.
5608        UNACCOUNTED = 11;
5609        // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
5610        WIFI = 13;
5611    }
5612    optional DrainType drain_type = 1;
5613
5614    // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
5615    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
5616    optional int64 power_nano_amp_secs = 2;
5617}
5618
5619/**
5620 * Logs device policy features.
5621 *
5622 * Logged from:
5623 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
5624 *   packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
5625 */
5626message DevicePolicyEvent {
5627    // The event id - unique for each event.
5628    optional android.stats.devicepolicy.EventId event_id = 1;
5629    // The admin package name.
5630    optional string admin_package_name = 2;
5631    // A generic integer parameter.
5632    optional int32 integer_value = 3;
5633    // A generic boolean parameter.
5634    optional bool boolean_value = 4;
5635    // A parameter specifying a time period in milliseconds.
5636    optional uint64 time_period_millis = 5;
5637    // A parameter specifying a list of package names, bundle extras or string parameters.
5638    optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
5639}
5640
5641/**
5642 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
5643 *
5644 * Logged from:
5645 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5646 */
5647message DocsUILaunchReported {
5648    optional android.stats.docsui.LaunchAction launch_action = 1;
5649    optional bool has_initial_uri = 2;
5650    optional android.stats.docsui.MimeType mime_type = 3;
5651    optional android.stats.docsui.Root initial_root = 4;
5652}
5653
5654/**
5655 * Logs root/app visited event in file managers/picker. Call this when the user
5656 * taps on root/app in hamburger menu.
5657 *
5658 * Logged from:
5659 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5660 */
5661message DocsUIRootVisitedReported {
5662    optional android.stats.docsui.ContextScope scope = 1;
5663    optional android.stats.docsui.Root root = 2;
5664}
5665
5666/**
5667 * Logs file operation stats. Call this when a file operation has completed.
5668 *
5669 * Logged from:
5670 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5671 */
5672message DocsUIFileOperationReported {
5673    optional android.stats.docsui.Provider provider = 1;
5674    optional android.stats.docsui.FileOperation file_op = 2;
5675}
5676
5677/**
5678 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
5679 * mode.
5680 *
5681 * Logged from:
5682 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5683 */
5684message DocsUIFileOperationCopyMoveModeReported {
5685    optional android.stats.docsui.FileOperation file_op = 1;
5686    optional android.stats.docsui.CopyMoveOpMode mode = 2;
5687}
5688
5689
5690/**
5691 * Logs file sub operation stats. Call this when a file operation has failed.
5692 *
5693 * Logged from:
5694 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5695 */
5696message DocsUIFileOperationFailureReported {
5697    optional android.stats.docsui.Authority authority = 1;
5698    optional android.stats.docsui.SubFileOperation sub_op = 2;
5699}
5700
5701/**
5702* Logs the cancellation of a file operation. Call this when a job is canceled
5703*
5704* Logged from:
5705*     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5706*/
5707message DocsUIFileOperationCanceledReported {
5708    optional android.stats.docsui.FileOperation file_op = 1;
5709}
5710
5711/**
5712 * Logs startup time in milliseconds.
5713 *
5714 * Logged from:
5715 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5716 */
5717message DocsUIStartupMsReported {
5718    optional int32 startup_millis = 1;
5719}
5720
5721/**
5722 * Logs the action that was started by user.
5723 *
5724 * Logged from:
5725 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5726 */
5727message DocsUIUserActionReported {
5728    optional android.stats.docsui.UserAction action = 1;
5729}
5730
5731/**
5732 * Logs the invalid type when invalid scoped access is requested.
5733 *
5734 * Logged from:
5735 *     package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
5736 */
5737message DocsUIInvalidScopedAccessRequestReported {
5738    optional android.stats.docsui.InvalidScopedAccess type = 1;
5739}
5740
5741/**
5742 * Logs the package name that launches docsui picker mode.
5743 *
5744 * Logged from:
5745 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5746 */
5747message DocsUIPickerLaunchedFromReported {
5748    optional string package_name = 1;
5749}
5750
5751/**
5752 * Logs the search type.
5753 *
5754 * Logged from:
5755 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5756 */
5757message DocsUISearchTypeReported {
5758    optional android.stats.docsui.SearchType search_type = 1;
5759}
5760
5761/**
5762 * Logs the search mode.
5763 *
5764 * Logged from:
5765 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5766 */
5767message DocsUISearchModeReported {
5768    optional android.stats.docsui.SearchMode search_mode = 1;
5769}
5770
5771/**
5772 * Logs the pick result information.
5773 *
5774 * Logged from:
5775 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5776 */
5777message DocsUIPickResultReported {
5778    optional int32 total_action_count = 1;
5779    optional int64 duration_millis = 2;
5780    optional int32 file_count= 3;
5781    optional bool is_searching = 4;
5782    optional android.stats.docsui.Root picked_from = 5;
5783    optional android.stats.docsui.MimeType mime_type = 6;
5784    optional int32 repeatedly_pick_times = 7;
5785}
5786
5787/**
5788 * Logs when an app's memory is compacted.
5789 *
5790 * Logged from:
5791 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5792 */
5793message AppCompacted {
5794  // The pid of the process being compacted.
5795  optional int32 pid = 1;
5796
5797  // The name of the process being compacted.
5798  optional string process_name = 2;
5799
5800  // The type of compaction.
5801  enum Action {
5802    UNKNOWN = 0;
5803    SOME = 1;
5804    FULL = 2;
5805    PERSISTENT = 3;
5806    BFGS = 4;
5807  }
5808  optional Action action = 3;
5809
5810  // Total RSS in kilobytes consumed by the process prior to compaction.
5811  optional int64 before_rss_total_kilobytes = 4;
5812
5813  // File RSS in kilobytes consumed by the process prior to compaction.
5814  optional int64 before_rss_file_kilobytes = 5;
5815
5816  // Anonymous RSS in kilobytes consumed by the process prior to compaction.
5817  optional int64 before_rss_anon_kilobytes = 6;
5818
5819  // Swap in kilobytes consumed by the process prior to compaction.
5820  optional int64 before_swap_kilobytes = 7;
5821
5822  // Total RSS in kilobytes consumed by the process after compaction.
5823  optional int64 after_rss_total_kilobytes = 8;
5824
5825  // File RSS in kilobytes consumed by the process after compaction.
5826  optional int64 after_rss_file_kilobytes = 9;
5827
5828  // Anonymous RSS in kilobytes consumed by the process after compaction.
5829  optional int64 after_rss_anon_kilobytes = 10;
5830
5831  // Swap in kilobytes consumed by the process after compaction.
5832  optional int64 after_swap_kilobytes = 11;
5833
5834  // The time taken to perform compaction in milliseconds.
5835  optional int64 time_to_compact_millis = 12;
5836
5837  // The last compaction action performed for this app.
5838  optional Action last_action = 13;
5839
5840  // The last time that compaction was attempted on this process in milliseconds
5841  // since boot, not including sleep (see SystemClock.uptimeMillis()).
5842  optional int64 last_compact_timestamp_ms_since_boot = 14;
5843
5844  // The "setAdj" (i.e. previous) oom_score_adj at the time of compaction.
5845  optional int32 oom_score_adj = 15;
5846
5847  // The process state at the time of compaction.
5848  optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
5849
5850  // Free ZRAM in kilobytes before compaction.
5851  optional int64 before_zram_free_kilobytes = 17;
5852
5853  // Free ZRAM in kilobytes after compaction.
5854  optional int64 after_zram_free_kilobytes = 18;
5855}
5856
5857/**
5858 * Logs when a Tethering event occurs.
5859 *
5860 */
5861message NetworkTetheringReported {
5862  // tethering error code
5863  optional android.stats.connectivity.ErrorCode error_code = 1;
5864
5865  // tethering downstream type
5866  optional android.stats.connectivity.DownstreamType downstream_type = 2;
5867
5868  // transport type of upstream network
5869  optional android.stats.connectivity.UpstreamType upstream_type = 3;
5870
5871  // The user type of Tethering
5872  optional android.stats.connectivity.UserType user_type= 4;
5873}
5874
5875/**
5876 * Logs a DNS lookup operation initiated by the system resolver on behalf of an application
5877 * invoking native APIs such as getaddrinfo() or Java APIs such as Network#getAllByName().
5878 *
5879 * The NetworkDnsEventReported message represents the entire lookup operation, which may
5880 * result one or more queries to the recursive DNS resolvers. Those are individually logged
5881 * in DnsQueryEvents to enable computing error rates and network latency and timeouts
5882 * broken up by query type, transport, network interface, etc.
5883 */
5884message NetworkDnsEventReported {
5885    optional android.stats.dnsresolver.EventType event_type = 1;
5886
5887    optional android.stats.dnsresolver.ReturnCode return_code = 2;
5888
5889    // The latency in microseconds of the entire DNS lookup operation.
5890    optional int32 latency_micros = 3;
5891
5892    // Only valid for event_type = EVENT_GETADDRINFO.
5893    optional int32 hints_ai_flags = 4;
5894
5895    // Flags passed to android_res_nsend() defined in multinetwork.h
5896    // Only valid for event_type = EVENT_RESNSEND.
5897    optional int32 res_nsend_flags = 5;
5898
5899    optional android.stats.dnsresolver.NetworkType network_type = 6;
5900
5901    // The DNS over TLS mode on a specific netId.
5902    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7;
5903
5904    // Additional pass-through fields opaque to statsd.
5905    // The DNS resolver Mainline module can add new fields here without requiring an OS update.
5906    optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES];
5907
5908    // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom.
5909    optional int32 sampling_rate_denom = 9;
5910}
5911
5912/**
5913 * logs the CapportApiData info
5914 * Logged from:
5915 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
5916 */
5917message CapportApiData {
5918    // The TTL of the network connection provided by captive portal
5919    optional int32 remaining_ttl_secs = 1;
5920
5921    // The limit traffic data of the network connection provided by captive portal
5922    optional int32 remaining_bytes = 2;
5923
5924    // Is portal url option included in the DHCP packet (Yes, No)
5925    optional bool has_portal_url = 3;
5926
5927    // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
5928    optional bool has_venue_info = 4;
5929}
5930
5931/**
5932 * logs a network Probe Event
5933 * Logged from:
5934 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
5935 */
5936message ProbeEvent {
5937    // The probe type (http or https, or captive portal API...)
5938    optional android.stats.connectivity.ProbeType probe_type = 1;
5939
5940    // The latency in microseconds of the probe event
5941    optional int32 latency_micros = 2;
5942
5943    // The result of the probe event
5944    optional android.stats.connectivity.ProbeResult probe_result = 3;
5945
5946    // The CaptivePortal API info
5947    optional CapportApiData capport_api_data = 4;
5948}
5949
5950/**
5951 * log each ProbeEvent in ProbeEvents
5952 * Logged from:
5953 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
5954 */
5955message ProbeEvents {
5956    // Record probe event during the validation
5957    repeated ProbeEvent probe_event = 1;
5958}
5959
5960/**
5961 * The DHCP (Dynamic Host Configuration Protocol) session info
5962 * Logged from:
5963 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
5964 */
5965message DhcpSession {
5966    // The DHCP Feature(s) enabled in this session
5967    repeated android.stats.connectivity.DhcpFeature used_features = 1;
5968
5969    // The discover packet (re)transmit count
5970    optional int32 discover_count = 2;
5971
5972    // The request packet (re)transmit count
5973    optional int32 request_count = 3;
5974
5975    // The IPv4 address conflict count
5976    // (only be meaningful when duplicate address detection is enabled)
5977    optional int32 conflict_count = 4;
5978
5979    // The DHCP packet parsing error code in this session
5980    // (defined in android.net.metrics.DhcpErrorEvent)
5981    repeated android.stats.connectivity.DhcpErrorCode error_code = 5;
5982
5983    // The result of DHCP hostname transliteration
5984    optional android.stats.connectivity.HostnameTransResult ht_result = 6;
5985}
5986
5987/**
5988 * Logs Network IP provisioning event
5989 * Logged from:
5990 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
5991 */
5992message NetworkIpProvisioningReported {
5993    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
5994    optional android.stats.connectivity.TransportType transport_type = 1;
5995
5996    // The latency in microseconds of IP Provisioning over IPV4
5997    optional int32 ipv4_latency_micros = 2;
5998
5999    // The latency in microseconds of IP Provisioning over IPV6
6000    optional int32 ipv6_latency_micros = 3;
6001
6002    // The time duration between provisioning start and end (success or failure)
6003    optional int64 provisioning_duration_micros = 4;
6004
6005    // The specific disconnect reason for this IP provisioning
6006    optional android.stats.connectivity.DisconnectCode disconnect_code = 5;
6007
6008    // Log DHCP session info (Only valid for IPv4)
6009    optional DhcpSession dhcp_session = 6 [(log_mode) = MODE_BYTES];
6010
6011    // The random number between 0 ~ 999 for sampling
6012    optional int32 random_number = 7;
6013}
6014
6015/**
6016 * Logs Network DHCP Renew event
6017 * Logged from:
6018 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
6019 */
6020message NetworkDhcpRenewReported {
6021    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
6022    optional android.stats.connectivity.TransportType transport_type = 1;
6023
6024    // The request packet (re)transmit count
6025    optional int32 request_count = 2;
6026
6027    // The latency in microseconds of DHCP Renew
6028    optional int32 latency_micros = 3;
6029
6030    // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
6031    optional android.stats.connectivity.DhcpErrorCode error_code = 4;
6032
6033    // The result of DHCP renew
6034    optional android.stats.connectivity.DhcpRenewResult renew_result = 5;
6035
6036    // The random number between 0 ~ 999 for sampling
6037    optional int32 random_number = 6;
6038}
6039
6040/**
6041 * Logs Network Validation event
6042 * Logged from:
6043 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
6044 */
6045message NetworkValidationReported {
6046    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
6047    optional android.stats.connectivity.TransportType transport_type = 1;
6048
6049    // Record each probe event
6050    optional ProbeEvents probe_events = 2 [(log_mode) = MODE_BYTES];
6051
6052    // The result of the network validation
6053    optional android.stats.connectivity.ValidationResult validation_result = 3;
6054
6055    // The latency in microseconds of network validation
6056    optional int32 latency_micros = 4;
6057
6058    // The validation index (the first validation attempt or second, third...)
6059    optional int32 validation_index = 5;
6060
6061    // The random number between 0 ~ 999 for sampling
6062    optional int32 random_number = 6;
6063}
6064
6065/**
6066 * Logs NetworkStack Quirk event
6067 * Logged from:
6068 * packages/modules/NetworkStack/src/com/android/networkstack/
6069 */
6070message NetworkStackQuirkReported {
6071    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
6072    optional android.stats.connectivity.TransportType transport_type = 1;
6073
6074    // Record each Quirk event
6075    optional android.stats.connectivity.NetworkQuirkEvent event = 2;
6076}
6077
6078/**
6079 * Logs when a data stall event occurs.
6080 *
6081 * Log from:
6082 *     packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
6083 */
6084message DataStallEvent {
6085    // Data stall evaluation type.
6086    // See packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
6087    // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
6088    optional int32 evaluation_type = 1;
6089    // See definition in data_stall_event.proto.
6090    optional com.android.server.connectivity.ProbeResult validation_result = 2;
6091    // See definition in data_stall_event.proto.
6092    optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
6093    // See definition in data_stall_event.proto.
6094    optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
6095    // See definition in data_stall_event.proto.
6096    optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
6097    // See definition in data_stall_event.proto.
6098    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
6099    // The tcp packets fail rate from the latest tcp polling.
6100    optional int32 tcp_fail_rate = 7;
6101    // Number of packets sent since the last received packet.
6102    optional int32 tcp_sent_since_last_recv = 8;
6103}
6104
6105/*
6106 * Logs when RescueParty resets some set of experiment flags.
6107 *
6108 * Logged from:
6109 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
6110 */
6111message RescuePartyResetReported {
6112    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
6113    optional int32 rescue_level = 1;
6114}
6115
6116/**
6117 * Logs when signed config is received from an APK, and if that config was applied successfully.
6118 * Logged from:
6119 *   frameworks/base/services/core/java/com/android/server/signedconfig/SignedConfigService.java
6120 */
6121message SignedConfigReported {
6122    enum Type {
6123        UNKNOWN_TYPE = 0;
6124        GLOBAL_SETTINGS = 1;
6125    }
6126    optional Type type = 1;
6127
6128    // The final status of the signed config received.
6129    enum Status {
6130        UNKNOWN_STATUS = 0;
6131        APPLIED = 1;
6132        BASE64_FAILURE_CONFIG = 2;
6133        BASE64_FAILURE_SIGNATURE = 3;
6134        SECURITY_EXCEPTION = 4;
6135        INVALID_CONFIG = 5;
6136        OLD_CONFIG = 6;
6137        SIGNATURE_CHECK_FAILED = 7;
6138        NOT_APPLICABLE = 8;
6139        SIGNATURE_CHECK_FAILED_PROD_KEY_ABSENT = 9;
6140    }
6141    optional Status status = 2;
6142
6143    // The version of the signed config processed.
6144    optional int32 version = 3;
6145
6146    // The package name that the config was extracted from.
6147    optional string from_package = 4;
6148
6149    enum Key {
6150        NO_KEY = 0;
6151        DEBUG = 1;
6152        PRODUCTION = 2;
6153    }
6154    // Which key was used to verify the config.
6155    optional Key verified_with = 5;
6156}
6157
6158/*
6159 * Logs GNSS Network-Initiated (NI) location events.
6160 *
6161 * Logged from:
6162 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
6163 */
6164message GnssNiEventReported {
6165    // The type of GnssNiEvent.
6166    enum EventType {
6167        UNKNOWN = 0;
6168        NI_REQUEST = 1;
6169        NI_RESPONSE = 2;
6170    }
6171    optional EventType event_type = 1;
6172
6173    // An ID generated by HAL to associate NI notifications and UI responses.
6174    optional int32 notification_id = 2;
6175
6176    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
6177    optional android.server.location.GnssNiType ni_type = 3;
6178
6179    // NI requires notification.
6180    optional bool need_notify = 4;
6181
6182    // NI requires verification.
6183    optional bool need_verify = 5;
6184
6185    // NI requires privacy override, no notification/minimal trace.
6186    optional bool privacy_override = 6;
6187
6188    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
6189    // seconds.
6190    optional int32 timeout = 7;
6191
6192    // Default response when timeout.
6193    optional android.server.location.GnssUserResponseType default_response = 8;
6194
6195    // String representing the requester of the network inititated location request.
6196    optional string requestor_id = 9;
6197
6198    // Notification message text string representing the service(for eg. SUPL-service) who sent the
6199    // network initiated location request.
6200    optional string text = 10;
6201
6202    // requestorId decoding scheme.
6203    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;
6204
6205    // Notification message text decoding scheme.
6206    optional android.server.location.GnssNiEncodingType text_encoding = 12;
6207
6208    // True if SUPL ES is enabled.
6209    optional bool is_supl_es_enabled = 13;
6210
6211    // True if GNSS location is enabled.
6212    optional bool is_location_enabled = 14;
6213
6214    // GNSS NI responses which define the response in NI structures.
6215    optional android.server.location.GnssUserResponseType user_response = 15;
6216}
6217
6218/**
6219 * Logs GNSS non-framework (NFW) location notification.
6220 *
6221 * Logged from:
6222 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
6223 */
6224message GnssNfwNotificationReported {
6225    // Package name of the Android proxy application representing the non-framework entity that
6226    // requested location. Set to empty string if unknown.
6227    optional string proxy_app_package_name = 1;
6228
6229    // Protocol stack that initiated the non-framework location request.
6230    optional android.server.location.NfwProtocolStack protocol_stack = 2;
6231
6232    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
6233    // set to empty string. This field is opaque to the framework and used for logging purposes.
6234    optional string other_protocol_stack_name = 3;
6235
6236    // Source initiating/receiving the location information.
6237    optional android.server.location.NfwRequestor requestor = 4;
6238
6239    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
6240    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
6241    // and used for logging purposes.
6242    optional string requestor_id = 5;
6243
6244    // Indicates whether location information was provided for this request.
6245    optional android.server.location.NfwResponseType response_type = 6;
6246
6247    // True if the device is in user initiated emergency session.
6248    optional bool in_emergency_mode = 7;
6249
6250    // True if cached location is provided.
6251    optional bool is_cached_location = 8;
6252
6253    // True if proxy app permission mismatch between framework and GNSS HAL.
6254    optional bool is_permission_mismatched = 9;
6255}
6256
6257/**
6258 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
6259 *
6260 * Logged from:
6261 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
6262 */
6263message GnssConfigurationReported {
6264    // SUPL host name.
6265    optional string supl_host = 1;
6266
6267    // SUPL port number.
6268    optional int32 supl_port = 2;
6269
6270    // C2K host name.
6271    optional string c2k_host = 3;
6272
6273    // C2K port number.
6274    optional int32 c2k_port = 4;
6275
6276    // The SUPL version requested by Carrier.
6277    optional int32 supl_ver = 5;
6278
6279    // The SUPL mode.
6280    optional android.server.location.SuplMode supl_mode = 6;
6281
6282    // True if NI emergency SUPL restrictions is enabled.
6283    optional bool supl_es = 7;
6284
6285    // LTE Positioning Profile settings
6286    optional android.server.location.LppProfile lpp_profile = 8;
6287
6288    // Positioning protocol on A-Glonass system.
6289    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;
6290
6291    // True if emergency PDN is used. Otherwise, regular PDN is used.
6292    optional bool use_emergency_pdn_for_emergency_supl= 10;
6293
6294    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
6295    optional android.server.location.GpsLock gps_lock = 11;
6296
6297    // Number of seconds to extend the emergency session duration post emergency call.
6298    optional int32 es_extension_sec = 12;
6299
6300    // The full list of package names of proxy Android applications representing the non-framework
6301    // location access entities (on/off the device) for which the framework user has granted
6302    // non-framework location access permission. The package names are concatenated in one string
6303    // with spaces as separators.
6304    optional string enabled_proxy_app_package_name_list = 13;
6305}
6306
6307/**
6308 * Logs when a NFC device's error occurred.
6309 * Logged from:
6310 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
6311 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
6312 */
6313message NfcErrorOccurred {
6314    enum Type {
6315        UNKNOWN = 0;
6316        CMD_TIMEOUT = 1;
6317        ERROR_NOTIFICATION = 2;
6318        AID_OVERFLOW = 3;
6319    }
6320    optional Type type = 1;
6321    // If it's nci cmd timeout, log the timeout command.
6322    optional uint32 nci_cmd = 2;
6323
6324    optional uint32 error_ntf_status_code = 3;
6325}
6326
6327/**
6328 * Logs when a NFC device's state changed event
6329 * Logged from:
6330 *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
6331 */
6332message NfcStateChanged {
6333    enum State {
6334        UNKNOWN = 0;
6335        OFF = 1;
6336        ON = 2;
6337        ON_LOCKED = 3; // Secure Nfc enabled.
6338        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
6339    }
6340    optional State state = 1;
6341}
6342
6343/**
6344 * Logs when a NFC Beam Transaction occurred.
6345 * Logged from:
6346 *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
6347 */
6348message NfcBeamOccurred {
6349    enum Operation {
6350        UNKNOWN = 0;
6351        SEND = 1;
6352        RECEIVE = 2;
6353    }
6354    optional Operation operation = 1;
6355}
6356
6357/**
6358 * Logs when a NFC Card Emulation Transaction occurred.
6359 * Logged from:
6360 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
6361 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
6362 */
6363message NfcCardemulationOccurred {
6364    enum Category {
6365        UNKNOWN = 0;
6366        HCE_PAYMENT = 1;
6367        HCE_OTHER = 2;
6368        OFFHOST = 3;
6369    }
6370    // Transaction belongs to HCE payment or HCE other category, or offhost.
6371    optional Category category = 1;
6372    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
6373    optional string se_name = 2;
6374}
6375
6376/**
6377 * Logs when a NFC Tag event occurred.
6378 * Logged from:
6379 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
6380 */
6381message NfcTagOccurred {
6382    enum Type {
6383        UNKNOWN = 0;
6384        URL = 1;
6385        BT_PAIRING = 2;
6386        PROVISION = 3;
6387        WIFI_CONNECT = 4;
6388        APP_LAUNCH = 5;
6389        OTHERS = 6;
6390    }
6391    optional Type type = 1;
6392}
6393
6394/**
6395 * Logs when Hce transaction triggered
6396 * Logged from:
6397 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
6398 */
6399message NfcHceTransactionOccurred {
6400    // The latency period(in microseconds) it took for the first HCE data
6401    // exchange.
6402    optional uint32 latency_micros = 1;
6403}
6404
6405/**
6406 * Logs when SecureElement state event changed
6407 * Logged from:
6408 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
6409 */
6410message SeStateChanged {
6411    enum State {
6412        UNKNOWN = 0;
6413        INITIALIZED = 1;
6414        DISCONNECTED = 2;
6415        CONNECTED = 3;
6416        HALCRASH = 4;
6417    }
6418    optional State state = 1;
6419
6420    optional string state_change_reason = 2;
6421    // SIMx or eSEx.
6422    optional string terminal = 3;
6423}
6424
6425/**
6426 * Information about a permission grant request
6427 */
6428message PermissionGrantRequestResultReported {
6429    // unique value identifying an API call. A API call might result in multiple of these atoms
6430    optional int64 request_id = 1;
6431
6432    // UID of package requesting the permission grant
6433    optional int32 requesting_uid = 2 [(is_uid) = true];
6434
6435    // Name of package requesting the permission grant
6436    optional string requesting_package_name = 3;
6437
6438    // The permission to be granted
6439    optional string permission_name = 4;
6440
6441    // If the permission was explicitly requested via the API or added by the system
6442    optional bool is_implicit = 5;
6443
6444    enum Result {
6445        UNDEFINED = 0;
6446        // permission request was ignored
6447        IGNORED = 1;
6448        // permission request was ignored because it was user fixed
6449        IGNORED_USER_FIXED = 2;
6450        // permission request was ignored because it was policy fixed
6451        IGNORED_POLICY_FIXED = 3;
6452        // permission was granted by user action
6453        USER_GRANTED = 4;
6454        // permission was automatically granted
6455        AUTO_GRANTED = 5;
6456        // permission was denied by user action
6457        USER_DENIED = 6;
6458        // permission was denied with prejudice by the user
6459        USER_DENIED_WITH_PREJUDICE = 7;
6460        // permission was automatically denied
6461        AUTO_DENIED = 8;
6462        // permission request was ignored because permission is restricted
6463        IGNORED_RESTRICTED_PERMISSION = 9;
6464    }
6465    // The result of the permission grant
6466    optional Result result = 6;
6467}
6468
6469/**
6470 * Logs when Omapi API used
6471 * Logged from:
6472 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
6473 */
6474message SeOmapiReported {
6475    enum Operation {
6476        UNKNOWN = 0;
6477        OPEN_CHANNEL = 1;
6478    }
6479    optional Operation operation = 1;
6480    // SIMx or eSEx.
6481    optional string terminal = 2;
6482
6483    optional string package_name = 3;
6484}
6485
6486/**
6487  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
6488  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
6489  * Logged from:
6490  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
6491  */
6492message BroadcastDispatchLatencyReported {
6493    optional int64 dispatch_latency_millis = 1;
6494}
6495
6496/**
6497   * Logs AttentionManagerService attention check result.
6498   *
6499   * Logged from:
6500   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
6501   */
6502message AttentionManagerServiceResultReported {
6503    // See core/java/android/service/attention/AttentionService.java
6504    enum AttentionCheckResult {
6505        UNKNOWN = 20;
6506        ATTENTION_SUCCESS_ABSENT = 0;
6507        ATTENTION_SUCCESS_PRESENT = 1;
6508        ATTENTION_FAILURE_UNKNOWN = 2;
6509        ATTENTION_FAILURE_CANCELLED = 3;
6510        ATTENTION_FAILURE_PREEMPTED = 4;
6511        ATTENTION_FAILURE_TIMED_OUT = 5;
6512        ATTENTION_FAILURE_CAMERA_PERMISSION_ABSENT = 6;
6513    }
6514    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
6515}
6516
6517/**
6518 * Logs when an adb connection changes state.
6519 *
6520 * Logged from:
6521 *     frameworks/base/services/core/java/com/android/server/adb/AdbDebuggingManager.java
6522 */
6523message AdbConnectionChanged {
6524    // The last time this system connected via adb, or 0 if the 'always allow' option was not
6525    // previously selected for this system.
6526    optional int64 last_connection_time_millis = 1;
6527
6528    // The time in ms within which a subsequent connection from an 'always allow' system is allowed
6529    // to reconnect via adb without user interaction.
6530    optional int64 auth_window_millis = 2;
6531
6532    // The state of the adb connection from frameworks/base/core/proto/android/debug/enums.proto.
6533    optional android.debug.AdbConnectionStateEnum state = 3;
6534
6535    // True if the 'always allow' option was selected for this system.
6536    optional bool always_allow = 4;
6537}
6538
6539/*
6540 * Logs the reported speech DSP status.
6541 *
6542 * Logged from:
6543 *  Vendor audio implementation.
6544 */
6545message SpeechDspStatReported {
6546    // The total Speech DSP uptime in milliseconds.
6547    optional int32 total_uptime_millis = 1;
6548    // The total Speech DSP downtime in milliseconds.
6549    optional int32 total_downtime_millis = 2;
6550    optional int32 total_crash_count = 3;
6551    optional int32 total_recover_count = 4;
6552}
6553
6554/**
6555 * Logs USB connector contaminant status.
6556 *
6557 * Logged from: USB Service.
6558 */
6559message UsbContaminantReported {
6560    optional string id = 1;
6561    optional android.service.usb.ContaminantPresenceStatus status = 2;
6562}
6563
6564/**
6565 * This atom is for debugging purpose.
6566 */
6567message DebugElapsedClock {
6568    // Monotically increasing value for each pull.
6569    optional int64 pull_count = 1;
6570    // Time from System.elapsedRealtime.
6571    optional int64 elapsed_clock_millis = 2;
6572    // Time from System.elapsedRealtime.
6573    optional int64 same_elapsed_clock_millis = 3;
6574    // Diff between current elapsed time and elapsed time from previous pull.
6575    optional int64 elapsed_clock_diff_millis = 4;
6576
6577    enum Type {
6578      TYPE_UNKNOWN = 0;
6579      ALWAYS_PRESENT = 1;
6580      PRESENT_ON_ODD_PULLS = 2;
6581    }
6582    // Type of behavior for the pulled data.
6583    optional Type type = 5;
6584}
6585
6586/**
6587 * This atom is for debugging purpose.
6588 */
6589message DebugFailingElapsedClock {
6590    // Monotically increasing value for each pull.
6591    optional int64 pull_count = 1;
6592    // Time from System.elapsedRealtime.
6593    optional int64 elapsed_clock_millis = 2;
6594    // Time from System.elapsedRealtime.
6595    optional int64 same_elapsed_clock_millis = 3;
6596    // Diff between current elapsed time and elapsed time from previous pull.
6597    optional int64 elapsed_clock_diff_millis = 4;
6598}
6599
6600/** Logs System UI bubbles event changed.
6601 *
6602 * Logged from:
6603 *     frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles
6604 */
6605message BubbleUIChanged {
6606
6607    // The app package that is posting the bubble.
6608    optional string package_name = 1;
6609
6610    // The notification channel that is posting the bubble.
6611    optional string notification_channel = 2;
6612
6613    // The notification id associated with the posted bubble.
6614    optional int32 notification_id = 3;
6615
6616    // The position of the bubble within the bubble stack.
6617    optional int32 position = 4;
6618
6619    // The total number of bubbles within the bubble stack.
6620    optional int32 total_number = 5;
6621
6622    // User interactions with the bubble.
6623    enum Action {
6624        UNKNOWN = 0;
6625        POSTED = 1;
6626        UPDATED = 2;
6627        EXPANDED = 3;
6628        COLLAPSED = 4;
6629        DISMISSED = 5;
6630        STACK_DISMISSED = 6;
6631        STACK_MOVED = 7;
6632        HEADER_GO_TO_APP = 8;
6633        HEADER_GO_TO_SETTINGS = 9;
6634        PERMISSION_OPT_IN = 10;
6635        PERMISSION_OPT_OUT = 11;
6636        PERMISSION_DIALOG_SHOWN = 12;
6637        SWIPE_LEFT = 13;
6638        SWIPE_RIGHT = 14;
6639        STACK_EXPANDED = 15;
6640        FLYOUT = 16;
6641    }
6642    optional Action action = 6;
6643
6644    // Normalized screen position of the bubble stack. The range is between 0 and 1.
6645    optional float normalized_x_position = 7;
6646    optional float normalized_y_position = 8;
6647
6648    // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
6649    optional bool is_unread = 9;
6650
6651    // Whether the bubble is an on-going one.
6652    optional bool is_ongoing = 10;
6653
6654    // Whether the bubble is produced by an app running in foreground.
6655    // This is deprecated and the value should be ignored.
6656    optional bool is_foreground = 11 [deprecated = true];
6657}
6658
6659/**
6660  * Logs System UI bubbles developer errors.
6661  *
6662  * Logged from:
6663  *   frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
6664  */
6665message BubbleDeveloperErrorReported {
6666
6667    // The app package that is posting the bubble.
6668    optional string package_name = 1;
6669
6670    // Bubble developer error type enums.
6671    enum Error {
6672        UNKNOWN = 0;
6673        ACTIVITY_INFO_MISSING = 1;
6674        ACTIVITY_INFO_NOT_RESIZABLE = 2;
6675        DOCUMENT_LAUNCH_NOT_ALWAYS = 3;
6676    }
6677    optional Error error = 2 [default = UNKNOWN];
6678}
6679
6680/**
6681 * Logs that a constraint for a scheduled job has changed.
6682 *
6683 * Logged from:
6684 *     frameworks/base/services/core/java/com/android/server/job/controllers/JobStatus.java
6685 */
6686message ScheduledJobConstraintChanged {
6687    repeated AttributionNode attribution_node = 1;
6688
6689    // Name of the job.
6690    optional string job_name = 2;
6691
6692    optional com.android.server.job.ConstraintEnum constraint = 3;
6693
6694    enum State {
6695        UNKNOWN = 0;
6696        UNSATISFIED = 1;
6697        SATISFIED = 2;
6698    }
6699    optional State state = 4;
6700}
6701
6702/**
6703 * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
6704 * returns true.
6705 *
6706 * Logged from:
6707 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
6708 */
6709message ScreenTimeoutExtensionReported {
6710    // Describes how many times in a row did the power manager reset the screen off timeout.
6711    optional uint32 consecutive_timeout_extended_count = 1;
6712}
6713
6714/*
6715* Logs number of milliseconds it takes to start a process.
6716* The definition of app process start time is from the app launch time to
6717* the time that Zygote finished forking the app process and loaded the
6718* application package's java classes.
6719
6720* This metric is different from AppStartOccurred which is for foreground
6721* activity only.
6722
6723* ProcessStartTime can report all processes (both foreground and background)
6724* start time.
6725*
6726* Logged from:
6727*   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6728*/
6729message ProcessStartTime {
6730    // The uid of the ProcessRecord.
6731    optional int32 uid = 1 [(is_uid) = true];
6732
6733    // The process pid.
6734    optional int32 pid = 2;
6735
6736    // The process name.
6737    // Usually package name, "system" for system server.
6738    // Provided by ActivityManagerService.
6739    optional string process_name = 3;
6740
6741    enum StartType {
6742        UNKNOWN = 0;
6743        WARM = 1;
6744        HOT = 2;
6745        COLD = 3;
6746    }
6747
6748    // The start type.
6749    optional StartType type = 4;
6750
6751    // The elapsed realtime at the start of the process.
6752    optional int64 process_start_time_millis = 5;
6753
6754    // Number of milliseconds it takes to reach bind application.
6755    optional int32 bind_application_delay_millis = 6;
6756
6757    // Number of milliseconds it takes to finish start of the process.
6758    optional int32 process_start_delay_millis = 7;
6759
6760    // hostingType field in ProcessRecord, the component type such as "activity",
6761    // "service", "content provider", "broadcast" or other strings.
6762    optional string hosting_type = 8;
6763
6764    // hostingNameStr field in ProcessRecord. The component class name that runs
6765    // in this process.
6766    optional string hosting_name = 9;
6767}
6768
6769/**
6770 * Track Media Codec usage
6771 * Logged from:
6772 *   frameworks/av/media/libstagefright/MediaCodec.cpp
6773 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
6774 */
6775message MediametricsCodecReported {
6776    optional int64 timestamp_nanos = 1;
6777    optional string package_name = 2;
6778    optional int64 package_version_code = 3;
6779    optional int64 media_apex_version = 4;
6780
6781    optional android.stats.mediametrics.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6782}
6783
6784/**
6785 * Track Media Extractor (pulling video/audio streams out of containers) usage
6786 * Logged from:
6787 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
6788 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
6789 */
6790message MediametricsExtractorReported {
6791    optional int64 timestamp_nanos = 1;
6792    optional string package_name = 2;
6793    optional int64 package_version_code = 3;
6794    optional int64 media_apex_version = 4;
6795
6796    optional android.stats.mediametrics.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6797}
6798
6799/**
6800 * Track how we arbitrate between microphone/input requests.
6801 * Logged from
6802 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
6803 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
6804 */
6805message MediametricsAudiopolicyReported {
6806    optional int64 timestamp_nanos = 1;
6807    optional string package_name = 2;
6808    optional int64 package_version_code = 3;
6809    optional int64 media_apex_version = 4;
6810
6811    optional android.stats.mediametrics.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6812}
6813
6814/**
6815 * Track how we arbitrate between microphone requests.
6816 * Logged from
6817 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
6818 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
6819 */
6820message MediametricsAudiorecordReported {
6821    optional int64 timestamp_nanos = 1;
6822    optional string package_name = 2;
6823    optional int64 package_version_code = 3;
6824    optional int64 media_apex_version = 4;
6825
6826    optional android.stats.mediametrics.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6827}
6828
6829/**
6830 * Track how we arbitrate between microphone/input requests.
6831 * Logged from
6832 *   frameworks/av/media/libnblog/ReportPerformance.cpp
6833 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
6834 */
6835message MediametricsAudiothreadReported {
6836    optional int64 timestamp_nanos = 1;
6837    optional string package_name = 2;
6838    optional int64 package_version_code = 3;
6839    optional int64 media_apex_version = 4;
6840
6841    optional android.stats.mediametrics.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6842}
6843
6844/**
6845 * Track how we arbitrate between microphone/input requests.
6846 * Logged from
6847 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
6848 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
6849 */
6850message MediametricsAudiotrackReported {
6851    optional int64 timestamp_nanos = 1;
6852    optional string package_name = 2;
6853    optional int64 package_version_code = 3;
6854    optional int64 media_apex_version = 4;
6855
6856    optional android.stats.mediametrics.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6857}
6858
6859/**
6860 * Track information about DRM framework performance
6861 * Logged from
6862 *   frameworks/av/drm/libmediadrm/DrmHal.cpp
6863 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
6864 */
6865message MediametricsMediadrmReported {
6866    optional int64 timestamp_nanos = 1;
6867    optional string package_name = 2;
6868    optional int64 package_version_code = 3;
6869    optional int64 media_apex_version = 4;
6870
6871    // vendor+description tell about which DRM plugin is in use on this device
6872    optional string vendor = 5;
6873    optional string description = 6;
6874    // from frameworks/av/drm/libmediadrm/protos/metrics.proto
6875    optional bytes framework_stats = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
6876}
6877
6878/**
6879 * Track information about the widevine DRM plugin performance
6880 * Logged from
6881 *   vendor/widevine/libwvdrmengine/cdm/metrics
6882 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
6883 */
6884message MediametricsDrmWidevineReported {
6885    optional int64 timestamp_nanos = 1;
6886    optional string package_name = 2;
6887    optional int64 package_version_code = 3;
6888    optional int64 media_apex_version = 4;
6889
6890    optional bytes vendor_specific_stats = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6891}
6892
6893/**
6894 * Track information about recordings (e.g. camcorder)
6895 * Logged from
6896 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
6897 *   frameworks/av/services/mediaanalytics/statsd_recorder.cpp
6898 */
6899message MediametricsRecorderReported {
6900    optional int64 timestamp_nanos = 1;
6901    optional string package_name = 2;
6902    optional int64 package_version_code = 3;
6903    optional int64 media_apex_version = 4;
6904
6905    optional android.stats.mediametrics.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6906}
6907
6908/**
6909 * Track Media Player usage
6910 * Logged from:
6911 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
6912 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
6913 */
6914message MediametricsNuPlayerReported {
6915    optional int64 timestamp_nanos = 1;
6916    optional string package_name = 2;
6917    optional int64 package_version_code = 3;
6918    optional int64 media_apex_version = 4;
6919
6920    optional android.stats.mediametrics.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6921}
6922
6923/**
6924 * State of a dangerous permission requested by a package
6925 */
6926message DangerousPermissionState {
6927    // Name of the permission
6928    optional string permission_name = 1;
6929
6930    // Uid of the package
6931    optional int32 uid = 2 [(is_uid) = true];
6932
6933    // Package requesting the permission
6934    optional string package_name = 3;
6935
6936    // If the permission is granted to the uid
6937    optional bool is_granted = 4;
6938
6939    // Permission flags as per android.content.pm.PermissionFlags
6940    optional int32 permission_flags = 5;
6941}
6942
6943/**
6944 * Logs when a package is denied access to a device identifier based on the new access requirements.
6945 *
6946 * Logged from:
6947 *     frameworks/base/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
6948 */
6949message DeviceIdentifierAccessDenied {
6950    // The name of the package denied access to the requested device identifier.
6951    optional string package_name = 1;
6952
6953    // The name of the device identifier method the package attempted to invoke.
6954    optional string method_name = 2;
6955
6956    // True if the package is preinstalled.
6957    optional bool is_preinstalled = 3;
6958
6959    // True if the package is privileged.
6960    // Starting from Android 11, this boolean is not set and will always be false.
6961    optional bool is_priv_app = 4 [deprecated = true];
6962}
6963
6964/**
6965 * Pulls the ongoing mainline install train version code.
6966 * Pulled from StatsCompanionService
6967 */
6968message TrainInfo {
6969    optional int64 train_version_code = 1;
6970
6971    optional TrainExperimentIds train_experiment_id = 2;
6972
6973    optional string train_name = 3;
6974
6975    enum Status {
6976        UNKNOWN = 0;
6977        INSTALL_REQUESTED = 1;
6978        INSTALL_STARTED = 2;
6979        INSTALL_STAGED_NOT_READY = 3;
6980        INSTALL_STAGED_READY = 4;
6981        INSTALL_SUCCESS = 5;
6982        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
6983        // and INSTALL_FAILURE_COMMIT.
6984        INSTALL_FAILURE = 6  [deprecated = true];
6985        // This enum is for installs that are manually cancelled via the Manual Update UI.
6986        INSTALL_CANCELLED = 7;
6987        INSTALLER_ROLLBACK_REQUESTED = 8;
6988        INSTALLER_ROLLBACK_INITIATED = 9;
6989        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
6990        INSTALLER_ROLLBACK_STAGED = 11;
6991        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
6992        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
6993        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
6994        INSTALLER_ROLLBACK_SUCCESS = 15;
6995        INSTALLER_ROLLBACK_FAILURE = 16;
6996        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
6997        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
6998        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
6999        INSTALL_STAGED_CANCEL_REQUESTED = 20;
7000        INSTALL_STAGED_CANCEL_SUCCESS = 21;
7001        INSTALL_STAGED_CANCEL_FAILURE = 22;
7002        INSTALL_FAILURE_DOWNLOAD = 23;
7003        INSTALL_FAILURE_STATE_MISMATCH = 24;
7004        INSTALL_FAILURE_COMMIT = 25;
7005    }
7006    optional Status status = 4;
7007}
7008
7009/**
7010 * Logs the gesture stage changed event.
7011 *
7012 * Logged from:
7013 *   frameworks/base/packages/SystemUI/
7014 */
7015message AssistGestureStageReported {
7016    optional android.hardware.sensor.assist.AssistGestureStageEnum gesture_stage = 1;
7017}
7018
7019/**
7020 * Logs the feedback type.
7021 *
7022 * Logged from:
7023 *   frameworks/base/packages/SystemUI/
7024 */
7025message AssistGestureFeedbackReported {
7026    // Whether or not the gesture was used.
7027    optional android.hardware.sensor.assist.AssistGestureFeedbackEnum feedback_type = 1;
7028}
7029
7030/**
7031 * Logs the progress.
7032 *
7033 * Logged from:
7034 *   frameworks/base/packages/SystemUI/
7035 */
7036message AssistGestureProgressReported {
7037    // [0,100] progress for the assist gesture.
7038    optional int32 progress = 1;
7039}
7040
7041/*
7042 * Information about the time zone data on a device.
7043 */
7044message TimeZoneDataInfo {
7045    // A version identifier for the data set on device. e.g. "2018i"
7046    optional string tzdb_version = 1;
7047}
7048
7049/**
7050 * Logs the GPU stats global health information.
7051 *
7052 * Logged from:
7053 *   frameworks/native/services/gpuservice/gpustats/
7054 */
7055message GpuStatsGlobalInfo {
7056    // Package name of the gpu driver.
7057    optional string driver_package_name = 1;
7058
7059    // Version name of the gpu driver.
7060    optional string driver_version_name = 2;
7061
7062    // Version code of the gpu driver.
7063    optional int64 driver_version_code = 3;
7064
7065    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
7066    optional int64 driver_build_time = 4;
7067
7068    // Total count of the gl driver gets loaded.
7069    optional int64 gl_loading_count = 5;
7070
7071    // Total count of the gl driver fails to be loaded.
7072    optional int64 gl_loading_failure_count = 6;
7073
7074    // Total count of the Vulkan driver gets loaded.
7075    optional int64 vk_loading_count = 7;
7076
7077    // Total count of the Vulkan driver fails to be loaded.
7078    optional int64 vk_loading_failure_count = 8;
7079
7080    // Api version of the system Vulkan driver.
7081    optional int32 vulkan_version = 9;
7082
7083    // Api version of the system CPU Vulkan driver.
7084    optional int32 cpu_vulkan_version = 10;
7085
7086    // Api version of the system GLES driver.
7087    optional int32 gles_version = 11;
7088
7089    // Total count of the angle driver gets loaded.
7090    optional int64 angle_loading_count = 12;
7091
7092    // Total count of the angle driver fails to be loaded.
7093    optional int64 angle_loading_failure_count = 13;
7094}
7095
7096/**
7097 * GPU driver loading time info.
7098 */
7099message GpuDriverLoadingTime {
7100    // List of all the driver loading times for this app. The list size is
7101    // capped at 50.
7102    repeated int64 driver_loading_time = 1;
7103}
7104
7105/**
7106 * Logs the GPU stats per app health information.
7107 *
7108 * Logged from:
7109 *   frameworks/native/services/gpuservice/gpustats/
7110 */
7111message GpuStatsAppInfo {
7112    // Package name of the application that loads the gpu driver. Total number
7113    // of different packages is capped at 100.
7114    optional string app_package_name = 1;
7115
7116    // Version code of the gpu driver this app loads.
7117    optional int64 driver_version_code = 2;
7118
7119    // gl driver loading time info.
7120    optional GpuDriverLoadingTime gl_driver_loading_time = 3
7121            [(android.os.statsd.log_mode) = MODE_BYTES];
7122
7123    // Vulkan driver loading time info.
7124    optional GpuDriverLoadingTime vk_driver_loading_time = 4
7125            [(android.os.statsd.log_mode) = MODE_BYTES];
7126
7127    // Angle driver loading time info.
7128    optional GpuDriverLoadingTime angle_driver_loading_time = 5
7129            [(android.os.statsd.log_mode) = MODE_BYTES];
7130
7131    // CPU Vulkan implementation is in use.
7132    optional bool cpu_vulkan_in_use = 6;
7133}
7134
7135/*
7136 * Logs the size of the system ion heap.
7137 *
7138 * Pulled from StatsCompanionService.
7139 */
7140message SystemIonHeapSize {
7141    // Size of the system ion heap in bytes.
7142    optional int64 size_in_bytes = 1;
7143}
7144
7145/*
7146 * Logs the per-process size of the system ion heap.
7147 *
7148 * Pulled from StatsCompanionService.
7149 */
7150message ProcessSystemIonHeapSize {
7151    // The uid if available. -1 means not available.
7152    optional int32 uid = 1 [(is_uid) = true];
7153
7154    // The process name (from /proc/PID/cmdline).
7155    optional string process_name = 2;
7156
7157    // Sum of sizes of all allocations.
7158    optional int32 total_size_in_kilobytes = 3;
7159
7160    // Number of allocations.
7161    optional int32 allocation_count = 4;
7162
7163    // Size of the largest allocation.
7164    optional int32 max_size_in_kilobytes = 5;
7165}
7166
7167/**
7168 * Push network stack events.
7169 *
7170 * Log from:
7171 *     frameworks/base/packages/NetworkStack/
7172 */
7173message NetworkStackReported {
7174    // The id that indicates the event reported from NetworkStack.
7175    optional int32 event_id = 1;
7176    // The data for the reported events.
7177    optional android.stats.connectivity.NetworkStackEventData network_stack_event = 2 [(log_mode) = MODE_BYTES];
7178}
7179
7180/**
7181 * Logs the apps that are installed on the external storage.
7182 * Pulled from:
7183 *   StatsCompanionService
7184 */
7185message AppsOnExternalStorageInfo {
7186    // The type of the external storage.
7187    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
7188    // The name of the package that is installed on the external storage.
7189    optional string package_name = 2;
7190}
7191
7192/**
7193 * Logs the settings related to Face.
7194 * Logged from:
7195 *   frameworks/base/services/core/java/com/android/server/stats
7196 */
7197message FaceSettings {
7198    // Whether or not face unlock is allowed on Keyguard.
7199    optional bool unlock_keyguard_enabled = 1;
7200    // Whether or not face unlock dismisses the Keyguard.
7201    optional bool unlock_dismisses_keyguard = 2;
7202    // Whether or not face unlock requires attention.
7203    optional bool unlock_attention_required = 3;
7204    // Whether or not face unlock is allowed for apps (through BiometricPrompt).
7205    optional bool unlock_app_enabled = 4;
7206    // Whether or not face unlock always requires user confirmation.
7207    optional bool unlock_always_require_confirmation = 5;
7208    // Whether or not a diverse set of poses are required during enrollment.
7209    optional bool unlock_diversity_required = 6;
7210}
7211
7212/**
7213 * Logs cooling devices maintained by the kernel.
7214 *
7215 * Pulled from StatsCompanionService.java
7216 */
7217message CoolingDevice {
7218    // The type of cooling device being reported. Eg. CPU, GPU...
7219    optional android.os.CoolingTypeEnum device_location = 1;
7220    // The name of the cooling device source. Eg. CPU0
7221    optional string device_name = 2;
7222    // Current throttle state of the cooling device. The value can any unsigned
7223    // integer between 0 and max_state defined in its driver. 0 means device is
7224    // not in throttling, higher value means deeper throttling.
7225    optional int32 state = 3;
7226}
7227
7228/**
7229 * Intelligence has several counter-type events that don't warrant a
7230 * full separate atom. These are primarily API call counters but also include
7231 * counters for feature usage and specific failure modes.
7232 *
7233 * Logged from the Intelligence mainline module.
7234 */
7235message IntelligenceEventReported {
7236  optional android.stats.intelligence.EventType event_id = 1;
7237  optional android.stats.intelligence.Status status = 2;
7238}
7239
7240/**
7241 * Logs when Car Power state changed.
7242 *
7243 * Logged from:
7244 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
7245 */
7246message CarPowerStateChanged {
7247    // States come from CpmsState in CarPowerManagementService.java.
7248    enum State {
7249       WAIT_FOR_VHAL = 0;
7250       ON = 1;
7251       SHUTDOWN_PREPARE = 2;
7252       WAIT_FOR_FINISH = 3;
7253       SUSPEND = 4;
7254       SIMULATE_SLEEP = 5;
7255    }
7256    optional State state = 1;
7257}
7258
7259/**
7260 * Logs whether GarageMode is entered.
7261 *
7262 * Logged from:
7263 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
7264 */
7265message GarageModeInfo {
7266    // Whether GarageMode is entered.
7267    optional bool is_garage_mode = 1;
7268}
7269
7270/**
7271 * Historical app ops data per package.
7272 */
7273message AppOps {
7274    // Uid of the package requesting the op
7275    optional int32 uid = 1 [(is_uid) = true];
7276
7277    // Nmae of the package performing the op
7278    optional string package_name = 2;
7279
7280    // operation id; maps to the OP_* constants in AppOpsManager.java
7281    optional int32 op_id = 3;
7282
7283    // The number of times the op was granted while the app was in the
7284    // foreground (only for trusted requests)
7285    optional int64 trusted_foreground_granted_count = 4;
7286
7287    // The number of times the op was granted while the app was in the
7288    // background (only for trusted requests)
7289    optional int64 trusted_background_granted_count = 5;
7290
7291    // The number of times the op was rejected while the app was in the
7292    // foreground (only for trusted requests)
7293    optional int64 trusted_foreground_rejected_count = 6;
7294
7295    // The number of times the op was rejected while the app was in the
7296    // background (only for trusted requests)
7297    optional int64 trusted_background_rejected_count = 7;
7298
7299    // For long-running operations, total duration of the operation
7300    // while the app was in the foreground (only for trusted requests)
7301    optional int64 trusted_foreground_duration_millis = 8;
7302
7303    // For long-running operations, total duration of the operation
7304    // while the app was in the background (only for trusted requests)
7305    optional int64 trusted_background_duration_millis = 9;
7306}
7307
7308/**
7309 * Location Manager API Usage information(e.g. API under usage,
7310 * API call's parameters).
7311 * Logged from:
7312 *  frameworks/base/services/core/java/com/android/server/LocationManagerService.java
7313 */
7314message LocationManagerApiUsageReported {
7315
7316    // Indicating if usage starts or usage ends.
7317    optional android.stats.location.UsageState state = 1;
7318
7319    // LocationManagerService's API in use.
7320    // We can identify which API from LocationManager is
7321    // invoking current LMS API by the combination of
7322    // API parameter(e.g. is_listener_null, is_intent_null,
7323    // is_location_request_null)
7324    optional android.stats.location.LocationManagerServiceApi api_in_use = 2;
7325
7326    // Name of the package calling the API.
7327    optional string calling_package_name = 3;
7328
7329    // Type of the location provider.
7330    optional android.stats.location.ProviderType provider = 4;
7331
7332    // Quality of the location request
7333    optional android.stats.location.LocationRequestQuality quality = 5;
7334
7335    // The desired interval for active location updates, in milliseconds.
7336    // Bucketized to reduce cardinality.
7337    optional android.stats.location.LocationRequestIntervalBucket bucketized_interval = 6;
7338
7339    // Minimum distance between location updates, in meters.
7340    // Bucketized to reduce cardinality.
7341    optional android.stats.location.SmallestDisplacementBucket
7342            bucketized_smallest_displacement = 7;
7343
7344    // The number of location updates.
7345    optional int64 num_updates = 8;
7346
7347    // The request expiration time, in millisecond since boot.
7348    // Bucketized to reduce cardinality.
7349    optional android.stats.location.ExpirationBucket
7350            bucketized_expire_in = 9;
7351
7352    // Type of Callback passed in for this API.
7353    optional android.stats.location.CallbackType callback_type = 10;
7354
7355    // The radius of the central point of the alert
7356    // region, in meters. Only for API REQUEST_GEOFENCE.
7357    // Bucketized to reduce cardinality.
7358    optional android.stats.location.GeofenceRadiusBucket bucketized_radius = 11;
7359
7360    // Activity Importance of API caller.
7361    // Categorized to 3 types that are interesting from location's perspective.
7362    optional android.stats.location.ActivityImportance activiy_importance = 12;
7363}
7364
7365/**
7366 * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
7367 */
7368message ReviewPermissionsFragmentResultReported {
7369    // unique value identifying a permission group change. A permission group change might result
7370    // in multiple of these atoms
7371    optional int64 change_id = 1;
7372
7373    // UID of package the permission belongs to
7374    optional int32 uid = 2 [(is_uid) = true];
7375
7376    // Name of package the permission belongs to
7377    optional string package_name = 3;
7378
7379    // The permission to be granted
7380    optional string permission_name = 4;
7381
7382    // The result of the permission grant
7383    optional bool permission_granted = 5;
7384}
7385
7386/**
7387* Information about results of permission upgrade by RuntimePermissionsUpgradeController
7388* Logged from: RuntimePermissionUpdgradeController
7389*/
7390message RuntimePermissionsUpgradeResult {
7391    // Permission granted as result of upgrade
7392    optional string permission_name = 1;
7393
7394    // UID of package granted permission
7395    optional int32 uid = 2 [(is_uid) = true];
7396
7397    // Name of package granted permission
7398    optional string package_name = 3;
7399}
7400
7401/**
7402* Information about a buttons presented in GrantPermissionsActivty and choice made by user
7403*/
7404message GrantPermissionsActivityButtonActions {
7405    // Permission granted as result of upgrade
7406    optional string permission_group_name = 1;
7407
7408    // UID of package granted permission
7409    optional int32 uid = 2 [(is_uid) = true];
7410
7411    // Name of package requesting permission
7412    optional string package_name = 3;
7413
7414    // Buttons presented in the dialog - bit flags, bit numbers are in accordance with
7415    // LABEL_ constants in GrantPermissionActivity.java
7416    optional int32 buttons_presented = 4;
7417
7418    // Button clicked by user - same as bit flags in buttons_presented with only single bit set
7419    optional int32 button_clicked = 5;
7420}
7421
7422/**
7423 * Information about LocationAccessCheck notification presented to user
7424 */
7425message LocationAccessCheckNotificationAction {
7426
7427    // id which identifies single session of user interacting with permission controller
7428    optional int64 session_id = 1;
7429
7430    // Uid of package for which location access check is presented
7431    optional int32 package_uid = 2;
7432
7433    // Name of package for which location access check is presented
7434    optional string package_name = 3;
7435
7436    enum Result {
7437        UNDEFINED = 0;
7438        // notification was presented to the user
7439        NOTIFICATION_PRESENTED = 1;
7440        // notification was declined by the user
7441        NOTIFICATION_DECLINED = 2;
7442        // notification was clicked by the user
7443        NOTIFICATION_CLICKED = 3;
7444    }
7445
7446    // View / interaction recorded
7447    optional Result result = 4;
7448}
7449
7450/**
7451 * Information about a permission grant or revoke made by user inside AppPermissionFragment
7452 */
7453message AppPermissionFragmentActionReported {
7454    // id which identifies single session of user interacting with permission controller
7455    optional int64 session_id = 1;
7456
7457    // unique value identifying a permission group change. A permission group change might result
7458    // in multiple of these atoms
7459    optional int64 change_id = 2;
7460
7461    // UID of package the permission belongs to
7462    optional int32 uid = 3 [(is_uid) = true];
7463
7464    // Name of package the permission belongs to
7465    optional string package_name = 4;
7466
7467    // The permission to be granted
7468    optional string permission_name = 5;
7469
7470    // The result of the permission grant
7471    optional bool permission_granted = 6;
7472}
7473
7474/**
7475* Information about a AppPermissionFragment viewed by user
7476*/
7477message AppPermissionFragmentViewed {
7478    // id which identifies single session of user interacting with permission controller
7479    optional int64 session_id = 1;
7480
7481    // UID of package for which permissions are viewed
7482    optional int32 uid = 2 [(is_uid) = true];
7483
7484    // Name of package for which permissions are viewed
7485    optional string package_name = 3;
7486
7487    // Permission group viewed
7488    optional string permission_group_name = 4;
7489}
7490
7491/**
7492* Information about a AppPermissionsFragment viewed by user
7493*/
7494message AppPermissionsFragmentViewed {
7495    // id which identifies single session of user interacting with permission controller
7496    optional int64 session_id = 1;
7497
7498    // id which identifies single view as every view might have several logging records
7499    // with different package information attached
7500    optional int64 view_id = 2;
7501
7502    // Permission group viewed
7503    optional string permission_group_name = 3;
7504
7505    // UID of package for which permissions are viewed
7506    optional int32 uid = 4 [(is_uid) = true];
7507
7508    // Name of package for which permissions are viewed
7509    optional string package_name = 5;
7510
7511    // Category in which permission is included
7512    enum Category {
7513      UNDEFINED = 0;
7514      ALLOWED = 1;
7515      ALLOWED_FOREGROUND = 2;
7516      DENIED = 3;
7517    }
7518    optional Category category = 6;
7519}
7520
7521/**
7522* Information about a PermissionAppsFragment viewed by user.
7523* Logged from ui/handheld/PermissionAppsFragment.java
7524*/
7525message PermissionAppsFragmentViewed {
7526    // id which identifies single session of user interacting with permission controller
7527    optional int64 session_id = 1;
7528
7529    // id which identifies single view as every view might have several logging records
7530    // with different package information attached
7531    optional int64 view_id = 2;
7532
7533    // Permission group viewed
7534    optional string permission_group_name = 3;
7535
7536    // UID of package for which permissions are viewed
7537    optional int32 uid = 4 [(is_uid) = true];
7538
7539    // Name of package for which permissions are viewed
7540    optional string package_name = 5;
7541
7542    // Category in which app is included
7543    enum Category {
7544        UNDEFINED = 0;
7545        ALLOWED = 1;
7546        ALLOWED_FOREGROUND = 2;
7547        DENIED = 3;
7548    }
7549    optional Category category = 6;
7550}
7551
7552/**
7553 * Logs when a compatibility change is affecting an app.
7554 *
7555 * Logged from:
7556 *   frameworks/base/core/java/android/app/AppCompatCallbacks.java and
7557 *   frameworks/base/services/core/java/com/android/server/compat/PlatformCompat.java
7558 */
7559message AppCompatibilityChangeReported {
7560    // The UID of the app being affected by the compatibilty change.
7561    optional int32 uid = 1 [(is_uid) = true];
7562
7563    // The ID of the change affecting the app.
7564    optional int64 change_id = 2;
7565
7566    enum State {
7567        UNKNOWN_STATE = 0;
7568        ENABLED = 1;
7569        DISABLED = 2;
7570        LOGGED = 3;
7571    }
7572
7573    // The state of the change - if logged from gating whether it was enabled or disabled, or just
7574    // logged otherwise.
7575    optional State state = 3;
7576
7577    enum Source {
7578        UNKNOWN_SOURCE = 0;
7579        APP_PROCESS = 1;
7580        SYSTEM_SERVER = 2;
7581    }
7582
7583    // Where it was logged from.
7584    optional Source source = 4;
7585}
7586
7587/**
7588 * Logged from
7589 *     external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
7590 */
7591message PerfettoUploaded {
7592    enum Event {
7593        PERFETTO_UNDEFINED = 0;
7594        PERFETTO_TRACE_BEGIN = 1;
7595        PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
7596        PERFETTO_ON_CONNECT = 3;
7597        PERFETTO_ON_TRACING_DISABLED = 4;
7598        PERFETTO_UPLOAD_DROPBOX_BEGIN = 5;
7599        PERFETTO_UPLOAD_DROPBOX_SUCCESS = 6;
7600        PERFETTO_UPLOAD_DROPBOX_FAILURE = 7;
7601        PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
7602        PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9;
7603        PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
7604        PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
7605        PERFETTO_TRIGGER_BEGIN = 12;
7606        PERFETTO_TRIGGER_SUCCESS = 13;
7607        PERFETTO_TRIGGER_FAILURE = 14;
7608        PERFETTO_HIT_GUARDRAILS = 15;
7609        PERFETTO_ON_TIMEOUT = 16;
7610        PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
7611    }
7612
7613    // Which stage of the pipeline we are reporting from.
7614    optional Event event = 1;
7615
7616    // UUID matching the one set inside the SystemInfo trace packet.
7617    optional int64 trace_uuid_lsb = 2;
7618    optional int64 trace_uuid_msb = 3;
7619}
7620
7621/**
7622 * Pulls client metrics on data transferred via Vehicle Maps Service.
7623 * Metrics are keyed by uid + layer.
7624 *
7625 * Pulled from:
7626 *   packages/services/Car/service/src/com/android/car/stats/CarStatsService.java
7627 */
7628message VmsClientStats {
7629    // UID of the VMS client app
7630    optional int32 uid = 1 [(is_uid) = true];
7631
7632    // VMS layer definition
7633    optional int32 layer_type = 2;
7634    optional int32 layer_channel = 3;
7635    optional int32 layer_version = 4;
7636
7637    // Bytes and packets sent by the client for the layer
7638    optional int64 tx_bytes = 5;
7639    optional int64 tx_packets = 6;
7640
7641    // Bytes and packets received by the client for the layer
7642    optional int64 rx_bytes = 7;
7643    optional int64 rx_packets = 8;
7644
7645    // Bytes and packets dropped due to client error
7646    optional int64 dropped_bytes = 9;
7647    optional int64 dropped_packets = 10;
7648}
7649
7650/**
7651 * Information about an OTA update attempt by update_engine.
7652 * Logged from platform/system/update_engine/metrics_reporter_android.cc
7653 */
7654message UpdateEngineUpdateAttemptReported {
7655    // The number of attempts for the update engine to apply a given payload.
7656    optional int32 attempt_number = 1;
7657
7658    optional android.stats.otaupdate.PayloadType payload_type = 2;
7659
7660    // The total time in minutes for the update engine to apply a given payload.
7661    // The time is calculated by calling clock_gettime() / CLOCK_BOOTTIME; and
7662    // it's increased when the system is sleeping.
7663    optional int32 duration_boottime_in_minutes = 3;
7664
7665    // The total time in minutes for the update engine to apply a given payload.
7666    // The time is calculated by calling clock_gettime() / CLOCK_MONOTONIC_RAW;
7667    // and it's not increased when the system is sleeping.
7668    optional int32 duration_monotonic_in_minutes = 4;
7669
7670    // The size of the payload in MiBs.
7671    optional int32 payload_size_mib = 5;
7672
7673    // The attempt result reported by the update engine for an OTA update.
7674    optional android.stats.otaupdate.AttemptResult attempt_result = 6;
7675
7676    // The error code reported by the update engine after an OTA update attempt
7677    // on A/B devices.
7678    optional android.stats.otaupdate.ErrorCode error_code = 7;
7679
7680    // The build fingerprint of the source system. The value is read from a
7681    // system property when the device takes the update. e.g.
7682    // Android/aosp_sailfish/sailfish:10/QP1A.190425.004/5507117:userdebug/test-keys
7683    optional string source_fingerprint = 8;
7684}
7685
7686/**
7687 * Information about all the attempts the device make before finishing the
7688 * successful update.
7689 * Logged from platform/system/update_engine/metrics_reporter_android.cc
7690 */
7691message UpdateEngineSuccessfulUpdateReported {
7692    // The number of attempts for the update engine to apply the payload for a
7693    // successful update.
7694    optional int32 attempt_count = 1;
7695
7696    optional android.stats.otaupdate.PayloadType payload_type = 2;
7697
7698    optional int32 payload_size_mib = 3;
7699
7700    // The total number of bytes downloaded by update_engine since the last
7701    // successful update.
7702    optional int32 total_bytes_downloaded_mib = 4;
7703
7704    // The ratio in percentage of the over-downloaded bytes compared to the
7705    // total bytes needed to successfully install the update. e.g. 200 if we
7706    // download 200MiB in total for a 100MiB package.
7707    optional int32 download_overhead_percentage = 5;
7708
7709    // The total time in minutes for the update engine to apply the payload for a
7710    // successful update.
7711    optional int32 total_duration_minutes = 6;
7712
7713    // The number of reboot of the device during a successful update.
7714    optional int32 reboot_count = 7;
7715}
7716
7717/*
7718 * Logs userspace reboot outcome and duration.
7719 *
7720 * Logged from:
7721 *   frameworks/base/core/java/com/android/server/BootReceiver.java
7722 */
7723message UserspaceRebootReported {
7724    // Possible outcomes of userspace reboot.
7725    enum Outcome {
7726        // Default value in case platform failed to determine the outcome.
7727        OUTCOME_UNKNOWN = 0;
7728        // Userspace reboot succeeded (i.e. boot completed without a fall back to hard reboot).
7729        SUCCESS = 1;
7730        // Userspace reboot shutdown sequence was aborted.
7731        FAILED_SHUTDOWN_SEQUENCE_ABORTED = 2;
7732        // Remounting userdata into checkpointing mode failed.
7733        FAILED_USERDATA_REMOUNT = 3;
7734        // Device didn't finish booting before timeout and userspace reboot watchdog issued a hard
7735        // reboot.
7736        FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED = 4;
7737    }
7738    // Outcome of userspace reboot. Always set.
7739    optional Outcome outcome = 1;
7740    // Duration of userspace reboot in case it has a successful outcome.
7741    // Duration is measured as time between userspace reboot was initiated and until boot completed
7742    // (e.g. sys.boot_completed=1).
7743    optional int64 duration_millis = 2;
7744    // State of primary user's (user0) credential encryption storage.
7745    enum UserEncryptionState {
7746        // Default value.
7747        USER_ENCRYPTION_STATE_UNKNOWN = 0;
7748        // Credential encrypted storage is unlocked.
7749        UNLOCKED = 1;
7750        // Credential encrypted storage is locked.
7751        LOCKED = 2;
7752    }
7753    // State of primary user's encryption storage at the moment boot completed. Always set.
7754    optional UserEncryptionState user_encryption_state = 3;
7755}
7756
7757/**
7758 * Pulls information for a single voice call.
7759 *
7760 * Each pull creates multiple atoms, one for each call. The sequence is randomized when pulled.
7761 *
7762 * Pulled from:
7763 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
7764 */
7765message VoiceCallSession {
7766    // Bearer (IMS or CS) when the call started.
7767    optional android.telephony.CallBearerEnum bearer_at_start = 1;
7768
7769    // Bearer (IMS or CS) when the call ended.
7770    // The bearer may change during the call, e.g. due to SRVCC.
7771    optional android.telephony.CallBearerEnum bearer_at_end = 2;
7772
7773    // Direction of the call (incoming or outgoing).
7774    optional android.telephony.CallDirectionEnum direction = 3;
7775
7776    // Time spent setting up the call.
7777    optional android.telephony.CallSetupDurationEnum setup_duration = 4;
7778
7779    // Whether the call ended before the setup was completed.
7780    optional bool setup_failed = 5;
7781
7782    // IMS reason code or CS disconnect cause.
7783    // For IMS, see: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
7784    // For CS, see: frameworks/base/telephony/java/android/telephony/DisconnectCause.java
7785    optional int32 disconnect_reason_code = 6;
7786
7787    // IMS extra code or CS precise disconnect cause.
7788    // For IMS, this code is vendor-specific
7789    // For CS, see: frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java
7790    optional int32 disconnect_extra_code = 7;
7791
7792    // IMS extra message or CS vendor cause.
7793    optional string disconnect_extra_message = 8;
7794
7795    // Radio access technology (RAT) used when call started.
7796    optional android.telephony.NetworkTypeEnum rat_at_start = 9;
7797
7798    // Radio access technology (RAT) used when call terminated.
7799    optional android.telephony.NetworkTypeEnum rat_at_end = 10;
7800
7801    // Number of times RAT changed during the call.
7802    optional int64 rat_switch_count = 11;
7803
7804    // A bitmask of all codecs used during the call.
7805    // See: frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java
7806    optional int64 codec_bitmask = 12;
7807
7808    // Number of other calls going on during call setup, for the same SIM slot.
7809    optional int32 concurrent_call_count_at_start = 13;
7810
7811    // Number of other calls going on during call termination, for the same SIM slot.
7812    optional int32 concurrent_call_count_at_end = 14;
7813
7814    // Index of the SIM is used, 0 for single-SIM devices.
7815    optional int32 sim_slot_index = 15;
7816
7817    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
7818    optional bool is_multi_sim = 16;
7819
7820    // Whether the call was made with an eSIM profile.
7821    optional bool is_esim = 17;
7822
7823    // Carrier ID of the SIM card.
7824    // See https://source.android.com/devices/tech/config/carrierid.
7825    optional int32 carrier_id = 18;
7826
7827    // Whether an SRVCC has been completed successfully for this call.
7828    optional bool srvcc_completed = 19;
7829
7830    // Number of SRVCC failures.
7831    optional int64 srvcc_failure_count = 20;
7832
7833    // Number of SRVCC cancellations.
7834    optional int64 srvcc_cancellation_count = 21;
7835
7836    // Whether the Real-Time Text (RTT) was ever used in the call (rather than whether RTT was
7837    // enabled in the dialer's settings).
7838    optional bool rtt_enabled = 22;
7839
7840    // Whether this was an emergency call.
7841    optional bool is_emergency = 23;
7842
7843    // Whether the call was performed while roaming.
7844    optional bool is_roaming = 24;
7845
7846    // A random number used as the dimension field to pull multiple atoms.
7847    optional int32 dimension = 25;
7848}
7849
7850/**
7851 * Pulls voice call radio access technology (RAT) usage.
7852 *
7853 * Each pull creates multiple atoms, one for each carrier/RAT, the order of which is irrelevant to
7854 * time. The atom will be skipped if not enough data is available.
7855 *
7856 * Pulled from:
7857 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
7858 */
7859message VoiceCallRatUsage {
7860    // Carrier ID (https://source.android.com/devices/tech/config/carrierid).
7861    optional int32 carrier_id = 1;
7862
7863    // Radio access technology.
7864    optional android.telephony.NetworkTypeEnum rat = 2;
7865
7866    // Total duration that voice calls spent on this carrier and RAT.
7867    optional int64 total_duration_seconds = 3;
7868
7869    // Total number of calls using this carrier and RAT.
7870    // A call is counted once even if it used the RAT multiple times.
7871    optional int64 call_count = 4;
7872}
7873
7874/**
7875 * Pulls the number of active SIM slots and SIMs/eSIM profiles.
7876 *
7877 * Pulled from:
7878 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
7879 */
7880message SimSlotState {
7881    // Number of active SIM slots (both physical and eSIM profiles) in the device.
7882    optional int32 active_slot_count = 1;
7883
7884    // Number of SIM cards (both physical and active eSIM profiles).
7885    // This number is always equal to or less than the number of active SIM slots.
7886    optional int32 sim_count = 2;
7887
7888    // Number of active eSIM profiles.
7889    // This number is always equal to or less than the number of SIMs.
7890    optional int32 esim_count = 3;
7891}
7892
7893/**
7894 * Pulls supported cellular radio access technologies.
7895 *
7896 * This atom reports the capabilities of the device, rather than the network it has access to.
7897 *
7898 * Pulled from:
7899 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
7900 */
7901message SupportedRadioAccessFamily {
7902    // A bitmask of supported radio technologies.
7903    // See android.telephony.TelephonyManager.NetworkTypeBitMask.
7904    optional int64 network_type_bitmask = 1;
7905}
7906