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;
20
21option optimize_for = CODE_SIZE;
22option java_package = "com.android.os";
23option java_outer_classname = "AtomsProto";
24
25import "frameworks/proto_logging/stats/attribution_node.proto";
26import "frameworks/proto_logging/stats/atoms/adpf/adpf_atoms.proto";
27import "frameworks/proto_logging/stats/atoms/agif/agif_atoms.proto";
28import "frameworks/proto_logging/stats/atoms/corenetworking/connectivity/connectivity_atoms.proto";
29import "frameworks/proto_logging/stats/atoms/display/display_atoms.proto";
30import "frameworks/proto_logging/stats/atoms/dnd/dnd_atoms.proto";
31import "frameworks/proto_logging/stats/atoms/gps/gps_atoms.proto";
32import "frameworks/proto_logging/stats/atoms/hardware/biometrics/biometrics_atoms.proto";
33import "frameworks/proto_logging/stats/atoms/hotword/hotword_atoms.proto";
34import "frameworks/proto_logging/stats/atoms/input/input_atoms.proto";
35import "frameworks/proto_logging/stats/atoms/kernel/kernel_atoms.proto";
36import "frameworks/proto_logging/stats/atoms/locale/locale_atoms.proto";
37import "frameworks/proto_logging/stats/atoms/location/location_atoms.proto";
38import "frameworks/proto_logging/stats/atoms/media/media_drm_atoms.proto";
39import "frameworks/proto_logging/stats/atoms/wearsysui/wearsysui_atoms.proto";
40import "frameworks/proto_logging/stats/atoms/providers/mediaprovider/media_provider_atoms.proto";
41import "frameworks/proto_logging/stats/atoms/sysui/sysui_atoms.proto";
42import "frameworks/proto_logging/stats/atoms/usb/usb_atoms.proto";
43import "frameworks/proto_logging/stats/atoms/view/inputmethod/inputmethod_atoms.proto";
44import "frameworks/proto_logging/stats/atom_field_options.proto";
45import "frameworks/proto_logging/stats/enums/adservices/fledge/enums.proto";
46import "frameworks/proto_logging/stats/enums/adservices/measurement/enums.proto";
47import "frameworks/proto_logging/stats/enums/anr/enums.proto";
48import "frameworks/proto_logging/stats/enums/app/app_enums.proto";
49import "frameworks/proto_logging/stats/enums/app/job/job_enums.proto";
50import "frameworks/proto_logging/stats/enums/app/remoteprovisioner_enums.proto";
51import "frameworks/proto_logging/stats/enums/app/settings_enums.proto";
52import "frameworks/proto_logging/stats/enums/app/wearservices/wearservices_enums.proto";
53import "frameworks/proto_logging/stats/enums/app/tvsettings_enums.proto";
54import "frameworks/proto_logging/stats/enums/app/wearsettings_enums.proto";
55import "frameworks/proto_logging/stats/enums/autofill/enums.proto";
56import "frameworks/proto_logging/stats/enums/bluetooth/a2dp/enums.proto";
57import "frameworks/proto_logging/stats/enums/bluetooth/enums.proto";
58import "frameworks/proto_logging/stats/enums/bluetooth/hci/enums.proto";
59import "frameworks/proto_logging/stats/enums/bluetooth/hfp/enums.proto";
60import "frameworks/proto_logging/stats/enums/bluetooth/leaudio/enums.proto";
61import "frameworks/proto_logging/stats/enums/bluetooth/smp/enums.proto";
62import "frameworks/proto_logging/stats/enums/contexthub/enums.proto";
63import "frameworks/proto_logging/stats/enums/debug/enums.proto";
64import "frameworks/proto_logging/stats/enums/display/display_enums.proto";
65import "frameworks/proto_logging/stats/enums/hardware/biometrics/enums.proto";
66import "frameworks/proto_logging/stats/enums/jank/enums.proto";
67import "frameworks/proto_logging/stats/enums/media/audio/enums.proto";
68import "frameworks/proto_logging/stats/enums/media/midi/enums.proto";
69import "frameworks/proto_logging/stats/enums/media/outputswitcher/enums.proto";
70import "frameworks/proto_logging/stats/enums/media/enums.proto";
71import "frameworks/proto_logging/stats/enums/mms/enums.proto";
72import "frameworks/proto_logging/stats/enums/nearby/enums.proto";
73import "frameworks/proto_logging/stats/enums/net/enums.proto";
74import "frameworks/proto_logging/stats/enums/neuralnetworks/enums.proto";
75import "frameworks/proto_logging/stats/enums/nfc/enums.proto";
76import "frameworks/proto_logging/stats/enums/os/enums.proto";
77import "frameworks/proto_logging/stats/enums/server/connectivity/data_stall_event.proto";
78import "frameworks/proto_logging/stats/enums/server/display/enums.proto";
79import "frameworks/proto_logging/stats/enums/server/enums.proto";
80import "frameworks/proto_logging/stats/enums/server/job/enums.proto";
81import "frameworks/proto_logging/stats/enums/server/location/enums.proto";
82import "frameworks/proto_logging/stats/enums/service/enums.proto";
83import "frameworks/proto_logging/stats/enums/service/procstats_enum.proto";
84import "frameworks/proto_logging/stats/enums/stats/connectivity/connectivity_service.proto";
85import "frameworks/proto_logging/stats/enums/stats/connectivity/network_stack.proto";
86import "frameworks/proto_logging/stats/enums/stats/connectivity/tethering.proto";
87import "frameworks/proto_logging/stats/enums/stats/dnsresolver/dns_resolver.proto";
88import "frameworks/proto_logging/stats/enums/stats/devicepolicy/device_policy.proto";
89import "frameworks/proto_logging/stats/enums/stats/devicepolicy/device_policy_enums.proto";
90import "frameworks/proto_logging/stats/enums/stats/docsui/docsui_enums.proto";
91import "frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto";
92import "frameworks/proto_logging/stats/enums/stats/enums.proto";
93import "frameworks/proto_logging/stats/enums/stats/hdmi/enums.proto";
94import "frameworks/proto_logging/stats/enums/stats/intelligence/enums.proto";
95import "frameworks/proto_logging/stats/enums/stats/location/location_enums.proto";
96import "frameworks/proto_logging/stats/enums/stats/mediametrics/mediametrics.proto";
97import "frameworks/proto_logging/stats/enums/stats/mediaprovider/mediaprovider_enums.proto";
98import "frameworks/proto_logging/stats/enums/stats/mobiledatadownload/enums.proto";
99import "frameworks/proto_logging/stats/enums/stats/privacysignals/enums.proto";
100import "frameworks/proto_logging/stats/enums/stats/safetycenter/enums.proto";
101import "frameworks/proto_logging/stats/enums/stats/storage/storage_enums.proto";
102import "frameworks/proto_logging/stats/enums/stats/style/style_enums.proto";
103import "frameworks/proto_logging/stats/enums/stats/sysui/notification_enums.proto";
104import "frameworks/proto_logging/stats/enums/stats/tls/enums.proto";
105import "frameworks/proto_logging/stats/enums/stats/tv/tif_enums.proto";
106import "frameworks/proto_logging/stats/enums/stats/wm/enums.proto";
107import "frameworks/proto_logging/stats/enums/system/security/keystore2/enums.proto";
108import "frameworks/proto_logging/stats/enums/telecomm/enums.proto";
109import "frameworks/proto_logging/stats/enums/telephony/enums.proto";
110import "frameworks/proto_logging/stats/enums/transparency/enums.proto";
111import "frameworks/proto_logging/stats/enums/uwb/enums.proto";
112import "frameworks/proto_logging/stats/enums/view/enums.proto";
113import "frameworks/proto_logging/stats/enums/wifi/enums.proto";
114import "frameworks/proto_logging/stats/enums/stats/textclassifier/textclassifier_enums.proto";
115import "frameworks/proto_logging/stats/enums/stats/otaupdate/updateengine_enums.proto";
116import "frameworks/proto_logging/stats/message/mediametrics_message.proto";
117import "frameworks/proto_logging/stats/atoms/devicelogs/device_logs_atoms.proto";
118import "frameworks/proto_logging/stats/atoms/wearservices/wearservices_atoms.proto";
119import "frameworks/proto_logging/stats/atoms/wear/media/wear_media_atoms.proto";
120
121/**
122 * The primary atom class. This message defines all of the available
123 * raw stats log events from the Android system, also known as "atoms."
124 *
125 * This field contains a single oneof with all of the available messages.
126 * The stats-log-api-gen tool runs as part of the Android build and
127 * generates the android.util.StatsLog class, which contains the constants
128 * and methods that Android uses to log.
129 *
130 * This Atom class is not actually built into the Android system.
131 * Instead, statsd on Android constructs these messages synthetically,
132 * in the format defined here and in stats_log.proto.
133 */
134message Atom {
135    // Pushed atoms start at 2.
136    oneof pushed {
137        // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
138        BleScanStateChanged ble_scan_state_changed = 2
139                [(module) = "bluetooth", (module) = "statsdtest"];
140        ProcessStateChanged process_state_changed = 3 [(module) = "framework", deprecated = true];
141        BleScanResultReceived ble_scan_result_received = 4
142            [(module) = "bluetooth", (module) = "statsdtest"];
143        SensorStateChanged sensor_state_changed =
144                5 [(module) = "framework", (module) = "statsdtest"];
145        gps.GpsScanStateChanged gps_scan_state_changed = 6 [(module) = "framework"];
146        SyncStateChanged sync_state_changed = 7 [(module) = "framework", (module) = "statsdtest"];
147        ScheduledJobStateChanged scheduled_job_state_changed =
148                8 [(module) = "framework", (module) = "statsdtest"];
149        ScreenBrightnessChanged screen_brightness_changed =
150                9 [(module) = "framework", (module) = "statsdtest"];
151        WakelockStateChanged wakelock_state_changed =
152                10 [(module) = "framework", (module) = "statsdtest"];
153        LongPartialWakelockStateChanged long_partial_wakelock_state_changed =
154                11 [(module) = "framework"];
155        MobileRadioPowerStateChanged mobile_radio_power_state_changed =
156                12 [(module) = "framework", (truncate_timestamp) = true];
157        WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13 [(module) = "framework"];
158        ActivityManagerSleepStateChanged activity_manager_sleep_state_changed =
159                14 [(module) = "framework"];
160        MemoryFactorStateChanged memory_factor_state_changed = 15 [(module) = "framework"];
161        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16 [(module) = "framework"];
162        CachedKillReported cached_kill_reported = 17 [(module) = "framework", deprecated = true];
163        ProcessMemoryStatReported process_memory_stat_reported =
164                18 [(module) = "framework", deprecated = true];
165        sysui.LauncherUIChanged launcher_event = 19 [(module) = "sysui"];
166        BatterySaverModeStateChanged battery_saver_mode_state_changed =
167                20 [(module) = "framework", (module) = "statsdtest"];
168        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21 [(module) = "framework"];
169        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22 [(module) = "framework"];
170        AudioStateChanged audio_state_changed =
171                23 [(module) = "framework", (truncate_timestamp) = true];
172        MediaCodecStateChanged media_codec_state_changed = 24 [(module) = "framework"];
173        CameraStateChanged camera_state_changed = 25 [(module) = "framework"];
174        FlashlightStateChanged flashlight_state_changed = 26 [(module) = "framework"];
175        UidProcessStateChanged uid_process_state_changed =
176                27 [(module) = "framework", (module) = "statsdtest"];
177        ProcessLifeCycleStateChanged process_life_cycle_state_changed =
178                28 [(module) = "framework", (module) = "statsdtest"];
179        ScreenStateChanged screen_state_changed =
180                29 [(module) = "framework", (module) = "statsdtest"];
181        BatteryLevelChanged battery_level_changed =
182                30 [(module) = "framework", (module) = "statsdtest"];
183        ChargingStateChanged charging_state_changed = 31 [(module) = "framework"];
184        PluggedStateChanged plugged_state_changed = 32
185                [(module) = "framework", (module) = "statsdtest"];
186        InteractiveStateChanged interactive_state_changed = 33 [(module) = "framework"];
187        input.TouchEventReported touch_event_reported = 34;
188        WakeupAlarmOccurred wakeup_alarm_occurred = 35 [(module) = "framework"];
189        KernelWakeupReported kernel_wakeup_reported = 36 [(module) = "framework"];
190        WifiLockStateChanged wifi_lock_state_changed = 37 [(module) = "wifi"];
191        WifiSignalStrengthChanged wifi_signal_strength_changed = 38 [(module) = "wifi"];
192        WifiScanStateChanged wifi_scan_state_changed = 39 [(module) = "wifi"];
193        PhoneSignalStrengthChanged phone_signal_strength_changed =
194                40 [(module) = "framework", (module) = "statsdtest", (truncate_timestamp) = true];
195        SettingChanged setting_changed = 41 [(module) = "framework"];
196        ActivityForegroundStateChanged activity_foreground_state_changed =
197                42 [(module) = "framework", (module) = "statsdtest"];
198        IsolatedUidChanged isolated_uid_changed =
199                43 [(module) = "framework", (module) = "statsd", (module) = "statsdtest"];
200        PacketWakeupOccurred packet_wakeup_occurred = 44 [(module) = "framework"];
201        WallClockTimeShifted wall_clock_time_shifted = 45 [(module) = "framework"];
202        AnomalyDetected anomaly_detected = 46 [(module) = "statsd"];
203        AppBreadcrumbReported app_breadcrumb_reported = 47
204            [(module) = "statsd", (module) = "statsdtest"];
205        AppStartOccurred app_start_occurred = 48 [(module) = "framework", (module) = "statsdtest"];
206        AppStartCanceled app_start_canceled = 49 [(module) = "framework"];
207        AppStartFullyDrawn app_start_fully_drawn = 50 [(module) = "framework"];
208        LmkKillOccurred lmk_kill_occurred = 51 [(module) = "framework"];
209        PictureInPictureStateChanged picture_in_picture_state_changed = 52 [(module) = "framework"];
210        WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53 [(module) = "wifi"];
211        AppStartMemoryStateCaptured app_start_memory_state_captured = 55 [(module) = "framework"];
212        ShutdownSequenceReported shutdown_sequence_reported = 56 [(module) = "framework"];
213        BootSequenceReported boot_sequence_reported = 57;
214        OverlayStateChanged overlay_state_changed =
215                59 [(module) = "framework", (module) = "statsdtest"];
216        ForegroundServiceStateChanged foreground_service_state_changed
217                = 60 [(module) = "framework"];
218        CallStateChanged call_state_changed =
219                61 [(module) = "telecom", (truncate_timestamp) = true];
220        sysui.KeyguardStateChanged keyguard_state_changed = 62 [(module) = "sysui"];
221        sysui.KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63 [(module) = "sysui"];
222        sysui.KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered =
223                64 [(module) = "sysui"];
224        AppDied app_died = 65 [(module) = "framework"];
225        ResourceConfigurationChanged resource_configuration_changed = 66 [(module) = "framework"];
226        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67 [(module) = "bluetooth"];
227        BluetoothConnectionStateChanged bluetooth_connection_state_changed =
228                68 [(module) = "bluetooth"];
229        GpsSignalQualityChanged gps_signal_quality_changed = 69 [(module) = "framework"];
230        UsbConnectorStateChanged usb_connector_state_changed = 70 [(module) = "framework"];
231        SpeakerImpedanceReported speaker_impedance_reported = 71;
232        HardwareFailed hardware_failed = 72;
233        PhysicalDropDetected physical_drop_detected = 73;
234        ChargeCyclesReported charge_cycles_reported = 74;
235        MobileConnectionStateChanged mobile_connection_state_changed = 75 [(module) = "telephony"];
236        MobileRadioTechnologyChanged mobile_radio_technology_changed = 76 [(module) = "telephony"];
237        UsbDeviceAttached usb_device_attached = 77 [(module) = "framework"];
238        AppCrashOccurred app_crash_occurred = 78 [(module) = "framework", (module) = "statsdtest"];
239        ANROccurred anr_occurred = 79 [(module) = "framework"];
240        WTFOccurred wtf_occurred = 80 [(module) = "framework"];
241        LowMemReported low_mem_reported = 81 [(module) = "framework"];
242        GenericAtom generic_atom = 82;
243        VibratorStateChanged vibrator_state_changed = 84 [(module) = "framework"];
244        DeferredJobStatsReported deferred_job_stats_reported = 85 [(module) = "framework"];
245        ThermalThrottlingStateChanged thermal_throttling = 86 [deprecated=true];
246        BiometricAcquired biometric_acquired = 87 [(module) = "framework"];
247        BiometricAuthenticated biometric_authenticated = 88 [(module) = "framework"];
248        BiometricErrorOccurred biometric_error_occurred = 89 [(module) = "framework"];
249        UiEventReported ui_event_reported = 90 [
250            (module) = "framework",
251            (module) = "sysui",
252            (module) = "mediaprovider"
253        ];
254        BatteryHealthSnapshot battery_health_snapshot = 91;
255        SlowIo slow_io = 92;
256        BatteryCausedShutdown battery_caused_shutdown = 93;
257        PhoneServiceStateChanged phone_service_state_changed = 94 [(module) = "framework"];
258        PhoneStateChanged phone_state_changed = 95 [(module) = "framework"];
259        UserRestrictionChanged user_restriction_changed = 96;
260        SettingsUIChanged settings_ui_changed = 97 [(module) = "settings"];
261        ConnectivityStateChanged connectivity_state_changed = 98 [(module) = "framework"];
262        // TODO: service state change is very noisy shortly after boot, as well
263        // as at other transitions - coming out of doze, device plugged in, etc.
264        // Consider removing this if it becomes a problem
265        ServiceStateChanged service_state_changed = 99 [(module) = "framework"];
266        ServiceLaunchReported service_launch_reported = 100 [(module) = "framework"];
267        FlagFlipUpdateOccurred flag_flip_update_occurred = 101 [(module) = "framework"];
268        BinaryPushStateChanged binary_push_state_changed = 102 [(module) = "statsd"];
269        DevicePolicyEvent device_policy_event = 103 [(module) = "framework"];
270        DocsUIFileOperationCanceledReported docs_ui_file_op_canceled = 104 [(module) = "docsui"];
271        DocsUIFileOperationCopyMoveModeReported docs_ui_file_op_copy_move_mode_reported =
272            105 [(module) = "docsui"];
273        DocsUIFileOperationFailureReported docs_ui_file_op_failure = 106 [(module) = "docsui"];
274        DocsUIFileOperationReported docs_ui_provider_file_op = 107 [(module) = "docsui"];
275        DocsUIInvalidScopedAccessRequestReported docs_ui_invalid_scoped_access_request =
276            108 [(module) = "docsui"];
277        DocsUILaunchReported docs_ui_launch_reported = 109 [(module) = "docsui"];
278        DocsUIRootVisitedReported docs_ui_root_visited = 110 [(module) = "docsui"];
279        DocsUIStartupMsReported docs_ui_startup_ms = 111 [(module) = "docsui"];
280        DocsUIUserActionReported docs_ui_user_action_reported = 112 [(module) = "docsui"];
281        WifiEnabledStateChanged wifi_enabled_state_changed = 113 [(module) = "framework"];
282        WifiRunningStateChanged wifi_running_state_changed = 114
283                [(module) = "framework", deprecated = true];
284        AppCompacted app_compacted = 115 [(module) = "framework", deprecated = true];
285        NetworkDnsEventReported network_dns_event_reported = 116 [(module) = "resolv"];
286        DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported =
287            117 [(module) = "docsui"];
288        DocsUIPickResultReported docs_ui_pick_result_reported = 118 [(module) = "docsui"];
289        DocsUISearchModeReported docs_ui_search_mode_reported = 119 [(module) = "docsui"];
290        DocsUISearchTypeReported docs_ui_search_type_reported = 120 [(module) = "docsui"];
291        DataStallEvent data_stall_event = 121 [(module) = "network_stack"];
292        RescuePartyResetReported rescue_party_reset_reported = 122 [(module) = "crashrecovery", (module) = "framework"];
293        SignedConfigReported signed_config_reported = 123 [(module) = "framework"];
294        GnssNiEventReported gnss_ni_event_reported = 124 [(module) = "framework"];
295        BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event =
296                125 [(module) = "bluetooth"];
297        BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed =
298                126 [(module) = "bluetooth"];
299        BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed =
300                127 [(module) = "bluetooth"];
301        AppDowngraded app_downgraded = 128 [(module) = "framework"];
302        AppOptimizedAfterDowngraded app_optimized_after_downgraded = 129;
303        LowStorageStateChanged low_storage_state_changed = 130 [(module) = "framework"];
304        GnssNfwNotificationReported gnss_nfw_notification_reported = 131 [(module) = "framework"];
305        GnssConfigurationReported gnss_configuration_reported = 132 [(module) = "framework"];
306        UsbPortOverheatEvent usb_port_overheat_event_reported = 133;
307        NfcErrorOccurred nfc_error_occurred = 134 [(module) = "nfc"];
308        NfcStateChanged nfc_state_changed = 135 [(module) = "nfc"];
309        NfcBeamOccurred nfc_beam_occurred = 136 [(module) = "nfc"];
310        NfcCardemulationOccurred nfc_cardemulation_occurred = 137 [(module) = "nfc"];
311        NfcTagOccurred nfc_tag_occurred = 138 [(module) = "nfc"];
312        NfcHceTransactionOccurred nfc_hce_transaction_occurred = 139 [(module) = "nfc"];
313        SeStateChanged se_state_changed = 140 [(module) = "secure_element"];
314        SeOmapiReported se_omapi_reported = 141 [(module) = "secure_element"];
315        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported =
316                142 [(module) = "framework"];
317        AttentionManagerServiceResultReported attention_manager_service_result_reported =
318                143 [(module) = "framework"];
319        AdbConnectionChanged adb_connection_changed = 144 [(module) = "framework"];
320        SpeechDspStatReported speech_dsp_stat_reported = 145;
321        UsbContaminantReported usb_contaminant_reported = 146 [(module) = "framework"];
322        WatchdogRollbackOccurred watchdog_rollback_occurred =
323                147 [(module) = "framework", (module) = "crashrecovery", (module) = "statsd"];
324        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected =
325                148 [(module) = "framework"];
326        BubbleUIChanged bubble_ui_changed = 149 [(module) = "framework"];
327        ScheduledJobConstraintChanged scheduled_job_constraint_changed =
328                150 [(module) = "framework"];
329        BluetoothActiveDeviceChanged bluetooth_active_device_changed =
330                151 [(module) = "bluetooth"];
331        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed =
332                152 [(module) = "bluetooth"];
333        BluetoothA2dpCodecConfigChanged bluetooth_a2dp_codec_config_changed =
334                153 [(module) = "bluetooth"];
335        BluetoothA2dpCodecCapabilityChanged bluetooth_a2dp_codec_capability_changed =
336                154 [(module) = "bluetooth"];
337        BluetoothA2dpAudioUnderrunReported bluetooth_a2dp_audio_underrun_reported =
338                155 [(module) = "bluetooth"];
339        BluetoothA2dpAudioOverrunReported bluetooth_a2dp_audio_overrun_reported =
340                156 [(module) = "bluetooth"];
341        BluetoothDeviceRssiReported bluetooth_device_rssi_reported =
342                157 [(module) = "bluetooth"];
343        BluetoothDeviceFailedContactCounterReported
344                bluetooth_device_failed_contact_counter_reported = 158 [(module) = "bluetooth"];
345        BluetoothDeviceTxPowerLevelReported bluetooth_device_tx_power_level_reported =
346                159 [(module) = "bluetooth"];
347        BluetoothHciTimeoutReported bluetooth_hci_timeout_reported =
348                160 [(module) = "bluetooth"];
349        BluetoothQualityReportReported bluetooth_quality_report_reported =
350                161 [(module) = "bluetooth"];
351        BluetoothDeviceInfoReported bluetooth_device_info_reported =
352                162 [(module) = "bluetooth"];
353        BluetoothRemoteVersionInfoReported bluetooth_remote_version_info_reported =
354                163 [(module) = "bluetooth"];
355        BluetoothSdpAttributeReported bluetooth_sdp_attribute_reported =
356                164 [(module) = "bluetooth"];
357        BluetoothBondStateChanged bluetooth_bond_state_changed =
358                165 [(module) = "bluetooth"];
359        BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported =
360                166 [(module) = "bluetooth"];
361        BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported =
362                167 [(module) = "bluetooth"];
363        ScreenTimeoutExtensionReported screen_timeout_extension_reported =
364                168 [(module) = "framework"];
365        ProcessStartTime process_start_time = 169 [(module) = "framework"];
366        PermissionGrantRequestResultReported permission_grant_request_result_reported =
367                170 [(module) = "permissioncontroller"];
368        BluetoothSocketConnectionStateChanged bluetooth_socket_connection_state_changed =
369                171 [(module) = "bluetooth"];
370        DeviceIdentifierAccessDenied device_identifier_access_denied =
371                172 [(module) = "telephony_common"];
372        BubbleDeveloperErrorReported bubble_developer_error_reported = 173 [(module) = "framework"];
373        sysui.AssistGestureStageReported assist_gesture_stage_reported = 174 [(module) = "sysui"];
374        sysui.AssistGestureFeedbackReported assist_gesture_feedback_reported =
375                175 [(module) = "sysui"];
376        sysui.AssistGestureProgressReported assist_gesture_progress_reported =
377                176 [(module) = "sysui"];
378        input.TouchGestureClassified touch_gesture_classified = 177 [(module) = "framework"];
379        HiddenApiUsed hidden_api_used = 178 [(module) = "framework"];
380        StyleUIChanged style_ui_changed = 179 [(module) = "sysui", (module) = "wallpaper"];
381        PrivacyIndicatorsInteracted privacy_indicators_interacted =
382                180 [(module) = "permissioncontroller"];
383        AppInstallOnExternalStorageReported app_install_on_external_storage_reported =
384                181 [(module) = "framework"];
385        NetworkStackReported network_stack_reported = 182 [(module) = "network_stack"];
386        AppMovedStorageReported app_moved_storage_reported = 183 [(module) = "framework"];
387        BiometricEnrolled biometric_enrolled = 184 [(module) = "framework"];
388        SystemServerWatchdogOccurred system_server_watchdog_occurred = 185 [(module) = "framework"];
389        TombStoneOccurred tomb_stone_occurred = 186 [(module) = "framework"];
390        BluetoothClassOfDeviceReported bluetooth_class_of_device_reported =
391                187 [(module) = "bluetooth"];
392        IntelligenceEventReported intelligence_event_reported =
393                188 [(module) = "intelligence"];
394        ThermalThrottlingSeverityStateChanged thermal_throttling_severity_state_changed =
395                189 [(module) = "framework"];
396        RoleRequestResultReported role_request_result_reported =
397                190 [(module) = "permissioncontroller"];
398        MediametricsAudiopolicyReported mediametrics_audiopolicy_reported =
399                191 [(module) = "media_metrics"];
400        MediametricsAudiorecordReported mediametrics_audiorecord_reported =
401                192[(module) = "media_metrics"];
402        MediametricsAudiothreadReported mediametrics_audiothread_reported =
403                193 [(module) = "media_metrics"];
404        MediametricsAudiotrackReported mediametrics_audiotrack_reported =
405                194 [(module) = "media_metrics"];
406        MediametricsCodecReported mediametrics_codec_reported =
407                195 [(module) = "media_metrics"];
408        MediametricsDrmWidevineReported mediametrics_drm_widevine_reported =
409                196 [(module) = "media_metrics"];
410        MediametricsExtractorReported mediametrics_extractor_reported =
411                197 [(module) = "media_metrics"];
412        MediametricsMediadrmReported mediametrics_mediadrm_reported =
413                198 [(module) = "media_metrics"];
414        MediametricsNuPlayerReported mediametrics_nuplayer_reported =
415                199 [(module) = "media_metrics"];
416        MediametricsRecorderReported mediametrics_recorder_reported =
417                200 [(module) = "media_metrics"];
418        MediametricsDrmManagerReported mediametrics_drmmanager_reported =
419                201 [(module) = "media_metrics"];
420        CarPowerStateChanged car_power_state_changed = 203 [(module) = "car"];
421        GarageModeInfo garage_mode_info = 204 [(module) = "car"];
422        TestAtomReported test_atom_reported = 205
423            [(module) = "cts", (module) = "statsdtest"];
424        ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported =
425                206 [(module) = "framework"];
426        ContentCaptureServiceEvents content_capture_service_events = 207 [(module) = "framework"];
427        ContentCaptureSessionEvents content_capture_session_events = 208 [(module) = "framework"];
428        ContentCaptureFlushed content_capture_flushed = 209 [(module) = "framework"];
429        LocationManagerApiUsageReported location_manager_api_usage_reported =
430                210 [(module) = "framework"];
431        ReviewPermissionsFragmentResultReported review_permissions_fragment_result_reported =
432                211 [(module) = "permissioncontroller"];
433        RuntimePermissionsUpgradeResult runtime_permissions_upgrade_result =
434                212 [(module) = "permissioncontroller"];
435        GrantPermissionsActivityButtonActions grant_permissions_activity_button_actions =
436                213 [(module) = "permissioncontroller"];
437        LocationAccessCheckNotificationAction location_access_check_notification_action =
438                214 [(module) = "permissioncontroller"];
439        AppPermissionFragmentActionReported app_permission_fragment_action_reported =
440                215 [(module) = "permissioncontroller"];
441        AppPermissionFragmentViewed app_permission_fragment_viewed =
442                216 [(module) = "permissioncontroller"];
443        AppPermissionsFragmentViewed app_permissions_fragment_viewed =
444                217 [(module) = "permissioncontroller"];
445        PermissionAppsFragmentViewed permission_apps_fragment_viewed =
446                218  [(module) = "permissioncontroller"];
447        TextSelectionEvent text_selection_event = 219  [(module) = "textclassifier"];
448        TextLinkifyEvent text_linkify_event = 220  [(module) = "textclassifier"];
449        ConversationActionsEvent conversation_actions_event = 221  [(module) = "textclassifier"];
450        LanguageDetectionEvent language_detection_event = 222  [(module) = "textclassifier"];
451        ExclusionRectStateChanged exclusion_rect_state_changed = 223 [(module) = "framework"];
452        sysui.BackGesture back_gesture_reported_reported = 224 [(module) = "sysui"];
453        UpdateEngineUpdateAttemptReported update_engine_update_attempt_reported =
454                225 [(module) = "update_engine"];
455        UpdateEngineSuccessfulUpdateReported update_engine_successful_update_reported =
456                226 [(module) = "update_engine"];
457        CameraActionEvent camera_action_event = 227 [(module) = "framework"];
458        AppCompatibilityChangeReported app_compatibility_change_reported =
459                228 [(module) = "framework"];
460        PerfettoUploaded perfetto_uploaded = 229 [(module) = "perfetto"];
461        VmsClientConnectionStateChanged vms_client_connection_state_changed =
462                230 [(module) = "car"];
463        MediaProviderScanOccurred media_provider_scan_occurred = 233 [(module) = "mediaprovider"];
464        MediaContentDeleted media_content_deleted = 234 [(module) = "mediaprovider"];
465        MediaProviderPermissionRequested media_provider_permission_requested =
466            235 [(module) = "mediaprovider"];
467        MediaProviderSchemaChanged media_provider_schema_changed = 236 [(module) = "mediaprovider"];
468        MediaProviderIdleMaintenanceFinished media_provider_idle_maintenance_finished =
469            237 [(module) = "mediaprovider"];
470        RebootEscrowRecoveryReported reboot_escrow_recovery_reported = 238 [(module) = "framework"];
471        BootTimeEventDuration boot_time_event_duration_reported = 239 [(module) = "framework"];
472        BootTimeEventElapsedTime boot_time_event_elapsed_time_reported =
473                240 [(module) = "framework"];
474        BootTimeEventUtcTime boot_time_event_utc_time_reported = 241;
475        BootTimeEventErrorCode boot_time_event_error_code_reported = 242 [(module) = "framework"];
476        UserspaceRebootReported userspace_reboot_reported = 243 [(module) = "framework"];
477        NotificationReported notification_reported = 244 [(module) = "framework"];
478        sysui.NotificationPanelReported notification_panel_reported = 245 [(module) = "sysui"];
479        NotificationChannelModified notification_channel_modified = 246 [(module) = "framework"];
480        IntegrityCheckResultReported integrity_check_result_reported = 247 [(module) = "framework"];
481        IntegrityRulesPushed integrity_rules_pushed = 248 [(module) = "framework"];
482        CellBroadcastMessageReported cb_message_reported =
483            249 [(module) = "cellbroadcast"];
484        CellBroadcastMessageError cb_message_error =
485            250 [(module) = "cellbroadcast"];
486        WifiHealthStatReported wifi_health_stat_reported = 251 [(module) = "wifi"];
487        WifiFailureStatReported wifi_failure_stat_reported = 252 [(module) = "wifi"];
488        WifiConnectionResultReported wifi_connection_result_reported = 253 [(module) = "wifi"];
489        AppFreezeChanged app_freeze_changed = 254 [(module) = "framework"];
490        SnapshotMergeReported snapshot_merge_reported =
491            255 [(module) = "update_engine"];
492        ForegroundServiceAppOpSessionEnded foreground_service_app_op_session_ended =
493            256  [(module) = "framework"];
494        // DisplayJankReported was deprecated in Android 12+
495        DisplayJankReported display_jank_reported = 257 [deprecated = true];
496        AppStandbyBucketChanged app_standby_bucket_changed = 258 [(module) = "framework"];
497        SharesheetStarted sharesheet_started = 259 [(module) = "framework"];
498        RankingSelected ranking_selected = 260 [
499            (module) = "framework",
500            (module) = "sysui",
501            (module) = "mediaprovider"
502        ];
503        TvSettingsUIInteracted tvsettings_ui_interacted = 261 [(module) = "tv_settings"];
504        sysui.LauncherStaticLayout launcher_snapshot = 262 [(module) = "sysui"];
505        PackageInstallerV2Reported package_installer_v2_reported = 263 [(module) = "framework"];
506        UserLifecycleJourneyReported user_lifecycle_journey_reported = 264 [(module) = "framework"];
507        UserLifecycleEventOccurred user_lifecycle_event_occurred = 265 [(module) = "framework"];
508        AccessibilityShortcutReported accessibility_shortcut_reported =
509            266 [(module) = "framework"];
510        AccessibilityServiceReported accessibility_service_reported = 267 [(module) = "settings"];
511        DocsUIDragAndDropReported docs_ui_drag_and_drop_reported = 268 [(module) = "docsui"];
512        AppUsageEventOccurred app_usage_event_occurred = 269 [(module) = "framework"];
513        AutoRevokeNotificationClicked auto_revoke_notification_clicked =
514            270 [(module) = "permissioncontroller"];
515        AutoRevokeFragmentAppViewed auto_revoke_fragment_app_viewed =
516            271 [(module) = "permissioncontroller"];
517        AutoRevokedAppInteraction auto_revoked_app_interaction =
518            272 [(module) = "permissioncontroller", (module) = "settings"];
519        AppPermissionGroupsFragmentAutoRevokeAction
520            app_permission_groups_fragment_auto_revoke_action =
521            273 [(module) = "permissioncontroller"];
522        EvsUsageStatsReported evs_usage_stats_reported = 274 [(module) = "evs"];
523        AudioPowerUsageDataReported audio_power_usage_data_reported =
524            275 [(module) = "media_metrics"];
525        TvTunerStateChanged tv_tuner_state_changed = 276 [(module) = "framework"];
526        sysui.MediaOutputOpSwitchReported mediaoutput_op_switch_reported =
527            277 [(module) = "sysui"];
528        CellBroadcastMessageFiltered cb_message_filtered =
529            278 [(module) = "cellbroadcast"];
530        TvTunerDvrStatus tv_tuner_dvr_status = 279 [(module) = "framework"];
531        TvCasSessionOpenStatus tv_cas_session_open_status =
532            280 [(module) = "framework"];
533        AssistantInvocationReported assistant_invocation_reported = 281 [(module) = "framework"];
534        DisplayWakeReported display_wake_reported = 282 [(module) = "framework"];
535        CarUserHalModifyUserRequestReported car_user_hal_modify_user_request_reported =
536            283 [(module) = "car"];
537        CarUserHalModifyUserResponseReported car_user_hal_modify_user_response_reported =
538            284 [(module) = "car"];
539        CarUserHalPostSwitchResponseReported car_user_hal_post_switch_response_reported =
540            285 [(module) = "car"];
541        CarUserHalInitialUserInfoRequestReported car_user_hal_initial_user_info_request_reported =
542            286 [(module) = "car"];
543        CarUserHalInitialUserInfoResponseReported car_user_hal_initial_user_info_response_reported =
544            287 [(module) = "car"];
545        CarUserHalUserAssociationRequestReported car_user_hal_user_association_request_reported =
546            288 [(module) = "car"];
547        CarUserHalSetUserAssociationResponseReported car_user_hal_set_user_association_response_reported =
548            289 [(module) = "car"];
549        NetworkIpProvisioningReported network_ip_provisioning_reported =
550            290 [(module) = "network_stack"];
551        NetworkDhcpRenewReported network_dhcp_renew_reported = 291 [(module) = "network_stack"];
552        NetworkValidationReported network_validation_reported = 292 [(module) = "network_stack"];
553        NetworkStackQuirkReported network_stack_quirk_reported = 293 [(module) = "network_stack"];
554        MediametricsAudioRecordDeviceUsageReported mediametrics_audiorecorddeviceusage_reported =
555            294 [(module) = "media_metrics"];
556        MediametricsAudioThreadDeviceUsageReported mediametrics_audiothreaddeviceusage_reported =
557            295 [(module) = "media_metrics"];
558        MediametricsAudioTrackDeviceUsageReported mediametrics_audiotrackdeviceusage_reported =
559            296 [(module) = "media_metrics"];
560        MediametricsAudioDeviceConnectionReported mediametrics_audiodeviceconnection_reported =
561            297 [(module) = "media_metrics"];
562        BlobCommitted blob_committed = 298 [(module) = "framework"];
563        BlobLeased blob_leased = 299 [(module) = "framework"];
564        BlobOpened blob_opened = 300 [(module) = "framework"];
565        ContactsProviderStatusReported contacts_provider_status_reported = 301;
566        KeystoreKeyEventReported keystore_key_event_reported = 302;
567        NetworkTetheringReported  network_tethering_reported =
568            303 [(module) = "network_tethering"];
569        sysui.ImeTouchReported ime_touch_reported = 304 [(module) = "sysui"];
570        UIInteractionFrameInfoReported ui_interaction_frame_info_reported =
571            305 [(module) = "framework"];
572        UIActionLatencyReported ui_action_latency_reported = 306 [(module) = "framework"];
573        WifiDisconnectReported wifi_disconnect_reported = 307 [(module) = "wifi"];
574        WifiConnectionStateChanged wifi_connection_state_changed = 308 [(module) = "wifi"];
575        HdmiCecActiveSourceChanged hdmi_cec_active_source_changed = 309 [(module) = "framework"];
576        HdmiCecMessageReported hdmi_cec_message_reported = 310 [(module) = "framework"];
577        AirplaneMode airplane_mode = 311 [(module) = "telephony"];
578        ModemRestart modem_restart = 312 [(module) = "telephony"];
579        CarrierIdMismatchReported carrier_id_mismatch_reported = 313 [(module) = "telephony"];
580        CarrierIdTableUpdated carrier_id_table_updated = 314 [(module) = "telephony"];
581        DataStallRecoveryReported data_stall_recovery_reported = 315 [(module) = "telephony"];
582        MediametricsMediaParserReported mediametrics_mediaparser_reported =
583                316 [(module) = "media_metrics"];
584        TlsHandshakeReported tls_handshake_reported = 317 [(module) = "conscrypt"];
585        TextClassifierApiUsageReported text_classifier_api_usage_reported = 318  [(module) = "textclassifier"];
586        CarWatchdogKillStatsReported car_watchdog_kill_stats_reported = 319 [(module) = "car"];
587        MediametricsPlaybackReported mediametrics_playback_reported = 320 [(module) = "media_metrics"];
588        MediaNetworkInfoChanged media_network_info_changed = 321 [(module) = "media_metrics"];
589        MediaPlaybackStateChanged media_playback_state_changed = 322 [(module) = "media_metrics"];
590        MediaPlaybackErrorReported media_playback_error_reported = 323 [(module) = "media_metrics"];
591        MediaPlaybackTrackChanged media_playback_track_changed = 324 [(module) = "media_metrics"];
592        WifiScanReported wifi_scan_reported = 325 [(module) = "wifi"];
593        WifiPnoScanReported wifi_pno_scan_reported = 326  [(module) = "wifi"];
594        TifTuneStateChanged tif_tune_changed = 327 [(module) = "framework"];
595        AutoRotateReported auto_rotate_reported = 328 [(module) = "framework"];
596        PerfettoTrigger perfetto_trigger = 329 [(module) = "perfetto"];
597        TranscodingData transcoding_data = 330 [(module) = "mediaprovider"];
598        ImsServiceEntitlementUpdated ims_service_entitlement_updated = 331 [(module) = "imsentitlement"];
599        DeviceRotated device_rotated = 333 [(module) = "framework"];
600        SimSpecificSettingsRestored sim_specific_settings_restored = 334
601            [(module) = "telephony"];
602        TextClassifierDownloadReported text_classifier_download_reported = 335 [(module) = "textclassifier"];
603        PinStorageEvent pin_storage_event = 336 [(module) = "telephony"];
604        FaceDownReported face_down_reported = 337 [(module) = "framework"];
605        BluetoothHALCrashReasonReported bluetooth_hal_crash_reason_reported =
606            338 [(module) = "bluetooth"];
607        RebootEscrowPreparationReported reboot_escrow_preparation_reported =
608            339 [(module) = "framework"];
609        RebootEscrowLskfCaptureReported reboot_escrow_lskf_capture_reported =
610            340 [(module) = "framework"];
611        RebootEscrowRebootReported reboot_escrow_reboot_reported = 341 [(module) = "framework"];
612        BinderLatencyReported binder_latency_reported = 342 [(module) = "framework"];
613        MediametricsAAudioStreamReported mediametrics_aaudiostream_reported =
614            343 [(module) = "media_metrics"];
615        MediaTranscodingSessionEnded media_transcoding_session_ended = 344
616            [(module) = "media"];
617        MagnificationUsageReported magnification_usage_reported =
618            345 [(module) = "framework"];
619        MagnificationModeWithImeOnReported magnification_mode_with_ime_on_reported =
620            346 [(module) = "framework"];
621        AppSearchCallStatsReported app_search_call_stats_reported = 347 [(module) = "appsearch"];
622        AppSearchPutDocumentStatsReported app_search_put_document_stats_reported = 348 [(module) = "appsearch"];
623        sysui.DeviceControlChanged device_control_changed = 349 [(module) = "sysui"];
624        DeviceStateChanged device_state_changed = 350 [(module) = "framework"];
625        input.InputDeviceRegistered inputdevice_registered = 351 [(module) = "framework"];
626        sysui.SmartSpaceCardReported smartspace_card_reported = 352 [(module) = "sysui"];
627        AuthPromptAuthenticateInvoked auth_prompt_authenticate_invoked = 353 [(module) = "framework"];
628        AuthManagerCanAuthenticateInvoked auth_manager_can_authenticate_invoked = 354 [(module) = "framework"];
629        AuthEnrollActionInvoked auth_enroll_action_invoked = 355 [(module) = "framework"];
630        AuthDeprecatedAPIUsed auth_deprecated_api_used = 356 [(module) = "framework"];
631        UnattendedRebootOccurred unattended_reboot_occurred = 357 [(module) = "scheduling"];
632        LongRebootBlockingReported long_reboot_blocking_reported = 358 [(module) = "scheduling"];
633        LocationTimeZoneProviderStateChanged location_time_zone_provider_state_changed =
634            359 [(module) = "framework"];
635        // 360-363 are reserved.
636        FdtrackEventOccurred fdtrack_event_occurred = 364 [(module) = "framework"];
637        TimeoutAutoExtendedReported timeout_auto_extended_reported = 365
638            [(module) = "framework"];
639        AlarmBatchDelivered alarm_batch_delivered = 367 [(module) = "framework"];
640        AlarmScheduled alarm_scheduled = 368 [(module) = "framework"];
641        CarWatchdogIoOveruseStatsReported car_watchdog_io_overuse_stats_reported = 369 [(module) = "car"];
642        UserLevelHibernationStateChanged user_level_hibernation_state_changed = 370 [(module) = "framework"];
643        AppSearchInitializeStatsReported app_search_initialize_stats_reported = 371 [(module) = "appsearch"];
644        AppSearchQueryStatsReported app_search_query_stats_reported = 372 [(module) = "appsearch"];
645        AppProcessDied app_process_died = 373 [(module) = "framework"];
646        NetworkIpReachabilityMonitorReported network_ip_reachability_monitor_reported =
647            374 [(module) = "network_stack"];
648        input.SlowInputEventReported slow_input_event_reported = 375 [(module) = "input"];
649        ANROccurredProcessingStarted anr_occurred_processing_started = 376 [(module) = "framework"];
650        AppSearchRemoveStatsReported app_search_remove_stats_reported = 377 [(module) = "appsearch"];
651        MediaCodecReported media_codec_reported =
652            378 [(module) = "framework", (module) = "media_metrics"];
653        PermissionUsageFragmentInteraction permission_usage_fragment_interaction = 379 [(module) = "permissioncontroller"];
654        PermissionDetailsInteraction permission_details_interaction = 380 [(module) = "permissioncontroller"];
655        PrivacySensorToggleInteraction privacy_sensor_toggle_interaction = 381 [(module) = "framework"];
656        PrivacyToggleDialogInteraction privacy_toggle_dialog_interaction = 382 [(module) = "framework"];
657        AppSearchOptimizeStatsReported app_search_optimize_stats_reported = 383 [(module) = "appsearch"];
658        NonA11yToolServiceWarningReported non_a11y_tool_service_warning_report = 384 [(module) = "framework"];
659        AppCompatStateChanged app_compat_state_changed = 386 [(module) = "framework"];
660        SizeCompatRestartButtonEventReported size_compat_restart_button_event_reported = 387 [(module) = "framework"];
661        SplitscreenUIChanged splitscreen_ui_changed = 388 [(module) = "framework"];
662        NetworkDnsHandshakeReported network_dns_handshake_reported = 389 [(module) = "resolv"];
663        BluetoothCodePathCounter bluetooth_code_path_counter =
664            390 [(module) = "bluetooth"];
665        BluetoothLeBatchScanReportDelay bluetooth_le_batch_scan_report_delay =
666            392 [(module) = "bluetooth"];
667        sysui.AccessibilityFloatingMenuUIChanged accessibility_floating_menu_ui_changed =
668            393 [(module) = "sysui"];
669        NeuralNetworksCompilationCompleted neuralnetworks_compilation_completed = 394
670            [(module) = "neuralnetworks"];
671        NeuralNetworksExecutionCompleted neuralnetworks_execution_completed = 395
672            [(module) = "neuralnetworks"];
673        NeuralNetworksCompilationFailed neuralnetworks_compilation_failed = 396
674            [(module) = "neuralnetworks"];
675        NeuralNetworksExecutionFailed neuralnetworks_execution_failed = 397
676            [(module) = "neuralnetworks"];
677        ContextHubBooted context_hub_booted = 398 [(module) = "contexthub"];
678        ContextHubRestarted context_hub_restarted = 399 [(module) = "contexthub"];
679        ContextHubLoadedNanoappSnapshotReported context_hub_loaded_nanoapp_snapshot_reported = 400
680            [(module) = "contexthub"];
681        ChreCodeDownloadTransacted chre_code_download_transacted = 401 [(module) = "contexthub"];
682        UwbSessionInitiated uwb_session_inited = 402 [(module) = "uwb"];
683        UwbSessionClosed uwb_session_closed = 403 [(module) = "uwb"];
684        UwbFirstRangingReceived uwb_first_ranging_received = 404 [(module) = "uwb"];
685        UwbRangingMeasurementReceived uwb_ranging_measurement_received = 405 [(module) = "uwb"];
686        TextClassifierDownloadWorkScheduled text_classifier_download_work_scheduled = 406 [(module) = "textclassifier"];
687        TextClassifierDownloadWorkCompleted text_classifier_download_work_completed = 407 [(module) = "textclassifier"];
688        ClipboardCleared clipboard_cleared = 408 [(module) = "framework"];
689        VmCreationRequested vm_creation_requested = 409 [(module) = "virtualizationservice"];
690        NearbyDeviceScanStateChanged nearby_device_scan_state_changed = 410 [(module) = "nearby"];
691        CameraCompatControlEventReported camera_compat_control_event_reported = 411 [(module) = "framework"];
692        ApplicationLocalesChanged application_locales_changed = 412 [(module) = "framework"];
693        MediametricsAudioTrackStatusReported mediametrics_audiotrackstatus_reported =
694            413 [(module) = "media_metrics"];
695        FoldStateDurationReported fold_state_duration_reported = 414 [(module) = "framework"];
696        LocationTimeZoneProviderControllerStateChanged location_time_zone_provider_controller_state_changed =
697            415 [(module) = "framework"];
698        DisplayHbmStateChanged display_hbm_state_changed = 416 [(module) = "framework"];
699        DisplayHbmBrightnessChanged display_hbm_brightness_changed = 417 [(module) = "framework"];
700        PersistentUriPermissionsFlushed persistent_uri_permissions_flushed =
701            418 [(module) = "framework"];
702        EarlyBootCompOsArtifactsCheckReported early_boot_comp_os_artifacts_check_reported = 419 [(module) = "art"];
703        VBMetaDigestReported vbmeta_digest_reported = 420 [(module) = "framework"];
704        ApexInfoGathered apex_info_gathered = 421 [(module) = "framework"];
705        PvmInfoGathered pvm_info_gathered = 422 [(module) = "framework"];
706        WearSettingsUIInteracted wear_settings_ui_interacted = 423 [(module) = "wear_settings"];
707        TracingServiceReportEvent tracing_service_report_event = 424 [(module) = "framework"];
708        MediametricsAudioRecordStatusReported mediametrics_audiorecordstatus_reported =
709            425 [(module) = "media_metrics"];
710        sysui.LauncherLatency launcher_latency = 426 [(module) = "sysui"];
711        DropboxEntryDropped dropbox_entry_dropped = 427 [(module) = "framework"];
712        WifiP2pConnectionReported wifi_p2p_connection_reported = 428 [(module) = "wifi"];
713        GameStateChanged game_state_changed = 429 [(module) = "framework"];
714        hotword.HotwordDetectorCreateRequested hotword_detector_create_requested = 430
715            [(module) = "framework"];
716        hotword.HotwordDetectionServiceInitResultReported hotword_detection_service_init_result_reported = 431
717            [(module) = "framework"];
718        hotword.HotwordDetectionServiceRestarted hotword_detection_service_restarted = 432
719            [(module) = "framework"];
720        hotword.HotwordDetectorKeyphraseTriggered hotword_detector_keyphrase_triggered = 433
721            [(module) = "framework"];
722        hotword.HotwordDetectorEvents hotword_detector_events = 434
723            [(module) = "framework"];
724        BootCompletedBroadcastCompletionLatencyReported boot_completed_broadcast_completion_latency_reported =
725                437 [(module) = "framework"];
726        ContactsIndexerUpdateStatsReported contacts_indexer_update_stats_reported = 440
727            [(module) = "appsearch"];
728        AppBackgroundRestrictionsInfo app_background_restrictions_info =
729            441 [(module) = "framework"];
730        MmsSmsProviderGetThreadIdFailed mms_sms_provider_get_thread_id_failed = 442 [(module) = "telephony"];
731        MmsSmsDatabaseHelperOnUpgradeFailed mms_sms_database_helper_on_upgrade_failed = 443 [(module) = "telephony"];
732        PermissionReminderNotificationInteracted permission_reminder_notification_interacted =
733            444 [(module) = "permissioncontroller"];
734        RecentPermissionDecisionsInteracted recent_permission_decisions_interacted =
735            445 [(module) = "permissioncontroller"];
736        GnssPsdsDownloadReported gnss_psds_download_reported = 446 [(module) = "framework"];
737        LeAudioConnectionSessionReported le_audio_connection_session_reported = 447 [(module) = "bluetooth"];
738        LeAudioBroadcastSessionReported le_audio_broadcast_session_reported = 448 [(module) = "bluetooth"];
739        DreamUiEventReported dream_ui_event_reported = 449 [(module) = "framework"];
740        sysui.TaskManagerEventReported task_manager_event_reported = 450 [(module) = "sysui"];
741        CdmAssociationAction cdm_association_action = 451 [(module) = "framework"];
742        MagnificationTripleTapAndHoldActivatedSessionReported magnification_triple_tap_and_hold_activated_session_reported =
743            452 [(module) = "framework"];
744        MagnificationFollowTypingFocusActivatedSessionReported magnification_follow_typing_focus_activated_session_reported =
745            453 [(module) = "framework"];
746        AccessibilityTextReadingOptionsChanged accessibility_text_reading_options_changed = 454 [(module) = "settings"];
747        WifiSetupFailureCrashReported wifi_setup_failure_crash_reported = 455 [(module) = "wifi"];
748        UwbDeviceErrorReported uwb_device_error_reported = 456 [(module) = "uwb"];
749        IsolatedCompilationScheduled isolated_compilation_scheduled = 457 [(module) = "art"];
750        IsolatedCompilationEnded isolated_compilation_ended = 458 [(module) = "art"];
751        OnsOpportunisticEsimProvisioningComplete ons_opportunistic_esim_provisioning_complete = 459 [(module) = "ons"];
752        SystemServerPreWatchdogOccurred system_server_pre_watchdog_occurred = 460 [(module) = "framework"];
753        TelephonyAnomalyDetected telephony_anomaly_detected = 461 [(module) = "telephony"];
754        LetterboxPositionChanged letterbox_position_changed = 462 [(module) = "framework"];
755        RemoteKeyProvisioningAttempt remote_key_provisioning_attempt = 463 [(module) = "rkpd"];
756        RemoteKeyProvisioningNetworkInfo remote_key_provisioning_network_info = 464 [(module) = "rkpd"];
757        RemoteKeyProvisioningTiming remote_key_provisioning_timing = 465 [(module) = "rkpd"];
758        sysui.MediaOutputOpInteractionReported mediaoutput_op_interaction_report =
759            466 [(module) = "sysui"];
760        SyncExemptionOccurred sync_exemption_occurred = 468 [(module) = "framework"];
761        AutofillPresentationEventReported autofill_presentation_event_reported = 469 [(module) = "framework"];
762        DockStateChanged dock_state_changed = 470 [(module) = "framework"];
763        SafetySourceStateCollected safety_source_state_collected = 471 [(module) = "permissioncontroller"];
764        SafetyCenterSystemEventReported safety_center_system_event_reported = 472 [(module) = "permissioncontroller"];
765        SafetyCenterInteractionReported safety_center_interaction_reported = 473 [(module) = "permissioncontroller"];
766        SettingsProviderSettingChanged settings_provider_setting_changed = 474 [(module) = "framework"];
767        BroadcastDeliveryEventReported broadcast_delivery_event_reported =
768                475 [(module) = "framework"];
769        ServiceRequestEventReported service_request_event_reported = 476 [(module) = "framework"];
770        ProviderAcquisitionEventReported provider_acquisition_event_reported =
771                477 [(module) = "framework"];
772        BluetoothDeviceNameReported bluetooth_device_name_reported = 478 [(module) = "bluetooth"];
773        CellBroadcastConfigUpdated cb_config_updated = 479 [(module) = "cellbroadcast"];
774        CellBroadcastModuleErrorReported cb_module_error_reported = 480 [(module) = "cellbroadcast"];
775        CellBroadcastServiceFeatureChanged cb_service_feature_changed = 481 [(module) = "cellbroadcast"];
776        CellBroadcastReceiverFeatureChanged cb_receiver_feature_changed = 482 [(module) = "cellbroadcast"];
777        PrivacySignalNotificationInteraction privacy_signal_notification_interaction = 484 [(module) = "permissioncontroller"];
778        PrivacySignalIssueCardInteraction privacy_signal_issue_card_interaction = 485 [(module) = "permissioncontroller"];
779        PrivacySignalsJobFailure privacy_signals_job_failure = 486 [(module) = "permissioncontroller"];
780        VibrationReported vibration_reported = 487 [(module) = "framework"];
781        UwbStartRanging uwb_ranging_start = 489 [(module) = "uwb"];
782        AppCompactedV2 app_compacted_v2 = 491 [(module) = "framework"];
783        // reserved 492
784        DisplayBrightnessChanged display_brightness_changed = 494 [(module) = "framework"];
785        ActivityActionBlocked activity_action_blocked = 495 [(module) = "framework"];
786        NetworkDnsServerSupportReported network_dns_server_support_reported = 504 [(module) = "resolv"];
787        VmBooted vm_booted = 505 [(module) = "virtualizationservice"];
788        VmExited vm_exited = 506 [(module) = "virtualizationservice"];
789        AmbientBrightnessStatsReported ambient_brightness_stats_reported = 507 [(module) = "framework"];
790        MediametricsSpatializerCapabilitiesReported mediametrics_spatializercapabilities_reported =
791                508 [(module) = "media_metrics"];
792        MediametricsSpatializerDeviceEnabledReported mediametrics_spatializerdeviceenabled_reported =
793                509 [(module) = "media_metrics"];
794        MediametricsHeadTrackerDeviceEnabledReported mediametrics_headtrackerdeviceenabled_reported =
795                510 [(module) = "media_metrics"];
796        MediametricsHeadTrackerDeviceSupportedReported mediametrics_headtrackerdevicesupported_reported =
797                511 [(module) = "media_metrics"];
798        HearingAidInfoReported hearing_aid_info_reported = 513 [(module) = "framework"];
799        DeviceWideJobConstraintChanged device_wide_job_constraint_changed =
800            514 [(module) = "framework"];
801        AmbientModeChanged ambient_mode_changed = 515 [(module) = "framework"];
802        ANRLatencyReported anr_latency_reported = 516 [(module) = "framework"];
803        ResourceValueApiStatisticsReported resource_api_info = 517 [(module) = "framework"];
804        SystemDefaultNetworkChanged system_default_network_changed =
805            518 [(module) = "network_stack"];
806        IwlanSetupDataCallResultReported iwlan_setup_data_call_result_reported = 519 [(module) = "iwlan"];
807        IwlanPdnDisconnectedReasonReported iwlan_pdn_disconnected_reason_reported = 520 [(module) = "iwlan"];
808        AirplaneModeSessionReported airplane_mode_session_reported = 521 [(module) = "wifi", (module) = "bluetooth"];
809        VmCpuStatusReported vm_cpu_status_reported = 522 [(module) = "virtualizationservice", deprecated = true];
810        VmMemStatusReported vm_mem_status_reported = 523 [(module) = "virtualizationservice", deprecated = true];
811        PackageInstallationSessionReported package_installation_session_reported = 524 [(module) = "framework"];
812        DefaultNetworkRematchInfo default_network_rematch_info = 525 [(module) = "connectivity"];
813        NetworkSelectionPerformance network_selection_performance = 526 [(module) = "connectivity"];
814        NetworkNsdReported network_nsd_reported = 527 [(module) = "connectivity"];
815        BluetoothDisconnectionReasonReported bluetooth_disconnection_reason_reported = 529 [(module) = "bluetooth"];
816        BluetoothLocalVersionsReported bluetooth_local_versions_reported = 530 [(module) = "bluetooth"];
817        BluetoothRemoteSupportedFeaturesReported bluetooth_remote_supported_features_reported = 531 [(module) = "bluetooth"];
818        BluetoothLocalSupportedFeaturesReported bluetooth_local_supported_features_reported = 532 [(module) = "bluetooth"];
819        BluetoothGattAppInfo bluetooth_gatt_app_info = 533 [(module) = "bluetooth"];
820        BrightnessConfigurationUpdated brightness_configuration_updated = 534 [(module) = "framework"];
821        WearMediaOutputSwitcherLaunched wear_media_output_switcher_launched =
822            538 [(module) = "MediaOutputSwitcher"];
823        WearMediaOutputSwitcherFinished wear_media_output_switcher_finished =
824            539 [(module) = "MediaOutputSwitcher"];
825        WearMediaOutputSwitcherConnectionReported
826            wear_media_output_switcher_connection_reported =
827                540 [(module) = "MediaOutputSwitcher"];
828        WearMediaOutputSwitcherDeviceScanTriggered
829            wear_media_output_switcher_device_scan_triggered =
830                541 [(module) = "MediaOutputSwitcher"];
831        WearMediaOutputSwitcherFirstDeviceScanLatency
832            wear_media_output_switcher_first_device_scan_latency =
833                542 [(module) = "MediaOutputSwitcher"];
834        WearMediaOutputSwitcherConnectDeviceLatency
835            wear_media_output_switcher_connect_device_latency =
836                543 [(module) = "MediaOutputSwitcher"];
837        PackageManagerSnapshotReported
838            package_manager_snapshot_reported = 544 [(module) = "framework"];
839        PackageManagerAppsFilterCacheBuildReported
840            package_manager_apps_filter_cache_build_reported = 545 [(module) = "framework"];
841        PackageManagerAppsFilterCacheUpdateReported
842            package_manager_apps_filter_cache_update_reported = 546 [(module) = "framework"];
843        sysui.LauncherImpressionEvent launcher_impression_event = 547 [(module) = "sysui"];
844        WearMediaOutputSwitcherAllDevicesScanLatency
845            wear_media_output_switcher_all_devices_scan_latency =
846                549 [(module) = "MediaOutputSwitcher"];
847        WsWatchFaceEdited ws_watch_face_edited = 551 [(module) = "wearservices"];
848        WsWatchFaceFavouriteActionReported ws_watch_face_favorite_action_reported = 552 [(module) = "wearservices"];
849        WsWatchFaceSetActionReported ws_watch_face_set_action_reported = 553 [(module) = "wearservices"];
850        PackageUninstallationReported package_uninstallation_reported = 554 [(module) = "framework"];
851        agif.GameModeChanged game_mode_changed = 555 [(module) = "framework"];
852        agif.GameModeConfigurationChanged game_mode_configuration_changed = 556 [(module) = "framework"];
853        BedtimeModeStateChanged bedtime_mode_state_changed = 557 [(module) = "framework"];
854        NetworkSliceSessionEnded network_slice_session_ended = 558 [(module) = "connectivity"];
855        NetworkSliceDailyDataUsageReported network_slice_daily_data_usage_reported = 559 [(module) = "connectivity"];
856        NfcTagTypeOccurred nfc_tag_type_occurred = 560 [(module) = "nfc"];
857        NfcAIDConflictOccurred nfc_aid_conflict_occurred = 561 [(module) = "nfc"];
858        NfcReaderConflictOccurred nfc_reader_conflict_occurred = 562 [(module) = "nfc"];
859        WsTileListChanged ws_tile_list_changed = 563 [(module) = "wearservices"];
860        GetTypeAccessedWithoutPermission get_type_accessed_without_permission = 564[(module) = "framework"];
861        MobileBundledAppInfoGathered mobile_bundled_app_info_gathered = 566 [(module) = "framework"];
862        WsWatchFaceComplicationSetChanged ws_watch_face_complication_set_changed = 567 [(module) = "wearservices"];
863        media.MediaDrmCreated media_drm_created = 568 [(module) = "media_metrics"];
864        media.MediaDrmErrored media_drm_errored = 569 [(module) = "media_metrics"];
865        media.MediaDrmSessionOpened media_drm_session_opened = 570
866            [(module) = "media_metrics"];
867        media.MediaDrmSessionClosed media_drm_session_closed = 571
868            [(module) = "media_metrics"];
869        UserSelectedResolution user_selected_resolution = 572 [(module) = "settings"];
870        UnsafeIntentEventReported unsafe_intent_event_reported = 573 [(module) = "framework"];
871        adpf.PerformanceHintSessionReported performance_hint_session_reported = 574 [(module) = "framework"];
872        MediametricsMidiDeviceCloseReported mediametrics_midi_device_close_reported =
873            576 [(module) = "media_metrics"];
874        hardware.biometrics.BiometricTouchReported biometric_touch_reported = 577 [(module) = "sysui"];
875        hotword.HotwordAudioEgressEventReported hotword_audio_egress_event_reported = 578
876            [(module) = "framework"];
877        location.LocationEnabledStateChanged location_enabled_state_changed = 580 [(module) = "framework"];
878        view.inputmethod.ImeRequestFinished ime_request_finished = 581 [(module) = "framework"];
879        usb.UsbComplianceWarningsReported usb_compliance_warnings_reported = 582 [(module) = "framework"];
880        locale.AppSupportedLocalesChanged app_supported_locales_changed = 583 [(module) = "framework"];
881        providers.mediaprovider.MediaProviderVolumeRecoveryReported
882            media_provider_volume_recovery_reported = 586 [(module) = "mediaprovider"];
883        hardware.biometrics.BiometricPropertiesCollected
884            biometric_properties_collected = 587 [(module) = "framework"];
885        kernel.KernelWakeupAttributed kernel_wakeup_attributed = 588 [(module) = "framework"];
886        display.ScreenStateChangedV2 screen_state_changed_v2 = 589 [(module) = "framework"];
887        wearservices.WsBackupActionReported ws_backup_action_reported = 590
888            [(module) = "wearservices"];
889        wearservices.WsRestoreActionReported ws_restore_action_reported = 591
890            [(module) = "wearservices"];
891        devicelogs.DeviceLogAccessEventReported device_log_access_event_reported = 592 [(module) = "sysui"];
892        wear.media.MediaSessionUpdated media_session_updated = 594 [(module) = "wearmedia"];
893        wearsysui.WearOobeStateChanged wear_oobe_state_changed = 595 [(module) = "framework"];
894        wearservices.WsNotificationUpdated ws_notification_updated = 596
895            [(module) = "wearservices"];
896        // reserved 597
897        corenetworking.connectivity.NetworkValidationFailureStatsDailyReported
898            network_validation_failure_stats_daily_reported = 601 [(module) = "connectivity"];
899        wearservices.WsComplicationTapped ws_complication_tapped = 602 [(module) = "wearservices"];
900        wearservices.WsNotificationBlocking ws_notification_blocking = 780 [(module) = "wearservices"];
901        wearservices.WsNotificationBridgemodeUpdated ws_notification_bridgemode_updated = 822 [(module) = "wearservices"];
902        wearservices.WsNotificationDismissalActioned ws_notification_dismissal_actioned = 823 [(module) = "wearservices"];
903        wearservices.WsNotificationActioned ws_notification_actioned = 824 [(module) = "wearservices"];
904        wearservices.WsNotificationLatency ws_notification_latency = 880 [(module) = "wearservices"];
905    }
906
907    // Pushed atom extensions.
908    // The atom definitions are under atoms/<feature>/<feature>_extension_atoms.proto
909    extensions 332; // ArtDatumReported art_datum_reported
910    extensions 366; // OdrefreshReported odrefresh_reported
911    extensions 385; // AppSearchSetSchemaStatsReported app_search_set_schema_stats_reported
912    extensions 435; // AdServicesApiCalled ad_services_api_called
913    extensions 436; // AdServicesMeasurementReportsUploaded ad_services_mesurement_reports_uploaded
914    extensions 467; // BackgroundDexoptJobEnded background_dexopt_job_ended
915    extensions 483; // JSScriptEngineLatencyReported jsscriptengine_latency_reported
916    extensions 488; // SandboxApiCalled sandbox_api_called
917    extensions 490; // MobileDataDownloadFileGroupDownloadStatusReported mobile_data_download_file_group_status_reported
918    extensions 493; // AdServicesSettingsUsageReported ad_services_settings_usage_reported
919    extensions 496; // BackgroundFetchProcessReported background_fetch_process_reported
920    extensions 497; // UpdateCustomAudienceProcessReported update_custom_audience_process_reported
921    extensions 498; // RunAdBiddingProcessReported run_ad_bidding_process_reported
922    extensions 499; // RunAdScoringProcessReported run_ad_scoring_process_reported
923    extensions 500; //RunAdSelectionProcessReported run_ad_selection_process_reported
924    extensions 501; // RunAdBiddingPerCAProcessReported run_ad_bidding_per_ca_process_reported
925    extensions 502; // MobileDataDownloadDownloadResultReported mobile_data_download_download_result_reported
926    extensions 503; // MobileDataDownloadFileGroupStorageStatsReported mobile_data_download_file_group_storage_stats_reported
927    extensions 512; // AdServicesMeasurementRegistrations ad_services_measurement_registrations
928    extensions 528; // ExpressEventReported express_event_reported
929    extensions 535; // AdServicesGetTopicsReported ad_services_get_topics_reported
930    extensions 536; // AdServicesEpochComputationGetTopTopicsReported ad_services_epoch_computation_get_top_topics_reported
931    extensions 537; // ServicesEpochComputationClassifierReported ad_services_epoch_computation_classifier_reported
932    extensions 548; // OdsignReported odsign_reported
933    extensions 550; // ArtDeviceDatumReported art_device_datum_reported
934    extensions 565; // ArtDatumDeltaReported art_datum_delta_reported
935    extensions 579; // AppSearchSchemaMigrationStatsReported app_search_schema_migration_stats_reported
936    extensions 584; // ApplicationGrammaticalInflectionChanged application_grammatical_inflection_changed
937    extensions 585; // CredentialManagerApiCalled credential_manager_api_called
938    extensions 593; // ExpressHistogramSampleReported express_histogram_sample_reported
939    extensions 598; // AdServicesBackCompatGetTopicsReported ad_services_back_compat_get_topics_reported
940    extensions 599; // AdServicesBackCompatEpochComputationClassifierReported ad_services_back_compat_epoch_computation_classifier_reported
941    extensions 600; // MediaCodecReclaimRequestCompleted media_codec_reclaim_request_completed
942    extensions 603; // AutofillUiEventReported autofill_ui_event_reported
943    extensions 604; // AutofillFillRequestReported autofill_fill_request_reported
944    extensions 605; // AutofillFillResponseReported autofill_fill_response_reported
945    extensions 606; // AutofillSaveEventReported autofill_save_event_reported
946    extensions 607; // AutofillSessionCommitted autofill_session_committed
947    extensions 608; // MediaActionReported media_action_reported
948    extensions 609; // MediaControlsLaunched media_controls_launched
949    extensions 610; // WsWearTimeSession ws_wear_time_session
950    extensions 611; // LockscreenShortcutSelected lockscreen_shortcut_selected
951    extensions 612; // LockscreenShortcutTriggered lockscreen_shortcut_triggered
952    extensions 613; // BluetoothHashedDeviceNameReported bluetooth_hashed_device_name_reported
953    extensions 614; // BluetoothL2capCocClientConnection bluetooth_l2cap_coc_client_connection
954    extensions 615; // BluetoothL2capCocServerConnection bluetooth_l2cap_coc_server_connection
955    extensions 616; // HealthConnectApiCalled health_connect_api_called
956    extensions 617; // HealthConnectUsageStats health_usage_stats
957    extensions 618; // HealthConnectStorageStats health_connect_storage_stats
958    extensions 619; // WearAdaptiveSuspendStatsReported wear_adaptive_suspend_stats_reported
959    extensions 620; // WearPowerAnomalyServiceOperationalStatsReported wear_power_anomaly_service_operational_stats_reported
960    extensions 621; // WearPowerAnomalyServiceEventStatsReported wear_power_anomaly_service_event_stats_reported
961    extensions 622; // SettingsSpaReported settings_spa_reported
962    extensions 623; // HealthConnectUiImpression health_connect_ui_impression
963    extensions 624; // HealthConnectUiInteraction health_connect_ui_interaction
964    extensions 625; // HealthConnectAppOpenedReported health_connect_app_opened_reported
965    extensions 626; // WsIncomingCallActionReported ws_incoming_call_action_reported
966    extensions 627; // WsCallDisconnectionReported ws_call_disconnection_reported
967    extensions 628; // WsCallDurationReported ws_call_duration_reported
968    extensions 629; // WsCallUserExperienceLatencyReported ws_call_user_experience_latency_reported
969    extensions 630; // WsCallInteractionReported ws_call_interaction_reported
970    extensions 631; // FullScreenIntentLaunched full_screen_intent_launched
971    extensions 632; // BalAllowed bal_allowed
972    extensions 633; // EmergencyStateChanged emergency_state_changed
973    extensions 634; // QualifiedRatListChanged qualified_rat_list_changed
974    extensions 635; // QnsImsCallDropStats qns_ims_call_drop_stats
975    extensions 636; // QnsFallbackRestrictionChanged qns_fallback_restriction_changed
976    extensions 637; // EmergencyNumberDialed emergency_number_dialed
977    extensions 638; // WifiAwareNdpReported wifi_aware_ndp_reported
978    extensions 639; // WifiAwareAttachReported wifi_aware_attach_reported
979    extensions 640; // AdServicesMeasurementDebugKeys ad_services_measurement_debug_keys
980    extensions 641; // MediaCodecStarted media_codec_started
981    extensions 642; // MediaCodecStopped media_codec_stopped
982    extensions 643; // HealthConnectApiInvoked health_connect_api_invoked
983    extensions 644; // ExpressUidEventReported express_uid_event_reported
984    extensions 645; // PermissionRationaleDialogViewed permission_rationale_dialog_viewed
985    extensions 646; // PermissionRationaleDialogActionReported permission_rationale_dialog_action_reported
986    extensions 647; // AppDataSharingUpdatesNotificationInteraction app_data_sharing_updates_notification_interaction
987    extensions 648; // AppDataSharingUpdatesFragmentViewed app_data_sharing_updates_fragment_viewed
988    extensions 649; // AppDataSharingUpdatesFragmentActionReported app_data_sharing_updates_fragment_action_reported
989    extensions 650; // DailykeepaliveInfoReported daily_keepalive_info_reported
990    extensions 651; // CredentialManagerInitialPhaseReported credential_manager_init_phase_reported
991    extensions 652; // CredentialManagerCandidatePhaseReported credential_manager_candidate_phase_reported
992    extensions 653; // CredentialManagerFinalPhaseReported credential_manager_final_phase_reported
993    extensions 654; // ExerciseRouteApiCalled exercise_route_api_called
994    extensions 655; // PluginInitialized plugin_initialized
995    extensions 656; // BluetoothLeSessionConnected bluetooth_le_session_connected
996    extensions 657; // DNDStateChanged dnd_state_changed
997    extensions 658; // ExpressUidHistogramSampleReported express_uid_histogram_sample_reported
998    extensions 659; // AutofillFieldClassificationEventReported autofill_field_classification_event_reported
999    extensions 660; // TestExtensionAtomReported test_extension_atom_reported
1000    extensions 661; // WifiSelfRecoveryTriggered wifi_self_recovery_triggered
1001    extensions 662; // AdServicesErrorReported ad_services_error_reported
1002    extensions 663; // AdServicesBackgroundJobsExecutionReported ad_services_background_jobs_execution_reported
1003    extensions 664; // RkpdPoolStats rkpd_pool_stats
1004    extensions 665; // RkpdClientOperation rkpd_client_operation
1005    extensions 666;  // RestrictedBluetoothDeviceNameReported restricted_bluetooth_device_name_reported
1006    extensions 667; // CredentialManagerTotalCandidateReported credential_manager_total_reported
1007    extensions 668; // CredentialManagerFinalNoUidReported credential_manager_finalnouid_reported
1008    extensions 669; // CredentialManagerGetProviderReported credential_manager_get_reported
1009    extensions 670; // CredentialManagerBrowsedAuthenticationClicked credential_manager_auth_click_reported
1010    extensions 671; // CredentialManagerApiV2Called credential_manager_apiv2_called
1011    extensions 672; // TestRestrictedAtomReported test_restricted_atom_reported
1012    extensions 673; // AdServicesMeasurementDelayedSourceRegistration ad_services_measurement_delayed_source_registration
1013    extensions 674; // AdServicesMeasurementAttribution ad_services_measurement_attribution
1014    extensions 675; // AdServicesMeasurementJobs ad_services_measurement_jobs
1015    extensions 676; // AdServicesMeasurementWipeout ad_services_measurement_wipeout
1016    extensions 677; // MediaSessionStateChanged media_session_state_changed
1017    extensions 678; // IkeSessionTerminated ike_session_terminated
1018    extensions 679; // TvLowPowerStandbyPolicy tv_low_power_standby_policy
1019    extensions 680; // SoftApStarted softap_started
1020    extensions 681; // SoftApStopped softap_stopped
1021    extensions 682; // KeyboardConfigured keyboard_configured
1022    extensions 683; // KeyboardSystemsEventReported keyboard_systems_event_reported
1023    extensions 684; // MediaCodecRendered media_codec_rendered
1024    extensions 685; // InTaskActivityStarted in_task_activity_started
1025    extensions 686; // InputDeviceUsageReported inputdevice_usage_reported
1026    extensions 687; // WifiLockReleased wifi_lock_released
1027    extensions 688; // WifiLockDeactivated wifi_lock_deactivated
1028    extensions 689; // WifiConfigSaved wifi_config_saved
1029    extensions 690; // WifiAwareResourceUsingChanged wifi_aware_resource_using_changed
1030    extensions 691; // WifiAwareHalApiCalled wifi_aware_hal_api_called
1031    extensions 692; // WifiLocalOnlyRequestReceived wifi_local_only_request_received
1032    extensions 693; // WifiLocalOnlyRequestScanTriggered wifi_local_only_request_scan_triggered
1033    extensions 694; // WifiThreadTaskExecuted wifi_thread_task_executed
1034    extensions 695; // AdServicesMeasurementAdIdMatchForDebugKeys ad_services_ad_id_match_for_debug_keys
1035    extensions 696; // BluetoothProfileConnectionAttempted bluetooth_profile_connection_attempted
1036    extensions 697; // AdServicesEnrollmentDataStored ad_services_enrollment_data_stored
1037    extensions 698; // AdServicesEnrollmentFileDownloaded ad_services_enrollment_file_downloaded
1038    extensions 699; // AdServicesEnrollmentMatched ad_services_enrollment_matched
1039    extensions 700; // WifiStateChanged wifi_state_changed
1040    extensions 701; // HdmiEarcStatusReported hdmi_earc_status_reported
1041    extensions 702; // AdServicesConsentMigrated ad_services_consent_migrated
1042    extensions 703; // CronetEngineCreated cronet_engine_created
1043    extensions 704; // CronetTrafficReported cronet_traffic_reported
1044    extensions 705; // DreamSettingChanged dream_setting_changed
1045    extensions 706; // AiWallpapersButtonPressed ai_wallpapers_button_pressed
1046    extensions 707; // AiWallpapersTemplateSelected ai_wallpapers_template_selected
1047    extensions 708; // AiWallpapersTermSelected ai_wallpapers_term_selected
1048    extensions 709; // AiWallpapersWallpaperSet ai_wallpapers_wallpaper_set
1049    extensions 710; // AiWallpapersSessionSummary ai_wallpapers_session_summary
1050    extensions 711; // OnDevicePersonalizationApiCalled ondevicepersonalization_api_called
1051    extensions 712; // FederatedComputeApiCalled federated_compute_api_called
1052    extensions 713; // CellularRadioPowerStateChanged cellular_radio_power_state_changed
1053    extensions 714; // AdServicesEnrollmentFailed ad_services_enrollment_failed
1054    extensions 715; // WearModeStateChanged wear_mode_state_changed
1055    extensions 716; // LauncherImpressionEventV2 launcher_impression_event_v2
1056    extensions 717; // ExternalTvInputEvent external_tv_input_event
1057    extensions 718; // StylusPredictionMetricsReported stylus_prediction_metrics_reported
1058    extensions 719; // PnoScanStarted pno_scan_started
1059    extensions 720; // PnoScanStopped pno_scan_stopped
1060    extensions 721; // MediatorUpdated mediator_updated
1061    extensions 722; // WifiIsUnusableReported wifi_is_unusable_reported
1062    extensions 723; // WifiApCapabilitiesReported wifi_ap_capabilities_reported
1063    extensions 724; // HdmiSoundbarModeStatusReported hdmi_soundbar_mode_status_reported
1064    extensions 725; // UserRiskEventReported user_risk_event_reported
1065    extensions 726; // DeviceLockCheckInRequestReported device_lock_check_in_request_reported
1066    extensions 727; // DeviceLockProvisioningCompleteReported device_lock_provisioning_complete_reported
1067    extensions 728; // DeviceLockKioskAppRequestReported device_lock_kiosk_app_request_reported
1068    extensions 729; // MediaProjectionStateChanged media_projection_state_changed
1069    extensions 730; // MediaProjectionTargetChanged media_projection_target_changed
1070    extensions 731; // WearPowerMenuOpened wear_power_menu_opened
1071    extensions 732; // ApexInstallationRequested apex_installation_requested
1072    extensions 733; // ApexInstallationStaged apex_installation_staged
1073    extensions 734; // ApexInstallationEnded apex_installation_ended
1074    extensions 735; // SandboxActivityEventOccurred sandbox_activity_event_occurred
1075    extensions 736; // RendererInitialized renderer_initialized
1076    extensions 737; // SchemaVersionReceived schema_version_received
1077    extensions 738; // ThreadnetworkTelemetryDataReported threadnetwork_telemetry_data_reported
1078    extensions 739; // ThreadnetworkTopoEntryRepeated threadnetwork_topo_entry_repeated
1079    extensions 740; // ThreadnetworkDeviceInfoReported threadnetwork_device_info_reported
1080    extensions 741; // LayoutInspected layout_inspected
1081    extensions 742; // LayoutExpressionsInspected layout_expression_inspected
1082    extensions 743; // LayoutAnimationsInspected layout_animations_inspected
1083    extensions 744; // MaterialComponentsInspected material_components_inspected
1084    extensions 745; // TileRequested tile_requested
1085    extensions 746; // StateResponseReceived state_response_received
1086    extensions 747; // TileResponseReceived tile_response_received
1087    extensions 748; // InflationFinished inflation_finished
1088    extensions 749; // InflationFailed inflation_failed
1089    extensions 750; // IgnoredInflationFailuresReported ignored_inflation_failures_reported
1090    extensions 751; // DrawableRendered drawable_rendered
1091    extensions 752; // StatsSocketLossReported stats_socket_loss_reported
1092    extensions 753; // DisplaySwitchLatencyTracked display_switch_latency_tracked
1093    extensions 754; // KernelOomKillOccurred kernel_oom_kill_occurred
1094    extensions 755; // WearAssistantOpened wear_assistant_opened
1095    extensions 756; // AdServicesMeasurementClickVerification ad_services_measurement_click_verification
1096    extensions 757; // WearMediaOutputSwitcherDeviceScanApiLatency wear_media_output_switcher_device_scan_api_latency
1097    extensions 758; // WearMediaOutputSwitcherSassDeviceUnavailable wear_media_output_switcher_sass_device_unavailable
1098    extensions 759; // WearMediaOutputSwitcherFastPairApiTimeout wear_media_output_switcher_fastpair_api_timeout
1099    extensions 760; // IkeLivenessCheckSessionValidated ike_liveness_check_session_validated
1100    extensions 761; // HotwordEventEgressSize hotword_egress_size_atom_reported
1101    extensions 762; // CronetEngineBuilderInitialized cronet_engine_builder_initialized
1102    extensions 763; // CronetHttpFlagsInitialized cronet_http_flags_initialized
1103    extensions 764; // CronetInitialized cronet_initialized
1104    extensions 765; // AdServicesEncryptionKeyFetched ad_services_encryption_key_fetched
1105    extensions 766; // AdServicesEncryptionKeyDbTransactionEnded ad_services_encryption_key_db_transaction_ended
1106    extensions 767; // DestinationRegisteredBeacons destination_registered_beacons
1107    extensions 768; // ReportInteractionApiCalled report_interaction_api_called
1108    extensions 769; // InteractionReportingTableCleared interaction_reporting_table_cleared
1109    extensions 770; // CarRecentsEventReported car_recents_event_reported
1110    extensions 771; // FederatedComputeTrainingEventReported federated_compute_training_event_reported
1111    extensions 772; // ThermalStatusCalled thermal_status_called
1112    extensions 773; // ThermalHeadroomCalled thermal_headroom_called
1113    extensions 774; // ThermalHeadroomThresholdsCalled thermal_headroom_thresholds_called
1114    extensions 775; // BootIntegrityInfoReported boot_integrity_info_reported
1115    extensions 776; // ScreenOffReported screen_off_reported
1116    extensions 777; // ApfSessionInfoReported apf_session_info_reported
1117    extensions 778; // IpClientRaInfoReported ip_client_ra_info_reported
1118    extensions 779; // NetworkRequestStateChanged network_request_state_changed
1119    extensions 781; // BluetoothContentProfileErrorReported bluetooth_content_profile_error_reported
1120    extensions 782; // BluetoothRfcommConnectionAttempted bluetooth_rfcomm_connection_attempted
1121    extensions 783; // NetworkStatsRecorderFileOperated network_stats_recorder_file_operated
1122    extensions 784; // MediaProviderDatabaseRollbackReported media_provider_database_rollback_reported
1123    extensions 785; // BackupSetupStatusReported backup_setup_status_reported
1124    extensions 786; // SysproxyConnectionUpdated sysproxy_connection_updated
1125    extensions 787; // WsOnBodyStateChanged ws_on_body_state_changed
1126    extensions 788; // AppManifestConfigHelperCalled app_manifest_config_helper_called
1127    extensions 789; // CheckInRetryReported device_lock_check_in_retry_reported
1128    extensions 790; // ProvisionFailureReported device_lock_provision_failure_reported
1129    extensions 791; // LockUnlockDeviceFailureReported device_lock_unlock_device_failure_reported
1130    extensions 792; // DisplayModeDirectorVoteChanged display_mode_director_vote_changed
1131    extensions 793; // AdFilteringProcessJoinCAReported ad_filtering_process_join_ca_reported
1132    extensions 794; // AdFilteringProcessAdSelectionReported ad_filtering_process_ad_selection_reported
1133    extensions 795; // AdCounterHistogramUpdaterReported ad_counter_histogram_updater_reported
1134    extensions 796; // SdkSandboxRestrictedAccessInSession sdk_sandbox_restricted_access_in_session
1135    extensions 797; // CarCalmModeEventReported car_calm_mode_event_reported
1136    extensions 798; // MediaEditingEndedReported media_editing_ended_reported
1137    extensions 799; // SELinux selinux_audit_log
1138    extensions 800; // CellularIdentifierDisclosed cellular_identifier_disclosed
1139    // reserved 801
1140    extensions 802; // WsWatchFaceRestrictedComplicationsImpacted ws_watch_face_restricted_complications_impacted
1141    extensions 803; // WsWatchFaceDefaultRestrictedComplicationsRemoved ws_watch_face_default_restricted_complications_removed
1142    extensions 804; // WsComplicationsImpactedNotificationEventReported ws_complications_impacted_notification_event_reported
1143    extensions 805; // SoftApStateChanged soft_ap_state_changed
1144    extensions 806; // ExternalDisplayStateChanged external_display_state_changed
1145    extensions 807; // SignatureVerification signature_verification
1146    extensions 808; // KAnonImmediateSignJoinStatusReported k_anon_immediate_sign_join_status_reported
1147    extensions 809; // KAnonBackgroundJobStatusReported k_anon_background_job_status_reported
1148    extensions 810; // KAnonInitializeStatusReported k_anon_initialize_status_reported
1149    extensions 811; // KAnonSignStatusReported k_anon_sign_status_reported
1150    extensions 812; // KAnonJoinStatusReported k_anon_join_status_reported
1151    extensions 813; // KAnonKeyAttestationStatusReported k_anon_key_attestation_status_reported
1152    extensions 814; // GetAdSelectionDataApiCalled get_ad_selection_data_api_called
1153    extensions 815; // GetAdSelectionDataBuyerInputGenerated get_ad_selection_data_buyer_input_generated
1154    extensions 816; // SystemGrammaticalInflectionChanged system_grammatical_inflection_changed
1155    extensions 817; // BiometricFRRNotification biometric_frr_notification
1156    extensions 818; // DesktopModeUIChanged desktop_mode_ui_changed
1157    extensions 819; // DesktopModeSessionTaskUpdate desktop_mode_session_task_update
1158    extensions 820; // AdaptiveAuthUnlockAfterLockReported adaptive_auth_unlock_after_lock_reported
1159    extensions 821; // NegotiatedSecurityAssociation negotiated_security_association
1160    extensions 825; // AppSearchUsageSearchIntentStatsReported app_search_usage_search_intent_stats_reported
1161    extensions 826; // AppSearchUsageSearchIntentRawQueryStatsReported app_search_usage_search_intent_raw_query_stats_reported
1162    extensions 827; // EnhancedConfirmationDialogResultReported
1163    extensions 828; // EnhancedConfirmationRestrictionCleared
1164    extensions 829; // NotificationListenerService
1165    extensions 830; // SensitiveContentMediaProjectionSession
1166    extensions 831; // SensitiveNotificationAppProtectionSession
1167    extensions 832; // SensitiveNotificationAppProtectionApplied
1168    extensions 833; // SensitiveNotificationRedaction
1169    extensions 834; // BackgroundJobSchedulingReported background_job_scheduling_reported
1170    extensions 835; // SensitiveContentAppProtection
1171    extensions 836; // ScreenTimeoutOverrideReported screen_timeout_override_reported
1172    extensions 837; // ScreenInteractiveSessionReported screen_interactive_session_reported
1173    extensions 838; // ExampleIteratorNextLatencyReported example_iterator_next_latency_reported
1174    extensions 839; // AdpfHintSessionTidCleanup adpf_hint_session_tid_cleanup
1175    extensions 840; // TopicsEncryptionEpochComputationReported topics_encryption_epoch_computation_reported
1176    extensions 841; // TopicsEncryptionGetTopicsReported topics_encryption_get_topics_reported
1177    extensions 842; // AdServicesShellCommandCalled adservices_shell_command_called
1178    extensions 843; // UpdateSignalsApiCalled update_signals_api_called
1179    extensions 844; // EncodingJobRun encoding_job_run
1180    extensions 845; // EncodingJsFetch encoding_js_fetch
1181    extensions 846; // EncodingJsExecution encoding_js_execution
1182    extensions 847; // PersistAdSelectionResultCalled persist_ad_selection_result_called
1183    extensions 848; // ServerAuctionKeyFetchCalled server_auction_key_fetch_called
1184    extensions 849; // ServerAuctionBackgroundKeyFetchScheduled server_auction_background_key_fetch_enabled
1185    extensions 850; // VpnConnectionStateChanged vpn_connection_state_changed
1186    extensions 851; // VpnConnectionReported vpn_connection_reported
1187    extensions 852; // CarWakeupFromSuspendReported car_wakeup_from_suspend_reported
1188    extensions 853; // ExcessiveBinderProxyCountReported excessive_binder_proxy_count_reported
1189    extensions 854; // DataRatStateChanged data_rat_state_changed
1190    extensions 855; // NfcObserveModeStateChanged nfc_observe_mode_state_changed
1191    extensions 856; // NfcFieldChanged nfc_field_changed
1192    extensions 857; // NfcPollingLoopNotificationReported nfc_polling_loop_notification_reported
1193    extensions 858; // NfcProprietaryCapabilitiesReported nfc_proprietary_capabilities_reported
1194    extensions 859; // PdfLoadReported pdf_load_reported
1195    extensions 860; // PdfApiUsageReported pdf_api_usage_reported
1196    extensions 861; // PdfSearchReported pdf_search_reported
1197    extensions 862; // RemoteDeviceInformationWithMetricId remote_device_information_with_metric_id
1198    extensions 863; // ComponentStateChangedReported component_state_changed_reported
1199    extensions 864; // AdServicesMeasurementProcessOdpRegistration ad_services_measurement_process_odp_registration
1200    extensions 865; // AdServicesMeasurementNotifyRegistrationToOdp ad_services_measurement_notify_registration_to_odp
1201    extensions 866; // AppRestrictionStateChanged app_restriction_state_changed
1202    extensions 867; // ScreenDimReported screen_dim_reported
1203    extensions 868; // ChreSignificantMotionStateChanged chre_significant_motion_state_changed
1204    extensions 869; // NavHandleTouchPoints nav_handle_touch_points
1205    extensions 870; // LeAppScanStateChanged le_app_scan_state_changed
1206    extensions 871; // LeRadioScanStopped le_radio_scan_stopped
1207    extensions 872; // LeScanResultReceived le_scan_result_received
1208    extensions 873; // LeScanAbused le_scan_abused
1209    extensions 874; // LeAdvStateChanged le_adv_state_changed
1210    extensions 875; // LeAdvErrorReported le_adv_error_reported
1211    extensions 876; // SelectAdsFromOutcomesApiCalled select_ads_from_outcomes_api_called
1212    extensions 877; // ReportImpressionApiCalled report_impression_api_called
1213    extensions 878; // Reserved for b/333882013
1214    extensions 879; // Reserved for b/333882013
1215    extensions 881; // Reserved for b/339008431
1216    extensions 882; // ConnectedChannelChanged connected_channel_changed
1217    extensions 883; // PreRebootDexoptJobEnded pre_reboot_dexopt_job_ended
1218    extensions 884; // ScorerPredictionResultReported scorer_prediction_result_reported
1219    extensions 885; // AdServicesEnrollmentTransactionStats ad_services_enrollment_transaction_stats
1220    extensions 886; // PhotopickerSessionInfoReported photopicker_session_info_reported
1221    extensions 887; // PhotopickerApiInfoReported photopicker_api_info_reported
1222    extensions 888; // PhotopickerUIEventLogged photopicker_ui_event_logged
1223    extensions 889; // PhotopickerMediaItemStatusRepoprted photopicker_media_item_status_reported
1224    extensions 890; // PhotopickerPreviewInfoLogged photopicker_preview_info_logged
1225    extensions 891; // PhotopickerMenuInteractionLogged photopicker_menu_interaction_logged
1226    extensions 892; // PhotopickerBannerInteractionLogged photopicker_banner_interaction_logged
1227    extensions 893; // PhotopickerMediaLibraryInfoLogged photopicker_media_library_info_logged
1228    extensions 894; // PhotopickerPageInfoLogged photopicker_page_info_logged
1229    extensions 895; // PhotopickerMediaGridSyncInfoReported photopicker_media_grid_sync_info_reported
1230    extensions 896; // PhotopickerAlbumSyncInfoReported photopicker_album_sync_info_reported
1231    extensions 897; // PhotopickerSearchInfoReported photopicker_search_info_reported
1232    extensions 898; // SearchDataExtractionDetailsReported search_data_extraction_details_reported
1233    extensions 899; // EmbeddedPhotopickerInfoReported embedded_photopicker_info_reported
1234    extensions 900; // CameraFeatureCombinationQueryEvent camera_feature_combination_query_event
1235    extensions 9999; // Atom9999 atom_9999
1236    // StatsdStats tracks platform atoms with ids up to 900.
1237    // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
1238
1239    // Pulled events will start at field 10000.
1240    // Next: 10218
1241    oneof pulled {
1242        WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
1243        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
1244        MobileBytesTransfer mobile_bytes_transfer =
1245                10002 [(module) = "framework", (truncate_timestamp) = true];
1246        MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg =
1247                10003 [(module) = "framework", (truncate_timestamp) = true];
1248        BluetoothBytesTransfer bluetooth_bytes_transfer = 10006 [(module) = "framework"];
1249        KernelWakelock kernel_wakelock = 10004 [(module) = "framework"];
1250        SubsystemSleepState subsystem_sleep_state = 10005 [(module) = "framework", (module) = "statsdtest"];
1251        CpuTimePerUid cpu_time_per_uid = 10009 [(module) = "framework", (module) = "statsdtest"];
1252        CpuTimePerUidFreq cpu_time_per_uid_freq =
1253                10010 [(module) = "framework", (module) = "statsd"];
1254        WifiActivityInfo wifi_activity_info = 10011 [(module) = "framework"];
1255        ModemActivityInfo modem_activity_info = 10012 [(module) = "framework"];
1256        BluetoothActivityInfo bluetooth_activity_info = 10007 [(module) = "framework"];
1257        ProcessMemoryState process_memory_state = 10013 [(module) = "framework"];
1258        SystemElapsedRealtime system_elapsed_realtime = 10014 [(module) = "framework"];
1259        SystemUptime system_uptime = 10015 [(module) = "framework"];
1260        CpuActiveTime cpu_active_time = 10016 [(module) = "framework", (module) = "statsdtest"];
1261        CpuClusterTime cpu_cluster_time = 10017 [(module) = "framework"];
1262        DiskSpace disk_space = 10018 [deprecated=true, (module) = "statsdtest"];
1263        RemainingBatteryCapacity remaining_battery_capacity = 10019 [(module) = "framework"];
1264        FullBatteryCapacity full_battery_capacity = 10020 [(module) = "framework"];
1265        Temperature temperature = 10021 [(module) = "framework", (module) = "statsdtest"];
1266        BinderCalls binder_calls = 10022 [(module) = "framework", (module) = "statsd"];
1267        BinderCallsExceptions binder_calls_exceptions = 10023 [(module) = "framework"];
1268        LooperStats looper_stats = 10024 [(module) = "framework", (module) = "statsd"];
1269        DiskStats disk_stats = 10025 [(module) = "framework"];
1270        DirectoryUsage directory_usage = 10026 [(module) = "framework"];
1271        AppSize app_size = 10027 [(module) = "framework"];
1272        CategorySize category_size = 10028 [(module) = "framework"];
1273        ProcStats proc_stats = 10029 [(module) = "framework"];
1274        BatteryVoltage battery_voltage = 10030 [(module) = "framework"];
1275        NumFingerprintsEnrolled num_fingerprints_enrolled = 10031 [(module) = "framework"];
1276        DiskIo disk_io = 10032 [(module) = "framework"];
1277        PowerProfile power_profile = 10033 [(module) = "framework"];
1278        ProcStatsPkgProc proc_stats_pkg_proc = 10034 [(module) = "framework"];
1279        ProcessCpuTime process_cpu_time = 10035 [(module) = "framework"];
1280        CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037 [(module) = "framework"];
1281        OnDevicePowerMeasurement on_device_power_measurement = 10038 [(module) = "framework"];
1282        DeviceCalculatedPowerUse device_calculated_power_use = 10039 [(module) = "framework"];
1283        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042 [(module) = "framework"];
1284        BatteryLevel battery_level = 10043 [(module) = "framework"];
1285        BuildInformation build_information = 10044 [(module) = "framework"];
1286        BatteryCycleCount battery_cycle_count = 10045 [(module) = "framework"];
1287        DebugElapsedClock debug_elapsed_clock = 10046 [(module) = "framework"];
1288        DebugFailingElapsedClock debug_failing_elapsed_clock = 10047 [(module) = "framework"];
1289        NumFacesEnrolled num_faces_enrolled = 10048 [(module) = "framework"];
1290        RoleHolder role_holder = 10049 [(module) = "framework"];
1291        DangerousPermissionState dangerous_permission_state = 10050 [(module) = "framework"];
1292        TrainInfo train_info = 10051 [(module) = "statsd"];
1293        TimeZoneDataInfo time_zone_data_info = 10052 [(module) = "framework"];
1294        ExternalStorageInfo external_storage_info = 10053 [(module) = "framework"];
1295        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
1296        GpuStatsAppInfo gpu_stats_app_info = 10055;
1297        SystemIonHeapSize system_ion_heap_size = 10056 [deprecated = true, (module) = "framework"];
1298        AppsOnExternalStorageInfo apps_on_external_storage_info = 10057 [(module) = "framework"];
1299        FaceSettings face_settings = 10058 [(module) = "framework"];
1300        CoolingDevice cooling_device = 10059 [(module) = "framework"];
1301        AppOps app_ops = 10060 [(module) = "framework"];
1302        ProcessSystemIonHeapSize process_system_ion_heap_size = 10061 [(module) = "framework"];
1303        SurfaceflingerStatsGlobalInfo surfaceflinger_stats_global_info = 10062;
1304        SurfaceflingerStatsLayerInfo surfaceflinger_stats_layer_info = 10063;
1305        ProcessMemorySnapshot process_memory_snapshot = 10064 [(module) = "framework"];
1306        VmsClientStats vms_client_stats = 10065 [(module) = "car"];
1307        NotificationRemoteViews notification_remote_views = 10066 [(module) = "framework"];
1308        DangerousPermissionStateSampled dangerous_permission_state_sampled =
1309                10067 [(module) = "framework"];
1310        GraphicsStats graphics_stats = 10068 [(module) = "hwui"];
1311        RuntimeAppOpAccess runtime_app_op_access = 10069 [(module) = "framework"];
1312        IonHeapSize ion_heap_size = 10070 [(module) = "framework"];
1313        PackageNotificationPreferences package_notification_preferences =
1314                10071 [(module) = "framework"];
1315        PackageNotificationChannelPreferences package_notification_channel_preferences =
1316                10072 [(module) = "framework"];
1317        PackageNotificationChannelGroupPreferences package_notification_channel_group_preferences =
1318                10073 [(module) = "framework"];
1319        GnssStats gnss_stats = 10074 [(module) = "framework"];
1320        AttributedAppOps attributed_app_ops = 10075 [(module) = "framework"];
1321        VoiceCallSession voice_call_session = 10076 [(module) = "telephony"];
1322        VoiceCallRatUsage voice_call_rat_usage = 10077 [(module) = "telephony"];
1323        SimSlotState sim_slot_state = 10078 [(module) = "telephony"];
1324        SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
1325        SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
1326        BlobInfo blob_info = 10081 [(module) = "framework"];
1327        DataUsageBytesTransfer data_usage_bytes_transfer =
1328                10082 [(module) = "framework", (truncate_timestamp) = true];
1329        BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered =
1330                10083 [(module) = "framework", (truncate_timestamp) = true];
1331        dnd.DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"];
1332        GeneralExternalStorageAccessStats general_external_storage_access_stats =
1333            10085 [(module) = "mediaprovider"];
1334        IncomingSms incoming_sms = 10086 [(module) = "telephony"];
1335        OutgoingSms outgoing_sms = 10087 [(module) = "telephony"];
1336        CarrierIdTableVersion carrier_id_table_version = 10088 [(module) = "telephony"];
1337        DataCallSession data_call_session = 10089 [(module) = "telephony"];
1338        CellularServiceState cellular_service_state = 10090 [(module) = "telephony"];
1339        CellularDataServiceSwitch cellular_data_service_switch = 10091 [(module) = "telephony"];
1340        SystemMemory system_memory = 10092 [(module) = "framework"];
1341        ImsRegistrationTermination ims_registration_termination = 10093 [(module) = "telephony"];
1342        ImsRegistrationStats ims_registration_stats = 10094 [(module) = "telephony"];
1343        CpuTimePerClusterFreq cpu_time_per_cluster_freq = 10095 [(module) = "framework"];
1344        CpuCyclesPerUidCluster cpu_cycles_per_uid_cluster = 10096 [(module) = "framework"];
1345        DeviceRotatedData device_rotated_data = 10097 [(module) = "framework"];
1346        CpuCyclesPerThreadGroupCluster cpu_cycles_per_thread_group_cluster = 10098 [(module) = "framework"];
1347        MediaDrmActivityInfo media_drm_activity_info = 10099 [(module) = "media_metrics"];
1348        OemManagedBytesTransfer oem_managed_bytes_transfer = 10100 [(module) = "framework"];
1349        GnssPowerStats gnss_power_stats = 10101 [(module) = "framework"];
1350        TimeZoneDetectorState time_zone_detector_state = 10102 [(module) = "framework"];
1351        Keystore2StorageStats keystore2_storage_stats = 10103 [(module) = "framework"];
1352        RkpPoolStats rkp_pool_stats = 10104 [deprecated = true];
1353        ProcessDmabufMemory process_dmabuf_memory = 10105 [(module) = "framework"];
1354        PendingAlarmInfo pending_alarm_info = 10106 [(module) = "framework"];
1355        UserLevelHibernatedApps user_level_hibernated_apps = 10107 [(module) = "framework"];
1356        sysui.LauncherLayoutSnapshot launcher_layout_snapshot = 10108
1357            [(module) = "sysui"];
1358        GlobalHibernatedApps global_hibernated_apps = 10109 [(module) = "framework"];
1359        input.InputEventLatencySketch input_event_latency_sketch = 10110 [(module) = "input"];
1360        BatteryUsageStatsBeforeReset battery_usage_stats_before_reset =
1361            10111 [(module) = "framework"];
1362        BatteryUsageStatsSinceReset battery_usage_stats_since_reset =
1363            10112 [(module) = "framework"];
1364        BatteryUsageStatsSinceResetUsingPowerProfileModel
1365            battery_usage_stats_since_reset_using_power_profile_model =
1366            10113 [(module) = "framework"];
1367        InstalledIncrementalPackage installed_incremental_package = 10114 [(module) = "framework"];
1368        TelephonyNetworkRequests telephony_network_requests =
1369            10115 [(module) = "telephony", deprecated = true];
1370        AppSearchStorageInfo app_search_storage_info = 10116 [(module) = "appsearch"];
1371        VmStat vmstat = 10117 [(module) = "framework"];
1372        Keystore2KeyCreationWithGeneralInfo keystore2_key_creation_with_general_info =
1373                10118 [(module) = "framework"];
1374        Keystore2KeyCreationWithAuthInfo keystore2_key_creation_with_auth_info =
1375                10119 [(module) = "framework"];
1376        Keystore2KeyCreationWithPurposeAndModesInfo
1377                keystore2_key_creation_with_purpose_and_modes_info = 10120 [(module) = "framework"];
1378        Keystore2AtomWithOverflow keystore2_atom_with_overflow = 10121 [(module) = "framework"];
1379        Keystore2KeyOperationWithPurposeAndModesInfo
1380                keystore2_key_operation_with_purpose_and_modes_info =
1381                        10122 [(module) = "framework"];
1382        Keystore2KeyOperationWithGeneralInfo keystore2_key_operation_with_general_info =
1383                10123 [(module) = "framework"];
1384        RkpErrorStats rkp_error_stats = 10124 [(module) = "framework"];
1385        Keystore2CrashStats keystore2_crash_stats = 10125 [(module) = "framework"];
1386        VendorApexInfo vendor_apex_info = 10126 [(module) = "framework"];
1387        AccessibilityShortcutStats accessibility_shortcut_stats = 10127 [(module) = "framework"];
1388        AccessibilityFloatingMenuStats accessibility_floating_menu_stats =
1389            10128 [(module) = "framework"];
1390        DataUsageBytesTransferV2 data_usage_bytes_transfer_v2 = 10129 [(module) = "framework",
1391                (truncate_timestamp) = true];
1392        MediaCapabilities media_capabilities = 10130 [(module) = "framework"];
1393        CarWatchdogSystemIoUsageSummary car_watchdog_system_io_usage_summary =
1394            10131 [(module) = "car"];
1395        CarWatchdogUidIoUsageSummary car_watchdog_uid_io_usage_summary = 10132 [(module) = "car"];
1396        ImsRegistrationFeatureTagStats ims_registration_feature_tag_stats =
1397                10133 [(module) = "telephony"];
1398        RcsClientProvisioningStats rcs_client_provisioning_stats =
1399                10134 [(module) = "telephony"];
1400        RcsAcsProvisioningStats rcs_acs_provisioning_stats =
1401                10135 [(module) = "telephony"];
1402        SipDelegateStats sip_delegate_stats = 10136 [(module) = "telephony"];
1403        SipTransportFeatureTagStats sip_transport_feature_tag_stats =
1404                10137 [(module) = "telephony"];
1405        SipMessageResponse sip_message_response = 10138 [(module) = "telephony"];
1406        SipTransportSession sip_transport_session = 10139 [(module) = "telephony"];
1407        ImsDedicatedBearerListenerEvent ims_dedicated_bearer_listener_event =
1408                10140 [(module) = "telephony"];
1409        ImsDedicatedBearerEvent ims_dedicated_bearer_event = 10141 [(module) = "telephony"];
1410        ImsRegistrationServiceDescStats ims_registration_service_desc_stats =
1411                10142 [(module) = "telephony"];
1412        UceEventStats uce_event_stats = 10143 [(module) = "telephony"];
1413        PresenceNotifyEvent presence_notify_event = 10144 [(module) = "telephony"];
1414        GbaEvent gba_event = 10145 [(module) = "telephony"];
1415        PerSimStatus per_sim_status = 10146 [(module) = "telephony"];
1416        GpuWorkPerUid gpu_work_per_uid = 10147;
1417        PersistentUriPermissionsAmountPerPackage persistent_uri_permissions_amount_per_package =
1418            10148 [(module) = "framework"];
1419        SignedPartitionInfo signed_partition_info = 10149 [(module) = "framework"];
1420        PinnedFileSizesPerPackage pinned_file_sizes_per_package = 10150
1421            [(module) = "framework"];
1422        PendingIntentsPerPackage pending_intents_per_package = 10151
1423            [(module) = "framework"];
1424        UserInfo user_info = 10152 [(module) = "framework"];
1425        TelephonyNetworkRequestsV2 telephony_network_requests_v2 = 10153 [(module) = "telephony"];
1426        DeviceTelephonyProperties device_telephony_properties = 10154 [(module) = "telephony"];
1427        RemoteKeyProvisioningErrorCounts remote_key_provisioning_error_counts = 10155 [deprecated = true];
1428        SafetyState safety_state = 10156 [(module) = "permissioncontroller"];
1429        IncomingMms incoming_mms = 10157 [(module) = "mms"];
1430        OutgoingMms outgoing_mms = 10158 [(module) = "mms"];
1431        MultiUserInfo multi_user_info = 10160 [(module) = "framework"];
1432        NetworkBpfMapInfo network_bpf_map_info = 10161 [(module) = "connectivity"];
1433        OutgoingShortCodeSms outgoing_short_code_sms = 10162 [(module) = "telephony"];
1434        ConnectivityStateSample connectivity_state_sample = 10163 [(module) = "connectivity"];
1435        NetworkSelectionRematchReasonsInfo network_selection_rematch_reasons_info = 10164 [(module) = "connectivity"];
1436        agif.GameModeInfo game_mode_info = 10165 [(module) = "framework"];
1437        agif.GameModeConfiguration game_mode_configuration = 10166 [(module) = "framework"];
1438        agif.GameModeListener game_mode_listener = 10167 [(module) = "framework"];
1439        NetworkSliceRequestCountSample network_slice_request_count = 10168 [(module) = "connectivity"];
1440        WsTileSnapshot ws_tile_snapshot = 10169 [(module) = "wearservices"];
1441        WsActiveWatchFaceComplicationSetSnapshot ws_active_watch_face_complication_set_snapshot = 10170 [(module) = "wearservices"];
1442        ProcessState process_state = 10171 [(module) = "framework"];
1443        ProcessAssociation process_association = 10172 [(module) = "framework"];
1444        adpf.ADPFSystemComponentInfo adpf_system_component_info = 10173 [(module) = "framework"];
1445        sysui.NotificationMemoryUse notification_memory_use = 10174 [(module) = "sysui"];
1446        display.HdrCapabilities hdr_capabilities = 10175 [(module) = "framework"];
1447        WsFavouriteWatchFaceListSnapshot ws_favourite_watch_face_list_snapshot = 10176 [(module) = "wearservices"];
1448    }
1449
1450    // Pulled atom extensions.
1451    // The atom definitions are under atoms/<feature>/<feature>_extension_atoms.proto
1452    extensions 10159; // SandboxSdkStorage sandbox_sdk_storage
1453    extensions 10177; // QnsRatPreferenceMismatchInfo qns_rat_preference_mismatch_info
1454    extensions 10178; // QnsHandoverTimeMillis qns_handover_time_millis
1455    extensions 10179; // QnsHandoverPingpong qns_handover_pingpong
1456    extensions 10180; // EmergencyNumbersInfo emergency_numbers_info
1457    extensions 10181; // MteState mte_state
1458    extensions 10182; // SatelliteController satellite_controller
1459    extensions 10183; // SatelliteSession satellite_session
1460    extensions 10184; // SatelliteIncomingDatagram satellite_incoming_datagram
1461    extensions 10185; // SatelliteOutgoingDatagram satellite_outgoing_datagram
1462    extensions 10186; // SatelliteProvision satellite_provision
1463    extensions 10187; // SatelliteSosMessageRecommender satellite_sos_message_recommender
1464    extensions 10188; // UwbActivityInfo uwb_activity_info
1465    extensions 10189; // CachedAppsHighWaterMark cached_apps_high_watermark
1466    extensions 10190; // WifiAwareCapabilities wifi_aware_capabilities
1467    extensions 10191; // TouchpadUsage touchpad_usage
1468    extensions 10192; // DreamSettingSnapshot dream_setting_snapshot
1469    extensions 10193; // WifiModuleInfo wifi_module_info
1470    extensions 10194; // WifiSettingInfo wifi_setting_info
1471    extensions 10195; // WifiComplexSettingInfo wifi_complex_setting_info
1472    extensions 10196; // SysproxyBluetoothBytesTransfer sysproxy_bluetooth_bytes_transfer
1473    extensions 10197; // WsStandaloneModeSnapshot ws_standalone_mode_snapshot
1474    extensions 10198; // WifiConfiguredNetworkInfo wifi_configured_network_info;
1475    extensions 10199; // CpuPolicy cpu_policy
1476    extensions 10200; // ProxyBytesTransferByFgBg proxy_bytes_transfer_by_fg_bg
1477    extensions 10201; // ThermalHeadroomThresholds thermal_headroom_thresholds
1478    extensions 10202; // Reserved for b/308823939.
1479    extensions 10203; // Reserved for b/308823939.
1480    extensions 10204; // MobileBytesTransferByProcState mobile_bytes_transfer_by_proc_state
1481    extensions 10205; // ArtDeviceStatus art_device_status
1482    extensions 10206; // WsFavouriteWatchFaceSnapshot ws_favorite_watch_face_snapshot
1483    extensions 10207; // DataNetworkValidation data_network_validation
1484    // 10208 is reserved due to removing the old atom.
1485    extensions 10209; // Reserved for b/324602949
1486    extensions 10210; // Reserved for b/339008431
1487    extensions 10211; // CarrierRoamingSatelliteSession carrier_roaming_satellite_session
1488    extensions 10212; // CarrierRoamingSatelliteControllerStats carrier_roaming_satellite_controller_stats
1489    extensions 10213; // ControllerStatsPerPackage controller_stats_per_package
1490    extensions 10214; // SatelliteEntitlement satellite_entitlement
1491    extensions 10215; // SatelliteConfigUpdater satellite_config_updater
1492    extensions 10216; // DevicePolicyManagementMode
1493    extensions 10217; // DevicePolicyPolicyState
1494    extensions 10218; // AdpfSessionSnapshot adpf_session_snapshot
1495    extensions 10219; // SatelliteAccessController satellite_access_controller
1496    extensions 99999; // Atom99999 atom_99999
1497
1498    // DO NOT USE field numbers above 100,000 in AOSP.
1499    // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
1500    // Field numbers 200,000 and above are reserved for future use; do not use them at all.
1501    reserved 54, 58, 83, 360 to 363, 492, 597, 801, 10008, 10036, 10040, 10041, 21004, 21005;
1502}
1503
1504/*
1505 * *****************************************************************************
1506 * Below are all of the individual atoms that are logged by Android via statsd.
1507 *
1508 * RULES:
1509 *   - The field ids for each atom must start at 1, and count upwards by 1.
1510 *     Skipping field ids is not allowed.
1511 *   - These form an API, so renaming, renumbering or removing fields is
1512 *     not allowed between android releases.  (This is not currently enforced,
1513 *     but there will be a tool to enforce this restriction).
1514 *   - The types must be built-in protocol buffer types, namely, no sub-messages
1515 *     are allowed (yet).  The bytes type is also not allowed.
1516 *   - The CamelCase name of the message type should match the
1517 *     underscore_separated name as defined in Atom.
1518 *   - If an atom represents work that can be attributed to an app, there can
1519 *     be exactly one AttributionChain field. It must be field number 1.
1520 *   - A field that is a uid should be an int32 field, tagged with the
1521 *     [(is_uid) = true] annotation.
1522 *
1523 * CONVENTIONS:
1524 *   - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
1525 *   - If there is a UID, it goes first. Think in an object-oriented fashion.
1526 * *****************************************************************************
1527 */
1528
1529/**
1530 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
1531 * Logs when the Thermal service HAL notifies the throttling start/stop events.
1532 *
1533 * Logged from:
1534 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
1535 */
1536message ThermalThrottlingStateChanged {
1537    // The type of temperature being reported (CPU, GPU, SKIN, etc)
1538    optional android.os.TemperatureTypeEnum sensor_type = 1;
1539
1540    // Throttling state, this field is DEPRECATED
1541    enum State {
1542        UNKNOWN = 0;
1543        START = 1; // START indicated that throttling was triggered.
1544        STOP = 2; // STOP indicates that throttling was cleared.
1545    }
1546    optional State state = 2;
1547
1548    optional float temperature = 3;
1549}
1550
1551/**
1552 * Track transcoding service usage
1553 * Logged from:
1554 *   packages/providers/MediaProvider/src/com/android/providers/media/TranscodeHelper.java
1555 * Next Tag: 14
1556 */
1557message TranscodingData {
1558    // Reason that leads to the type of access.
1559    enum AccessReason {
1560        UNKNOWN = 0;
1561        SYSTEM_DEFAULT = 1; // Default option
1562        SYSTEM_CONFIG = 2;  // Server-side/on-device config
1563        APP_MANIFEST = 3;  // media_capabilites.xml
1564        APP_COMPAT = 4;   // App compat framework
1565        APP_EXTRA = 5;   // ApplicationMediaCapabilities API in open()
1566    }
1567
1568    // Causes that leads to the failure of transcode.
1569    enum FailureCause {
1570        CAUSE_UNKNOWN = 0;
1571        TRANSCODING_SERVICE_ERROR = 1;     // Error from transcoding service.
1572        TRANSCODING_CLIENT_TIMEOUT = 2;    // Timeout from MediaProvider.
1573        TRANSCODING_SESSION_CANCELED = 3; // MediaProvider cancels the transcode.
1574    }
1575
1576    enum AccessType {
1577        HEVC_WRITE = 1;
1578        READ_DIRECT = 2;
1579        READ_CACHE = 3;
1580        READ_TRANSCODE = 4;
1581        WRITE_CACHE = 5; // App trying to write to transcodeid avc file in cache, this is rare.
1582        AVC_WRITE = 6;
1583    }
1584
1585    enum Result {
1586        SUCCESS = 0;
1587        FAIL = 1;
1588        UNDEFINED = 2;
1589    }
1590
1591    optional string requestor_package = 1;
1592    optional AccessType access_type = 2;
1593    optional int64 file_size_bytes = 3;
1594    optional Result transcode_result = 4;
1595    optional int64 transcode_duration_millis = 5; // The duration of transcoding.
1596    optional int64 file_duration_millis = 6; // The duration of the video file.
1597    optional int64 file_framerate_fps = 7; // The framerate of the video file.
1598    optional AccessReason access_reason = 8;
1599    optional int64 width = 9;
1600    optional int64 height = 10;
1601    optional bool hit_anr = 11;
1602    optional FailureCause failure_cause = 12;   // This field is valid only when fails.
1603    optional int64 transcoding_service_error_code = 13; // Error code from transcoding service.
1604}
1605
1606/**
1607 * Logs when the screen state changes.
1608 *
1609 * Logged from:
1610 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1611 */
1612message ScreenStateChanged {
1613    // New screen state, from frameworks/proto_logging/stats/enums/view/enums.proto.
1614    optional android.view.DisplayStateEnum state = 1
1615            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1616}
1617
1618/**
1619 * Part of the go/activity-security project. Logs information about activity
1620 * starts which would be blocked as part of the project.
1621 *
1622 * Logged from:
1623 *  - frameworks/base/services/core/java/com/android/server/wm/ActivityStarter.java
1624 *  - frameworks/base/services/core/java/com/android/server/wm/ActivityClientController.java
1625 */
1626message ActivityActionBlocked {
1627    enum Action {
1628        ACTION_UNSPECIFIED = 0;
1629        ACTIVITY_START_SAME_TASK = 1;
1630        ACTIVITY_START_DIFFERENT_TASK = 2;
1631        ACTIVITY_START_NEW_TASK = 3;
1632        FINISH_TASK = 4;
1633    }
1634    optional int32 caller_uid = 1 [(is_uid) = true];
1635    optional string caller_activity_class_name = 2;
1636    optional int32 target_task_top_activity_uid = 3 [(is_uid) = true];
1637    optional string target_task_top_activity_class_name = 4;
1638    optional bool target_task_is_different = 5;
1639    optional int32 target_activity_uid = 6 [(is_uid) = true];
1640    optional string target_activity_class_name = 7;
1641    optional string target_intent_action = 8;
1642    optional int32 target_intent_flags = 9;
1643
1644    optional Action action = 10;
1645    optional int32 version = 11;
1646    optional bool multi_window = 12;
1647    optional int32 bal_code = 13;
1648    optional string task_debug_info = 14;
1649}
1650
1651/**
1652 * Logs that the process state of the uid, as determined by ActivityManager
1653 * (i.e. the highest process state of that uid's processes) has changed.
1654 *
1655 * Logged from:
1656 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1657 */
1658message UidProcessStateChanged {
1659    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
1660
1661    // The state, from frameworks/proto_logging/stats/enums/app/app_enums.proto.
1662    optional android.app.ProcessStateEnum state = 2
1663            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1664}
1665
1666/**
1667 * Logs process state change of a process, as per the activity manager.
1668 *
1669 * Logged from:
1670 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
1671 */
1672message ProcessStateChanged {
1673    optional int32 uid = 1;
1674    optional string process_name = 2;
1675    optional string package_name = 3;
1676    // TODO: remove this when validation is done
1677    optional int64 version = 5;
1678    // The state, from frameworks/proto_logging/stats/enums/app/app_enums.proto.
1679    optional android.app.ProcessStateEnum state = 4;
1680}
1681
1682/**
1683 * Logs how long a process was in each of the states.
1684 */
1685message ProcessState {
1686  optional int32 uid = 1 [(is_uid) = true];
1687  optional string process_name = 2;
1688
1689  // Measurement period. Can be used as denominator.
1690  // The gauge duration is not representative because we want uptime and also
1691  // the measurement usually ends at a time earlier than pull time.
1692  optional int32 measurement_start_uptime_seconds = 3;
1693  optional int32 measurement_end_uptime_seconds = 4;
1694  optional int32 measurement_duration_uptime_seconds = 5;
1695
1696  // Individual state breakdowns, summing up to total process runtime.
1697  // Flattening (instead of a dimensions - value pair) for two reasons:
1698  // 1. Makes metric filtering possible (can pull the entire process data based
1699  //    on a specific value.
1700  // 2. More efficient to encode (proto id serves as dimension).
1701  optional int32 top_seconds = 6;
1702  optional int32 fgs_seconds = 7;
1703  optional int32 bound_top_seconds = 8;
1704  optional int32 bound_fgs_seconds = 9;
1705  optional int32 important_fg_bg_seconds = 10;
1706  optional int32 cached_seconds = 11;
1707  optional int32 frozen_seconds = 12;
1708  optional int32 other_seconds = 13;
1709}
1710
1711/**
1712 * Logs association between processes.
1713 */
1714message ProcessAssociation {
1715  optional int32 client_uid = 1 [(is_uid) = true];
1716
1717  // If we only care about the package name name we do not need to upload this
1718  // (even though we should add it to the atom for filtering / sharding)
1719  optional string client_process = 2;
1720
1721  optional int32 service_uid = 3 [(is_uid) = true];
1722
1723  optional string service_name = 4;
1724
1725  optional string service_process = 10;
1726
1727  // Measurement period. Can be used as denominator.
1728  // The gauge duration is not representative because we want uptime and also
1729  // the measurement usually ends at a time earlier than pull time.
1730  optional int32 measurement_start_uptime_seconds = 5;
1731  optional int32 measurement_end_uptime_seconds = 6;
1732  optional int32 measurement_duration_uptime_seconds = 7;
1733
1734  optional int32 duration_seconds = 8;
1735
1736  // Number of times this association was established.
1737  optional int32 count = 9;
1738}
1739
1740/**
1741 * Logs when ActivityManagerService sleep state is changed.
1742 *
1743 * Logged from:
1744 *   frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
1745 */
1746message ActivityManagerSleepStateChanged {
1747    // TODO: import frameworks proto
1748    enum State {
1749        UNKNOWN = 0;
1750        ASLEEP = 1;
1751        AWAKE = 2;
1752    }
1753    optional State state = 1
1754            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1755}
1756
1757/**
1758 * Logs when system memory state changes.
1759 *
1760 * Logged from:
1761 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1762 */
1763message MemoryFactorStateChanged {
1764    // TODO: import frameworks proto
1765    enum State {
1766        MEMORY_UNKNOWN = 0;
1767        NORMAL = 1;     // normal.
1768        MODERATE = 2;   // moderate memory pressure.
1769        LOW = 3;        // low memory.
1770        CRITICAL = 4;   // critical memory.
1771
1772    }
1773    optional State factor = 1 [
1774        (state_field_option).exclusive_state = true,
1775        (state_field_option).nested = false
1776    ];
1777}
1778
1779/**
1780 * Logs when app is using too much cpu, according to ActivityManagerService.
1781 *
1782 * Logged from:
1783 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1784 */
1785message ExcessiveCpuUsageReported {
1786    optional int32 uid = 1;
1787    optional string process_name = 2;
1788    optional string package_name = 3;
1789    // package version. TODO: remove this when validation is done
1790    optional int64 version = 4;
1791}
1792
1793/**
1794 * Logs when a cached process is killed, along with its pss.
1795 *
1796 * Logged from:
1797 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1798 */
1799message CachedKillReported {
1800    optional int32 uid = 1;
1801    optional string process_name = 2;
1802    optional string package_name = 3;
1803    // TODO: remove this when validation is done
1804    optional int64 version = 5;
1805    optional int64 pss = 4;
1806}
1807
1808/**
1809 * Logs the change in wifi health.
1810 *
1811 * Logged from:
1812 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiDataStall.java
1813 */
1814message WifiHealthStatReported {
1815    enum Band {
1816        UNKNOWN = 0;
1817        // All of 2.4GHz band
1818        BAND_2G = 1;
1819        // Frequencies in the range of [5150, 5250) GHz
1820        BAND_5G_LOW = 2;
1821        // Frequencies in the range of [5250, 5725) GHz
1822        BAND_5G_MIDDLE = 3;
1823        // Frequencies in the range of [5725, 5850) GHz
1824        BAND_5G_HIGH = 4;
1825        // Frequencies in the range of [5925, 6425) GHz
1826        BAND_6G_LOW = 5;
1827        // Frequencies in the range of [6425, 6875) GHz
1828        BAND_6G_MIDDLE = 6;
1829        // Frequencies in the range of [6875, 7125) GHz
1830        BAND_6G_HIGH = 7;
1831    }
1832    // duration this stat is obtained over in milliseconds
1833    optional int32 duration_millis = 1;
1834    // whether wifi is classified as sufficient for the user's data traffic, determined
1835    // by whether the calculated throughput exceeds the average demand within |duration_millis|
1836    optional bool is_sufficient = 2;
1837    // whether cellular data is available
1838    optional bool is_cell_data_available = 3;
1839    // the Band bucket the connected network is on
1840    optional Band band = 4;
1841    // the Signal strength in the range of [-126, 0)
1842    optional int32 rssi = 5;
1843    // estimated tx throughput in kbps
1844    optional int32 tx_kbps = 6 [default = -1];
1845    // estimated rx throughput in kbps
1846    optional int32 rx_kbps = 7 [default = -1];
1847   // External scorer UID if external scorer is enabled. Otherwise WIFI_UID for
1848   // AOSP scorer.
1849   optional int32 scorer_uid = 8;
1850   // Whether or not Wi-Fi is predicted as usable by the scorer
1851   // Note: 'is_wifi_predicted_as_usable' is deprectaed by 'wifi_predicted_usability_state'.
1852   optional bool is_wifi_predicted_as_usable = 9;
1853   // Wi-Fi usability state as predicted by the scorer
1854   optional android.net.wifi.WifiPredictedUsabilityState wifi_predicted_usability_state = 10;
1855}
1856
1857/**
1858 * Logged when wifi detects a significant change in connection failure rate.
1859 *
1860 * Logged from: frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiHealthMonitor.java
1861 *
1862 */
1863message WifiFailureStatReported {
1864    enum AbnormalityType {
1865        UNKNOWN = 0;
1866        SIGNIFICANT_INCREASE = 1;
1867        SIGNIFICANT_DECREASE = 2;
1868        SIMPLY_HIGH = 3;
1869    }
1870    enum FailureType {
1871        FAILURE_UNKNOWN = 0;
1872        FAILURE_CONNECTION = 1;
1873        FAILURE_ASSOCIATION_REJECTION = 2;
1874        FAILURE_ASSOCIATION_TIMEOUT = 3;
1875        FAILURE_AUTHENTICATION = 4;
1876        FAILURE_NON_LOCAL_DISCONNECTION = 5;
1877        FAILURE_SHORT_CONNECTION_DUE_TO_NON_LOCAL_DISCONNECTION = 6;
1878    }
1879    // Reason for uploading this stat
1880    optional AbnormalityType abnormality_type = 1;
1881    // The particular type of failure
1882    optional FailureType failure_type = 2;
1883    // How many times we have encountered this combination of AbnormalityType and FailureType
1884    optional int32 failure_count = 3;
1885}
1886
1887/**
1888 * Logs whether a Wifi connection attempt was successful and reasons for failure if it wasn't.
1889 *
1890 * Logged from:
1891 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1892 */
1893message WifiConnectionResultReported {
1894    enum FailureCode {
1895        FAILURE_UNKNOWN = 0;
1896        FAILURE_ASSOCIATION_TIMEOUT = 1;
1897        FAILURE_ASSOCIATION_REJECTION = 2;
1898        FAILURE_AUTHENTICATION_GENERAL = 3;
1899        FAILURE_AUTHENTICATION_EAP = 4;
1900        FAILURE_DHCP = 5;
1901        FAILURE_NETWORK_DISCONNECTION = 6;
1902        FAILURE_ROAM_TIMEOUT = 7;
1903        FAILURE_WRONG_PASSWORD = 8;
1904        FAILURE_CONNECT_NETWORK_FAILED = 9;
1905        FAILURE_NEW_CONNECTION_ATTEMPT = 10;
1906        FAILURE_REDUNDANT_CONNECTION_ATTEMPT = 11;
1907        FAILURE_NETWORK_NOT_FOUND = 12;
1908        FAILURE_NO_RESPONSE = 13;
1909        FAILURE_OTHERS = 14;
1910    }
1911
1912    enum Trigger {
1913        UNKNOWN = 0;
1914        // Connection attempt was initiated manually.
1915        MANUAL = 1;
1916        // Automatic reconnection to the same network as connected previously.
1917        RECONNECT_SAME_NETWORK = 2;
1918        // Automatic reconnection to a saved network, but not the previous one.
1919        AUTOCONNECT_CONFIGURED_NETWORK = 3;
1920        // Automatic first connection attempt after device boot.
1921        AUTOCONNECT_BOOT = 4;
1922    }
1923
1924    // True represents a successful connection.
1925    optional bool connection_result = 1;
1926    // Reason for the connection failure.
1927    optional FailureCode failure_code = 2;
1928    // Scan RSSI before the connection attempt.
1929    optional int32 rssi = 3;
1930    // Time taken by this connection attempt.
1931    optional int32 connection_attempt_duration_millis = 4;
1932    // Band bucket the connected network is on.
1933    optional android.net.wifi.WifiBandBucket band = 5;
1934    // Authentication type.
1935    optional android.net.wifi.WifiAuthType auth_type = 6;
1936    // What triggered this connection attempt.
1937    optional Trigger trigger = 7;
1938    // Whether this network was used (successfully connected to) previously.
1939    optional bool network_used = 8;
1940    // Time taken from the last successful connection (or device boot if that's the first one).
1941    optional int32 time_since_last_connection_seconds = 9;
1942    // Whether the connection is carrier wifi.
1943    optional bool is_carrier_wifi = 10;
1944    // Whether the OOB pseeudonym is enabled for the current connection.
1945    optional bool is_oob_pseudonym_enabled = 11;
1946    // The client mode role for the connection, can use to determine the connection type.
1947    optional android.net.wifi.ClientModeRole role = 12;
1948    // The status code specific to each failure code.
1949    // - For FAILURE_ASSOCIATION_REJECTION, the value should be one of
1950    //   SupplicantStaIfaceHal.StaIfaceStatusCode.
1951    // - For FAILURE_NETWORK_DISCONNECTION, the value should be
1952    //   one of SupplicantStaIfaceHal.StaIfaceReasonCode.
1953    // - For FAILURE_AUTHENTICATION_EAP, the value should be a EAP failure code.
1954    // For all other failure codes, this should be 0.
1955    optional int32 failure_specific_status_code = 13;
1956    // Information only applicable for EAP networks.
1957    optional android.net.wifi.EapType eap_type = 14;
1958    optional android.net.wifi.EapInnerMethod eap_inner_method = 15;
1959    optional android.net.wifi.RoamingType passpoint_roaming_type = 16;
1960    // carrier ID of the network
1961    optional int32 carrier_id = 17;
1962    optional android.net.wifi.TofuConfiguration tofu_configuration = 18;
1963    // uid of the caller who initiated this connection
1964    optional int32 connection_uid = 19 [(is_uid) = true];
1965}
1966
1967/**
1968 * Logs when a Wifi connection drops.
1969 *
1970 * Logged from:
1971 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1972 */
1973message WifiDisconnectReported {
1974    enum FailureCode {
1975        UNKNOWN = 0;
1976
1977        // Wifi supplicant failure reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45).
1978        // See ISupplicantStaIfaceCallback.java:ReasonCode
1979        UNSPECIFIED = 1;
1980        PREV_AUTH_NOT_VALID = 2;
1981        DEAUTH_LEAVING = 3;
1982        DISASSOC_DUE_TO_INACTIVITY = 4;
1983        DISASSOC_AP_BUSY = 5;
1984        CLASS2_FRAME_FROM_NONAUTH_STA = 6;
1985        CLASS3_FRAME_FROM_NONASSOC_STA = 7;
1986        DISASSOC_STA_HAS_LEFT = 8;
1987        STA_REQ_ASSOC_WITHOUT_AUTH = 9;
1988        PWR_CAPABILITY_NOT_VALID = 10;
1989        SUPPORTED_CHANNEL_NOT_VALID = 11;
1990        BSS_TRANSITION_DISASSOC = 12;
1991        INVALID_IE = 13;
1992        MICHAEL_MIC_FAILURE = 14;
1993        FOURWAY_HANDSHAKE_TIMEOUT = 15;
1994        GROUP_KEY_UPDATE_TIMEOUT = 16;
1995        IE_IN_4WAY_DIFFERS = 17;
1996        GROUP_CIPHER_NOT_VALID = 18;
1997        PAIRWISE_CIPHER_NOT_VALID = 19;
1998        AKMP_NOT_VALID = 20;
1999        UNSUPPORTED_RSN_IE_VERSION = 21;
2000        INVALID_RSN_IE_CAPAB = 22;
2001        IEEE_802_1X_AUTH_FAILED = 23;
2002        CIPHER_SUITE_REJECTED = 24;
2003        TDLS_TEARDOWN_UNREACHABLE = 25;
2004        TDLS_TEARDOWN_UNSPECIFIED = 26;
2005        SSP_REQUESTED_DISASSOC = 27;
2006        NO_SSP_ROAMING_AGREEMENT = 28;
2007        BAD_CIPHER_OR_AKM = 29;
2008        NOT_AUTHORIZED_THIS_LOCATION = 30;
2009        SERVICE_CHANGE_PRECLUDES_TS = 31;
2010        UNSPECIFIED_QOS_REASON = 32;
2011        NOT_ENOUGH_BANDWIDTH = 33;
2012        DISASSOC_LOW_ACK = 34;
2013        EXCEEDED_TXOP = 35;
2014        STA_LEAVING = 36;
2015        END_TS_BA_DLS = 37;
2016        UNKNOWN_TS_BA = 38;
2017        TIMEOUT = 39;
2018        PEERKEY_MISMATCH = 45;
2019        AUTHORIZED_ACCESS_LIMIT_REACHED = 46;
2020        EXTERNAL_SERVICE_REQUIREMENTS = 47;
2021        INVALID_FT_ACTION_FRAME_COUNT = 48;
2022        INVALID_PMKID = 49;
2023        INVALID_MDE = 50;
2024        INVALID_FTE = 51;
2025        MESH_PEERING_CANCELLED = 52;
2026        MESH_MAX_PEERS = 53;
2027        MESH_CONFIG_POLICY_VIOLATION = 54;
2028        MESH_CLOSE_RCVD = 55;
2029        MESH_MAX_RETRIES = 56;
2030        MESH_CONFIRM_TIMEOUT = 57;
2031        MESH_INVALID_GTK = 58;
2032        MESH_INCONSISTENT_PARAMS = 59;
2033        MESH_INVALID_SECURITY_CAP = 60;
2034        MESH_PATH_ERROR_NO_PROXY_INFO = 61;
2035        MESH_PATH_ERROR_NO_FORWARDING_INFO = 62;
2036        MESH_PATH_ERROR_DEST_UNREACHABLE = 63;
2037        MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64;
2038        MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65;
2039        MESH_CHANNEL_SWITCH_UNSPECIFIED = 66;
2040
2041        // ClientModeImpl error codes
2042        // Defined in /frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
2043        IFACE_DESTROYED = 10000;
2044        WIFI_DISABLED = 10001;
2045        SUPPLICANT_DISCONNECTED = 10002;
2046        CONNECTING_WATCHDOG_TIMER = 10003;
2047        ROAM_WATCHDOG_TIMER = 10004;
2048
2049        // New reasons tracking disconnections initiated by wifi framework
2050        DISCONNECT_GENERAL = 10005; // Framework disconnect, generic reason
2051        // Disconnecting due to unspecified IP reachability lost.
2052        DISCONNECT_NUD_FAILURE_GENERIC = 10006;
2053        // Disconnecting due to IP reachability lost from roaming
2054        DISCONNECT_NUD_FAILURE_ROAM = 10007;
2055        // Disconnecting due to IP reachability lost from the CONFIRM command
2056        DISCONNECT_NUD_FAILURE_CONFIRM = 10008;
2057        // Disconnecting due to IP reachability lost from kernel check
2058        DISCONNECT_NUD_FAILURE_ORGANIC = 10009;
2059        // Connectivity no longer wants this network
2060        DISCONNECT_UNWANTED_BY_CONNECTIVITY = 10010;
2061        // Timeout creating the IP client
2062        DISCONNECT_CREATE_IP_CLIENT_TIMEOUT = 10011;
2063        DISCONNECT_IP_PROVISIONING_FAILURE = 10012; // IP provisioning failure
2064        DISCONNECT_P2P_REQUESTED_DISCONNECT = 10013; // Disconnect by P2P
2065        // Network is removed from the WifiConfigManager
2066        DISCONNECT_NETWORK_REMOVED = 10014;
2067        DISCONNECT_NETWORK_UNTRUSTED = 10015; // Network is marked as untrusted
2068        DISCONNECT_NETWORK_METERED = 10016; // Network is marked as metered
2069        DISCONNECT_TEMP_DISABLED = 10017; // Network is temporarily disabled
2070        DISCONNECT_PERM_DISABLED = 10018; // Network is permanently disabled
2071        DISCONNECT_CARRIER_OFFLOAD_DISABLED = 10019;
2072        // Disconnecting due to Passpoint terms and conditions page
2073        DISCONNECT_PASSPOINT_TAC = 10020;
2074        // Disconnecting due to issues with terms and conditions URL
2075        DISCONNECT_VNC_REQUEST = 10021;
2076        // Connected to a network that is already removed
2077        DISCONNECT_UNKNOWN_NETWORK = 10022;
2078        // User initiated a new connection
2079        DISCONNECT_NEW_CONNECTION_USER = 10023;
2080        // New connection triggered by non-user
2081        DISCONNECT_NEW_CONNECTION_OTHERS = 10024;
2082        // Wi-Fi 7 is enabled or disabled for this network
2083        DISCONNECT_NETWORK_WIFI7_TOGGLED = 10025;
2084    }
2085
2086    // How long the session lasted from successful connection to disconnect.
2087    optional int32 connected_duration_seconds = 1;
2088
2089    // Reason for the disconnect.
2090    optional FailureCode failure_code = 2;
2091
2092    // Band bucket the connected network was on.
2093    optional android.net.wifi.WifiBandBucket band = 3;
2094
2095    // Authentication type.
2096    optional android.net.wifi.WifiAuthType auth_type = 4;
2097
2098    // Last seen RSSI before the disconnect.
2099    optional int32 last_rssi = 5;
2100
2101    // Last seen link speed before the disconnect.
2102    optional int32 last_link_speed = 6;
2103
2104    // Time since the last RSSI and link speed update.
2105    // Useful for filtering out very old data
2106    optional int32 time_since_last_rssi_poll_seconds = 7;
2107
2108    // Time from the last NETWORK_CONNECTION_EVENT to the disconnect
2109    optional int32 connected_time_since_last_roam_seconds = 8;
2110
2111    // The purpose the of the connection
2112    optional android.net.wifi.ClientModeRole role = 9;
2113
2114    // The type of EAP authentication. Only applicable for EAP networks.
2115    optional android.net.wifi.EapType eap_type = 10;
2116
2117    optional android.net.wifi.EapInnerMethod eap_inner_method = 11;
2118
2119    optional android.net.wifi.RoamingType passpoint_roaming_type = 12;
2120
2121    // Carrier id of the network.
2122    optional int32 carrier_id = 13;
2123
2124    // uid of the caller who initiated this connection
2125    optional int32 connection_uid = 14 [(is_uid) = true];
2126}
2127
2128/**
2129 * Logs when Wifi connection is established or dropped.
2130 *
2131 * Logged from:
2132 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
2133 */
2134message WifiConnectionStateChanged {
2135    optional bool is_connected = 1 [
2136        (state_field_option).exclusive_state = true,
2137        (state_field_option).nested = false
2138    ];
2139
2140    // Band bucket the connected network was on.
2141    // Filled for both connected and disconnected cases.
2142    optional android.net.wifi.WifiBandBucket band = 2;
2143
2144    // Authentication type.
2145    // Filled for both connected and disconnected cases.
2146    optional android.net.wifi.WifiAuthType auth_type = 3;
2147}
2148
2149/**
2150 * Logged when wifi peer to peer connection happens
2151 */
2152message WifiP2pConnectionReported {
2153    enum Type {
2154        UNSPECIFIED = 0;
2155        // fresh new connection.
2156        FRESH = 1;
2157        // reinvoke a group.
2158        REINVOKE = 2;
2159        // create a group with the current device as the group owner locally.
2160        LOCAL = 3;
2161        // create a group or join a group with config.
2162        FAST = 4;
2163    }
2164    enum FailureCode {
2165        // Failure is unknown.
2166        UNKNOWN = 0;
2167        // No failure.
2168        NONE = 1;
2169        // Timeout for current connecting request.
2170        TIMEOUT = 2;
2171        // The connecting request is canceled by the user.
2172        CANCEL = 3;
2173        // Provision discovery failure, e.g. no pin code, timeout, rejected by the peer.
2174        PROV_DISC_FAIL = 4;
2175        // Invitation failure, e.g. rejected by the peer.
2176        INVITATION_FAIL = 5;
2177        // Incoming request is rejected by the user.
2178        USER_REJECT = 6;
2179        // New connection request is issued before ending previous connecting request.
2180        NEW_CONNECTION_ATTEMPT = 7;
2181        // Group has been removed
2182        GROUP_REMOVED = 8;
2183        // Creating group failed
2184        CREATE_GROUP_FAILED = 9;
2185    }
2186    enum GroupRole {
2187        GROUP_UNKNOWN = 0;
2188        GROUP_OWNER = 1;
2189        GROUP_CLIENT = 2;
2190    }
2191    enum Band {
2192        // Unknown band/frequency
2193        BAND_UNKNOWN = 0;
2194        // any band
2195        BAND_AUTO = 1;
2196        // With 2G band
2197        BAND_2G = 2;
2198        // With 5G band
2199        BAND_5G = 3;
2200        // With 6G band
2201        BAND_6G = 4;
2202        // With a specific frequency
2203        BAND_FREQUENCY = 5;
2204    }
2205    // Type of the connection.
2206    optional Type type = 1;
2207    // Duration to connect in millis.
2208    optional int32 latency_ms= 2;
2209    // Duration to connect in step size of 200 millis.
2210    optional int32 latency_200ms= 3;
2211    // Failure code
2212    optional FailureCode failure_code = 4;
2213    // Group role. This could be unknown with connect() call when the WifiConfig doesn't have the
2214    // credential.
2215    optional GroupRole group_role = 5;
2216    // Group band preference
2217    optional Band band = 6;
2218    // Group frequency in MHz if positive. Otherwise, no frequency preference.
2219    optional int32 frequency_mhz = 7;
2220    // STA mode channel frequency. 0 means unknown.
2221    optional int32 sta_frequency_mhz = 8;
2222    // The uid of the app that initiates the connection.
2223    optional int32 uid = 9 [(is_uid) = true];
2224    // if the country code is in the world mode
2225    optional bool is_country_code_world_mode = 10;
2226    // fallback to negotiation if device receives invitation response status code "information is
2227    // currently unavailable"
2228    optional bool fallback_to_negotiation_on_invite_status_info_unavailable = 11;
2229    // The try count of connection
2230    optional int32 try_count = 12;
2231    // The Attribution tag to identify the caller
2232    optional string attribution_tag = 13;
2233}
2234
2235/**
2236 * Logged when wifi setup failure or crash reported
2237 */
2238message WifiSetupFailureCrashReported {
2239    enum Type {
2240        UNKNOWN = 0;
2241        // Wifi HAL crash
2242        HAL_CRASH = 1;
2243        // Wificond crash
2244        WIFICOND_CRASH = 2;
2245        // Supplicant crash
2246        SUPPLICANT_CRASH = 3;
2247        // hostapd crash
2248        HOSTAPD_CRASH = 4;
2249        // HAL error on WifiNative.setupInterfaceForClientMode
2250        CLIENT_FAILURE_HAL = 5;
2251        // Wificond error on WifiNative.setupInterfaceForClientMode
2252        CLIENT_FAILURE_WIFICOND = 6;
2253        // Supplicant error on WifiNative.setupInterfaceForClientMode
2254        CLIENT_FAILURE_SUPPLICANT = 7;
2255        // HAL error on WifiNative.setupInterfaceForSoftApMode
2256        SOFT_AP_FAILURE_HAL = 8;
2257        // Wificond error on WifiNative.setupInterfaceForSoftApMode
2258        SOFT_AP_FAILURE_WIFICOND = 9;
2259        // Hostapd error on WifiNative.setupInterfaceForSoftApMode
2260        SOFT_AP_FAILURE_HOSTAPD = 10;
2261        // HAL error on WifiP2pNative.setupInterface
2262        P2P_FAILURE_HAL = 11;
2263        // Supplicant error on WifiP2pNative.setupInterface
2264        P2P_FAILURE_SUPPLICANT = 12;
2265    }
2266    // Type of failure
2267    optional Type type= 1;
2268}
2269
2270
2271/*
2272 * Logs metrics on bedtime mode state changed
2273 *
2274 * Logged From:
2275 *  frameworks/opt/wear/src/com/google/android/clockwork/healthservices/BedtimeModeController.java
2276*/
2277message BedtimeModeStateChanged {
2278    enum BedTimeModeState {
2279        BEDTIME_OFF = 0;
2280        BEDTIME_ON = 1;
2281    }
2282    // Log the bedtime mode state
2283    optional BedTimeModeState bedtime_mode_state = 1;
2284    enum State {
2285        OFF = 0;
2286        ON = 1;
2287    }
2288    // Current Wifi state when bedtime mode is toggled
2289    optional State current_wifi_state = 2;
2290
2291    // Current LTE state when bedtime mode is toggled
2292    optional State current_cellular_state = 3;
2293
2294    // Current BT state when bedtime mode is toggled
2295    optional State current_bluetooth_state = 4;
2296
2297    // Current Battery level. Should be in [0, 100].
2298    optional int32 battery_level = 5;
2299}
2300
2301/**
2302 * Logs when memory stats of a process is reported.
2303 *
2304 * Logged from:
2305 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
2306 */
2307message ProcessMemoryStatReported {
2308    optional int32 uid = 1;
2309    optional string process_name = 2;
2310    optional string package_name = 3;
2311    //TODO: remove this when validation is done
2312    optional int64 version = 9;
2313    optional int64 pss = 4;
2314    optional int64 uss = 5;
2315    optional int64 rss = 6;
2316    enum Type {
2317        ADD_PSS_INTERNAL_SINGLE = 0;
2318        ADD_PSS_INTERNAL_ALL_MEM = 1;
2319        ADD_PSS_INTERNAL_ALL_POLL = 2;
2320        ADD_PSS_EXTERNAL = 3;
2321        ADD_PSS_EXTERNAL_SLOW = 4;
2322    }
2323    optional Type type = 7;
2324    optional int64 duration_millis = 8;
2325
2326    // The types of the components this process is hosting at the moment this
2327    // snapshot is taken.
2328    // See the available types in HostingComponentType in AppProtoEnums.
2329    optional int32 current_hosting_component_types = 10;
2330
2331    // The historical types of the components this process is or was hosting
2332    // since it's born.
2333    // See the available types in HostingComponentType in AppProtoEnums.
2334    optional int32 historical_hosting_component_types = 11;
2335}
2336
2337/**
2338 * Logs that a process started, finished, crashed, or ANRed.
2339 *
2340 * Logged from:
2341 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2342 */
2343message ProcessLifeCycleStateChanged {
2344    optional int32 uid = 1 [(is_uid) = true];
2345
2346    // The process name (usually same as the app name).
2347    optional string process_name = 2;
2348
2349    // What lifecycle state the process changed to.
2350    // This enum is specific to atoms.proto.
2351    enum State {
2352        FINISHED = 0;
2353        STARTED = 1;
2354        CRASHED = 2;
2355    }
2356    optional State state = 3;
2357}
2358
2359/**
2360 * Logs when the ble scan state changes.
2361 *
2362 * Logged from:
2363 *   packages/apps/Bluetooth/src/com/android/bluetooth/le_scan/AppScanStats.java
2364 */
2365message BleScanStateChanged {
2366    repeated AttributionNode attribution_node = 1
2367            [(state_field_option).primary_field_first_uid = true];
2368
2369    enum State {
2370        OFF = 0;
2371        ON = 1;
2372        // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
2373        RESET = 2;
2374    }
2375    optional State state = 2 [
2376        (state_field_option).exclusive_state = true,
2377        (state_field_option).default_state_value = 0 /* State.OFF */,
2378        (state_field_option).trigger_state_reset_value = 2 /* State.RESET */,
2379        (state_field_option).nested = true
2380    ];
2381
2382    // Does the scan have a filter.
2383    optional bool is_filtered = 3 [(state_field_option).primary_field = true];
2384    // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
2385    optional bool is_first_match = 4 [(state_field_option).primary_field = true];
2386    // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
2387    optional bool is_opportunistic = 5 [(state_field_option).primary_field = true];
2388}
2389
2390/**
2391 * Logs reporting of a ble scan finding results.
2392 *
2393 * Logged from:
2394 *   packages/apps/Bluetooth/src/com/android/bluetooth/le_scan/AppScanStats.java
2395 */
2396// TODO: Consider also tracking per-scanner-id.
2397message BleScanResultReceived {
2398    repeated AttributionNode attribution_node = 1;
2399
2400    // Number of ble scan results returned.
2401    optional int32 num_results = 2;
2402}
2403
2404/**
2405 * Logs when a sensor state changes.
2406 *
2407 * Logged from:
2408 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2409 */
2410message SensorStateChanged {
2411    repeated AttributionNode attribution_node = 1;
2412
2413    // The id (int) of the sensor.
2414    optional int32 sensor_id = 2;
2415
2416    enum State {
2417        OFF = 0;
2418        ON = 1;
2419    }
2420    optional State state = 3;
2421}
2422
2423/**
2424 * Logs when GPS signal quality.
2425 *
2426 * Logged from:
2427 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
2428 */
2429message GpsSignalQualityChanged {
2430    optional android.server.location.GpsSignalQualityEnum level = 1;
2431}
2432
2433
2434/**
2435 * Logs when a sync manager sync state changes.
2436 *
2437 * Logged from:
2438 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2439 */
2440message SyncStateChanged {
2441    repeated AttributionNode attribution_node = 1;
2442
2443    // Name of the sync (as named in the app). Can be chosen at run-time.
2444    optional string sync_name = 2;
2445
2446    enum State {
2447        OFF = 0;
2448        ON = 1;
2449    }
2450    optional State state = 3;
2451}
2452
2453/*
2454 * Deferred job stats.
2455 *
2456 * Logged from:
2457 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
2458*/
2459message DeferredJobStatsReported {
2460    repeated AttributionNode attribution_node = 1;
2461
2462    // Number of jobs deferred.
2463    optional int32 num_jobs_deferred = 2;
2464
2465    // Time since the last job runs.
2466    optional int64 time_since_last_job_millis = 3;
2467}
2468
2469/**
2470 * Logs when a job scheduler job state changes.
2471 *
2472 * Logged from:
2473 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
2474 *   frameworks/base/services/core/java/com/android/server/job/JobServiceContext.java
2475 *
2476 * Next tag: 54
2477 */
2478message ScheduledJobStateChanged {
2479    repeated AttributionNode attribution_node = 1;
2480
2481    // Name of the job (as named in the app)
2482    optional string job_name = 2;
2483
2484    enum State {
2485        // A job started executing (passed through the STARTED state) and has finished.
2486        FINISHED = 0;
2487        // A scheduled job has just started executing.
2488        STARTED = 1;
2489        // An app just scheduled this job to be executed at some point in the future.
2490        SCHEDULED = 2;
2491        // The job was SCHEDULED but cancelled before it started executing (so it never went
2492        // through the STARTED state).
2493        CANCELLED = 3;
2494    }
2495    optional State state = 3;
2496
2497    // The internal reason a job has stopped.
2498    // This is only applicable when the state is FINISHED.
2499    // The default value is INTERNAL_STOP_REASON_UNKNOWN.
2500    optional android.app.job.InternalStopReasonEnum internal_stop_reason = 4;
2501
2502    // The publicly returned reason onStopJob() was called.
2503    // This is only applicable when the state is FINISHED, but may be undefined if
2504    // JobService.onStopJob() was never called for the job.
2505    // The default value is STOP_REASON_UNDEFINED.
2506    optional android.app.job.StopReasonEnum public_stop_reason = 17;
2507
2508    // The standby bucket of the app that scheduled the job. These match the framework constants
2509    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
2510    // already assigned 0.
2511    enum Bucket {
2512        UNKNOWN = -1;
2513        ACTIVE = 0;
2514        WORKING_SET = 1;
2515        FREQUENT = 2;
2516        RARE = 3;
2517        NEVER = 4;
2518        RESTRICTED = 5;
2519        EXEMPTED = 6;
2520    }
2521    optional Bucket standby_bucket = 5 [default = UNKNOWN];
2522
2523    // On T- builds, this is the job id (as assigned by the app).
2524    // On U+ builds, this is generated by the system, factoring in the job's namespace.
2525    optional int64 job_id = 6;
2526
2527    // One flag for each of the API constraints defined by JobScheduler. Does not include implicit
2528    // constraints as they are always assumed to be set.
2529    optional bool has_charging_constraint = 7;
2530    optional bool has_battery_not_low_constraint = 8;
2531    optional bool has_storage_not_low_constraint = 9;
2532    optional bool has_timing_delay_constraint = 10;
2533    optional bool has_deadline_constraint = 11;
2534    optional bool has_idle_constraint = 12;
2535    optional bool has_connectivity_constraint = 13;
2536    optional bool has_content_trigger_constraint = 14;
2537    optional bool is_prefetch = 18;
2538    optional bool is_periodic = 34;
2539    optional bool has_flex_constraint = 47;
2540
2541    // True if the app has requested this run as an expedited job.
2542    optional bool is_requested_expedited_job = 15;
2543    // True if the job is running as an expedited job. Only valid for STARTED and FINISHED states.
2544    optional bool is_running_as_expedited_job = 16;
2545
2546    // True if the app has requested this run as a user initiated job.
2547    optional bool is_requested_as_user_initiated_job = 32;
2548    // True if the job is running as a user initiated job. Only valid for STARTED/FINISHED states.
2549    optional bool is_running_as_user_initiated_job = 33;
2550
2551    // The priority set by the app (via JobInfo.Builder.setPriority()).
2552    optional int32 requested_priority = 19;
2553    // The priority JobScheduler ran the job at. Only valid for STARTED and FINISHED states.
2554    optional int32 effective_priority = 20;
2555
2556    // Number of times JobScheduler has tried to run this particular job. This value is incremented
2557    // when a job is stopped and rescheduled for various reasons (lost network, constraints no
2558    // longer satisfied, etc). For periodic jobs, this value is reset after a successful run.
2559    optional int32 num_previous_attempts = 21;
2560
2561    // The deadline that the Job has requested.
2562    // This is only valid if has_deadline_constraint is true.
2563    optional int64 deadline_ms = 22;
2564
2565    // The delay that the Job has requested.
2566    // This is only valid if has_timing_delay_constraint is true.
2567    optional int64 delay_ms = 35;
2568
2569    // True if the Job hit its deadline
2570    optional bool is_deadline_constraint_satisfied = 23;
2571
2572    optional bool is_charging_constraint_satisfied = 24;
2573
2574    optional bool is_battery_not_low_constraint_satisfied = 25;
2575
2576    optional bool is_storage_not_low_constraint_satisfied = 26;
2577
2578    optional bool is_timing_delay_constraint_satisfied = 27;
2579
2580    optional bool is_idle_constraint_satisfied = 28;
2581
2582    optional bool is_connectivity_constraint_satisfied = 29;
2583
2584    optional bool is_content_trigger_constraint_satisfied = 30;
2585
2586    optional bool is_flex_constraint_satisfied = 48;
2587
2588    // The amount of time that elapsed between the job being scheduled (state = SCHEDULED)
2589    // and it being started (state = STARTED). Persisted jobs loaded at boot are considered
2590    // to be scheduled at boot, so all values are within the current boot cycle. Periodic
2591    // and other rescheduled jobs are considered to be newly scheduled and therefore this
2592    // value reflects the time since the most recent (re)schedule.
2593    // This is only valid for the STARTED and FINISHED states.
2594    optional int64 job_start_latency_ms = 31;
2595
2596    // The amount of data the app estimated it would download.
2597    // This is only valid if has_connectivity_constraint is true.
2598    // If the job has JobWorkItems attached, this value will include the estimates from the items.
2599    optional int64 estimated_download_bytes = 36;
2600
2601    // The amount of data the app estimated it would upload.
2602    // This is only valid if has_connectivity_constraint is true.
2603    // If the job has JobWorkItems attached, this value will include the estimates from the items.
2604    optional int64 estimated_upload_bytes = 37;
2605
2606    // The number of JobWorkItems the app has attached to this job but not completed
2607    // (by calling JobParameters.completeWork()).
2608    optional int32 num_uncompleted_work_items = 38;
2609
2610    // Proc state of the UID of the logged event
2611    optional android.app.ProcessStateEnum proc_state = 39 [default = PROCESS_STATE_UNKNOWN];
2612
2613    // Hash of the namespace set via JobScheduler.forNamespace(String).
2614    optional string namespace_hash = 40;
2615
2616    // System estimated/measured bytes that the job
2617    // downloaded over its runtime. Only valid for FINISHED
2618    // state. We measure here for the SOURCE UID
2619    optional int64 system_measured_source_download_bytes = 41;
2620
2621    // System estimated/measured uploaded bytes that the job
2622    // uploaded over its runtime. Only valid for FINISHED
2623    // state. We measure here for the SOURCE UID
2624    optional int64 system_measured_source_upload_bytes = 42;
2625
2626    // System estimated/measured bytes that the job
2627    // downloaded over its runtime. Only valid for FINISHED
2628    // state. We measure here for the CALLING UID
2629    optional int64 system_measured_calling_download_bytes = 43;
2630
2631    // System estimated/measured uploaded bytes that the job
2632    // uploaded over its runtime. Only valid for FINISHED
2633    // state. We measure here for the CALLING UID
2634    optional int64 system_measured_calling_upload_bytes = 44;
2635
2636    // Interval for the job to recur when it is set as periodic.
2637    // Valid only if is_periodic is true
2638    optional int64 periodic_job_interval_ms = 45;
2639
2640    // Flex interval for the periodic job. This value is set via the second
2641    // parameter of JobInfo.Builder.setPeriodic(long, long). The job can
2642    // execute at any time in a window flex length at the end of the period.
2643    // Valid only if is_periodic is true
2644    optional int64 periodic_job_flex_interval_ms = 46;
2645
2646    // Whether transport preference logic can be applied to this job with flex policy
2647    optional bool can_apply_transport_affinities = 49;
2648
2649    // The number of flexible job constraints being applied to the job.
2650    // num_required_flex_constraints = num_applied_flex_constraints - num_dropped_flex_constraints.
2651    optional int32 num_applied_flex_constraints = 50;
2652
2653    // The number of required flexible job constraints that have been dropped for this job.
2654    // num_required_flex_constraints = num_applied_flex_constraints - num_dropped_flex_constraints.
2655    optional int32 num_dropped_flex_constraints = 51;
2656
2657    // Trace tag set via JobInfo.Builder.setTraceTag(). Basic PII filtering has been applied,
2658    // but further filtering should be done by clients.
2659    optional string filtered_trace_tag = 52;
2660
2661    // Set of tags set by the app to characterize the work being done. Set via
2662    // JobInfo.Builder.addDebugTag(). Basic PII filtering has been applied,
2663    // but further filtering should be done by clients.
2664    repeated string filtered_debug_tags = 53;
2665}
2666
2667/**
2668 * Logs when the audio state changes.
2669 *
2670 * Logged from:
2671 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2672 */
2673message AudioStateChanged {
2674    repeated AttributionNode attribution_node = 1;
2675
2676    enum State {
2677        OFF = 0;
2678        ON = 1;
2679        // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
2680        RESET = 2;
2681    }
2682    optional State state = 2;
2683}
2684
2685/**
2686 * Logs when the video codec state changes.
2687 *
2688 * Logged from:
2689 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2690 */
2691message MediaCodecStateChanged {
2692    repeated AttributionNode attribution_node = 1;
2693
2694    enum State {
2695        OFF = 0;
2696        ON = 1;
2697        // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
2698        RESET = 2;
2699    }
2700    optional State state = 2;
2701}
2702
2703/**
2704 * Logs when the flashlight state changes.
2705 *
2706 * Logged from:
2707 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2708 */
2709message FlashlightStateChanged {
2710    repeated AttributionNode attribution_node = 1;
2711
2712    enum State {
2713        OFF = 0;
2714        ON = 1;
2715        // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
2716        RESET = 2;
2717    }
2718    optional State state = 2;
2719}
2720
2721/**
2722 * Logs when the camera state changes.
2723 *
2724 * Logged from:
2725 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2726 */
2727message CameraStateChanged {
2728    repeated AttributionNode attribution_node = 1;
2729
2730    enum State {
2731        OFF = 0;
2732        ON = 1;
2733        // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
2734        RESET = 2;
2735    }
2736    optional State state = 2;
2737}
2738
2739/**
2740 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
2741 *
2742 * Logged from:
2743 *   TODO
2744 */
2745message WakelockStateChanged {
2746    repeated AttributionNode attribution_node = 1
2747            [(state_field_option).primary_field_first_uid = true];
2748
2749    // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
2750    // From frameworks/proto_logging/stats/enums/os/enums.proto.
2751    optional android.os.WakeLockLevelEnum type = 2 [(state_field_option).primary_field = true];
2752
2753    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
2754    optional string tag = 3 [(state_field_option).primary_field = true];
2755
2756    enum State {
2757        RELEASE = 0;
2758        ACQUIRE = 1;
2759        CHANGE_RELEASE = 2;
2760        CHANGE_ACQUIRE = 3;
2761    }
2762    optional State state = 4 [
2763        (state_field_option).exclusive_state = true,
2764        (state_field_option).default_state_value = 0,
2765        (state_field_option).nested = true
2766    ];
2767
2768    optional android.app.ProcessStateEnum process_state = 5 [default = PROCESS_STATE_UNKNOWN];
2769}
2770
2771/**
2772 * Logs when a partial wakelock is considered 'long' (over 1 min).
2773 *
2774 * Logged from:
2775 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2776 */
2777message LongPartialWakelockStateChanged {
2778    repeated AttributionNode attribution_node = 1;
2779
2780    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
2781    optional string tag = 2;
2782
2783    // TODO: I have no idea what this is.
2784    optional string history_tag = 3;
2785
2786    enum State {
2787        OFF = 0;
2788        ON = 1;
2789    }
2790    optional State state = 4;
2791}
2792
2793/**
2794 * Logs when the device is interactive, according to the PowerManager Notifier.
2795 *
2796 * Logged from:
2797 *   frameworks/base/services/core/java/com/android/server/power/Notifier.java
2798 */
2799message InteractiveStateChanged {
2800    enum State {
2801        OFF = 0;
2802        ON = 1;
2803    }
2804    optional State state = 1;
2805}
2806
2807/**
2808 * Logs Battery Saver state change.
2809 *
2810 * Logged from:
2811 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2812 */
2813message BatterySaverModeStateChanged {
2814    enum State {
2815        OFF = 0;
2816        ON = 1;
2817    }
2818    optional State state = 1
2819            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
2820}
2821
2822/**
2823 * Logs Doze mode state change.
2824 *
2825 * Logged from:
2826 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2827 */
2828message DeviceIdleModeStateChanged {
2829    optional android.server.DeviceIdleModeEnum state = 1
2830            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
2831}
2832
2833
2834/**
2835 * Logs state change of Doze mode including maintenance windows.
2836 *
2837 * Logged from:
2838 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2839 */
2840message DeviceIdlingModeStateChanged {
2841    optional android.server.DeviceIdleModeEnum state = 1
2842            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
2843}
2844
2845/**
2846 * Logs screen brightness level.
2847 *
2848 * Logged from:
2849 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2850 */
2851message ScreenBrightnessChanged {
2852    // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
2853    optional int32 level = 1;
2854}
2855
2856/**
2857 * Logs battery level (percent full, from 0 to 100).
2858 *
2859 * Logged from:
2860 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2861 */
2862message BatteryLevelChanged {
2863    // Battery level. Should be in [0, 100].
2864    optional int32 battery_level = 1;
2865}
2866
2867/**
2868 * Logs change in charging status of the device.
2869 *
2870 * Logged from:
2871 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2872 */
2873message ChargingStateChanged {
2874    // State of the battery, from frameworks/proto_logging/stats/enums/os/enums.proto.
2875    optional android.os.BatteryStatusEnum state = 1
2876            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
2877}
2878
2879/**
2880 * Logs whether the device is plugged in, and what power source it is using.
2881 *
2882 * Logged from:
2883 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2884 */
2885message PluggedStateChanged {
2886    // Whether the device is plugged in, from frameworks/proto_logging/stats/enums/os/enums.proto.
2887    optional android.os.BatteryPluggedStateEnum state = 1
2888            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
2889}
2890
2891/**
2892 * Logs whether the device is docked, and what type of dock it is using.
2893 *
2894 * Logged from:
2895 *   services/core/java/com/android/server/power/PowerManagerService.java
2896 */
2897message DockStateChanged {
2898    // The device dock state, from frameworks/proto_logging/stats/enums/server/enums.proto.
2899    optional android.server.DockStateEnum state = 1
2900    [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
2901}
2902
2903/**
2904 * Logs when an app's wakeup alarm fires.
2905 *
2906 * Logged from:
2907 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2908 */
2909message WakeupAlarmOccurred {
2910    repeated AttributionNode attribution_node = 1;
2911
2912    // Name of the wakeup alarm.
2913    optional string tag = 2;
2914
2915    // Name of source package (for historical reasons, since BatteryStats tracked it).
2916    optional string package_name = 3;
2917
2918    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
2919    optional AppStandbyBucketChanged.Bucket app_standby_bucket = 4;
2920}
2921
2922/**
2923 * Logs when an an app causes the mobile radio to change state.
2924 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
2925 *
2926 * Logged from:
2927 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
2928 */
2929message MobileRadioPowerStateChanged {
2930    repeated AttributionNode attribution_node = 1;
2931
2932    // Power state, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
2933    optional android.telephony.DataConnectionPowerStateEnum state = 2;
2934}
2935
2936/**
2937 * Logs when an an app causes the wifi radio to change state.
2938 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
2939 *
2940 * Logged from:
2941 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
2942 */
2943message WifiRadioPowerStateChanged {
2944    repeated AttributionNode attribution_node = 1;
2945
2946    // Power state, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
2947    optional android.telephony.DataConnectionPowerStateEnum state = 2;
2948}
2949
2950/**
2951 * Logs kernel wakeup reasons and aborts.
2952 *
2953 * Logged from:
2954 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2955 */
2956message KernelWakeupReported {
2957    // Name of the kernel wakeup reason (or abort).
2958    optional string wakeup_reason_name = 1;
2959
2960    // Duration (in microseconds) for the wake-up interrupt to be serviced.
2961    optional int64 duration_micros = 2;
2962
2963    // The elapsed time when this wake-up was reported.
2964    optional int64 elapsed_millis = 3;
2965}
2966
2967/**
2968 * Logs when Wifi is toggled on/off.
2969 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
2970 *
2971 * Logged from:
2972 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2973 */
2974message WifiEnabledStateChanged {
2975    enum State {
2976        OFF = 0;
2977        ON = 1;
2978    }
2979    optional State state = 1;
2980}
2981
2982/**
2983 * This atom is deprecated starting in R.
2984 *
2985 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
2986 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
2987 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
2988 *
2989 * Logged from:
2990 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
2991 */
2992message WifiRunningStateChanged {
2993    repeated AttributionNode attribution_node = 1;
2994
2995    enum State {
2996        OFF = 0;
2997        ON = 1;
2998    }
2999    optional State state = 2;
3000}
3001
3002/**
3003 * Logs wifi locks held by an app.
3004 *
3005 * Logged from:
3006 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3007 */
3008message WifiLockStateChanged {
3009    repeated AttributionNode attribution_node = 1;
3010
3011    enum State {
3012        OFF = 0;
3013        ON = 1;
3014    }
3015    optional State state = 2;
3016
3017    // WifiLock type, from frameworks/proto_logging/stats/enums/wifi/enums.proto.
3018    optional android.net.wifi.WifiModeEnum mode = 3;
3019}
3020
3021/**
3022 * Logs wifi signal strength changes.
3023 *
3024 * Logged from:
3025 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
3026 */
3027message WifiSignalStrengthChanged {
3028    // Signal strength, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
3029    optional android.telephony.SignalStrengthEnum signal_strength = 1;
3030}
3031
3032/**
3033 * Logs wifi scans performed by an app.
3034 *
3035 * Logged from:
3036 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
3037 */
3038message WifiScanStateChanged {
3039    repeated AttributionNode attribution_node = 1;
3040
3041    enum State {
3042        OFF = 0;
3043        ON = 1;
3044    }
3045    optional State state = 2;
3046}
3047
3048/**
3049 * Logs wifi multicast locks held by an app
3050 *
3051 * Logged from:
3052 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
3053 */
3054message WifiMulticastLockStateChanged {
3055    repeated AttributionNode attribution_node = 1;
3056
3057    enum State {
3058        OFF = 0;
3059        ON = 1;
3060    }
3061    optional State state = 2;
3062
3063    optional string tag = 3;
3064}
3065
3066/**
3067 * Logs shutdown reason and duration on next boot.
3068 *
3069 * Logged from:
3070 *   frameworks/base/core/java/com/android/server/BootReceiver.java
3071 */
3072message ShutdownSequenceReported {
3073    // True if shutdown is for a reboot. Default: false if we do not know.
3074    optional bool reboot = 1;
3075
3076    // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
3077    optional string reason = 2;
3078
3079    // Beginning of shutdown time in ms using wall clock time since unix epoch.
3080    // Default: 0 if no start time received.
3081    optional int64 start_time_millis = 3;
3082
3083    // Duration of shutdown in ms. Default: 0 if no duration received.
3084    optional int64 duration_millis = 4;
3085}
3086
3087
3088/**
3089 * Logs boot reason and duration.
3090 *
3091 * Logged from:
3092 *   system/core/bootstat/bootstat.cpp
3093 */
3094message BootSequenceReported {
3095    // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
3096    // Default: "<EMPTY>" if not available.
3097    optional string bootloader_reason = 1;
3098
3099    // Reason for system boot. Eg. bootloader, reboot,userrequested
3100    // Default: "<EMPTY>" if not available.
3101    optional string system_reason = 2;
3102
3103    // End of boot time in ms from unix epoch using system wall clock.
3104    optional int64 end_time_millis = 3;
3105
3106    // Total boot duration in ms.
3107    optional int64 total_duration_millis = 4;
3108
3109    // Bootloader duration in ms.
3110    optional int64 bootloader_duration_millis = 5;
3111
3112    // Time since last boot in ms. Default: 0 if not available.
3113    optional int64 time_since_last_boot = 6;
3114}
3115
3116
3117/**
3118 * Logs call state and disconnect cause (if applicable).
3119 *
3120 * Logged from:
3121 *   packages/services/Telecomm/src/com/android/server/telecom/Call.java
3122 */
3123message CallStateChanged {
3124    // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
3125    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto.
3126    optional android.telecom.CallStateEnum call_state = 1;
3127
3128    // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
3129    // This value is only applicable when the call_state is DISCONNECTED, and
3130    // should always be UNKNOWN if the call_state is not DISCONNECTED.
3131    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto.
3132    optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
3133
3134    // True if the call is self-managed, which are apps that use the
3135    // telecom infrastructure to make their own calls.
3136    optional bool self_managed = 3;
3137
3138    // True if call is external. External calls are calls on connected Wear
3139    // devices but show up in Telecom so the user can pull them onto the device.
3140    optional bool external_call = 4;
3141
3142    // True if call is emergency call.
3143    optional bool emergency_call = 5;
3144
3145    // UID of the package that has initiated the call.
3146    optional int32 uid = 6 [(is_uid) = true];
3147
3148    // Elapsed time between CALL_STATE_ACTIVE to CALL_STATE_DISCONNECTED.
3149    // This value is only applicable when the call_state is DISCONNECTED,
3150    // 0 otherwise.
3151    optional int32 duration_seconds = 7;
3152
3153    // Number of all existing calls when this call is created.
3154    optional int32 existing_call_count = 8;
3155
3156    // Number of existing calls held by this call.
3157    // This value is set after a call is actually held, 0 otherwise.
3158    optional int32 held_call_count = 9;
3159
3160    // The reason the call hasn't been started by device condition.
3161    // This value is only applicable when the call_state is DISCONNECTED,
3162    // and should always be NONE if the call_state is not DISCONNECTED.
3163    // From frameworks/base/core/proto/android/telecomm/enums.proto.
3164    optional android.telecom.CallFailureCauseEnum start_fail_cause = 10;
3165}
3166
3167/*
3168 * Logs changes to the configuration of the device. The configuration is defined
3169 * in frameworks/base/core/java/android/content/res/Configuration.java
3170 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
3171 * Please go there to interpret the possible values each field can be.
3172 *
3173 * Logged from:
3174 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3175 */
3176message ResourceConfigurationChanged {
3177    // Bit mask of color capabilities of the screen.
3178    // Contains information about the color gamut and hdr mode of the screen.
3179    // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
3180    optional int32 color_mode = 1;
3181
3182    // The target screen density being rendered to.
3183    // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
3184    optional int32 density_dpi = 2;
3185
3186    // Current user preference for the scaling factor for fonts,
3187    // relative to the base density scaling.
3188    // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
3189    optional float font_scale = 3;
3190
3191    // Flag indicating whether the hard keyboard is hidden.
3192    // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
3193    optional int32 hard_keyboard_hidden = 4;
3194
3195    // The type of keyboard attached to the device.
3196    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
3197    optional int32 keyboard = 5;
3198
3199    // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
3200    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
3201    optional int32 keyboard_hidden = 6;
3202
3203    // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
3204    // 0 if undefined.
3205    // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
3206    optional int32 mcc = 7;
3207
3208    // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
3209    // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
3210    // MNC_ZERO symbol defined in Configuration.java.
3211    // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
3212    optional int32 mnc = 8;
3213
3214    // The kind of navigation available on the device.
3215    // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
3216    optional int32 navigation = 9;
3217
3218    // Flag indicating whether the navigation is available.
3219    // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
3220    optional int32 navigation_hidden = 10;
3221
3222    // Overall orientation of the screen.
3223    // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
3224    optional int32 orientation = 11;
3225
3226    // The current height of the available screen space, in dp units.
3227    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
3228    optional int32 screen_height_dp = 12;
3229
3230    // Bit mask of overall layout of the screen.
3231    // Contains information about screen size, whether the screen is wider/taller
3232    // than normal, whether the screen layout is right-tl-left or left-to-right,
3233    // and whether the screen has a rounded shape.
3234    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
3235    optional int32 screen_layout = 13;
3236
3237    // Current width of the available screen space, in dp units.
3238    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
3239    optional int32 screen_width_dp = 14;
3240
3241    // The smallest screen size an application will see in normal operation.
3242    // This is the smallest value of both screenWidthDp and screenHeightDp
3243    // in portrait and landscape.
3244    // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
3245    optional int32 smallest_screen_width_dp = 15;
3246
3247    // The type of touch screen attached to the device.
3248    // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
3249    optional int32 touchscreen = 16;
3250
3251    // Bit mask of the ui mode.
3252    // Contains information about the overall ui mode of the device.
3253    // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
3254    // Also contains information about whether the device is in night mode.
3255    // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
3256    optional int32 ui_mode = 17;
3257}
3258
3259
3260/**
3261 * Logs changes in the connection state of the mobile radio.
3262 *
3263 * Logged from:
3264 *    frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
3265 */
3266message MobileConnectionStateChanged {
3267    // States are from the state machine DataConnection.java.
3268    enum State {
3269        UNKNOWN = 0;
3270        // The connection is inactive, or disconnected.
3271        INACTIVE = 1;
3272        // The connection is being activated, or connecting.
3273        ACTIVATING = 2;
3274        // The connection is active, or connected.
3275        ACTIVE = 3;
3276        // The connection is disconnecting.
3277        DISCONNECTING = 4;
3278        // The connection is disconnecting after creating a connection.
3279        DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
3280    }
3281    optional State state  = 1;
3282    // For multi-sim phones, this distinguishes between the sim cards.
3283    optional int32 sim_slot_index = 2;
3284    // Used to identify the connection. Starts at 0 and increments by 1 for
3285    // every new network created. Resets whenever the device reboots.
3286    optional int32 data_connection_id = 3;
3287    // A bitmask for the capabilities of this connection.
3288    // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
3289    // Default value (if we have no information): 0
3290    optional int64 capabilities = 4;
3291    // If this connection has internet.
3292    // This just checks if the DEFAULT bit of capabilities is set.
3293    optional bool has_internet = 5;
3294}
3295
3296/**
3297 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
3298 *
3299 * Logged from:
3300 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
3301 */
3302message MobileRadioTechnologyChanged {
3303    optional android.telephony.NetworkTypeEnum state = 1;
3304    // For multi-sim phones, this distinguishes between the sim cards.
3305    optional int32 sim_slot_index = 2;
3306}
3307
3308/**
3309 * Logs the VID and PID of any connected USB devices.
3310 *
3311 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
3312 *
3313 * Logged by Vendor.
3314 */
3315message UsbDeviceAttached {
3316    optional int32 vid = 1;
3317    optional int32 pid = 2;
3318    optional bool has_audio = 3;
3319    optional bool has_hid = 4;
3320    optional bool has_storage = 5;
3321    enum State {
3322        STATE_DISCONNECTED = 0;
3323        STATE_CONNECTED = 1;
3324    }
3325    optional State state = 6;
3326    optional int64 last_connect_duration_millis = 7;
3327}
3328
3329
3330/**
3331 * Logs when Bluetooth is enabled and disabled.
3332 *
3333 * Logged from:
3334 *   services/core/java/com/android/server/BluetoothManagerService.java
3335 */
3336message BluetoothEnabledStateChanged {
3337    repeated AttributionNode attribution_node = 1;
3338    // Whether or not bluetooth is enabled on the device.
3339    enum State {
3340        UNKNOWN = 0;
3341        ENABLED = 1;
3342        DISABLED = 2;
3343    }
3344    optional State state = 2;
3345    // The reason for being enabled/disabled.
3346    // Eg. Airplane mode, crash, application request.
3347    optional android.bluetooth.EnableDisableReasonEnum reason = 3;
3348    // If the reason is an application request, this will be the package name.
3349    optional string pkg_name = 4;
3350    // Previous state. Default: UNKNOWN if there is no previous state.
3351    optional State previous_state = 5;
3352    // Timedelta in milliseconds since the last state changed.
3353    // Default: 0 if there is no previous state.
3354    optional int64 time_since_last_changed_millis = 6;
3355}
3356
3357/**
3358 * Logs when profiles on a Bluetooth device connects and disconnects.
3359 *
3360 * Logged from:
3361 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
3362 *
3363 * Next Tag: 6
3364 */
3365message BluetoothConnectionStateChanged {
3366    // The state of the connection.
3367    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
3368    optional android.bluetooth.ConnectionStateEnum state = 1;
3369    // An identifier that can be used to match connect and disconnect events.
3370    // Currently is last two bytes of a hash of a device level ID and
3371    // the mac address of the bluetooth device that is connected.
3372    // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
3373    optional int32 obfuscated_id = 2 [deprecated = true];
3374    // The profile that is connected. Eg. GATT, A2DP, HEADSET.
3375    // From android.bluetooth.BluetoothAdapter.java
3376    // Default: 0 when not used
3377    optional int32 bt_profile = 3;
3378    // An identifier that can be used to match events for this device.
3379    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3380    // Salt: Randomly generated 256 bit value
3381    // Hash algorithm: HMAC-SHA256
3382    // Size: 32 byte
3383    // Default: null or empty if the device identifier is not known
3384    optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
3385    // An identifier that can be used to match events for this device.
3386    // The incremental identifier is locally generated and guaranteed not derived
3387    // from any globally unique hardware id.
3388    // For paired devices, it stays consistent between Bluetooth toggling for the
3389    // same remote device.
3390    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3391    // session for the same remote device.
3392    // Default: 0 if the device's metric id is unknown.
3393    optional int32 metric_id = 5;
3394    // An index to group connection events by session. It's a counter generated by
3395    // each profile. e.g. Gatt server generate such id to identify Gatt apps
3396    optional int32 session_index = 6;
3397    // An identifier that indicates the connection failure reason
3398    optional int32 connection_reason = 7;
3399}
3400
3401/**
3402 * Logs when a Bluetooth device connects and disconnects over ACL
3403 *
3404 * Logged from:
3405 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
3406 *
3407 * Next Tag: 4
3408 */
3409message BluetoothAclConnectionStateChanged {
3410    // An identifier that can be used to match events for this device.
3411    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3412    // Salt: Randomly generated 256 bit value
3413    // Hash algorithm: HMAC-SHA256
3414    // Size: 32 byte
3415    // Default: null or empty if the device identifier is not known
3416    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3417    // The state of the connection.
3418    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
3419    optional android.bluetooth.ConnectionStateEnum state = 2;
3420    // An identifier that can be used to match events for this device.
3421    // The incremental identifier is locally generated and guaranteed not derived
3422    // from any globally unique hardware id.
3423    // For paired devices, it stays consistent between Bluetooth toggling for the
3424    // same remote device.
3425    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3426    // session for the same remote device.
3427    // Default: 0 if the device's metric id is unknown.
3428    optional int32 metric_id = 3;
3429    // Used transport of this event.
3430    optional android.bluetooth.TransportTypeEnum transport = 4;
3431}
3432
3433/**
3434 * Logs when a Bluetooth device connects and disconnects over SCO
3435 *
3436 * Logged from:
3437 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
3438 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
3439 *
3440 * Next Tag: 5
3441 */
3442message BluetoothScoConnectionStateChanged {
3443    // An identifier that can be used to match events for this device.
3444    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3445    // Salt: Randomly generated 256 bit value
3446    // Hash algorithm: HMAC-SHA256
3447    // Size: 32 byte
3448    // Default: null or empty if the device identifier is not known
3449    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3450    // The state of the connection.
3451    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
3452    optional android.bluetooth.ConnectionStateEnum state = 2;
3453    // Codec used for this SCO connection
3454    // Default: UNKNOWN
3455    optional android.bluetooth.hfp.ScoCodec codec = 3;
3456    // An identifier that can be used to match events for this device.
3457    // The incremental identifier is locally generated and guaranteed not derived
3458    // from any globally unique hardware id.
3459    // For paired devices, it stays consistent between Bluetooth toggling for the
3460    // same remote device.
3461    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3462    // session for the same remote device.
3463    // Default: 0 if the device's metric id is unknown.
3464    optional int32 metric_id = 4;
3465}
3466
3467/**
3468 * Logged when active device of a profile changes
3469 *
3470 * Logged from:
3471 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
3472 *     packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetService.java
3473 *     packages/apps/Bluetooth/src/com/android/bluetooth/hearingaid/HearingAidService.java
3474 */
3475message BluetoothActiveDeviceChanged {
3476    // The profile whose active device has changed. Eg. A2DP, HEADSET, HEARING_AID
3477    // From android.bluetooth.BluetoothProfile
3478    optional int32 bt_profile = 1;
3479    // An identifier that can be used to match events for this new active device.
3480    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3481    // Salt: Randomly generated 256 bit value
3482    // Hash algorithm: HMAC-SHA256
3483    // Size: 32 byte
3484    // Default: null or empty if there is no active device for this profile
3485    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
3486    // An identifier that can be used to match events for this device.
3487    // The incremental identifier is locally generated and guaranteed not derived
3488    // from any globally unique hardware id.
3489    // For paired devices, it stays consistent between Bluetooth toggling for the
3490    // same remote device.
3491    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3492    // session for the same remote device.
3493    // Default: 0 if the device's metric id is unknown.
3494    optional int32 metric_id = 3;
3495}
3496
3497// Logs when there is an event affecting Bluetooth device's link layer connection.
3498// - This event is triggered when there is a related HCI command or event
3499// - Users of this metrics can deduce Bluetooth device's connection state from these events
3500// - HCI commands are logged before the command is sent, after receiving command status, and after
3501//   receiving command complete
3502// - HCI events are logged when they arrive
3503//
3504// Low level log from system/bt
3505//
3506// Bluetooth classic commands:
3507// - CMD_CREATE_CONNECTION
3508// - CMD_DISCONNECT
3509// - CMD_CREATE_CONNECTION_CANCEL
3510// - CMD_ACCEPT_CONNECTION_REQUEST
3511// - CMD_REJECT_CONNECTION_REQUEST
3512// - CMD_SETUP_ESCO_CONNECTION
3513// - CMD_ACCEPT_ESCO_CONNECTION
3514// - CMD_REJECT_ESCO_CONNECTION
3515// - CMD_ENH_SETUP_ESCO_CONNECTION
3516// - CMD_ENH_ACCEPT_ESCO_CONNECTION
3517//
3518// Bluetooth low energy commands:
3519// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
3520// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
3521// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
3522// - CMD_BLE_CLEAR_WHITE_LIST
3523// - CMD_BLE_ADD_WHITE_LIST
3524// - CMD_BLE_REMOVE_WHITE_LIST
3525//
3526// Bluetooth classic events:
3527// - EVT_CONNECTION_COMP
3528// - EVT_CONNECTION_REQUEST
3529// - EVT_DISCONNECTION_COMP
3530// - EVT_ESCO_CONNECTION_COMP
3531// - EVT_ESCO_CONNECTION_CHANGED
3532//
3533// Bluetooth low energy meta events:
3534// - BLE_EVT_CONN_COMPLETE_EVT
3535// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
3536//
3537// Next tag: 10
3538message BluetoothLinkLayerConnectionEvent {
3539    // An identifier that can be used to match events for this device.
3540    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3541    // Salt: Randomly generated 256 bit value
3542    // Hash algorithm: HMAC-SHA256
3543    // Size: 32 byte
3544    // Default: null or empty if the device identifier is not known
3545    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3546    // Connection handle of this connection if available
3547    // Range: 0x0000 - 0x0EFF (12 bits)
3548    // Default: 0xFFFF if the handle is unknown
3549    optional int32 connection_handle = 2;
3550    // Direction of the link
3551    // Default: DIRECTION_UNKNOWN
3552    optional android.bluetooth.DirectionEnum direction = 3;
3553    // Type of this link
3554    // Default: LINK_TYPE_UNKNOWN
3555    optional android.bluetooth.LinkTypeEnum type = 4;
3556
3557    // Reason metadata for this link layer connection event, rules for interpretation:
3558    // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
3559    //    EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
3560    // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
3561    //    set and valid, ignore hci_ble_event
3562
3563    // HCI command associated with this event
3564    // Default: CMD_UNKNOWN
3565    optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
3566    // HCI event associated with this event
3567    // Default: EVT_UNKNOWN
3568    optional android.bluetooth.hci.EventEnum hci_event = 6;
3569    // HCI BLE meta event associated with this event
3570    // Default: BLE_EVT_UNKNOWN
3571    optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
3572    // HCI command status code if this is triggerred by hci_cmd
3573    // Default: STATUS_UNKNOWN
3574    optional android.bluetooth.hci.StatusEnum cmd_status = 8;
3575    // HCI reason code associated with this event
3576    // Default: STATUS_UNKNOWN
3577    optional android.bluetooth.hci.StatusEnum reason_code = 9;
3578    // An identifier that can be used to match events for this device.
3579    // The incremental identifier is locally generated and guaranteed not derived
3580    // from any globally unique hardware id.
3581    // For paired devices, it stays consistent between Bluetooth toggling for the
3582    // same remote device.
3583    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3584    // session for the same remote device.
3585    // Default: 0 if the device's metric id is unknown.
3586    optional int32 metric_id = 10;
3587}
3588
3589/**
3590 * Logs when a module is rolled back by Watchdog.
3591 *
3592 * Logged from: Rollback Manager
3593 */
3594message WatchdogRollbackOccurred {
3595    enum RollbackType {
3596        UNKNOWN = 0;
3597        ROLLBACK_INITIATE = 1;
3598        ROLLBACK_SUCCESS = 2;
3599        ROLLBACK_FAILURE = 3;
3600        ROLLBACK_BOOT_TRIGGERED = 4;
3601    }
3602    optional RollbackType rollback_type = 1;
3603
3604    optional string package_name = 2;
3605
3606    optional int32 package_version_code = 3;
3607
3608    enum RollbackReasonType {
3609        REASON_UNKNOWN = 0;
3610        REASON_NATIVE_CRASH = 1;
3611        REASON_EXPLICIT_HEALTH_CHECK = 2;
3612        REASON_APP_CRASH = 3;
3613        REASON_APP_NOT_RESPONDING = 4;
3614        REASON_NATIVE_CRASH_DURING_BOOT = 5;
3615        REASON_NETWORK_RELATED_CRASH = 6;
3616        REASON_BOOT_LOOPING = 7;
3617    }
3618    optional RollbackReasonType rollback_reason = 4;
3619
3620    // Set by RollbackPackageHealthObserver to be the package that is failing when a rollback
3621    // is initiated. Empty if the package is unknown.
3622    optional string failing_package_name = 5;
3623
3624    optional TrainExperimentIds experiment_ids = 6 [(log_mode) = MODE_BYTES];
3625}
3626
3627/**
3628 * Logs when there is a change in Bluetooth A2DP playback state
3629 *
3630 * Logged from:
3631 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
3632 */
3633message BluetoothA2dpPlaybackStateChanged {
3634    // An identifier that can be used to match events for this device.
3635    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3636    // Salt: Randomly generated 256 bit value
3637    // Hash algorithm: HMAC-SHA256
3638    // Size: 32 byte
3639    // Default: null or empty if the device identifier is not known
3640    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3641    // Current playback state
3642    // Default: PLAYBACK_STATE_UNKNOWN
3643    optional android.bluetooth.a2dp.PlaybackStateEnum playback_state = 2;
3644    // Current audio coding mode
3645    // Default: AUDIO_CODING_MODE_UNKNOWN
3646    optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
3647    // An identifier that can be used to match events for this device.
3648    // The incremental identifier is locally generated and guaranteed not derived
3649    // from any globally unique hardware id.
3650    // For paired devices, it stays consistent between Bluetooth toggling for the
3651    // same remote device.
3652    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3653    // session for the same remote device.
3654    // Default: 0 if the device's metric id is unknown.
3655    optional int32 metric_id = 4;
3656}
3657
3658/**
3659 * Logs when there is a change in A2DP codec config for a particular remote device
3660 *
3661 * Logged from:
3662 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
3663 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
3664 */
3665message BluetoothA2dpCodecConfigChanged {
3666    // An identifier that can be used to match events for this device.
3667    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3668    // Salt: Randomly generated 256 bit value
3669    // Hash algorithm: HMAC-SHA256
3670    // Size: 32 byte
3671    // Default: null or empty if the device identifier is not known
3672    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3673    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
3674    // Default SOURCE_CODEC_TYPE_INVALID
3675    optional int32 codec_type = 2;
3676    // Codec priroity, the higher the more preferred, -1 for disabled
3677    // Default: CODEC_PRIORITY_DEFAULT
3678    optional int32 codec_priority = 3;
3679    // Sample rate in Hz as defined by various SAMPLE_RATE_* constants in BluetoothCodecConfig
3680    // Default: SAMPLE_RATE_NONE
3681    optional int32 sample_rate = 4;
3682    // Bits per sample as defined by various BITS_PER_SAMPLE_* constants in BluetoothCodecConfig
3683    // Default: BITS_PER_SAMPLE_NONE
3684    optional int32 bits_per_sample = 5;
3685    // Channel mode as defined by various CHANNEL_MODE_* constants in BluetoothCodecConfig
3686    // Default: CHANNEL_MODE_NONE
3687    optional int32 channel_mode = 6;
3688    // Codec specific values
3689    // Default 0
3690    optional int64 codec_specific_1 = 7;
3691    optional int64 codec_specific_2 = 8;
3692    optional int64 codec_specific_3 = 9;
3693    optional int64 codec_specific_4 = 10;
3694    // An identifier that can be used to match events for this device.
3695    // The incremental identifier is locally generated and guaranteed not derived
3696    // from any globally unique hardware id.
3697    // For paired devices, it stays consistent between Bluetooth toggling for the
3698    // same remote device.
3699    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3700    // session for the same remote device.
3701    // Default: 0 if the device's metric id is unknown.
3702    optional int32 metric_id = 11;
3703}
3704
3705/**
3706 * Logs when there is a change in selectable A2DP codec capability for a paricular remote device
3707 * Each codec's capability is logged separately due to statsd restriction
3708 *
3709 * Logged from:
3710 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
3711 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
3712 */
3713message BluetoothA2dpCodecCapabilityChanged {
3714    // An identifier that can be used to match events for this device.
3715    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3716    // Salt: Randomly generated 256 bit value
3717    // Hash algorithm: HMAC-SHA256
3718    // Size: 32 byte
3719    // Default: null or empty if the device identifier is not known
3720    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3721    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
3722    // Default SOURCE_CODEC_TYPE_INVALID
3723    optional int32 codec_type = 2;
3724    // Codec priroity, the higher the more preferred, -1 for disabled
3725    // Default: CODEC_PRIORITY_DEFAULT
3726    optional int32 codec_priority = 3;
3727    // A bit field of supported sample rates as defined by various SAMPLE_RATE_* constants
3728    // in BluetoothCodecConfig
3729    // Default: empty and SAMPLE_RATE_NONE for individual item
3730    optional int32 sample_rate = 4;
3731    // A bit field of supported bits per sample as defined by various BITS_PER_SAMPLE_* constants
3732    // in BluetoothCodecConfig
3733    // Default: empty and BITS_PER_SAMPLE_NONE for individual item
3734    optional int32 bits_per_sample = 5;
3735    // A bit field of supported channel mode as defined by various CHANNEL_MODE_* constants in
3736    // BluetoothCodecConfig
3737    // Default: empty and CHANNEL_MODE_NONE for individual item
3738    optional int32 channel_mode = 6;
3739    // Codec specific values
3740    // Default 0
3741    optional int64 codec_specific_1 = 7;
3742    optional int64 codec_specific_2 = 8;
3743    optional int64 codec_specific_3 = 9;
3744    optional int64 codec_specific_4 = 10;
3745    // An identifier that can be used to match events for this device.
3746    // The incremental identifier is locally generated and guaranteed not derived
3747    // from any globally unique hardware id.
3748    // For paired devices, it stays consistent between Bluetooth toggling for the
3749    // same remote device.
3750    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3751    // session for the same remote device.
3752    // Default: 0 if the device's metric id is unknown.
3753    optional int32 metric_id = 11;
3754}
3755
3756/**
3757 * Logs when A2DP failed to read from PCM source.
3758 * This typically happens when audio HAL cannot supply A2DP with data fast enough for encoding.
3759 *
3760 * Logged from:
3761 *     system/bt
3762 */
3763message BluetoothA2dpAudioUnderrunReported {
3764    // An identifier that can be used to match events for this device.
3765    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3766    // Salt: Randomly generated 256 bit value
3767    // Hash algorithm: HMAC-SHA256
3768    // Size: 32 byte
3769    // Default: null or empty if the device identifier is not known
3770    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3771    // Encoding interval in nanoseconds
3772    // Default: 0
3773    optional int64 encoding_interval_nanos = 2;
3774    // Number of bytes of PCM data that could not be read from the source
3775    // Default: 0
3776    optional int32 num_missing_pcm_bytes = 3;
3777    // An identifier that can be used to match events for this device.
3778    // The incremental identifier is locally generated and guaranteed not derived
3779    // from any globally unique hardware id.
3780    // For paired devices, it stays consistent between Bluetooth toggling for the
3781    // same remote device.
3782    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3783    // session for the same remote device.
3784    // Default: 0 if the device's metric id is unknown.
3785    optional int32 metric_id = 4;
3786}
3787
3788/**
3789 * Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit
3790 * buffer queue is full and we have to drop data
3791 *
3792 * Logged from:
3793 *     system/bt
3794 */
3795message BluetoothA2dpAudioOverrunReported {
3796    // An identifier that can be used to match events for this device.
3797    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3798    // Salt: Randomly generated 256 bit value
3799    // Hash algorithm: HMAC-SHA256
3800    // Size: 32 byte
3801    // Default: null or empty if the device identifier is not known
3802    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3803    // Encoding interval in nanoseconds
3804    // Default: 0
3805    optional int64 encoding_interval_nanos = 2;
3806    // Number of buffers dropped in this event
3807    // Each buffer is encoded in one encoding interval and consists of multiple encoded frames
3808    // Default: 0
3809    optional int32 num_dropped_buffers = 3;
3810    // Number of encoded buffers dropped in this event
3811    // Default 0
3812    optional int32 num_dropped_encoded_frames = 4;
3813    // Number of encoded bytes dropped in this event
3814    // Default: 0
3815    optional int32 num_dropped_encoded_bytes = 5;
3816    // An identifier that can be used to match events for this device.
3817    // The incremental identifier is locally generated and guaranteed not derived
3818    // from any globally unique hardware id.
3819    // For paired devices, it stays consistent between Bluetooth toggling for the
3820    // same remote device.
3821    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3822    // session for the same remote device.
3823    // Default: 0 if the device's metric id is unknown.
3824    optional int32 metric_id = 6;
3825}
3826
3827/**
3828 * Logs when we receive reports regarding a device's RSSI value
3829 *
3830 * Logged from:
3831 *     system/bt
3832 */
3833message BluetoothDeviceRssiReported {
3834    // An identifier that can be used to match events for this device.
3835    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3836    // Salt: Randomly generated 256 bit value
3837    // Hash algorithm: HMAC-SHA256
3838    // Size: 32 byte
3839    // Default: null or empty if the device identifier is not known
3840    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3841    // Connection handle of this connection if available
3842    // Range: 0x0000 - 0x0EFF (12 bits)
3843    // Default: 0xFFFF if the handle is unknown
3844    optional int32 connection_handle = 2;
3845    // HCI command status code if this is triggerred by hci_cmd
3846    // Default: STATUS_UNKNOWN
3847    optional android.bluetooth.hci.StatusEnum hci_status = 3;
3848    // BR/EDR
3849    //   Range: -128 ≤ N ≤ 127 (signed integer)
3850    //   Units: dB
3851    // LE:
3852    //   Range: -127 to 20, 127 (signed integer)
3853    //   Units: dBm
3854    // Invalid when an out of range value is reported
3855    optional int32 rssi = 4;
3856    // An identifier that can be used to match events for this device.
3857    // The incremental identifier is locally generated and guaranteed not derived
3858    // from any globally unique hardware id.
3859    // For paired devices, it stays consistent between Bluetooth toggling for the
3860    // same remote device.
3861    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3862    // session for the same remote device.
3863    // Default: 0 if the device's metric id is unknown.
3864    optional int32 metric_id = 5;
3865}
3866
3867/**
3868 * Logs when we receive reports regarding how many consecutive failed contacts for a connection
3869 *
3870 * Logged from:
3871 *     system/bt
3872 */
3873message BluetoothDeviceFailedContactCounterReported {
3874    // An identifier that can be used to match events for this device.
3875    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3876    // Salt: Randomly generated 256 bit value
3877    // Hash algorithm: HMAC-SHA256
3878    // Size: 32 byte
3879    // Default: null or empty if the device identifier is not known
3880    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3881    // Connection handle of this connection if available
3882    // Range: 0x0000 - 0x0EFF (12 bits)
3883    // Default: 0xFFFF if the handle is unknown
3884    optional int32 connection_handle = 2;
3885    // HCI command status code if this is triggerred by hci_cmd
3886    // Default: STATUS_UNKNOWN
3887    optional android.bluetooth.hci.StatusEnum cmd_status = 3;
3888    // Number of consecutive failed contacts for a connection corresponding to the Handle
3889    // Range: uint16_t, 0-0xFFFF
3890    // Default: 0xFFFFF
3891    optional int32 failed_contact_counter = 4;
3892    // An identifier that can be used to match events for this device.
3893    // The incremental identifier is locally generated and guaranteed not derived
3894    // from any globally unique hardware id.
3895    // For paired devices, it stays consistent between Bluetooth toggling for the
3896    // same remote device.
3897    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3898    // session for the same remote device.
3899    // Default: 0 if the device's metric id is unknown.
3900    optional int32 metric_id = 5;
3901}
3902
3903/**
3904 * Logs when we receive reports regarding the tranmit power level used for a specific connection
3905 *
3906 * Logged from:
3907 *     system/bt
3908 */
3909message BluetoothDeviceTxPowerLevelReported {
3910    // An identifier that can be used to match events for this device.
3911    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3912    // Salt: Randomly generated 256 bit value
3913    // Hash algorithm: HMAC-SHA256
3914    // Size: 32 byte
3915    // Default: null or empty if the device identifier is not known
3916    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3917    // Connection handle of this connection if available
3918    // Range: 0x0000 - 0x0EFF (12 bits)
3919    // Default: 0xFFFF if the handle is unknown
3920    optional int32 connection_handle = 2;
3921    // HCI command status code if this is triggered by hci_cmd
3922    // Default: STATUS_UNKNOWN
3923    optional android.bluetooth.hci.StatusEnum hci_status = 3;
3924    // Range: -30 ≤ N ≤ 20
3925    // Units: dBm
3926    // Invalid when an out of range value is reported
3927    optional int32 transmit_power_level = 4;
3928    // An identifier that can be used to match events for this device.
3929    // The incremental identifier is locally generated and guaranteed not derived
3930    // from any globally unique hardware id.
3931    // For paired devices, it stays consistent between Bluetooth toggling for the
3932    // same remote device.
3933    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3934    // session for the same remote device.
3935    // Default: 0 if the device's metric id is unknown.
3936    optional int32 metric_id = 5;
3937}
3938
3939/**
3940 * Logs when Bluetooth controller failed to reply with command status within a timeout period after
3941 * receiving an HCI command from the host
3942 *
3943 * Logged from: system/bt
3944 */
3945message BluetoothHciTimeoutReported {
3946    // HCI command associated with this event
3947    // Default: CMD_UNKNOWN
3948    optional android.bluetooth.hci.CommandEnum hci_command = 1;
3949}
3950
3951/**
3952 * Logs when we receive Bluetooth Link Quality Report event from the controller
3953 * See Android Bluetooth HCI specification for more details
3954 *
3955 * Note: all count and bytes field are counted since last event
3956 *
3957 * Logged from: system/bt
3958 */
3959message BluetoothQualityReportReported {
3960    // Quality report ID
3961    // Original type: uint8_t
3962    // Default: BQR_ID_UNKNOWN
3963    optional android.bluetooth.hci.BqrIdEnum quality_report_id = 1;
3964    // Packet type of the connection
3965    // Original type: uint8_t
3966    // Default: BQR_PACKET_TYPE_UNKNOWN
3967    optional android.bluetooth.hci.BqrPacketTypeEnum packet_types = 2;
3968    // Connection handle of the connection
3969    // Original type: uint16_t
3970    optional int32 connection_handle = 3;
3971    // Performing Role for the connection
3972    // Original type: uint8_t
3973    optional int32 connection_role = 4;
3974    // Current Transmit Power Level for the connection. This value is the same as the controller's
3975    // response to the HCI_Read_Transmit_Power_Level HCI command
3976    // Original type: uint8_t
3977    optional int32 tx_power_level = 5;
3978    // Received Signal Strength Indication (RSSI) value for the connection. This value is an
3979    // absolute receiver signal strength value
3980    // Original type: int8_t
3981    optional int32 rssi = 6;
3982    // Signal-to-Noise Ratio (SNR) value for the connection. It is the average SNR of all the
3983    // channels used by the link currently
3984    // Original type: uint8_t
3985    optional int32 snr = 7;
3986    // Indicates the number of unused channels in AFH_channel_map
3987    // Original type: uint8_t
3988    optional int32 unused_afh_channel_count = 8;
3989    // Indicates the number of the channels which are interfered and quality is bad but are still
3990    // selected for AFH
3991    // Original type: uint8_t
3992    optional int32 afh_select_unideal_channel_count = 9;
3993    // Current Link Supervision Timeout Setting
3994    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
3995    // Original type: uint16_t
3996    optional int32 lsto = 10;
3997    // Piconet Clock for the specified Connection_Handle. This value is the same as the controller's
3998    // response to HCI_Read_Clock HCI command with the parameter "Which_Clock" of
3999    // 0x01 (Piconet Clock)
4000    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
4001    // Original type: uint32_t
4002    optional int64 connection_piconet_clock = 11;
4003    // The count of retransmission
4004    // Original type: uint32_t
4005    optional int64 retransmission_count = 12;
4006    // The count of no RX
4007    // Original type: uint32_t
4008    optional int64 no_rx_count = 13;
4009    // The count of NAK (Negative Acknowledge)
4010    // Original type: uint32_t
4011    optional int64 nak_count = 14;
4012    // Controller timestamp of last TX ACK
4013    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
4014    // Original type: uint32_t
4015    optional int64 last_tx_ack_timestamp = 15;
4016    // The count of Flow-off (STOP)
4017    // Original type: uint32_t
4018    optional int64 flow_off_count = 16;
4019    // Controller timestamp of last Flow-on (GO)
4020    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
4021    // Original type: uint32_t
4022    optional int64 last_flow_on_timestamp = 17;
4023    // Buffer overflow count (how many bytes of TX data are dropped) since the last event
4024    // Original type: uint32_t
4025    optional int64 buffer_overflow_bytes = 18;
4026    // Buffer underflow count (in byte) since last event
4027    // Original type: uint32_t
4028    optional int64 buffer_underflow_bytes = 19;
4029}
4030
4031/**
4032 * Logs when a Bluetooth device's manufacturer information is learnt by the Bluetooth stack
4033 *
4034 * Notes:
4035 * - Each event can be partially filled as we might learn different pieces of device
4036 *   information at different time
4037 * - Multiple device info events can be combined to give more complete picture
4038 * - When multiple device info events tries to describe the same information, the
4039 *   later one wins
4040 *
4041 * Logged from:
4042 *     packages/apps/Bluetooth
4043 */
4044message BluetoothDeviceInfoReported {
4045    // An identifier that can be used to match events for this device.
4046    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4047    // Salt: Randomly generated 256 bit value
4048    // Hash algorithm: HMAC-SHA256
4049    // Size: 32 byte
4050    // Default: null or empty if the device identifier is not known
4051    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
4052    // Where is this device info obtained from
4053    optional android.bluetooth.DeviceInfoSrcEnum source_type = 2;
4054    // Name of the data source
4055    // For EXTERNAL: package name of the data source
4056    // For INTERNAL: null for general case, component name otherwise
4057    optional string source_name = 3;
4058    // Name of the manufacturer of this device
4059    optional string manufacturer = 4;
4060    // Model of this device
4061    optional string model = 5;
4062    // Hardware version of this device
4063    optional string hardware_version = 6;
4064    // Software version of this device
4065    optional string software_version = 7;
4066    // An identifier that can be used to match events for this device.
4067    // The incremental identifier is locally generated and guaranteed not derived
4068    // from any globally unique hardware id.
4069    // For paired devices, it stays consistent between Bluetooth toggling for the
4070    // same remote device.
4071    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4072    // session for the same remote device.
4073    // Default: 0 if the device's metric id is unknown.
4074    optional int32 metric_id = 8;
4075    // A flag indicating if the MAC address of the remote device is public or
4076    // random.
4077    optional android.bluetooth.AddressTypeEnum address_type = 9;
4078    // The first byte of MAC address
4079    optional int32 byte1 = 10;
4080    // The second byte of MAC address
4081    optional int32 byte2 = 11;
4082    // The third byte of MAC address
4083    optional int32 byte3 = 12;
4084
4085}
4086
4087/**
4088 * Logs when we receive Bluetooth Read Remote Version Information Complete Event from the remote
4089 * device, as documented by the Bluetooth Core HCI specification
4090 * Reference: https://www.bluetooth.com/specifications/bluetooth-core-specification
4091 * Vol 2, Part E, Page 1118
4092 *
4093 * Logged from:
4094 *     system/bt
4095 */
4096message BluetoothRemoteVersionInfoReported {
4097    // Connection handle of the connection
4098    // Original type: uint16_t
4099    optional int32 connection_handle = 1;
4100    // HCI command status code
4101    // Default: STATUS_UNKNOWN
4102    optional android.bluetooth.hci.StatusEnum hci_status = 2;
4103    // 1 byte Version of current LMP in the remote controller
4104    optional int32 lmp_version = 3;
4105    // 2 bytes LMP manufacturer code of the remote controller
4106    // https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
4107    optional int32 lmp_manufacturer_code = 4;
4108    // 4 bytes subversion of the LMP in the remote controller
4109    optional int32 lmp_subversion = 5;
4110}
4111
4112/**
4113 * Logs when certain Bluetooth SDP attributes are discovered
4114 * Constant definitions are from:
4115 *     https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
4116 *
4117 * Current logged attributes:
4118 * - BluetoothProfileDescriptorList
4119 * - Supported Features Bitmask
4120 *
4121 * Logged from:
4122 *     system/bt
4123 */
4124message BluetoothSdpAttributeReported {
4125    // An identifier that can be used to match events for this device.
4126    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4127    // Salt: Randomly generated 256 bit value
4128    // Hash algorithm: HMAC-SHA256
4129    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
4130    // Short form UUIDs used to identify Bluetooth protocols, profiles, and service classes
4131    // Original type: uint16_t
4132    optional int32 protocol_uuid = 2;
4133    // Short form UUIDs used to identify Bluetooth SDP attribute types
4134    // Original type: uint16_t
4135    optional int32 attribute_id = 3;
4136    // Attribute value for the particular attribute
4137    optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
4138    // An identifier that can be used to match events for this device.
4139    // The incremental identifier is locally generated and guaranteed not derived
4140    // from any globally unique hardware id.
4141    // For paired devices, it stays consistent between Bluetooth toggling for the
4142    // same remote device.
4143    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4144    // session for the same remote device.
4145    // Default: 0 if the device's metric id is unknown.
4146    optional int32 metric_id = 5;
4147}
4148
4149/**
4150* Logs the user created Bluetooth device's name.
4151* It is pushed at Bluetooth pairing and connection.
4152*
4153* Logged from:
4154*     packages/modules/Bluetooth
4155*/
4156message BluetoothDeviceNameReported {
4157   // An identifier that can be used to match events for this device.
4158   // The incremental identifier is locally generated and guaranteed not derived
4159   // from any globally unique hardware id.
4160   // For paired devices, it stays consistent between Bluetooth toggling for the
4161   // same remote device.
4162   // For unpaired devices, it stays consistent within the same Bluetooth adapter
4163   // session for the same remote device.
4164   // Default: 0 if the device's metric id is unknown.
4165   optional int32 metric_id = 1;
4166
4167   // Name of the Bluetooth device. It is created by the user.
4168   optional string device_name = 2;
4169}
4170
4171/**
4172 * Logs when bond state of a Bluetooth device changes
4173 *
4174 * Logged from:
4175 *     frameworks/base/core/java/android/bluetooth/BluetoothDevice.java
4176 *     packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
4177 */
4178message BluetoothBondStateChanged {
4179    // An identifier that can be used to match events for this device.
4180    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4181    // Salt: Randomly generated 256 bit value
4182    // Hash algorithm: HMAC-SHA256
4183    // Size: 32 byte
4184    // Default: null or empty if the device identifier is not known
4185    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
4186    // Preferred transport type to remote dual mode device
4187    // Default: TRANSPORT_AUTO means no preference
4188    optional android.bluetooth.TransportTypeEnum transport = 2;
4189    // The type of this Bluetooth device (Classic, LE, or Dual mode)
4190    // Default: UNKNOWN
4191    optional android.bluetooth.DeviceTypeEnum type = 3;
4192    // Current bond state (NONE, BONDING, BONDED)
4193    // Default: BOND_STATE_UNKNOWN
4194    optional android.bluetooth.BondStateEnum bond_state = 4;
4195    // Bonding sub state
4196    // Default: BOND_SUB_STATE_UNKNOWN
4197    optional android.bluetooth.BondSubStateEnum bonding_sub_state = 5;
4198    // Unbond Reason
4199    // Default: UNBOND_REASON_UNKNOWN
4200    optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
4201    // An identifier that can be used to match events for this device.
4202    // The incremental identifier is locally generated and guaranteed not derived
4203    // from any globally unique hardware id.
4204    // For paired devices, it stays consistent between Bluetooth toggling for the
4205    // same remote device.
4206    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4207    // session for the same remote device.
4208    // Default: 0 if the device's metric id is unknown.
4209    optional int32 metric_id = 7;
4210}
4211
4212/**
4213 * Logs there is an event related Bluetooth classic pairing
4214 *
4215 * Logged from:
4216 *     system/bt
4217 */
4218message BluetoothClassicPairingEventReported {
4219    // An identifier that can be used to match events for this device.
4220    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4221    // Salt: Randomly generated 256 bit value
4222    // Hash algorithm: HMAC-SHA256
4223    // Size: 32 byte
4224    // Default: null or empty if the device identifier is not known
4225    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
4226    // Connection handle of this connection if available
4227    // Range: 0x0000 - 0x0EFF (12 bits)
4228    // Default: 0xFFFF if the handle is unknown
4229    optional int32 connection_handle = 2;
4230    // HCI command associated with this event
4231    // Default: CMD_UNKNOWN
4232    optional android.bluetooth.hci.CommandEnum hci_cmd = 3;
4233    // HCI event associated with this event
4234    // Default: EVT_UNKNOWN
4235    optional android.bluetooth.hci.EventEnum hci_event = 4;
4236    // HCI command status code if this is triggerred by hci_cmd
4237    // Default: STATUS_UNKNOWN
4238    optional android.bluetooth.hci.StatusEnum cmd_status = 5;
4239    // HCI reason code associated with this event
4240    // Default: STATUS_UNKNOWN
4241    optional android.bluetooth.hci.StatusEnum reason_code = 6;
4242    // A status value related to this specific event
4243    // Default: 0
4244    optional int64 event_value = 7;
4245    // An identifier that can be used to match events for this device.
4246    // The incremental identifier is locally generated and guaranteed not derived
4247    // from any globally unique hardware id.
4248    // For paired devices, it stays consistent between Bluetooth toggling for the
4249    // same remote device.
4250    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4251    // session for the same remote device.
4252    // Default: 0 if the device's metric id is unknown.
4253    optional int32 metric_id = 8;
4254}
4255
4256/**
4257 * Logs when there is an event related to Bluetooth Security Manager Protocol (SMP)
4258 *
4259 * Logged from:
4260 *     system/bt
4261 */
4262message BluetoothSmpPairingEventReported {
4263    // An identifier that can be used to match events for this device.
4264    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4265    // Salt: Randomly generated 256 bit value
4266    // Hash algorithm: HMAC-SHA256
4267    // Size: 32 byte
4268    // Default: null or empty if the device identifier is not known
4269    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
4270    // SMP command sent or received over L2CAP
4271    // Default: CMD_UNKNOWN
4272    optional android.bluetooth.smp.CommandEnum smp_command = 2;
4273    // Whether this command is sent or received
4274    // Default: DIRECTION_UNKNOWN
4275    optional android.bluetooth.DirectionEnum direction = 3;
4276    // SMP failure reason code
4277    // Default: PAIRING_FAIL_REASON_DEFAULT
4278    optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
4279    // An identifier that can be used to match events for this device.
4280    // The incremental identifier is locally generated and guaranteed not derived
4281    // from any globally unique hardware id.
4282    // For paired devices, it stays consistent between Bluetooth toggling for the
4283    // same remote device.
4284    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4285    // session for the same remote device.
4286    // Default: 0 if the device's metric id is unknown.
4287    optional int32 metric_id = 5;
4288}
4289
4290/**
4291 * Logs when a Bluetooth socket’s connection state changed
4292 *
4293 * Logged from:
4294 *   system/bt
4295 */
4296message BluetoothSocketConnectionStateChanged {
4297    // An identifier that can be used to match events for this device.
4298    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4299    // Salt: Randomly generated 256 bit value
4300    // Hash algorithm: HMAC-SHA256
4301    // Size: 32 byte
4302    // Default: null or empty if this is a server listener socket
4303    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
4304    // Temporary port of this socket for the current connection or session only
4305    // Default 0 when unknown or don't care
4306    optional int32 port = 2;
4307    // Socket type as mentioned in
4308    // frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
4309    // Default: SOCKET_TYPE_UNKNOWN
4310    optional android.bluetooth.SocketTypeEnum type = 3;
4311    // Socket connection state
4312    // Default: SOCKET_CONNECTION_STATE_UNKNOWN
4313    optional android.bluetooth.SocketConnectionstateEnum state = 4;
4314    // Number of bytes sent to remote device during this connection
4315    optional int64 tx_bytes = 5;
4316    // Number of bytes received from remote device during this connection
4317    optional int64 rx_bytes = 6;
4318    // Socket owner's UID
4319    optional int32 uid = 7 [(is_uid) = true];
4320    // Server port of this socket, if any. When both |server_port| and |port| fields are populated,
4321    // |port| must be spawned by |server_port|
4322    // Default 0 when unknown or don't care
4323    optional int32 server_port = 8;
4324    // Whether this is a server listener socket
4325    optional android.bluetooth.SocketRoleEnum is_server = 9;
4326    // An identifier that can be used to match events for this device.
4327    // The incremental identifier is locally generated and guaranteed not derived
4328    // from any globally unique hardware id.
4329    // For paired devices, it stays consistent between Bluetooth toggling for the
4330    // same remote device.
4331    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4332    // session for the same remote device.
4333    // Default: 0 if the device's metric id is unknown.
4334    optional int32 metric_id = 10;
4335}
4336
4337/**
4338 * Logs when Class of Device (CoD) value is learnt for a device during pairing or connection
4339 *
4340 * Logged from:
4341 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
4342 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
4343 *
4344 */
4345message BluetoothClassOfDeviceReported {
4346    // An identifier that can be used to match events for this device.
4347    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4348    // Salt: Randomly generated 256 bit value
4349    // Hash algorithm: HMAC-SHA256
4350    // Size: 32 byte
4351    // Default: null or empty if this is a server listener socket
4352    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
4353    // Class of Device (CoD) value including both Major, Minor device class and service class
4354    // Defined in: https://www.bluetooth.com/specifications/assigned-numbers/baseband
4355    // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
4356    // Default: 0
4357    optional int32 class_of_device = 2;
4358    // An identifier that can be used to match events for this device.
4359    // The incremental identifier is locally generated and guaranteed not derived
4360    // from any globally unique hardware id.
4361    // For paired devices, it stays consistent between Bluetooth toggling for the
4362    // same remote device.
4363    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4364    // session for the same remote device.
4365    // Default: 0 if the device's metric id is unknown.
4366    optional int32 metric_id = 3;
4367}
4368
4369/**
4370 * Logs when there is a crash in hardware abstraction layer (HAL)
4371 *
4372 * Logged from:
4373 *   system/bt
4374 *
4375 */
4376message BluetoothHALCrashReasonReported {
4377    // An identifier that can be used to match events for this device.
4378    // The incremental identifier is locally generated and guaranteed not derived
4379    // from any globally unique hardware id.
4380    // For paired devices, it stays consistent between Bluetooth toggling for the
4381    // same remote device.
4382    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4383    // session for the same remote device.
4384    // Default: 0 if the device's metric id is unknown.
4385    optional int32 metric_id = 1;
4386    // An identifier that can be used to match events for this device.
4387    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
4388    // Salt: Randomly generated 256 bit value
4389    // Hash algorithm: HMAC-SHA256
4390    // Size: 32 byte
4391    // Default: null or empty if the device identifier is not known
4392    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
4393    // Bluetooth HAL crash reason error code.
4394    // Original type: uint8_t
4395    // Default: 0x00 (DEFAULT)
4396    optional int32 error_code = 3;
4397    // Bluetooth HAL crash reason vendor error code.
4398    // Original type: uint8_t
4399    // Default: 0x00 (DEFAULT)
4400    optional int32 vendor_error_code = 4;
4401}
4402
4403/**
4404 * Logs when an LE Audio connection session ended
4405 *
4406 * Logged from:
4407 *   packages/modules/Bluetooth
4408 *
4409 */
4410message LeAudioConnectionSessionReported {
4411    // Size of this CSIS group
4412    optional int32 group_size = 1;
4413    // An identifier that can be used to match events for this CSIS group.
4414    // The incremental identifier is locally generated and guaranteed not derived
4415    // from any globally unique hardware id.
4416    // For paired groups, it stays consistent between Bluetooth toggling for the
4417    // same remote group.
4418    // For unpaired groups, it stays consistent within the same Bluetooth adapter
4419    // session for the same remote group.
4420    // Default: 0 if the group's metric id is unknown.
4421    optional int32 group_metric_id = 2;
4422    // Total duration of this LeAudioConnectionSession
4423    optional int64 duration_nanos = 3;
4424
4425    // Connecting timestamp offset to the beginning of this session of each device session
4426    repeated int64 device_connecting_offset_nanos = 4;
4427    // Connected timestamp offset to the beginning of this session of each device session
4428    repeated int64 device_connected_offset_nanos = 5;
4429    // Duration of each device session
4430    repeated int64 device_connection_duration_nanos = 6;
4431    // Connection status of each device session
4432    repeated android.bluetooth.leaudio.ConnectionStatus device_connection_status = 7;
4433    // Disconnection status of each device session
4434    repeated android.bluetooth.leaudio.ConnectionStatus device_disconnection_status = 8;
4435    // An identifier that can be used to match events for this device.
4436    // The incremental identifier is locally generated and guaranteed not derived
4437    // from any globally unique hardware id.
4438    // For paired devices, it stays consistent between Bluetooth toggling for the
4439    // same remote device.
4440    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4441    // session for the same remote device.
4442    // Default: 0 if the device's metric id is unknown.
4443    repeated int32 device_metric_id = 9;
4444
4445    // Streaming beginning timestamp offset to the beginning of this session
4446    repeated int64 streaming_session_offset_nanos = 10;
4447    // Streaming ending timestamp offset to the beginning of this session
4448    repeated int64 streaming_session_duration_nanos = 11;
4449    // Streaming context type of each steaming session
4450    repeated android.bluetooth.leaudio.ContextType streaming_context_type = 12;
4451}
4452
4453/**
4454 * Logs when an LE Audio broadcast session ended
4455 *
4456 * Logged from:
4457 *   packages/modules/Bluetooth
4458 *
4459 */
4460message LeAudioBroadcastSessionReported {
4461    // Broadcast duration
4462    optional int64 duration_nanos = 1;
4463}
4464
4465/**
4466 * Logs when the counter is incremented
4467 *
4468 * Logged from:
4469 *   system/bt
4470 *   packages/apps/Bluetooth
4471 *
4472 */
4473message BluetoothCodePathCounter {
4474    // Keys of events with enum ranges to be defined
4475    optional android.bluetooth.CodePathCounterKeyEnum key = 1;
4476    // Number of frequency of events
4477    optional int64 number = 2;
4478}
4479
4480/**
4481 * Logs when an application attempts to start a Bluetooth Low Energy scan.
4482 * It only happens when the scan is initiated and does not repeatedly call
4483 * while the scan is running.
4484 *
4485 * Logged from:
4486 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/GattService.java
4487 *
4488 */
4489message BluetoothLeBatchScanReportDelay {
4490    optional int32 application_uid = 1;
4491    optional int64 application_report_delay_millis = 2;
4492}
4493
4494message BluetoothLocalVersionsReported {
4495    // Chip Manufacturer name
4496    optional int32 lmp_manufacturer_name = 1;
4497    // LMP Version
4498    optional int32 lmp_version = 2;
4499    // LMP Subversion
4500    optional int32 lmp_subversion = 3;
4501    // HCI Version
4502    optional int32 hci_version = 4;
4503    // HCI Revision
4504    optional int32 hci_revision = 5;
4505}
4506
4507message BluetoothRemoteSupportedFeaturesReported {
4508    // An identifier that can be used to match events for this device.
4509    // The incremental identifier is locally generated and guaranteed not derived
4510    // from any globally unique hardware id.
4511    // For paired devices, it stays consistent between Bluetooth toggling for the
4512    // same remote device.
4513    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4514    // session for the same remote device.
4515    // Default: 0 if the device's metric id is unknown.
4516    optional int32 metric_id = 1;
4517    // Page of the feature bit masks
4518    optional int32 page = 2;
4519    // Bit mask of features
4520    optional int64 features_page2 = 3;
4521    // Connection handle of this connection if available
4522    // Range: 0x0000 - 0x0EFF (12 bits)
4523    // Default: 0xFFFF if the handle is unknown
4524    optional int32 connection_handle = 4;
4525}
4526
4527message BluetoothLocalSupportedFeaturesReported {
4528    // Page of the feature bit masks
4529    optional int32 page_num = 1;
4530    // Bit mask of features
4531    optional int64 features_page = 2;
4532}
4533
4534message BluetoothDisconnectionReasonReported {
4535    // Disconnection reason
4536    optional int32 reason = 1;
4537    // An identifier that can be used to match events for this device.
4538    // The incremental identifier is locally generated and guaranteed not derived
4539    // from any globally unique hardware id.
4540    // For paired devices, it stays consistent between Bluetooth toggling for the
4541    // same remote device.
4542    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4543    // session for the same remote device.
4544    // Default: 0 if the device's metric id is unknown.
4545    optional int32 metric_id = 2;
4546    // Connection handle of this connection if available
4547    // Range: 0x0000 - 0x0EFF (12 bits)
4548    // Default: 0xFFFF if the handle is unknown
4549    optional int32 connection_handle = 3;
4550}
4551
4552message BluetoothGattAppInfo {
4553    // An index to group connection events by session. It's a counter generated by
4554    // each profile. e.g. Gatt server generate such id to identify Gatt apps
4555    optional int32 session_index = 1;
4556    // An identifier that can be used to match events for this device.
4557    // The incremental identifier is locally generated and guaranteed not derived
4558    // from any globally unique hardware id.
4559    // For paired devices, it stays consistent between Bluetooth toggling for the
4560    // same remote device.
4561    // For unpaired devices, it stays consistent within the same Bluetooth adapter
4562    // session for the same remote device.
4563    // Default: 0 if the device's metric id is unknown.
4564    optional int32 metric_id = 2;
4565    // UID of the GATT app
4566    optional int32 uid = 3 [(is_uid) = true];
4567}
4568
4569/**
4570 * Logs when something is plugged into or removed from the USB-C connector.
4571 *
4572 * Logged from:
4573 *  UsbService
4574 */
4575message UsbConnectorStateChanged {
4576    enum State {
4577        STATE_DISCONNECTED = 0;
4578        STATE_CONNECTED = 1;
4579    }
4580    optional State state = 1
4581            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
4582    optional string id = 2 [(state_field_option).primary_field = true];
4583    // Last active session in ms.
4584    // 0 when the port is in connected state.
4585    optional int64 last_connect_duration_millis = 3;
4586}
4587
4588/**
4589 * Logs the reported speaker impedance.
4590 *
4591 * Logged from:
4592 *  Vendor audio implementation.
4593 */
4594message SpeakerImpedanceReported {
4595    optional int32 speaker_location = 1;
4596    optional int32 impedance = 2;
4597}
4598
4599/**
4600 * Logs the report of a failed hardware.
4601 *
4602 * Logged from:
4603 *  Vendor HALs.
4604 *
4605 */
4606message HardwareFailed {
4607    enum HardwareType {
4608        HARDWARE_FAILED_UNKNOWN = 0;
4609        HARDWARE_FAILED_MICROPHONE = 1;
4610        HARDWARE_FAILED_CODEC = 2;
4611        HARDWARE_FAILED_SPEAKER = 3;
4612        HARDWARE_FAILED_FINGERPRINT = 4;
4613    }
4614    optional HardwareType hardware_type = 1;
4615
4616   /**
4617    * hardware_location allows vendors to differentiate between multiple instances of
4618    * the same hardware_type.  The specific locations are vendor defined integers,
4619    * referring to board-specific numbering schemes.
4620    */
4621    optional int32 hardware_location = 2;
4622
4623    /**
4624     * failure_code is specific to the HardwareType of the failed hardware.
4625     * It should use one of the enum values defined below.
4626     */
4627    enum HardwareErrorCode {
4628        UNKNOWN = 0;
4629        COMPLETE = 1;
4630        SPEAKER_HIGH_Z = 2;
4631        SPEAKER_SHORT = 3;
4632        FINGERPRINT_SENSOR_BROKEN = 4;
4633        FINGERPRINT_TOO_MANY_DEAD_PIXELS = 5;
4634        DEGRADE = 6;
4635    }
4636    optional int32 failure_code = 3;
4637}
4638
4639/**
4640 * Log an event when the device has been physically dropped.
4641 * Reported from the /vendor partition.
4642 */
4643message PhysicalDropDetected {
4644    // Confidence that the event was actually a drop, 0 -> 100
4645    optional int32 confidence_pctg = 1;
4646    // Peak acceleration of the drop, in 1/1000s of a g.
4647    optional int32 accel_peak_thousandths_g = 2;
4648    // Duration of freefall in ms
4649    optional int32 freefall_time_millis = 3;
4650}
4651
4652/**
4653 * Log bucketed battery charge cycles.
4654 *
4655 * Each bucket represents cycles of the battery past
4656 * a given charge point.  For example, if 10 cycle buckets are
4657 * initialized, bucket 1 is the lowest 1/10th of the battery,
4658 * and bucket 10 is 100%.
4659 *
4660 * Logged from:
4661 * /sys/class/power_supply/bms/cycle_count, via Vendor.
4662 */
4663message ChargeCyclesReported {
4664    optional int32 cycle_bucket_1 = 1;
4665    optional int32 cycle_bucket_2 = 2;
4666    optional int32 cycle_bucket_3 = 3;
4667    optional int32 cycle_bucket_4 = 4;
4668    optional int32 cycle_bucket_5 = 5;
4669    optional int32 cycle_bucket_6 = 6;
4670    optional int32 cycle_bucket_7 = 7;
4671    optional int32 cycle_bucket_8 = 8;
4672    optional int32 cycle_bucket_9 = 9;
4673    optional int32 cycle_bucket_10 = 10;
4674}
4675
4676/**
4677 * Log battery health snapshot.
4678 *
4679 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
4680 * are snapshotted periodically over 24hrs.
4681 */
4682message BatteryHealthSnapshot {
4683    enum BatterySnapshotType {
4684        UNKNOWN = 0;
4685        MIN_TEMP = 1;         // Snapshot at min batt temp over 24hrs.
4686        MAX_TEMP = 2;         // Snapshot at max batt temp over 24hrs.
4687        MIN_RESISTANCE = 3;   // Snapshot at min batt resistance over 24hrs.
4688        MAX_RESISTANCE = 4;   // Snapshot at max batt resistance over 24hrs.
4689        MIN_VOLTAGE = 5;      // Snapshot at min batt voltage over 24hrs.
4690        MAX_VOLTAGE = 6;      // Snapshot at max batt voltage over 24hrs.
4691        MIN_CURRENT = 7;      // Snapshot at min batt current over 24hrs.
4692        MAX_CURRENT = 8;      // Snapshot at max batt current over 24hrs.
4693        MIN_BATT_LEVEL = 9;   // Snapshot at min battery level (SoC) over 24hrs.
4694        MAX_BATT_LEVEL = 10;  // Snapshot at max battery level (SoC) over 24hrs.
4695        AVG_RESISTANCE = 11;  // Snapshot at average battery resistance over 24hrs.
4696    }
4697    optional BatterySnapshotType type = 1;
4698    // Temperature, in 1/10ths of degree C.
4699    optional int32 temperature_deci_celsius = 2;
4700    // Voltage Battery Voltage, in microVolts.
4701    optional int32 voltage_micro_volt = 3;
4702    // Current Battery current, in microAmps.
4703    optional int32 current_micro_amps = 4;
4704    // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
4705    optional int32 open_circuit_micro_volt = 5;
4706    // Resistance Battery Resistance, in microOhms.
4707    optional int32 resistance_micro_ohm = 6;
4708    // Level Battery Level, as % of full.
4709    optional int32 level_percent = 7;
4710}
4711
4712/**
4713 * Log slow I/O operations on the primary storage.
4714 */
4715message SlowIo {
4716    // Classifications of IO Operations.
4717    enum IoOperation {
4718        UNKNOWN = 0;
4719        READ = 1;
4720        WRITE = 2;
4721        UNMAP = 3;
4722        SYNC = 4;
4723    }
4724    optional IoOperation operation = 1;
4725
4726    // The number of slow IO operations of this type over 24 hours.
4727    optional int32 count = 2;
4728}
4729
4730/**
4731 * Log battery caused shutdown with the last recorded voltage.
4732 */
4733message BatteryCausedShutdown {
4734    // The last recorded battery voltage prior to shutdown.
4735    optional int32 last_recorded_micro_volt = 1;
4736}
4737
4738/**
4739 * Logs when ThermalService receives throttling events.
4740 *
4741 * Logged from:
4742 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
4743 */
4744message ThermalThrottlingSeverityStateChanged {
4745  // The type of temperature being reported (CPU, GPU, SKIN, etc)
4746  optional android.os.TemperatureTypeEnum sensor_type = 1
4747      [(state_field_option).primary_field = true];
4748
4749  // The name of the temperature source. Eg. CPU0
4750  optional string sensor_name = 2 [(state_field_option).primary_field = true];
4751
4752  // Temperature in tenths of a degree C.
4753  // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
4754  optional int32 temperature_deci_celsius = 3;
4755
4756  // Relative severity of the throttling, see enum definition.
4757  optional android.os.ThrottlingSeverityEnum severity = 4 [
4758    (state_field_option).exclusive_state = true,
4759    (state_field_option).nested = false
4760  ];
4761}
4762
4763/**
4764 * Logs phone signal strength changes.
4765 *
4766 * Logged from:
4767 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4768 */
4769message PhoneSignalStrengthChanged {
4770    // Signal strength, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
4771    optional android.telephony.SignalStrengthEnum signal_strength = 1;
4772}
4773
4774
4775/**
4776 * Logs when the phone state, sim state or signal strength changes
4777 *
4778 * Logged from:
4779 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4780 */
4781message PhoneServiceStateChanged {
4782    optional android.telephony.ServiceStateEnum state = 1;
4783    optional android.telephony.SimStateEnum sim_state = 2;
4784    optional android.telephony.SignalStrengthEnum signal_strength = 3;
4785}
4786
4787/**
4788 * Logs when the phone becomes on or off.
4789 *
4790 * Logged from:
4791 *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
4792 */
4793message PhoneStateChanged {
4794    enum State {
4795        OFF = 0;
4796        ON = 1;
4797    }
4798    optional State state = 1;
4799}
4800
4801message ExclusionRectStateChanged {
4802    optional string component_name = 1;    // if not available, simply packageName
4803    optional int32 requested_height = 2;   // px
4804    optional int32 rejected_height = 3;    // px
4805
4806    enum WindowHorizontalLocation {
4807        DEFAULT_LOCATION = 0;
4808        LEFT = 1;
4809        RIGHT = 2;
4810    }
4811    optional WindowHorizontalLocation x_location = 4;
4812    optional bool landscape = 5;
4813    optional bool splitscreen = 6 [deprecated = true];
4814    optional int32 duration_millis = 7;
4815}
4816
4817/**
4818 * Logs when Wallpaper or ThemePicker UI has changed.
4819 *
4820 * Logged from:
4821 *   packages/apps/ThemePicker
4822 *   packages/apps/WallpaperPicker2
4823 */
4824message StyleUIChanged {
4825    optional android.stats.style.Action action = 1;
4826    optional int32 color_package_hash = 2;
4827    optional int32 font_package_hash  = 3;
4828    optional int32 shape_package_hash = 4;
4829    optional int32 clock_package_hash = 5;
4830    optional int32 launcher_grid = 6;
4831    optional int32 wallpaper_category_hash = 7;
4832    optional int32 wallpaper_id_hash = 8;
4833    optional int32 color_preference = 9;
4834    optional android.stats.style.LocationPreference location_preference = 10;
4835    optional android.stats.style.DatePreference date_preference = 11;
4836    optional android.stats.style.LaunchedPreference launched_preference = 12;
4837    optional android.stats.style.EffectPreference effect_preference = 13;
4838    optional int32 effect_id_hash = 14;
4839    optional int32 lock_wallpaper_category_hash = 15;
4840    optional int32 lock_wallpaper_id_hash = 16;
4841    optional int32 first_launch_date_since_setup = 17;
4842    optional int32 first_wallpaper_apply_date_since_setup = 18;
4843    optional int32 app_launch_count = 19;
4844    optional int32 color_variant = 20;
4845    optional int64 time_elapsed_millis = 21;
4846    optional int32 effect_status_code = 22;
4847    optional int32 app_session_id = 23;
4848    optional android.stats.style.SetWallpaperEntryPoint set_wallpaper_entry_point = 24;
4849    optional android.stats.style.WallpaperDestination wallpaper_destination = 25;
4850    optional android.stats.style.ColorSource color_source = 26;
4851    optional int32 seed_color = 27;
4852    optional android.stats.style.ClockSize clock_size = 28;
4853    optional bool toggle_on = 29;
4854    optional string shortcut = 30;
4855    optional string shortcut_slot_id = 31;
4856    optional int32 lock_effect_id_hash = 32;
4857}
4858
4859/**
4860 * Logs when Settings UI has changed.
4861 *
4862 * Logged from:
4863 *   packages/apps/Settings
4864 */
4865message SettingsUIChanged {
4866    /**
4867     * Where this SettingsUIChange event comes from. For example, if
4868     * it's a PAGE_VISIBLE event, where the page is opened from.
4869     */
4870    optional android.app.settings.PageId attribution = 1;
4871
4872    /**
4873     * What the UI action is.
4874     */
4875    optional android.app.settings.Action action = 2;
4876
4877    /**
4878     * Where the action is happening
4879     */
4880    optional android.app.settings.PageId page_id = 3;
4881
4882    /**
4883     * What preference changed in this event.
4884     */
4885    optional string changed_preference_key = 4;
4886
4887    /**
4888     * The new value of the changed preference.
4889     */
4890    optional int64 changed_preference_int_value = 5;
4891
4892    /**
4893     * Data about elapsed time since setup wizard finished.
4894     */
4895    optional int64 elapsed_time_millis = 6;
4896}
4897
4898/**
4899 * Logs that a setting was updated.
4900 * Logged from:
4901 *   frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
4902 * The tag and is_default allow resetting of settings to default values based on the specified
4903 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
4904 */
4905message SettingChanged {
4906    // The name of the setting.
4907    optional string setting = 1;
4908
4909    // The change being imposed on this setting. May represent a number, eg "3".
4910    optional string value = 2;
4911
4912    // The new value of this setting. For most settings, this is same as value. For some settings,
4913    // value is +X or -X where X represents an element in a set. For example, if the previous value
4914    // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
4915    // The +/- feature is currently only used for location_providers_allowed.
4916    optional string new_value = 3;
4917
4918    // The previous value of this setting.
4919    optional string prev_value = 4;
4920
4921    // The tag used with the is_default for resetting sets of settings. This is generally null.
4922    optional string tag = 5;
4923
4924    // True if this setting with tag should be resettable.
4925    optional bool is_default = 6;
4926
4927    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
4928    optional int32 user = 7;
4929
4930    enum ChangeReason {
4931        UPDATED = 1; // Updated can be an insertion or an update.
4932        DELETED = 2;
4933    }
4934    optional ChangeReason reason = 8;
4935}
4936
4937/**
4938 * Logs activity going to foreground or background
4939 *
4940 * Logged from:
4941  *   frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
4942 */
4943message ActivityForegroundStateChanged {
4944    optional int32 uid = 1 [(is_uid) = true];
4945    optional string pkg_name = 2;
4946    optional string class_name = 3;
4947
4948    enum State {
4949        BACKGROUND = 0;
4950        FOREGROUND = 1;
4951    }
4952    optional State state = 4;
4953}
4954
4955/**
4956 * Logs when a volume entered low Storage state.
4957 * Logged from:
4958 *      frameworks/base/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
4959 */
4960message LowStorageStateChanged {
4961    // Volume that ran out of storage.
4962    optional string volume_description = 1;
4963
4964    enum State {
4965        UNKNOWN = 0;
4966        OFF = 1;
4967        ON = 2;
4968    }
4969    optional State state = 2;
4970}
4971
4972/**
4973 * Logs when an app is downgraded.
4974 * Logged from:
4975 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
4976 */
4977message AppDowngraded {
4978    optional string package_name = 1;
4979    // Size of the package (all data) before being downgraded.
4980    optional int64 size_in_bytes_before = 2;
4981    // Size of the package (all data) after being downgraded.
4982    optional int64 size_in_bytes_after = 3;
4983
4984    optional bool aggressive = 4;
4985}
4986
4987/**
4988 * Logs when an app is optimized after being downgraded.
4989 * Logged from:
4990 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
4991 */
4992message AppOptimizedAfterDowngraded {
4993    optional string package_name = 1;
4994}
4995
4996/**
4997 * Logs whenever an app is installed on external storage.
4998 * Logged from:
4999        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
5000 */
5001message AppInstallOnExternalStorageReported {
5002    // The type of external storage.
5003    optional android.stats.storage.ExternalStorageType storage_type = 1;
5004    // The name of the package that is installed on the sd card.
5005    optional string package_name = 2;
5006}
5007
5008/**
5009 * Logs when an app crashes.
5010 * Logged from:
5011 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5012 */
5013message AppCrashOccurred {
5014    optional int32 uid = 1 [(is_uid) = true];
5015
5016    optional string event_type = 2;
5017
5018    // The name of the process.
5019    // system_server if it is not by an app
5020    optional string process_name = 3;
5021
5022    // The pid if available. -1 means not available.
5023    optional int32 pid = 4;
5024
5025    optional string package_name = 5;
5026
5027    enum InstantApp {
5028        UNAVAILABLE = 0;
5029        FALSE = 1;
5030        TRUE = 2;
5031    }
5032    optional InstantApp is_instant_app = 6;
5033
5034    enum ForegroundState {
5035        UNKNOWN = 0;
5036        BACKGROUND = 1;
5037        FOREGROUND = 2;
5038    }
5039    optional ForegroundState foreground_state = 7;
5040
5041    optional android.server.ErrorSource error_source = 8;
5042
5043    optional bool is_incremental = 9;
5044
5045    optional float loading_progress = 10;
5046
5047    optional int64 millis_since_oldest_pending_read = 11;
5048
5049    // Status code to represent the health of the file system backing storage, as defined in
5050    // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
5051    // Value -1 if the app is not installed on Incremental
5052    optional int32 storage_health_code = 12;
5053
5054    // Status code to represent the status of data loader, as defined in
5055    // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
5056    // Value -1 if the app is not installed on Incremental
5057    optional int32 data_loader_status_code = 13;
5058
5059    // Whether read logs collection is enabled
5060    optional bool read_logs_enabled = 14;
5061
5062    // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
5063    // -1 means the app is not installed on Incremental.
5064    optional int64 millis_since_last_data_loader_bind = 15;
5065
5066    // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
5067    optional int64 data_loader_bind_delay_millis = 16;
5068
5069    // Total count of delayed reads, as reported by Incremental File System.
5070    optional int32 total_delayed_reads = 17;
5071
5072    // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
5073    optional int32 total_failed_reads = 18;
5074
5075    // UID of the process that tried to read a page from the app but failed.
5076    // This shows whether the read was initiated by the system, the app itself, or some other apps.
5077    // -1 means there was no read error or the app is not installed on Incremental.
5078    optional int32 last_read_error_uid = 19;
5079
5080    // Duration since that last read failure.
5081    // -1 means there was no read error or the app is not installed on Incremental.
5082    optional int64 last_read_error_millis_since = 20;
5083
5084    // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
5085    // and other positive values for other errors. -1 means app is not installed on Incremental.
5086    optional int32 last_read_error_code = 21;
5087
5088    // Total duration of delayed reads in milliseconds
5089    optional int64 total_delayed_reads_duration_millis = 22;
5090}
5091
5092/**
5093 * Logs when a WTF (What a Terrible Failure) happened.
5094 * Logged from:
5095 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5096 */
5097message WTFOccurred {
5098    optional int32 uid = 1 [(is_uid) = true];
5099
5100    optional string tag = 2;
5101
5102    // The name of the process.
5103    // system_server if it is not by an app
5104    optional string process_name = 3;
5105
5106    // The pid if available. -1 means not available.
5107    optional int32 pid = 4;
5108
5109    optional android.server.ErrorSource error_source = 5;
5110}
5111
5112/**
5113 * Logs when system server reports low memory.
5114 * Logged from:
5115 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5116 */
5117message LowMemReported {
5118}
5119
5120/**
5121 * Logs when an app ANR (App Not Responding) occurs.
5122 * Logged from:
5123 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
5124 */
5125message ANROccurred {
5126    optional int32 uid = 1 [(is_uid) = true];
5127
5128    optional string process_name = 2;
5129
5130    optional string short_component_name = 3;
5131
5132    optional string reason = 4;
5133
5134    enum InstantApp {
5135        UNAVAILABLE = 0;
5136        FALSE = 1;
5137        TRUE = 2;
5138    }
5139    optional InstantApp is_instant_app = 5;
5140
5141    enum ForegroundState {
5142        UNKNOWN = 0;
5143        BACKGROUND = 1;
5144        FOREGROUND = 2;
5145    }
5146    optional ForegroundState foreground_state = 6;
5147
5148    optional android.server.ErrorSource error_source = 7;
5149
5150    optional string package_name = 8;
5151
5152    optional bool is_incremental = 9;
5153
5154    optional float loading_progress = 10;
5155
5156    optional int64 millis_since_oldest_pending_read = 11;
5157
5158    // Status code to represent the health of the file system backing storage, as defined in
5159    // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
5160    // Value -1 if the app is not installed on Incremental
5161    optional int32 storage_health_code = 12;
5162
5163    // Status code to represent the status of data loader, as defined in
5164    // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
5165    // Value -1 if the app is not installed on Incremental
5166    optional int32 data_loader_status_code = 13;
5167
5168    // Whether read logs collection is enabled
5169    optional bool read_logs_enabled = 14;
5170
5171    // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
5172    // -1 means the app is not installed on Incremental.
5173    optional int64 millis_since_last_data_loader_bind = 15;
5174
5175    // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
5176    optional int64 data_loader_bind_delay_millis = 16;
5177
5178    // Total count of delayed reads, as reported by Incremental File System.
5179    optional int32 total_delayed_reads = 17;
5180
5181    // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
5182    optional int32 total_failed_reads = 18;
5183
5184    // UID of the process that tried to read a page from the app but failed.
5185    // This shows whether the read was initiated by the system, the app itself, or some other apps.
5186    // -1 means there was no read error or the app is not installed on Incremental.
5187    optional int32 last_read_error_uid = 19;
5188
5189    // Duration since that last read failure.
5190    // -1 means there was no read error or the app is not installed on Incremental.
5191    optional int64 last_read_error_millis_since = 20;
5192
5193    // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
5194    // and other positive values for other errors. -1 means app is not installed on Incremental.
5195    optional int32 last_read_error_code = 21;
5196
5197    // Total duration of delayed reads in milliseconds
5198    optional int64 total_delayed_reads_duration_millis = 22;
5199}
5200
5201/**
5202 * Logs immediately after an app ANR (App Not Responding) occurs. In contrast, ANROccurred (the
5203 * atom above) logs some time (not necessarily immediately) after the ANR is detected.
5204 * Logged from:
5205 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
5206 */
5207message ANROccurredProcessingStarted {
5208  optional string process_name = 1;
5209}
5210
5211/**
5212 * Logs when the vibrator state changes.
5213 * Logged from:
5214 *      frameworks/base/services/core/java/com/android/vibrator/VibratorManagerService.java
5215 */
5216message VibratorStateChanged {
5217    repeated AttributionNode attribution_node = 1;
5218
5219    enum State {
5220        OFF = 0;
5221        ON = 1;
5222    }
5223    optional State state = 2;
5224
5225    // Duration (in milliseconds) requested to keep the vibrator on.
5226    // Only applicable for State == ON.
5227    optional int64 duration_millis = 3;
5228}
5229
5230/**
5231 * Logs vibration request.
5232 * Logged from:
5233 *      frameworks/base/services/core/java/com/android/server/vibrator/VibratorManagerService.java
5234 */
5235// Next tag: 27
5236message VibrationReported {
5237  repeated AttributionNode attribution_node = 1;
5238
5239  enum VibrationType {
5240    UNKNOWN = 0;
5241    SINGLE = 1;
5242    REPEATED = 2;
5243    EXTERNAL = 3;
5244  }
5245
5246  // Vibration identifiers for aggregation.
5247  optional VibrationType vibration_type = 2;
5248  // One of VibrationAttributes.USAGE_* constant values.
5249  optional int32 vibration_usage = 3;
5250  optional int32 vibration_status = 4;
5251
5252  // Vibration parameters.
5253  // Adaptive scale value applied to this vibration, 0 if unset.
5254  optional float adaptive_scale = 26;
5255
5256  // Vibration completion causes.
5257  // Flag indicating if the vibration was canceled by the same process
5258  // or superseded/canceled by another vibration from the same process.
5259  optional bool ended_by_same_uid = 5;
5260  // Usage value of the vibration that superseded/canceled this one.
5261  optional int32 ended_by_usage = 6;
5262  // Usage value of the vibration that was superseded/canceled by this one.
5263  optional int32 interrupted_usage = 7;
5264
5265  // Vibration execution counters.
5266  optional int32 repeat_count = 8;
5267  // Total duration of this vibration at the service, including setup and cleanup.
5268  optional int64 vibration_duration_millis = 9;
5269  // Total duration the vibrator motor was active with non-zero amplitude.
5270  optional int64 vibrator_on_duration_millis = 10;
5271  // Delta between the incoming binder call to vibrate and the first step in the
5272  // vibration conductor (closest measure of starting HAL interactions).
5273  optional int64 start_latency_millis = 11;
5274  // Delta between the HAL reporting the last vibrate operation has completed and
5275  // vibrator service has finished the vibration and become idle.
5276  optional int64 end_latency_millis = 12;
5277
5278  // Vibrator hardware HAL API interaction counters.
5279  // The majority of vibrations will populate only a couple of the fields below.
5280  optional int32 hal_compose_count = 13;
5281  optional int32 hal_compose_pwle_count = 14;
5282  optional int32 hal_on_count = 15;
5283  optional int32 hal_off_count = 16;
5284  optional int32 hal_perform_count = 17;
5285  optional int32 hal_set_amplitude_count = 18;
5286  optional int32 hal_set_external_control_count = 19;
5287
5288  // Vibrator hardware HAL API constants used (deduped).
5289  // Values from CompositionPrimitive.aidl successfully triggered by this vibration at least once.
5290  repeated int32 hal_supported_composition_primitives_used = 20;
5291  // Values from Effect.aidl triggered by this vibration at least once.
5292  repeated int32 hal_supported_effects_used = 21;
5293  // Values from CompositionPrimitive.aidl triggered but not supported by the device.
5294  repeated int32 hal_unsupported_composition_primitives_used = 22;
5295  // Values from Effect.aidl triggered but not supported by the device.
5296  repeated int32 hal_unsupported_effects_used = 23;
5297  // Vibrator hardware HAL argument sizes (total).
5298  optional int32 hal_composition_size = 24;
5299  optional int32 hal_pwle_size = 25;
5300}
5301
5302/*
5303 * Allows other apps to push events into statsd.
5304 * Logged from:
5305 *      frameworks/base/core/java/android/util/StatsLog.java
5306 */
5307message AppBreadcrumbReported {
5308    // The uid of the application that sent this custom atom.
5309    optional int32 uid = 1 [(is_uid) = true];
5310
5311    // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
5312    optional int32 label = 2;
5313
5314    // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
5315    // predicates for the metrics).
5316    enum State {
5317        UNKNOWN = 0;
5318        UNSPECIFIED = 1;  // For events that are known to not represent START/STOP.
5319        STOP = 2;
5320        START = 3;
5321    }
5322    optional State state = 3;
5323}
5324
5325/**
5326 * Logs the wall-clock time when a significant wall-clock time shift occurs.
5327 * For example, this could be due to the user manually changing the time.
5328 *
5329 * Logged from:
5330 *   frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
5331 */
5332message WallClockTimeShifted {
5333    // New wall-clock time in milliseconds, according to System.currentTimeMillis().
5334    optional int64 wall_clock_timestamp_millis = 1;
5335}
5336
5337/**
5338 * Logs when statsd detects an anomaly.
5339 *
5340 * Logged from:
5341 *   frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
5342 */
5343message AnomalyDetected {
5344    // Uid that owns the config whose anomaly detection alert fired.
5345    optional int32 config_uid = 1 [(is_uid) = true];
5346
5347    // Id of the config whose anomaly detection alert fired.
5348    optional int64 config_id = 2;
5349
5350    // Id of the alert (i.e. name of the anomaly that was detected).
5351    optional int64 alert_id = 3;
5352}
5353
5354message AppStartOccurred {
5355    // The uid if available. -1 means not available.
5356    optional int32 uid = 1 [(is_uid) = true];
5357
5358    // The app package name.
5359    optional string pkg_name = 2;
5360
5361    enum TransitionType {
5362        UNKNOWN = 0;
5363        WARM = 1;
5364        HOT = 2;
5365        COLD = 3;
5366        RELAUNCH = 4;
5367    }
5368    // The transition type.
5369    optional TransitionType type = 3;
5370
5371    // The activity name.
5372    optional string activity_name = 4;
5373
5374    // The name of the calling app. Empty if not set.
5375    optional string calling_pkg_name = 5;
5376
5377    // Whether the app is an instant app.
5378    optional bool is_instant_app = 6;
5379
5380    // Device uptime when activity started. Deprecated: use activity_start_timestamp_millis instead.
5381    optional int64 activity_start_millis = 7 [deprecated = true];
5382
5383    optional android.app.AppTransitionReasonEnum reason = 8;
5384
5385    optional int32 transition_delay_millis = 9;
5386    // -1 if not set.
5387    optional int32 starting_window_delay_millis = 10;
5388    // -1 if not set.
5389    optional int32 bind_application_delay_millis = 11;
5390    optional int32 windows_drawn_delay_millis = 12;
5391
5392    // Empty if not set.
5393    optional string launch_token = 13;
5394
5395    // The reason why the package was optimized.
5396    optional int32 package_optimization_compilation_reason = 14;
5397
5398    // The compiler filter used when when the package was optimized.
5399    optional int32 package_optimization_compilation_filter = 15;
5400
5401    enum SourceType {
5402        UNAVAILABLE = 0;
5403        LAUNCHER = 1;
5404        NOTIFICATION = 2;
5405        LOCKSCREEN = 3;
5406        RECENTS_ANIMATION = 4;
5407    }
5408    // The type of the startup source.
5409    optional SourceType source_type = 16;
5410
5411    // The time from the startup source to the beginning of handling the startup event.
5412    // -1 means not available.
5413    optional int32 source_event_delay_millis = 17;
5414
5415    // Whether the app is hibernating when it started
5416    optional bool is_hibernating = 18;
5417
5418    // Whether the app is installed on Incremental File System.
5419    optional bool is_incremental = 19;
5420
5421    // Whether the app is still being streamed.
5422    optional bool is_loading = 20;
5423
5424    // The hash value of the activity name.
5425    optional int32 activity_name_hash = 21;
5426
5427    // The timestamp(SystemClock#elapsedRealtime()) when starting activity.
5428    optional int64 activity_start_timestamp_millis = 22;
5429
5430    /**
5431     * The process state of apps, keep in sync with
5432     * frameworks/base/core/java/android/app/ActivityManager.java
5433     */
5434    enum AppProcessState {
5435        PROCESS_STATE_UNKNOWN = -1;
5436        PROCESS_STATE_PERSISTENT = 0;
5437        PROCESS_STATE_PERSISTENT_UI = 1;
5438        PROCESS_STATE_TOP = 2;
5439        PROCESS_STATE_BOUND_TOP = 3;
5440        PROCESS_STATE_FOREGROUND_SERVICE = 4;
5441        PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 5;
5442        PROCESS_STATE_IMPORTANT_FOREGROUND = 6;
5443        PROCESS_STATE_IMPORTANT_BACKGROUND = 7;
5444        PROCESS_STATE_TRANSIENT_BACKGROUND = 8;
5445        PROCESS_STATE_BACKUP = 9;
5446        PROCESS_STATE_SERVICE = 10;
5447        PROCESS_STATE_RECEIVER = 11;
5448        PROCESS_STATE_TOP_SLEEPING = 12;
5449        PROCESS_STATE_HEAVY_WEIGHT = 13;
5450        PROCESS_STATE_HOME = 14;
5451        PROCESS_STATE_LAST_ACTIVITY = 15;
5452        PROCESS_STATE_CACHED_ACTIVITY = 16;
5453        PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 17;
5454        PROCESS_STATE_CACHED_RECENT = 18;
5455        PROCESS_STATE_CACHED_EMPTY = 19;
5456        PROCESS_STATE_NONEXISTENT = 20;
5457    }
5458
5459    // The process state of the launching activity prior to the launch.
5460    optional AppProcessState process_state = 23;
5461
5462    // The oom adj score of the launching activity prior to the launch.
5463    optional int32 process_oom_adj = 24;
5464
5465    // The stopped state (if any) the package was in before the launch
5466    optional PackageStoppedState package_stopped_state = 25;
5467
5468    // Reserved for b/281564325.
5469    optional bool is_xr_activity = 26;
5470
5471    // Whether this is the first launch of the app since install
5472    optional bool first_launch = 27;
5473
5474    // How long since this package was stopped, if it was in
5475    // package_stopped_state == PACKAGE_STATE_STOPPED
5476    optional int64 millis_since_stopped = 28;
5477
5478    /**
5479     * The type of multi-window launch.
5480     * This should match the constants declared in ActivityMetricsLogger.
5481     */
5482    enum MultiWindowLaunchType {
5483        LAUNCH_TYPE_UNSPECIFIED = 0;
5484        LAUNCH_TYPE_APP_PAIR = 1;
5485    }
5486
5487    // The multi-indow launch type
5488    optional MultiWindowLaunchType multi_window_launch_type = 29;
5489}
5490
5491message AppStartCanceled {
5492    // The uid if available. -1 means not available.
5493    optional int32 uid = 1 [(is_uid) = true];
5494
5495    // The app package name.
5496    optional string pkg_name = 2;
5497
5498    enum TransitionType {
5499        UNKNOWN = 0;
5500        WARM = 1;
5501        HOT = 2;
5502        COLD = 3;
5503        RELAUNCH = 4;
5504    }
5505    // The transition type.
5506    optional TransitionType type = 3;
5507
5508    // The activity name.
5509    optional string activity_name = 4;
5510}
5511
5512message AppStartFullyDrawn {
5513    // The uid if available. -1 means not available.
5514    optional int32 uid = 1 [(is_uid) = true];
5515
5516    // The app package name.
5517    optional string pkg_name = 2;
5518
5519    enum TransitionType {
5520        UNKNOWN = 0;
5521        WITH_BUNDLE = 1;
5522        WITHOUT_BUNDLE = 2;
5523    }
5524    // The transition type.
5525    optional TransitionType type = 3;
5526
5527    // The activity name.
5528    optional string activity_name = 4;
5529
5530    optional bool transition_process_running = 5;
5531
5532    // App startup time (until call to Activity#reportFullyDrawn()).
5533    optional int64 app_startup_time_millis = 6;
5534
5535    // The reason why the package was optimized.
5536    optional int32 package_optimization_compilation_reason = 7;
5537
5538    // The compiler filter used when when the package was optimized.
5539    optional int32 package_optimization_compilation_filter = 8;
5540
5541    enum SourceType {
5542        UNAVAILABLE = 0;
5543        LAUNCHER = 1;
5544        NOTIFICATION = 2;
5545        LOCKSCREEN = 3;
5546    }
5547    // The type of the startup source.
5548    optional SourceType source_type = 9;
5549
5550    // The time from the startup source to the beginning of handling the startup event.
5551    // -1 means not available.
5552    optional int32 source_event_delay_millis = 10;
5553
5554    // Whether the app is installed on Incremental File System.
5555    optional bool is_incremental = 11;
5556
5557    // Whether the app is still being streamed.
5558    optional bool is_loading = 12;
5559
5560    // The hash value of the activity name.
5561    optional int32 activity_name_hash = 13;
5562
5563    // The timestamp(SystemClock#elapsedRealtime()) when starting activity.
5564    optional int64 activity_start_timestamp_millis = 14;
5565}
5566
5567/**
5568 * Logs when an app enters a different App Compat state.
5569 *
5570 * Logged from:
5571 *   frameworks/base/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
5572 */
5573message AppCompatStateChanged {
5574    // UID of the package whose state changed.
5575    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
5576
5577    enum State {
5578        UNKNOWN = 0;
5579        // The app is not visible or has been closed.
5580        NOT_VISIBLE = 1;
5581        // The app’s bounds aren’t letterboxed.
5582        NOT_LETTERBOXED = 2;
5583        // The app’s bounds are letterboxed because of size-compat-mode.
5584        LETTERBOXED_FOR_SIZE_COMPAT_MODE = 3;
5585        // The app’s bounds are letterboxed because of fixed orientation.
5586        LETTERBOXED_FOR_FIXED_ORIENTATION = 4;
5587        // The app’s bounds are letterboxed because of aspect ratio restrictions.
5588        LETTERBOXED_FOR_ASPECT_RATIO = 5;
5589    }
5590
5591    // Position of the letterbox
5592    enum Position {
5593        UNKNOWN_POSITION = 0;
5594        NOT_LETTERBOXED_POSITION = 1;
5595        CENTER = 2;
5596        LEFT = 3;
5597        RIGHT = 4;
5598        TOP = 5;
5599        BOTTOM = 6;
5600    }
5601
5602    // The state that was entered.
5603    optional State state = 2 [
5604      (state_field_option).exclusive_state = true,
5605      (state_field_option).nested = false];
5606
5607    optional Position letterbox_position = 3;
5608}
5609
5610/**
5611 * Logs when an app that is letterboxed changes position.
5612 *
5613 * Logged from:
5614 *   frameworks/base/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
5615 */
5616
5617message LetterboxPositionChanged {
5618    // UID of the package that is letterboxed.
5619    optional int32 uid = 1 [(is_uid) = true];
5620
5621    // The new position of the letterbox
5622    enum PositionChange {
5623        UNKNOWN = 0;
5624        CENTER_TO_LEFT = 1;
5625        LEFT_TO_CENTER = 2;
5626        CENTER_TO_RIGHT= 3;
5627        RIGHT_TO_CENTER = 4;
5628        CENTER_TO_TOP = 5;
5629        TOP_TO_CENTER = 6;
5630        CENTER_TO_BOTTOM = 7;
5631        BOTTOM_TO_CENTER = 8;
5632    }
5633
5634    optional PositionChange position_change = 2;
5635
5636}
5637
5638/**
5639 * Logs events reported for the Size Compat restart button of an app.
5640 *
5641 * Logged from:
5642 *   frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java
5643 */
5644message SizeCompatRestartButtonEventReported {
5645    // UID of the package that has the button.
5646    optional int32 uid = 1 [(is_uid) = true];
5647
5648    enum Event {
5649        UNKNOWN = 0;
5650        APPEARED = 1;
5651        CLICKED = 2;
5652    }
5653
5654    // The event that was reported.
5655    optional Event event = 2;
5656}
5657
5658/**
5659 * Logs events reported for the Camera App Compat control, which is used to
5660 * correct stretched viewfinder in apps that don't handle all possible
5661 * configurations, and changes between them, correctly.
5662 *
5663 * Logged from:
5664 *   frameworks/base/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
5665 */
5666message CameraCompatControlEventReported {
5667  // UID of the package that has the control.
5668  optional int32 uid = 1 [(is_uid) = true];
5669
5670  enum Event {
5671    UNKNOWN = 0;
5672    // Button to apply the treatment appeared.
5673    APPEARED_APPLY_TREATMENT = 1;
5674    // Button to revert the treatment appeared.
5675    APPEARED_REVERT_TREATMENT = 2;
5676    // Users clicked on the button to apply the treatment.
5677    CLICKED_APPLY_TREATMENT = 3;
5678    // Users clicked on the button to revert the treatment.
5679    CLICKED_REVERT_TREATMENT = 4;
5680    // Users clicked on the button to dismiss the control.
5681    CLICKED_DISMISS = 5;
5682  }
5683
5684  // The event that was reported.
5685  optional Event event = 2;
5686}
5687
5688/**
5689 * Logs a picture-in-picture action
5690 * Logged from:
5691 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5692 *      frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
5693 *      frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
5694 */
5695message PictureInPictureStateChanged {
5696    // -1 if it is not available
5697    optional int32 uid = 1 [(is_uid) = true];
5698
5699    optional string short_name = 2;
5700
5701    enum State {
5702        ENTERED = 1;
5703        EXPANDED_TO_FULL_SCREEN = 2;
5704        MINIMIZED = 3;
5705        DISMISSED = 4;
5706    }
5707    optional State state = 3;
5708}
5709
5710/**
5711 * Logs overlay action
5712 * Logged from:
5713 *     services/core/java/com/android/server/wm/Session.java
5714 */
5715message OverlayStateChanged {
5716    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
5717
5718    optional string package_name = 2 [(state_field_option).primary_field = true];
5719
5720    optional bool using_alert_window = 3;
5721
5722    enum State {
5723        ENTERED = 1;
5724        EXITED = 2;
5725    }
5726    optional State state = 4
5727            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
5728}
5729
5730/**
5731 * Logs foreground service starts and stops.
5732 * Note that this is not when a service starts or stops, but when it is
5733 * considered foreground.
5734 * Logged from
5735 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
5736 */
5737message ForegroundServiceStateChanged {
5738    optional int32 uid = 1 [(is_uid) = true];
5739    // package_name + "/" + class_name
5740    optional string short_name = 2;
5741
5742    enum State {
5743        UNKNOWN_STATE = 0;
5744        ENTER = 1;
5745        EXIT = 2;
5746        DENIED = 3;
5747        API_CALL = 4; // this event is to annotate API call.
5748        TIMED_OUT = 5; // time-restricted fgs type timed out.
5749    }
5750    optional State state = 3;
5751
5752    // Whether the fgs is allowed while-in-use permissions, i.e. is considered 'in-use' to the user.
5753    // (If the fgs was started while the app wasn't TOP it usually will be denied these permissions)
5754    optional bool allow_while_in_use_permission = 4;
5755    // the reason why FGS is allowed or denied to start. The reason code is defined as
5756    // PowerExemptionManager#ReasonCode.
5757    optional int32 fgs_start_reason_code = 5;
5758    // FGS service's targetSdkVersion.
5759    optional int32 target_sdk_version = 6;
5760    // uid of the app that start/bind this service.
5761    optional int32 calling_uid = 7;
5762    // targetSdkVersion of the app that start/bind this service.
5763    optional int32 caller_target_sdk_version = 8;
5764    // uid of the app that set the temp-allowlist, INVALID_UID (-1) if not in any
5765    // temp-allowlist.
5766    optional int32 temp_allow_list_calling_uid = 9;
5767    // FGS notification was deferred.
5768    optional bool fgs_notification_deferred = 10;
5769    // FGS notification was shown before the FGS finishes, or it wasn't deferred in the first place.
5770    optional bool fgs_notification_shown = 11;
5771    // The duration from state ENTER to state EXIT. Only meaningful when the state is EXIT.
5772    optional int32 fgs_duration_ms = 12;
5773    // Number of times startForeground() is called on this service.
5774    optional int32 fgs_start_count = 13;
5775    // SHA-1 hashed short_name combined with ANDROID_ID.
5776    optional int32 short_name_hash = 14;
5777    // Whether this FGS package had permission to notify the user.
5778    optional bool fgs_has_notification_permission = 15;
5779
5780    // Keep in sync with frameworks/base/core/java/android/content/pm/ServiceInfo.java
5781    enum ForegroundServiceType {
5782        FOREGROUND_SERVICE_TYPE_NONE = 0;
5783        FOREGROUND_SERVICE_TYPE_DATA_SYNC = 0x0001; // 1 << 0
5784        FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK = 0x0002; // 1 << 1
5785        FOREGROUND_SERVICE_TYPE_PHONE_CALL = 0x0004; //1 << 2
5786        FOREGROUND_SERVICE_TYPE_LOCATION = 0x0008; // 1 << 3
5787        FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE = 0x0010; // 1 << 4
5788        FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = 0x0020; // 1 << 5
5789        FOREGROUND_SERVICE_TYPE_CAMERA = 0x0040; // 1 << 6
5790        FOREGROUND_SERVICE_TYPE_MICROPHONE = 0x0080; // 1 << 7
5791        FOREGROUND_SERVICE_TYPE_HEALTH = 0x0100; // 1 << 8
5792        FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING = 0x0200; // 1 << 9
5793        FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED = 0x0400; // 1 << 10
5794        FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 0x0800; // 1 << 11
5795        // 1 << 12 is being skipping since it was temporarily reserved for FILE_MANAGEMENT
5796        FOREGROUND_SERVICE_TYPE_MEDIA_PROCESSING = 0x2000; // 1 << 13
5797        FOREGROUND_SERVICE_TYPE_SPECIAL_USE = 0x40000000; // 1 << 30
5798    }
5799
5800    // The foreground service types, must be one or a combination of the types
5801    // in the ForegroundServiceType above.
5802    optional int32 fgs_types = 16;
5803    // The result check code for the fgs type enforcement.
5804    optional android.app.FgsTypePolicyCheckEnum fgs_type_check_code = 17;
5805    // If true, this FGS service is a delegate (instead of real FGS).
5806    optional bool is_delegate = 18;
5807    // The actual client app's uid.
5808    optional int32 delegate_client_uid = 19 [(is_uid) = true];
5809    // The service module that start/stop the delegate, could be
5810    // MediaSessionService, VOIP, Camera, Audio, Location etc.
5811    // The enum is defined in interface
5812    // ForegroundServiceDelegationOptions.DelegationService
5813    optional int32 delegation_service = 20;
5814
5815    enum ApiJourneyState {
5816    	  UNKNOWN_JOURNEY_STATE = 0;
5817        ENTER_WITH_FGS = 1;
5818        EXIT_WITH_FGS = 2;
5819        EXIT_WITHOUT_FGS = 3;
5820        PAUSE = 4;
5821        RESUME = 5;
5822    }
5823
5824    optional ApiJourneyState api_state = 21;
5825
5826    enum ApiType {
5827    	  UNKNOWN_API_TYPE = 0;
5828        CAMERA = 1;
5829        BLUETOOTH = 2;
5830        LOCATION = 3;
5831        MEDIA_PLAYBACK = 4;
5832        AUDIO = 5;
5833        MICROPHONE = 6;
5834        PHONE_CALL = 7;
5835        USB = 8;
5836        CDM = 9;
5837    }
5838
5839    repeated ApiType api_type = 22;
5840
5841    repeated int64 api_timestamp = 23;
5842
5843    optional int64 api_before_fgs_start_duration_millis = 28;
5844
5845    optional int64 api_after_fgs_end_duration_millis = 29;
5846
5847    // Keep it in sync with ActivityManager.ProcessCapability.
5848    enum ProcessCapability {
5849        PROCESS_CAPABILITY_NONE = 0;
5850        PROCESS_CAPABILITY_FOREGROUND_LOCATION = 1;
5851        PROCESS_CAPABILITY_FOREGROUND_CAMERA = 2;
5852        PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 4;
5853        PROCESS_CAPABILITY_POWER_RESTRICTED_NETWORK = 8;
5854        PROCESS_CAPABILITY_BFSL = 16;
5855        PROCESS_CAPABILITY_USER_RESTRICTED_NETWORK = 32;
5856    }
5857
5858    optional android.app.ProcessStateEnum service_uid_state = 24 [default = PROCESS_STATE_UNKNOWN];
5859    optional ProcessCapability service_uid_capabilities = 25;
5860
5861    optional android.app.ProcessStateEnum calling_uid_state = 26 [default = PROCESS_STATE_UNKNOWN];
5862    optional ProcessCapability calling_uid_capabilities = 27;
5863
5864    optional int32 while_in_use_reason_code_no_binding = 30;
5865    optional int32 while_in_use_reason_code_in_bind_service = 31;
5866    optional int32 while_in_use_reason_code_by_bindings = 32;
5867    optional int32 fgs_start_reason_code_no_binding = 33;
5868    optional int32 fgs_start_reason_code_in_bind_service = 34;
5869    optional int32 fgs_start_reason_code_by_bindings = 35;
5870
5871    enum FgsStartApi {
5872        // Not available -- used in atoms that are unrelated to this selection.
5873        FGSSTARTAPI_NA = 0;
5874        // The FGS was not started. (likely it's bound.)
5875        FGSSTARTAPI_NONE = 1;
5876        // The FGS was started with Context.startService().
5877        FGSSTARTAPI_START_SERVICE = 2;
5878        // The FGS was started with Context.startForegroundService().
5879        FGSSTARTAPI_START_FOREGROUND_SERVICE = 3;
5880        // It's a delegate FGS.
5881        FGSSTARTAPI_DELEGATE = 4;
5882
5883    }
5884    optional FgsStartApi fgs_start_api = 36;
5885
5886    // Whether setFgsRestrictionLocked() was called in Service.startForeground().
5887    optional bool fgs_restriction_recalculated = 37;
5888}
5889
5890/**
5891 * Logs the number of times a uid accesses a sensitive AppOp during a foreground service session.
5892 * A foreground service session is any continuous period during which the uid holds at least one
5893 * foreground service; the atom will be pushed when the uid no longer holds any foreground services.
5894 * Accesses initiated while the uid is in the TOP state are ignored.
5895 * Sessions with no attempted accesses are not logged.
5896 * Logged from
5897 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
5898 */
5899message ForegroundServiceAppOpSessionEnded {
5900    optional int32 uid = 1 [(is_uid) = true];
5901
5902    // The operation's name.
5903    // Only following four ops are logged
5904    // COARSE_LOCATION = 0
5905    // FINE_LOCATION = 1
5906    // CAMERA = 26
5907    // RECORD_AUDIO = 27
5908    optional android.app.AppOpEnum app_op_name = 2 [default = APP_OP_NONE];
5909
5910    // The uid's permission mode for accessing the AppOp during this fgs session.
5911    enum Mode {
5912        MODE_UNKNOWN = 0;
5913        MODE_ALLOWED = 1; // Always allowed
5914        MODE_IGNORED = 2; // Denied
5915        MODE_FOREGROUND = 3; // Allow-while-in-use (or allowed-one-time)
5916    }
5917    optional Mode app_op_mode = 3;
5918
5919    // Number of times this AppOp was requested and allowed.
5920    optional int32 count_ops_accepted = 4;
5921    // Number of times this AppOp was requested but denied.
5922    optional int32 count_ops_rejected = 5;
5923}
5924
5925/**
5926 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
5927 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
5928 * attributed back to the parent (host) uid. One example is Chrome.
5929 *
5930 * Logged from:
5931 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5932 */
5933message IsolatedUidChanged {
5934    // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
5935    // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
5936    // This field is ignored when event == REMOVED.
5937    optional int32 parent_uid = 1;
5938
5939    optional int32 isolated_uid = 2;
5940
5941    // We expect an isolated uid to be removed before if it's used for another parent uid.
5942    enum Event {
5943        REMOVED = 0;
5944        CREATED = 1;
5945    }
5946    optional Event event = 3;
5947}
5948
5949/*
5950 * Logs the reception of an incoming network packet causing the main system to wake up for
5951 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
5952 * and processed by WakeupController.cpp.
5953 */
5954message PacketWakeupOccurred {
5955    // The uid owning the socket into which the packet was delivered, or -1 if the packet was
5956    // delivered nowhere.
5957    optional int32 uid = 1 [(is_uid) = true];
5958    // The interface name on which the packet was received.
5959    optional string iface = 2;
5960    // The ethertype value of the packet.
5961    optional int32 ethertype = 3;
5962    // String representation of the destination MAC address of the packet.
5963    optional string destination_hardware_address = 4;
5964    // String representation of the source address of the packet if this was an IP packet.
5965    optional string source_ip = 5;
5966    // String representation of the destination address of the packet if this was an IP packet.
5967    optional string destination_ip = 6;
5968    // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
5969    // field if this was an IPv6 packet. The range of possible values is the same for both IP
5970    // families.
5971    optional int32 ip_next_header = 7;
5972    // The source port if this was a TCP or UDP packet.
5973    optional int32 source_port = 8;
5974    // The destination port if this was a TCP or UDP packet.
5975    optional int32 destination_port = 9;
5976}
5977
5978/*
5979 * Logs the memory stats for an app on startup.
5980 * Logged from:
5981 *     frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5982 */
5983message AppStartMemoryStateCaptured {
5984    // The uid if available. -1 means not available.
5985    optional int32 uid = 1 [(is_uid) = true];
5986
5987    // The process name.
5988    optional string process_name = 2;
5989
5990    // The activity name.
5991    optional string activity_name = 3;
5992
5993    // # of page-faults
5994    optional int64 page_fault = 4;
5995
5996    // # of major page-faults
5997    optional int64 page_major_fault = 5;
5998
5999    // RSS
6000    optional int64 rss_in_bytes = 6;
6001
6002    // CACHE
6003    optional int64 cache_in_bytes = 7;
6004
6005    // SWAP
6006    optional int64 swap_in_bytes = 8;
6007}
6008
6009/*
6010 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
6011 * Logged from:
6012 *      system/core/lmkd/lmkd.c
6013 */
6014message LmkKillOccurred {
6015    enum Reason {
6016        UNKNOWN = 0;
6017        PRESSURE_AFTER_KILL = 1;
6018        NOT_RESPONDING = 2;
6019        LOW_SWAP_AND_THRASHING = 3;
6020        LOW_MEM_AND_SWAP = 4;
6021        LOW_MEM_AND_THRASHING = 5;
6022        DIRECT_RECL_AND_THRASHING = 6;
6023        LOW_MEM_AND_SWAP_UTIL = 7;
6024        LOW_FILECACHE_AFTER_THRASHING = 8;
6025        LOW_MEM = 9;
6026        DIRECT_RECL_STUCK = 10;
6027    }
6028
6029    // The uid if available. -1 means not available.
6030    optional int32 uid = 1 [(is_uid) = true];
6031
6032    // The process name.
6033    optional string process_name = 2;
6034
6035    // oom adj score.
6036    optional int32 oom_adj_score = 3;
6037
6038    // # of page-faults
6039    optional int64 page_fault = 4;
6040
6041    // # of major page-faults
6042    optional int64 page_major_fault = 5;
6043
6044    // RSS
6045    optional int64 rss_in_bytes = 6;
6046
6047    // CACHE
6048    optional int64 cache_in_bytes = 7;
6049
6050    // SWAP
6051    optional int64 swap_in_bytes = 8;
6052
6053    // The elapsed real time of start of the process.
6054    optional int64 process_start_time_nanos = 9;
6055
6056    // Min oom adj score considered by lmkd.
6057    optional int32 min_oom_score = 10;
6058
6059    // Free physical memory on device at LMK time.
6060    optional int32 free_mem_kb = 11;
6061
6062    // Free swap on device at LMK time.
6063    optional int32 free_swap_kb = 12;
6064
6065    // What triggered the LMK event.
6066    optional Reason reason = 13;
6067
6068    // Current thrashing levels (workingset_refaults/filecache in %).
6069    optional int32 thrashing = 14;
6070
6071    // Max thrashing levels (workingset_refaults/filecache in %).
6072    optional int32 max_thrashing = 15;
6073
6074    // How many active foreground services across the system
6075    optional int32 total_foreground_services = 16;
6076
6077    // How many processes hosting foreground services
6078    optional int32 procs_with_foreground_services = 17;
6079}
6080
6081/*
6082 * Logs when the ActivityManagerService detects that an app died.
6083 *
6084 * Logged from:
6085 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6086 */
6087message AppDied {
6088    // timestamp(elapsedRealtime) of record creation
6089    optional uint64 timestamp_millis = 1;
6090}
6091
6092/**
6093 * An atom for generic metrics logging. Available from Android Q.
6094 */
6095message GenericAtom {
6096    // The uid of the application that sent this custom atom.
6097    optional int32 uid = 1 [(is_uid) = true];
6098
6099    // An event_id indicates the type of event.
6100    optional android.stats.EventType event_id = 2;
6101}
6102
6103/**
6104 * Atom for simple logging of user interaction and impression events, such as "the user touched
6105 * this button" or "this dialog was displayed".
6106 * Keep the UI event stream clean: don't use for system or background events.
6107 * Log using the UiEventLogger wrapper - don't write with the StatsLog API directly.
6108 *
6109 * Logged from:
6110 *   frameworks/base/services/core/java/com/android/server/
6111 *   frameworks/base/packages/SystemUI/src/com/android/systemui/
6112 */
6113message UiEventReported {
6114    // The event_id.
6115    optional int32 event_id = 1;
6116    // The event's source or target uid and package, if applicable.
6117    // For example, the package posting a notification, or the destination package of a share.
6118    optional int32 uid = 2 [(is_uid) = true];
6119    optional string package_name = 3;
6120    // An identifier used to disambiguate which logs refer to a particular instance of some
6121    // UI element. Useful when there might be multiple instances simultaneously active.
6122    optional int32 instance_id = 4;
6123}
6124
6125/**
6126 * Atom for logging Dream user interaction and impression events.
6127 *
6128 * Logged from:
6129 *   frameworks/base/services/core/java/com/android/server/
6130 */
6131message DreamUiEventReported {
6132    // The event's source or target uid, if applicable.
6133    optional int32 uid = 1 [(is_uid) = true];
6134    // The event_id (as for UiEventReported).
6135    optional int32 event_id = 2;
6136    // An identifier used to disambiguate which logs refer to a particular instance of some
6137    // UI element. Useful when there might be multiple instances simultaneously active.
6138    optional int32 instance_id = 3;
6139
6140    // The name of the dream component, which identifies the type of the dream.
6141    optional string dream_component_name = 4;
6142}
6143
6144/**
6145 * Reports a notification was created or updated.
6146 *
6147 * Logged from:
6148 *   frameworks/base/services/core/java/com/android/server/notification/
6149 */
6150message NotificationReported {
6151    // The event_id (as for UiEventReported).
6152    optional int32 event_id = 1;
6153    // The notifying app's uid and package.
6154    optional int32 uid = 2 [(is_uid) = true];
6155    optional string package_name = 3;
6156    // A small system-assigned identifier for the notification.
6157    // Locally probably-unique, but expect collisions across users and/or days.
6158    optional int32 instance_id = 4;
6159    optional int32 notification_id_hash = 5;  // Small hash of the app-assigned notif ID + tag
6160    optional int32 channel_id_hash = 6;  // Small hash of app-assigned channel ID
6161
6162    // Grouping information
6163    optional int32 group_id_hash = 7;  // Small hash of the group ID of the notification
6164    optional int32 group_instance_id = 8;  // Instance_id of the group-summary notification
6165    optional bool is_group_summary = 9;  // Tags the group-summary notification
6166
6167    // Attributes
6168    optional string category = 10;   // App-assigned notification category (API-defined strings)
6169    optional int32 style = 11;       // App-assigned notification style
6170    optional int32 num_people = 12;  // Number of Person records attached to the notification
6171
6172    // Ordering, importance and interruptiveness
6173
6174    optional int32 position = 13;    // Position in NotificationManager's list
6175
6176    optional android.stats.sysui.NotificationImportance importance = 14;
6177    optional int32 alerting = 15;    // Bitfield, 1=buzz 2=beep 4=blink
6178
6179    enum NotificationImportanceExplanation {
6180        IMPORTANCE_EXPLANATION_UNKNOWN = 0;
6181        IMPORTANCE_EXPLANATION_APP = 1;     // App-specified channel importance.
6182        IMPORTANCE_EXPLANATION_USER = 2;    // User-specified channel importance.
6183        IMPORTANCE_EXPLANATION_ASST = 3;    // Notification Assistant override.
6184        IMPORTANCE_EXPLANATION_SYSTEM = 4;  // System override.
6185        // Like _APP, but based on pre-channels priority signal.
6186        IMPORTANCE_EXPLANATION_APP_PRE_CHANNELS = 5;
6187    }
6188
6189    optional NotificationImportanceExplanation importance_source = 16;
6190    optional android.stats.sysui.NotificationImportance importance_initial = 17;
6191    optional NotificationImportanceExplanation importance_initial_source = 18;
6192    optional android.stats.sysui.NotificationImportance importance_asst = 19;
6193    optional int32 assistant_hash = 20;
6194    optional float assistant_ranking_score = 21;
6195
6196    // Fields for tracking ongoing and foreground service notifications
6197    optional bool is_ongoing = 22;
6198    optional bool is_foreground_service = 23;
6199    // Fields to know about the timeout for notifications.
6200    optional int64 timeout_millis = 24;
6201
6202    // Field for tracking whether the notification is non-dismissible
6203    optional bool is_non_dismissible = 25;
6204
6205    // Time elapsed between the notify() API call and the NLSes being told about the notification.
6206    // Will be 0 for NotificationReported protos that do not correspond to a notify() call.
6207    optional int64 post_duration_millis = 26;
6208
6209    // State of the full screen intent posted with this notification.
6210    enum FsiState {
6211        // This notification was not posted with a full screen intent.
6212        NO_FSI = 0;
6213        // This notification was posted with a full screen intent and the FSI permission is granted.
6214        FSI_ALLOWED = 1;
6215        // This notification was posted with a full screen intent but the FSI permission is denied.
6216        FSI_DENIED = 2;
6217    }
6218    optional FsiState fsi_state = 27;
6219
6220    // True if the device was locked or showing unlocked AOD.
6221    optional bool is_locked = 28;
6222
6223    // Age of the notification in minutes.
6224    optional int32 age_in_minutes = 29;
6225}
6226
6227/**
6228 * Reports a notification channel, or channel group, was created, updated, or deleted.
6229 *
6230 * Logged from:
6231 *   frameworks/base/services/core/java/com/android/server/notification/
6232 */
6233message NotificationChannelModified {
6234    // The event_id (as for UiEventReported).
6235    optional int32 event_id = 1;
6236    // The notifying app's uid and package.
6237    optional int32 uid = 2 [(is_uid) = true];
6238    optional string package_name = 3;
6239    // Hash of app-assigned notification channel ID or channel-group ID
6240    optional int32 channel_id_hash = 4;
6241    // Previous importance setting, if applicable
6242    optional android.stats.sysui.NotificationImportance old_importance = 5;
6243    // New importance setting
6244    optional android.stats.sysui.NotificationImportance importance = 6;
6245    // whether or not this channel represents a conversation
6246    optional bool is_conversation = 7;
6247    // Hash of app-assigned notification conversation id
6248    optional int32 conversation_id_hash = 8;
6249    // whether or not the user demoted this channel out of the conversation space
6250    optional bool is_conversation_demoted = 9;
6251    // whether this conversation is marked as being a priority
6252    optional bool is_conversation_priority = 10;
6253}
6254
6255/**
6256 * Logged when notification are dismissed. If multiple notifications are dismissed together,
6257 * this is only logged once per style per UID.
6258 * Logged from
6259 *    frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging
6260 */
6261message NotificationDismissed {
6262    // UID if the application (can be mapped to package and version)
6263    optional int32 uid = 1 [(is_uid) = true];
6264    // Integer enum value showing aggregated notification style.
6265    optional android.stats.sysui.NotificationStyle style = 2;
6266    // Reason for dismissal, based on REASON_ constants in
6267    // frameworks/base/core/java/android/service/notification/NotificationListenerService.java
6268    optional int32 reason = 3;
6269    // Number of notifications dismissed.
6270    optional int32 count = 4;
6271    // Memory use of Notification object being dismissed, in KB.
6272    optional int32 notificationObjectMemoryUse = 5;
6273    // Memory use of Notification views being dismissed, in KB.
6274    optional int32 notificationViewMemoryUse = 6;
6275    // Current memory use of SystemUI, RSS Anon in KB.
6276    optional int32 systemUiMemoryUse = 7;
6277}
6278
6279/**
6280 * Logs when a biometric acquire event occurs.
6281 *
6282 * Logged from:
6283 *   frameworks/base/services/core/java/com/android/server/biometrics
6284 */
6285message BiometricAcquired {
6286    // Biometric modality that was acquired.
6287    optional android.hardware.biometrics.ModalityEnum modality = 1;
6288    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java.
6289    optional int32 user = 2;
6290    // If this acquire is for a crypto operation. e.g. Secure purchases, unlock password storage.
6291    optional bool is_crypto = 3;
6292    // Action that the device is performing. Acquired messages are only expected for enroll and
6293    // authenticate. Other actions may indicate an error.
6294    optional android.hardware.biometrics.ActionEnum action = 4;
6295    // The client that this acquisition was received for.
6296    optional android.hardware.biometrics.ClientEnum client = 5;
6297    // Acquired constants, e.g. ACQUIRED_GOOD. See constants defined by <Biometric>Manager.
6298    optional int32 acquire_info = 6;
6299    // Vendor-specific acquire info. Valid only if acquire_info == ACQUIRED_VENDOR.
6300    optional int32 acquire_info_vendor = 7;
6301    // Dictates if this message should trigger additional debugging.
6302    optional bool debug = 8;
6303    // The ID of the biometric sensor associated with this action.
6304    optional int32 sensor_id = 9;
6305    // The ID of the session this event occurred in (if any)
6306    optional int32 session_id = 10;
6307    // The type of session (i.e. CUJ)
6308    optional android.hardware.biometrics.SessionTypeEnum session_type = 11;
6309    // If the AoD was on when this event occurred.
6310    optional bool is_aod = 12;
6311    // If the display is on when this event occurred.
6312    optional bool is_display_on = 13;
6313    // The dock state when this event occurred.
6314    optional android.server.DockStateEnum dock_state = 14;
6315    // The orientation of the device when this event occurred
6316    optional android.hardware.biometrics.OrientationEnum orientation = 15;
6317    // The fold state of the device when this event occurred
6318    optional android.hardware.biometrics.FoldStateEnum fold_state = 16;
6319    // The order this event was processed by the framework, if part of a session
6320    optional int32 session_order = 17;
6321    // An associated device wake up reason for this event, or UNKNOWN if the event was not triggered due to a wake up event.
6322    optional android.hardware.biometrics.WakeReasonEnum wake_reason = 18;
6323}
6324
6325/**
6326 * Logs when a biometric authentication event occurs.
6327 *
6328 * Logged from:
6329 *   frameworks/base/services/core/java/com/android/server/biometrics
6330 */
6331message BiometricAuthenticated {
6332    // Biometric modality that was used.
6333    optional android.hardware.biometrics.ModalityEnum modality = 1;
6334    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
6335    optional int32 user = 2;
6336    // If this authentication is for a crypto operation. e.g. Secure purchases, unlock password
6337    // storage.
6338    optional bool is_crypto = 3;
6339    // The client that this acquisition was received for.
6340    optional android.hardware.biometrics.ClientEnum client = 4;
6341    // If authentication requires user confirmation. See BiometricPrompt's
6342    // setRequireConfirmation(bool) method.
6343    optional bool require_confirmation = 5;
6344
6345    enum State {
6346        UNKNOWN = 0;
6347        REJECTED = 1;
6348        PENDING_CONFIRMATION = 2;
6349        CONFIRMED = 3;
6350    }
6351
6352    // State of the current auth attempt.
6353    optional State state = 6;
6354    // Time it took to authenticate. For BiometricPrompt where setRequireConfirmation(false) is
6355    // specified and supported by the biometric modality, this is from the first ACQUIRED_GOOD to
6356    // AUTHENTICATED. for setRequireConfirmation(true), this is from PENDING_CONFIRMATION to
6357    // CONFIRMED.
6358    optional int64 latency_millis = 7;
6359    // Dictates if this message should trigger additional debugging.
6360    optional bool debug = 8;
6361    // The ID of the biometric sensor associated with this action.
6362    optional int32 sensor_id = 9;
6363    // The ambient light lux when authenticated.
6364    optional float ambient_light_lux = 10;
6365    // The ID of the session this event occurred in (if any)
6366    optional int32 session_id = 11;
6367    // The type of session (i.e. CUJ)
6368    optional android.hardware.biometrics.SessionTypeEnum session_type = 12;
6369    // If the AoD was on when this event occurred.
6370    optional bool is_aod = 13;
6371    // If the display is on when this event occurred.
6372    optional bool is_display_on = 14;
6373    // The dock state when this event occurred.
6374    optional android.server.DockStateEnum dock_state = 15;
6375    // The orientation of the device when this event occurred
6376    optional android.hardware.biometrics.OrientationEnum orientation = 16;
6377    // The fold state of the device when this event occurred
6378    optional android.hardware.biometrics.FoldStateEnum fold_state = 17;
6379    // The order this event was processed by the framework, if part of a session
6380    optional int32 session_order = 18;
6381    // An associated device wake up reason for this event, or UNKNOWN if the event was not triggered due to a wake up event.
6382    optional android.hardware.biometrics.WakeReasonEnum wake_reason = 19;
6383    // Additional modality-specific details that caused a biometric to be activated (often associated with a device wake_reason).
6384    repeated android.hardware.biometrics.WakeReasonDetailsEnum wake_reason_details = 20;
6385}
6386
6387/**
6388 * Logs when a biometric error occurs.
6389 *
6390 * Logged from:
6391 *   frameworks/base/services/core/java/com/android/server/biometrics
6392 */
6393message BiometricErrorOccurred {
6394    // Biometric modality that was used.
6395    optional android.hardware.biometrics.ModalityEnum modality = 1;
6396    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
6397    optional int32 user = 2;
6398    // If this error is for a crypto operation. e.g. Secure purchases, unlock password storage.
6399    optional bool is_crypto = 3;
6400    // Action that the device is performing.
6401    optional android.hardware.biometrics.ActionEnum action = 4;
6402    // The client that this acquisition was received for.
6403    optional android.hardware.biometrics.ClientEnum client = 5;
6404    // Error constants. See constants defined by <Biometric>Manager. Enums won't work since errors
6405    // are unique to modality.
6406    optional int32 error_info = 6;
6407    // Vendor-specific error info. Valid only if acquire_info == ACQUIRED_VENDOR. These are defined
6408    // by the vendor and not specified by the HIDL interface.
6409    optional int32 error_info_vendor = 7;
6410    // Dictates if this message should trigger additional debugging.
6411    optional bool debug = 8;
6412    // Time spent during the authentication attempt.
6413    optional int64 latency_millis = 9;
6414    // The ID of the biometric sensor associated with this action.
6415    optional int32 sensor_id = 10;
6416    // The ID of the session this event occurred in (if any)
6417    optional int32 session_id = 11;
6418    // The type of session (i.e. CUJ)
6419    optional android.hardware.biometrics.SessionTypeEnum session_type = 12;
6420    // If the AoD was on when this event occurred.
6421    optional bool is_aod = 13;
6422    // If the display is on when this event occurred.
6423    optional bool is_display_on = 14;
6424    // The dock state when this event occurred.
6425    optional android.server.DockStateEnum dock_state = 15;
6426    // The orientation of the device when this event occurred
6427    optional android.hardware.biometrics.OrientationEnum orientation = 16;
6428    // The fold state of the device when this event occurred
6429    optional android.hardware.biometrics.FoldStateEnum fold_state = 17;
6430    // The order this event was processed by the framework, if part of a session
6431    optional int32 session_order = 18;
6432    // An associated device wake up reason for this event, or UNKNOWN if the event was not triggered due to a wake up event.
6433    optional android.hardware.biometrics.WakeReasonEnum wake_reason = 19;
6434    // Additional modality-specific details that caused a biometric to be activated (often associated with a device wake_reason).
6435    repeated android.hardware.biometrics.WakeReasonDetailsEnum wake_reason_details = 20;
6436}
6437
6438/**
6439 * Logs when a system health issue is detected.
6440 * Logged from:
6441 *   frameworks/base/services/core/java/com/android/server/biometrics
6442 */
6443message BiometricSystemHealthIssueDetected {
6444    // Biometric modality.
6445    optional android.hardware.biometrics.ModalityEnum modality = 1;
6446    // Type of issue detected.
6447    optional android.hardware.biometrics.IssueEnum issue = 2;
6448    // Dictates if this message should trigger additional debugging.
6449    optional bool debug = 3;
6450    // The ID of the biometric sensor associated with this action.
6451    optional int32 sensor_id = 4;
6452}
6453
6454/**
6455 * Logs when a biometric enrollment occurs.
6456 *
6457 * Logged from:
6458 *   frameworks/base/services/core/java/com/android/server/biometrics
6459 */
6460message BiometricEnrolled {
6461    // Biometric modality that was used.
6462    optional android.hardware.biometrics.ModalityEnum modality = 1;
6463    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
6464    optional int32 user = 2;
6465    // The amount of time the enrollment took in milliseconds.
6466    optional int64 latency_millis = 3;
6467    // Whether or not the enrollment was successful.
6468    optional bool success = 4;
6469    // The ID of the biometric sensor associated with this action.
6470    optional int32 sensor_id = 5;
6471    // The ambient light lux when the user enrolled.
6472    optional float ambient_light_lux = 6;
6473    // The source for where this enrollment came frame
6474    optional android.hardware.biometrics.EnrollmentSourceEnum enroll_source = 7;
6475}
6476
6477
6478/*
6479 * Logs when one of the BiometricPrompt#authenticate() method variants is called.
6480 *
6481 * Logged from:
6482 *   frameworks/base/services/core/java/com/android/server/biometrics
6483 *
6484 */
6485 message AuthPromptAuthenticateInvoked {
6486    // Whether an explicit CryptoObject was passed to the biometric prompt.
6487    optional bool is_crypto = 1;
6488    // The value passed to setConfirmationRequired(boolean), or true if not set.
6489    optional bool is_confirmation_required = 2;
6490    // The value passed to setDeviceCredentialAllowed(boolean), or false if not set.
6491    optional bool is_credential_allowed = 3;
6492    // Whether a value was passed to setAllowedAuthenticators(int).
6493    optional bool is_allowed_authenticators_set = 4;
6494    // The value passed to setAllowedAuthenticators(int), if any.
6495    optional int32 allowed_authenticators = 5;
6496}
6497
6498/*
6499 * Logs when one of the BiometricPrompt#canAuthenticate() method variants is called.
6500 *
6501 * Logged from:
6502 *   frameworks/base/services/core/java/com/android/server/biometrics
6503 *
6504 */
6505message AuthManagerCanAuthenticateInvoked {
6506    // Whether a bit field of allowed authenticator types was provided as an argument.
6507    optional bool is_allowed_authenticators_set = 1;
6508    // The bit field of allowed authenticator types provided, if any.
6509    optional int32 allowed_authenticators = 2;
6510    // The authentication status code that was returned.
6511    optional int32 result_code = 3;
6512}
6513
6514/*
6515 * Logs when Biometric enrollment is requested via the ACTION_BIOMETRIC_ENROLL intent action.
6516 *
6517 * Logged from:
6518 *   frameworks/base/services/core/java/com/android/server/biometrics
6519 *
6520 */
6521message AuthEnrollActionInvoked {
6522    // Whether a Class 3 (strong) biometric was previously enrolled on this device.
6523    optional bool is_strong_biometric_enrolled = 1;
6524    // Whether a Class 2 (weak) biometric was previously enrolled on this device.
6525    optional bool is_weak_biometric_enrolled = 2;
6526    // Whether a PIN/pattern/password was previously enrolled on this device.
6527    optional bool is_device_credential_enrolled = 3;
6528    // Whether a bit field of allowed authenticator types was provided as an extra.
6529    optional bool is_allowed_authenticators_set = 4;
6530    // The bit field of allowed authenticator types provided, if any.
6531    optional int32 allowed_authenticators = 5;
6532}
6533
6534/*
6535 * Logs when an application uses a deprecated biometric or authentication API feature.
6536 *
6537 * Logged from:
6538 *   frameworks/base/services/core/java/com/android/server/biometrics
6539 */
6540 message AuthDeprecatedAPIUsed {
6541    enum APIEnum {
6542        API_UNKNOWN = 0;
6543        // android.hardware.fingerprint.FingerprintManager#authenticate(CryptoObject,
6544        // CancellationSignal, int, AuthenticationCallback, Handler)
6545        API_FINGERPRINT_MANAGER_AUTHENTICATE = 1;
6546        // android.hardware.fingerprint.FingerprintManager#hasEnrolledFingerprints()
6547        API_FINGERPRINT_MANAGER_HAS_ENROLLED_FINGERPRINTS = 2;
6548        // android.hardware.fingerprint.FingerprintManager#isHardwareDetected()
6549        API_FINGERPRINT_MANAGER_IS_HARDWARE_DETECTED = 3;
6550        // android.hardware.biometrics.BiometricManager#canAuthenticate()
6551        API_BIOMETRIC_MANAGER_CAN_AUTHENTICATE = 4;
6552    }
6553
6554     // The deprecated API feature that was used.
6555     optional APIEnum deprecated_api = 1;
6556     // The UID of the application that used the deprecated API.
6557     optional int32 app_uid = 2;
6558     // The target SDK version (API level) of the application that used the deprecated API.
6559     optional int32 target_sdk = 3;
6560 }
6561
6562/*
6563 * Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
6564 */
6565message FlagFlipUpdateOccurred {
6566    // If the event is from a flag config package, specify the package name.
6567    optional string flag_flip_package_name = 1;
6568
6569    // The order id of the package
6570    optional int64 order_id = 2;
6571}
6572
6573/**
6574 * Potential experiment ids that goes with a train install.
6575 * Should be kept in sync with experiment_ids.proto.
6576 */
6577message TrainExperimentIds {
6578    repeated int64 experiment_id = 1;
6579}
6580
6581/*
6582 * Logs when a binary push state changes.
6583 * Logged by the installer via public api.
6584 */
6585message BinaryPushStateChanged {
6586    // Name of the train.
6587    optional string train_name = 1;
6588    // Version code for a "train" of packages that need to be installed atomically
6589    optional int64 train_version_code = 2;
6590    // After installation of this package, device requires a restart.
6591    optional bool requires_staging = 3;
6592    // Rollback should be enabled for this install.
6593    optional bool rollback_enabled = 4;
6594    // Requires low latency monitoring if possible.
6595    optional bool requires_low_latency_monitor = 5;
6596
6597    enum State {
6598        UNKNOWN = 0;
6599        INSTALL_REQUESTED = 1;
6600        INSTALL_STARTED = 2;
6601        INSTALL_STAGED_NOT_READY = 3;
6602        INSTALL_STAGED_READY = 4;
6603        INSTALL_SUCCESS = 5;
6604        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
6605        // and INSTALL_FAILURE_COMMIT.
6606        INSTALL_FAILURE = 6  [deprecated = true];
6607        // This enum is for installs that are manually cancelled via the Manual Update UI.
6608        INSTALL_CANCELLED = 7;
6609        INSTALLER_ROLLBACK_REQUESTED = 8;
6610        INSTALLER_ROLLBACK_INITIATED = 9;
6611        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
6612        INSTALLER_ROLLBACK_STAGED = 11;
6613        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
6614        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
6615        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
6616        INSTALLER_ROLLBACK_SUCCESS = 15;
6617        INSTALLER_ROLLBACK_FAILURE = 16;
6618        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
6619        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
6620        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
6621        INSTALL_STAGED_CANCEL_REQUESTED = 20;
6622        INSTALL_STAGED_CANCEL_SUCCESS = 21;
6623        INSTALL_STAGED_CANCEL_FAILURE = 22;
6624        INSTALL_FAILURE_DOWNLOAD = 23;
6625        INSTALL_FAILURE_STATE_MISMATCH = 24;
6626        INSTALL_FAILURE_COMMIT = 25;
6627        REBOOT_TRIGGERED = 26;
6628        // Logged after INSTALL_REQUESTED for devices installing a train that
6629        // contains no module requiring reboot.
6630        REBOOT_NOT_REQUIRED = 27;
6631        // Logged after INSTALL_REQUESTED for devices that are installing a train
6632        // which requires reboot and eligible for soft restart.
6633        SOFT_RESTART_ELIGIBLE = 28;
6634        // Logged after INSTALL_REQUESTED for devices that are installing a train
6635        // which requires reboot and eligible for notification restart.
6636        NOTIFICATION_RESTART_ELIGIBLE = 29;
6637        // Logged after INSTALL_REQUESTED for devices that are installing a train
6638        // which requires reboot and not eligible for any reboot promotion strategy
6639        // (e.g. soft restart, notification restart).
6640        NO_REBOOT_PROMOTION_STRATEGY_ELIGIBLE = 30;
6641        REBOOT_TRIGGER_FAILURE = 31;
6642        // Logged after INSTALL_REQUESTED for devices installing a train which
6643        // requires reboot and eligible for unattended reboot.
6644        UNATTENDED_REBOOT_ELIGIBLE = 32;
6645        // Logged when Phonesky trys to prepare LSKF.
6646        LSKF_PREPARATION_INITITATED = 33;
6647        // Logged when LSKF preparation succeeded.
6648        LSKF_PREPARATION_SUCCESS = 34;
6649        // Logged when LSKF preparation failed.
6650        LSKF_PREPARATION_FAILURE = 35;
6651        // Logged when Phonesky cannot schedule reboot job on a unattended reboot
6652        // eligible device.
6653        UNATTENDED_REBOOT_NOT_TRIGGERED = 36;
6654        // Logged when SIM PIN recovery preparation succeeded.
6655        SIM_PIN_PREPARATION_SUCCESS = 37;
6656        // Logged when SIM PIN recovery preparation failed.
6657        SIM_PIN_PREPARATION_FAILURE = 38 [deprecated = true];
6658        // Logged when unattended reboot is aborted and falls back to organic
6659        // reboot.
6660        UNATTENDED_REBOOT_ABORT = 39;
6661        // Logged when Phonesky re-prepares LSKF.
6662        LSKF_PREPARATION_RETRY = 40;
6663        // Logged when the device doesn’t support checkpoint and cannot stage
6664        // multiple sessions.
6665        CHECKPOINT_NOT_SUPPORTED = 41;
6666        // Logged when Phonesky instructs Android platform to monitor reboot
6667        // readiness signal.
6668        PENDING_REBOOT_MARKED = 42;
6669        // Logged when Phonesky instructs Android platform to stop monitoring reboot
6670        // readiness signal.
6671        PENDING_REBOOT_CANCELLED = 43 [deprecated = true];
6672        // Logged when Phonesky receives reboot readiness broadcast and the device
6673        // is ready to reboot.
6674        SIGNAL_READY_TO_REBOOT_RECEIVED = 44;
6675        // Logged when Phonesky receives reboot readiness broadcast and the device
6676        // is not ready to reboot.
6677        SIGNAL_NOT_READY_TO_REBOOT_RECEIVED = 45;
6678        // Logged when Phonesky cancels an untracked train.
6679        UNTRACKED_TRAIN_CANCELLED = 46;
6680    }
6681    optional State state = 6;
6682    // Possible experiment ids for monitoring this push.
6683    optional TrainExperimentIds experiment_ids = 7 [(log_mode) = MODE_BYTES];
6684    // Index of the Android User. E.g. 0 for primary profile, 10, 11, 12
6685    // for guest and secondary profiles. Not PII.
6686    optional int32 user_id = 8;
6687    // Log additional info for a state when needed.
6688    // When state = REBOOT_TRIGGERED, this field logs the reboot type:
6689    //  USERSPACE_REBOOT = 1.
6690    //  FORCED_REBOOT = 2.
6691    //  NOTIFICATION_RESTART_REBOOT = 3.
6692    //  UNATTENDED_REBOOT_SECURED_AND_SIM_PIN = 4.
6693    //  UNATTENDED_REBOOT_SECURED_NO_SIM_PIN = 5.
6694    //  UNATTENDED_REBOOT_UNSECURED_AND_SIM_PIN = 6.
6695    //  UNATTENDED_REBOOT_UNSECURED_NO_SIM_PIN = 7.
6696    // When state = INSTALL_FAILURE, this field logs the Install errors related
6697    // statusCode
6698    // When state = UNATTENDED_REBOOT_ABORT, this field logs the cancellation
6699    // reason:
6700    //  LSKF_RETRY_EXCEED_MAXIMUM = 1.
6701    //  SIM_PIN_NOT_PREPARED = 2.
6702    // When state = UNATTENDED_REBOOT_ELIGIBLE, this field logs the cancellation
6703    // reason:
6704    //  UNATTENDED_REBOOT_SECURED_AND_SIM_PIN = 1.
6705    //  UNATTENDED_REBOOT_SECURED_NO_SIM_PIN = 2.
6706    //  UNATTENDED_REBOOT_UNSECURED_AND_SIM_PIN = 3.
6707    //  UNATTENDED_REBOOT_UNSECURED_NO_SIM_PIN = 4.
6708    // When state = UNATTENDED_REBOOT_NOT_TRIGGERED, this field logs the
6709    // cancellation reason:
6710    //  LSKF_NOT_PREPARED = 1.
6711    //  REBOOT_NOT_READY = 2.
6712    // When state = PENDING_REBOOT_CANCELLED, this field logs the cancellation
6713    // reason:
6714    //  LSKF_NOT_PREPARED = 1.
6715    //  NO_STAGED_TRAIN = 2.
6716    //  HAS_SIM_PIN_AND_SIM_PIN_STORAGE_DISABLED = 3.
6717    optional int32 reason = 9;
6718    // Whether or not this is a rollback event.
6719    optional bool is_rollback = 10;
6720}
6721
6722/* Test atom, is not logged anywhere */
6723message TestAtomReported {
6724    repeated AttributionNode attribution_node = 1;
6725    optional int32 int_field = 2;
6726    optional int64 long_field = 3;
6727    optional float float_field = 4;
6728    optional string string_field = 5;
6729    optional bool boolean_field = 6;
6730    enum State {
6731        UNKNOWN = 0;
6732        OFF = 1;
6733        ON = 2;
6734    }
6735    optional State state = 7;
6736    optional TrainExperimentIds bytes_field = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
6737    repeated int32 repeated_int_field = 9;
6738    repeated int64 repeated_long_field = 10;
6739    repeated float repeated_float_field = 11;
6740    repeated string repeated_string_field = 12;
6741    repeated bool repeated_boolean_field = 13;
6742    repeated State repeated_enum_field = 14;
6743}
6744
6745/** Represents USB port overheat event. */
6746message UsbPortOverheatEvent {
6747    /* Temperature of USB port at USB plug event, in 1/10ths of degree C. */
6748    optional int32 plug_temperature_deci_c = 1;
6749
6750    /* Maximum temperature of USB port during overheat event, in 1/10ths of degree C. */
6751    optional int32 max_temperature_deci_c = 2;
6752
6753    /* Time between USB plug event and overheat threshold trip, in seconds. */
6754    optional int32 time_to_overheat_secs = 3;
6755
6756    /* Time between overheat threshold trip and hysteresis, in seconds. */
6757    optional int32 time_to_hysteresis_secs = 4;
6758
6759    /* Time between hysteresis and active mitigation ending, in seconds. */
6760    optional int32 time_to_inactive_secs = 5;
6761};
6762
6763/**
6764 * Logs total effective full charge and discharge cycles on a battery.
6765 * Here are some examples of one effective cycle:
6766 *   1) the battery charges from 0% to 100% and drains back to 0%,
6767 *   2) charging from 50% to 100% and draining back to 50% twice.
6768 * Pulled from:
6769 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
6770 */
6771message BatteryCycleCount {
6772    /* Number of total charge and discharge cycles on the system battery. */
6773    optional int32 cycle_count = 1;
6774}
6775
6776/**
6777 * Logs that external storage is mounted and information about it, the storage type (sd card/usb/
6778 * others), its type (public or private) and the size in bytes.
6779 * Pulled from:
6780 *   StatsCompanionService
6781 */
6782
6783message ExternalStorageInfo {
6784
6785    enum VolumeType {
6786        UNKNOWN = 0;
6787        PUBLIC = 1;
6788        PRIVATE = 2;
6789        OTHER = 3;
6790    }
6791
6792    // The type of external storage.
6793    optional android.stats.storage.ExternalStorageType storage_type = 1;
6794    // Type of the volume: TYPE_PUBLIC if portable and TYPE_PRIVATE if internal.
6795    optional VolumeType volume_type = 2;
6796    // Total size of the sd card in bytes.
6797    optional int64 size_bytes = 3;
6798}
6799
6800/*
6801 * Logs when a connection becomes available and lost.
6802 * Logged in StatsCompanionService.java
6803 */
6804message ConnectivityStateChanged {
6805  // Id of the network.
6806  optional int32 net_id = 1;
6807
6808  enum State {
6809    UNKNOWN = 0;
6810    CONNECTED = 1;
6811    DISCONNECTED = 2;
6812  }
6813  // Connected state of a network.
6814  optional State state = 2;
6815}
6816
6817/**
6818 * Logs when a service starts and stops.
6819 * Logged from:
6820 *   services/core/java/com/android/server/am/ActiveServices.java
6821 */
6822message ServiceStateChanged {
6823
6824    optional int32 uid = 1 [(is_uid) = true];
6825
6826    optional string package_name = 2;
6827
6828    optional string service_name = 3;
6829
6830    enum State {
6831        START = 1;
6832        STOP = 2;
6833    }
6834
6835    optional State state = 4;
6836}
6837
6838/**
6839 * Logs when a service is launched.
6840 * Logged from:
6841 *   services/core/java/com/android/server/am/ActiveServices.java
6842 */
6843message ServiceLaunchReported {
6844
6845    optional int32 uid = 1 [(is_uid) = true];
6846
6847    optional string package_name = 2;
6848
6849    optional string service_name = 3;
6850}
6851
6852/**
6853 * The type of process start. It's the same as ProcessStartTime.StartType but we
6854 * can't re-type that for background compatibility.
6855 */
6856enum ProcessStartType {
6857    PROCESS_START_TYPE_UNKNOWN = 0;
6858    PROCESS_START_TYPE_WARM = 1;
6859    PROCESS_START_TYPE_HOT = 2;
6860    PROCESS_START_TYPE_COLD = 3;
6861}
6862
6863/**
6864 * The stopped state of a package.
6865 */
6866enum PackageStoppedState {
6867    PACKAGE_STATE_UNKNOWN = 0;
6868    PACKAGE_STATE_NORMAL = 1; // The package is not in any stopped state
6869    PACKAGE_STATE_STOPPED = 2; // ApplicationInfo.FLAG_STOPPED
6870}
6871
6872/**
6873 * Logs when a service request is made.
6874 * Logged from:
6875 *   services/core/java/com/android/server/am/ActiveServices.java
6876 */
6877message ServiceRequestEventReported {
6878    /** The package uid of the service host. */
6879    optional int32 uid = 1 [(is_uid) = true];
6880
6881    /** The package uid of the service launch request. */
6882    optional int32 requester_uid = 2 [(is_uid) = true];
6883
6884    /** The action name of the service request. */
6885    optional string action_name = 3;
6886
6887    /**
6888     * The types of the requests to the service.
6889     */
6890    enum RequestType {
6891        UNKNOWN = 0;
6892        START = 1;
6893        BIND = 2;
6894    }
6895
6896    /** The type of the current request to the service.*/
6897    optional RequestType request_type = 4;
6898
6899    /** Whether or not it's requested to start as a foreground service. */
6900    optional bool fg_required = 5;
6901
6902    /** The start type of the host process. */
6903    optional ProcessStartType proc_start_type = 6;
6904
6905    /** The process name who requests the service launch */
6906    optional string request_process_name = 7;
6907
6908    /** The service component name, here consists of the class name part only */
6909    optional string service_component_name = 8;
6910
6911    /** The state the package was in when the service was requested */
6912    optional PackageStoppedState package_stopped_state = 9;
6913
6914    /** The package name of the service host */
6915    optional string package_name = 10;
6916
6917    /** The package name of the service lunch request */
6918    optional string requester_package_name = 11;
6919
6920    /** The process state of the requester */
6921    optional android.app.ProcessStateEnum requester_process_state = 12;
6922
6923    /** The process state of the service host before this service request */
6924    optional android.app.ProcessStateEnum service_process_state = 13;
6925
6926    /** Whether this is the first launch of the app since install */
6927    optional bool first_launch = 14;
6928
6929    // How long since this package was stopped, if it was in
6930    // package_stopped_state == PACKAGE_STATE_STOPPED
6931    optional int64 millis_since_stopped = 15;
6932}
6933
6934/**
6935 * Logs indicating a broadcast is being delivered to a receiver.
6936 *
6937 * Logged from:
6938 *     frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
6939 */
6940message BroadcastDeliveryEventReported {
6941    /** The package uid of the broadcast receiver. */
6942    optional int32 uid = 1 [(is_uid) = true];
6943
6944    /** The package uid of the broadcast sender. */
6945    optional int32 sender_uid = 2 [(is_uid) = true];
6946
6947    /** The action name of the broadcast. */
6948    optional string action_name = 3;
6949
6950    /**
6951     * The types of the broadcast receivers.
6952     */
6953    enum ReceiverType {
6954        UNKNOWN = 0;
6955        RUNTIME = 1;
6956        MANIFEST = 2;
6957    }
6958
6959    /** The type of the current broadcast receiver. */
6960    optional ReceiverType receiver_type = 4;
6961
6962    /** The start type of the host process. */
6963    optional ProcessStartType proc_start_type = 5;
6964
6965    /** The delay in ms from enqueue to dispatch of this intent to the set of receivers. */
6966    optional int64 dispatch_delay = 6;
6967
6968    /** The delay in ms from beginning of dispatch to this specific receiver. */
6969    optional int64 receive_delay = 7;
6970
6971    /** The delay in ms from dispatch to finish the handling of this intent. */
6972    optional int64 finish_delay = 8;
6973
6974    /** The stopped state (if any) the package was in before the broadcast was delivered */
6975    optional PackageStoppedState package_stopped_state = 9;
6976
6977    /** The package name of the broadcast receiver */
6978    optional string package_name = 10;
6979
6980    /** The package name of the broadcast sender */
6981    optional string sender_package_name = 11;
6982
6983    /** The type of the broadcast */
6984    optional int32 broadcast_type = 12;
6985
6986    /** Delivery group policy set for the broadcast */
6987    optional android.app.BroadcastDeliveryGroupPolicy delivery_group_policy = 13;
6988
6989    /** Flags set in the broadcast intent */
6990    optional int32 intent_flags = 14;
6991
6992    /** The intent filter priority of the broadcast receiver */
6993    optional int32 filter_priority = 15;
6994
6995    /** The procstate of the broadcast sender */
6996    optional android.app.ProcessStateEnum sender_proc_state = 16;
6997
6998    /** The procstate of the broadcast receiver before receiving this broadcast */
6999    optional android.app.ProcessStateEnum receiver_process_state = 17;
7000
7001    /** Whether this is the first launch of the app since install */
7002    optional bool first_launch = 18;
7003
7004    // How long since this package was stopped, if it was in
7005    // package_stopped_state == PACKAGE_STATE_STOPPED
7006    optional int64 millis_since_stopped = 19;
7007}
7008
7009/**
7010 * Logs indicating a client is requesting to acquire a provider,
7011 * this doesn't include the case where the provider has been installed in the
7012 * client's process space and it's just increasing a ref count.
7013 *
7014 * Logged from:
7015 *      frameworks/base/services/core/java/com/android/server/am/ContentProviderHelper.java
7016 */
7017message ProviderAcquisitionEventReported {
7018    /** The package uid of the content provider host. */
7019    optional int32 uid = 1 [(is_uid) = true];
7020
7021    /** The package uid of the content provider client who makes the request. */
7022    optional int32 client_uid = 2 [(is_uid) = true];
7023
7024    /** The start type of the host process. */
7025    optional ProcessStartType proc_start_type = 3;
7026
7027    /** The stopped state (if any) the package was in when acquiring the provider */
7028    optional PackageStoppedState package_stopped_state = 4;
7029
7030    /** The package name of the content provider host. */
7031    optional string package_name = 5;
7032
7033    /** The package name of the content provider client who makes the request. */
7034    optional string client_package_name = 6;
7035
7036    /** The process state of the client */
7037    optional android.app.ProcessStateEnum client_process_state = 7;
7038
7039    /** The process state of the content provider host before being acquired */
7040    optional android.app.ProcessStateEnum provider_process_state = 8;
7041
7042    /** Whether this is the first launch of the app since install */
7043    optional bool first_launch = 9;
7044
7045    // How long since this package was stopped, if it was in
7046    // package_stopped_state == PACKAGE_STATE_STOPPED
7047    optional int64 millis_since_stopped = 10;
7048}
7049
7050/**
7051 * Logs when a hidden API is used.
7052 *
7053 * Logged from:
7054 *     libcore/libart/src/main/java/dalvik/system/VMRuntime.java
7055 */
7056message HiddenApiUsed {
7057    // The uid of the app making the hidden access.
7058    optional int32 uid = 1 [(is_uid) = true];
7059
7060    // Signature of the method or field accessed.
7061    optional string signature = 2;
7062
7063    enum AccessMethod {
7064        NONE = 0;
7065        REFLECTION = 1;
7066        JNI = 2;
7067        LINKING = 3;
7068    }
7069
7070    // Type of access.
7071    optional AccessMethod access_method = 3;
7072
7073    // Whether the access was prevented or not.
7074    optional bool access_denied = 4;
7075}
7076
7077/**
7078 * Logs user interaction with the Privacy Indicators added in Q. In particular:
7079 * - When user sees privacy chip
7080 * - When user clicks privacy chip
7081 * - How does the user exit the Privacy Dialog
7082 * Logged from:
7083 *   packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
7084 */
7085message PrivacyIndicatorsInteracted {
7086
7087    enum Type {
7088        UNKNOWN = 0;
7089        CHIP_VIEWED = 1;
7090        CHIP_CLICKED = 2;
7091        reserved 3; // Used only in beta builds, never shipped
7092        DIALOG_DISMISS = 4;
7093        DIALOG_LINE_ITEM = 5;
7094    }
7095
7096    optional Type type = 1 [
7097        (state_field_option).exclusive_state = true,
7098        (state_field_option).nested = false
7099    ];
7100}
7101
7102/**
7103 * Logs information about a package that is moved from the internal to external storage and vice
7104 * versa.
7105 * It logs the package name, the type of the external storage where the package is installed
7106 * (if moved to external storage, or UNKNOWN if moved to internal storage),
7107 * and the move type: if it's from internal to external or the other way around.
7108 *
7109 * Logged from:
7110        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
7111 */
7112message AppMovedStorageReported {
7113    enum MoveType {
7114        UNKNOWN = 0;
7115        TO_EXTERNAL = 1;
7116        TO_INTERNAL = 2;
7117    }
7118    // The type of the external storage.
7119    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
7120    // The type of move.
7121    optional MoveType move_type = 2;
7122    // The name of the package that was moved.
7123    optional string package_name = 3;
7124}
7125
7126/**
7127 * Logs when system server watchdog occurs.
7128 * Logged from:
7129 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
7130 */
7131message SystemServerWatchdogOccurred {
7132    optional string subject = 1;
7133}
7134
7135/**
7136 * Logs when system server pre-watchdog occurs.
7137 * Logged from:
7138 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
7139 */
7140message SystemServerPreWatchdogOccurred {
7141}
7142
7143/**
7144 * Logs when new file added to tombstones.
7145 * Logged from:
7146 *      frameworks/base/core/java/com/android/server/BootReceiver.java
7147 */
7148message TombStoneOccurred {
7149}
7150
7151/*
7152 * Information about a role request
7153 *
7154 * Logged from:
7155 *   packages/apps/PermissionController/src/com/android/packageinstaller/role/ui/RequestRoleFragment.java
7156 */
7157message RoleRequestResultReported {
7158    // UID of application requesting the role
7159    optional int32 requesting_uid = 1;
7160
7161    // Package name of application requesting the role
7162    optional string requesting_package_name = 2;
7163
7164    // The role to be granted
7165    optional string role_name = 3;
7166
7167    // The count of applications qualifying for the role
7168    optional int32 qualifying_count = 4;
7169
7170    // UID of application current granted the role
7171    optional int32 current_uid = 5;
7172
7173    // Package name of application current granted the role
7174    optional string current_package_name = 6;
7175
7176    // UID of another application that user chose to grant the role to, instead of the requesting
7177    // application
7178    optional int32 granted_another_uid = 7;
7179
7180    // Package name of another application that user chose to grant the role to, instead of the
7181    // requesting application
7182    optional string granted_another_package_name = 8;
7183
7184    enum Result {
7185        UNDEFINED = 0;
7186        // role request was ignored
7187        IGNORED = 1;
7188        // role request was ignored because it's already granted
7189        IGNORED_ALREADY_GRANTED = 2;
7190        // role request was ignored because the application isn't qualified
7191        IGNORED_NOT_QUALIFIED = 3;
7192        // role request was ignored because user said it should be always denied
7193        IGNORED_USER_ALWAYS_DENIED = 4;
7194        // role was granted by user action
7195        USER_GRANTED = 5;
7196        // role was denied by user action
7197        USER_DENIED = 6;
7198        // role was denied by user granting another application the role
7199        USER_DENIED_GRANTED_ANOTHER = 7;
7200        // role was denied and set to be always denied by the user
7201        USER_DENIED_WITH_ALWAYS = 8;
7202        // role request was ignored because the user is blocked from changing
7203        // roles via DISALLOW_CONFIG_DEFAULT_APPS user restriction
7204        IGNORED_USER_RESTRICTION = 9;
7205        // role request was ignored when the package is enhanced confiramtion
7206        // restricted
7207        IGNORED_ENHANCED_CONFIRMATION_RESTRICTION = 10;
7208    }
7209    // The result of the role request
7210    optional Result result = 9;
7211}
7212
7213/**
7214 * Logs when a Vehicle Maps Service client's connection state has changed
7215 *
7216 * Logged from:
7217 *   packages/services/Car/service/src/com/android/car/stats/VmsClientLog.java
7218 */
7219message VmsClientConnectionStateChanged {
7220    // The UID of the VMS client app
7221    optional int32 uid = 1 [(is_uid) = true];
7222
7223    enum State {
7224        UNKNOWN = 0;
7225        // Attempting to connect to the client
7226        CONNECTING = 1;
7227        // Client connection established
7228        CONNECTED = 2;
7229        // Client connection closed unexpectedly
7230        DISCONNECTED = 3;
7231        // Client connection closed by VMS
7232        TERMINATED = 4;
7233        // Error establishing the client connection
7234        CONNECTION_ERROR = 5;
7235    }
7236
7237    optional State state  = 2;
7238}
7239
7240message MimeTypes {
7241    repeated string mime_types = 1;
7242}
7243
7244/**
7245 * Logs statistics regarding accesses to external storage.
7246 * All stats are normalized for one day period.
7247 *
7248 * Logged from:
7249 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
7250 */
7251message GeneralExternalStorageAccessStats {
7252    optional int32 uid = 1 [(is_uid) = true];
7253    // Total number of accesses like creation, open, delete and rename/update.
7254    // Includes file path and ContentResolver accesses
7255    optional uint32 total_accesses = 2;
7256    // Number of file path accesses, as opposed to file path and ContentResolver.
7257    optional uint32 file_path_accesses = 3;
7258    // Number of accesses on secondary volumes like SD cards.
7259    // Includes file path and ContentResolver accesses
7260    optional uint32 secondary_storage_accesses = 4;
7261    // Comma-separated list of mime types that were accessed.
7262    optional MimeTypes mime_types_accessed = 5 [(log_mode) = MODE_BYTES];
7263}
7264
7265/**
7266 * Logs when MediaProvider has successfully finished scanning a storage volume.
7267 *
7268 * Logged from:
7269 *   packages/providers/MediaProvider/src/com/android/providers/media/scan/ModernMediaScanner.java
7270 */
7271message MediaProviderScanOccurred {
7272    enum Reason {
7273        // Scan triggered due to unknown reason
7274        UNKNOWN = 0;
7275        // Scan triggered due to storage volume being mounted
7276        MOUNTED = 1;
7277        // Scan triggered due to explicit user action or app request
7278        DEMAND = 2;
7279        // Scan triggered due to idle maintenance
7280        IDLE = 3;
7281    }
7282
7283    // Volume type that this event pertains to
7284    optional android.stats.mediaprovider.VolumeType volume_type = 1;
7285    // Reason why this scan was triggered
7286    optional Reason reason = 2;
7287    // Total number of files scanned
7288    optional int64 item_count = 3;
7289    // Duration of scan, normalized per file
7290    optional float normalized_duration_millis = 4;
7291    // Number of database inserts, normalized per file
7292    optional float normalized_insert_count = 5;
7293    // Number of database updates, normalized per file
7294    optional float normalized_update_count = 6;
7295    // Number of database deletes, normalized per file
7296    optional float normalized_delete_count = 7;
7297}
7298
7299/**
7300 * Logs when an app has asked MediaProvider to delete media belonging to the user.
7301 *
7302 * Logged from:
7303 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
7304 */
7305message MediaContentDeleted {
7306    // Volume type that this event pertains to
7307    optional android.stats.mediaprovider.VolumeType volume_type = 1;
7308    // UID of app that requested deletion
7309    optional int32 uid = 2 [(is_uid) = true];
7310    // Number of items that were deleted
7311    optional int32 item_count = 3;
7312}
7313
7314/**
7315 * Logs when an app has asked MediaProvider to grant them access to media belonging to the user.
7316 *
7317 * Logged from:
7318 *   packages/providers/MediaProvider/src/com/android/providers/media/PermissionActivity.java
7319 */
7320message MediaProviderPermissionRequested {
7321    enum Result {
7322        UNKNOWN = 0;
7323        USER_GRANTED = 1;
7324        AUTO_GRANTED = 2;
7325        USER_DENIED = 3;
7326        USER_DENIED_WITH_PREJUDICE = 4;
7327        AUTO_DENIED = 5;
7328    }
7329
7330    // Volume type that this event pertains to
7331    optional android.stats.mediaprovider.VolumeType volume_type = 1;
7332    // UID of app that requested permission
7333    optional int32 uid = 2 [(is_uid) = true];
7334    // Number of items that were requested
7335    optional int32 item_count = 3;
7336    // Result of this request
7337    optional Result result = 4;
7338}
7339
7340/**
7341 * Logs when MediaProvider has finished upgrading or downgrading its database schema.
7342 *
7343 * Logged from:
7344 *   packages/providers/MediaProvider/src/com/android/providers/media/DatabaseHelper.java
7345 */
7346message MediaProviderSchemaChanged {
7347    // Volume type that this event pertains to
7348    optional android.stats.mediaprovider.VolumeType volume_type = 1;
7349    // Old database version code
7350    optional int32 version_from = 2;
7351    // New database version code
7352    optional int32 version_to = 3;
7353    // Total number of files in database
7354    optional int64 item_count = 4;
7355    // Duration of schema change, normalized per file
7356    optional float normalized_duration_millis = 5;
7357}
7358
7359/**
7360 * Logs when MediaProvider has finished an idle maintenance job.
7361 *
7362 * Logged from:
7363 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
7364 */
7365message MediaProviderIdleMaintenanceFinished {
7366    // Volume type that this event pertains to
7367    optional android.stats.mediaprovider.VolumeType volume_type = 1;
7368
7369    // Total number of files in database
7370    optional int64 item_count = 2;
7371    // Duration of idle maintenance, normalized per file
7372    optional float normalized_duration_millis = 3;
7373    // Number of thumbnails found to be stale, normalized per file
7374    optional float normalized_stale_thumbnails = 4;
7375    // Number of items found to be expired, normalized per file
7376    optional float normalized_expired_media = 5;
7377}
7378
7379/**
7380 * Represents boot time event with duration in ms.
7381 *
7382 * Logged from: bootstat and various system server components. Check each enums for details.
7383 */
7384message BootTimeEventDuration {
7385    enum DurationEvent {
7386        UNKNOWN = 0;
7387        // Bootloader time excluding BOOTLOADER_UI_WAIT + boot complete time. Logged from bootstat.
7388        ABSOLUTE_BOOT_TIME = 1;
7389        // Bootloader's 1st stage execution time.
7390        // Logged from bootstat.
7391        BOOTLOADER_FIRST_STAGE_EXEC = 2;
7392        // Bootloader's 1st stage loading time.
7393        // Logged from bootstat.
7394        BOOTLOADER_FIRST_STAGE_LOAD = 3;
7395        // Bootloader's kernel loading time.
7396        // Logged from bootstat.
7397        BOOTLOADER_KERNEL_LOAD = 4;
7398        // Bootloader's 2nd stage execution time.
7399        // Logged from bootstat.
7400        BOOTLOADER_SECOND_STAGE_EXEC = 5;
7401        // Bootloader's 2nd stage loading time.
7402        // Logged from bootstat.
7403        BOOTLOADER_SECOND_STAGE_LOAD = 6;
7404        // Duration for Bootloader to show unlocked device's warning UI. This should not happen
7405        // for locked device.
7406        // Logged from bootstat.
7407        BOOTLOADER_UI_WAIT = 7;
7408        // Total time spend in bootloader. This is the sum of all BOOTLOADER_* listed above.
7409        // Logged from bootstat.
7410        BOOTLOADER_TOTAL = 8;
7411        // Shutdown duration inside init for the reboot before the current boot up.
7412        // Logged from f/b/services/.../BootReceiver.java.
7413        SHUTDOWN_DURATION = 9;
7414        // Total time for mounting of disk devices during bootup.
7415        // Logged from f/b/services/.../BootReceiver.java.
7416        MOUNT_DEFAULT_DURATION = 10;
7417        // Total time for early stage mounting of disk devices during bootup.
7418        // Logged from f/b/services/.../BootReceiver.java.
7419        MOUNT_EARLY_DURATION = 11;
7420        // Total time for late stage mounting of disk devices during bootup.
7421        // Logged from f/b/services/.../BootReceiver.java.
7422        MOUNT_LATE_DURATION = 12;
7423        // Average time to scan non-system app after OTA
7424        // Logged from f/b/services/.../PackageManagerService.java
7425        OTA_PACKAGE_MANAGER_INIT_TIME = 13;
7426        // Time to initialize Package manager after OTA
7427        // Logged from f/b/services/.../PackageManagerService.java
7428        OTA_PACKAGE_MANAGER_DATA_APP_AVG_SCAN_TIME = 14;
7429        // Time to scan all system app from Package manager after OTA
7430        // Logged from f/b/services/.../PackageManagerService.java
7431        OTA_PACKAGE_MANAGER_SYSTEM_APP_AVG_SCAN_TIME = 15;
7432        // Init's total time for cold boot stage.
7433        // Logged from bootstat.
7434        COLDBOOT_WAIT = 16;
7435        // Init's total time for initializing selinux.
7436        // Logged from bootstat.
7437        SELINUX_INIT = 17;
7438        // Time since last factory reset.
7439        // Logged from bootstat.
7440        FACTORY_RESET_TIME_SINCE_RESET = 18;
7441        // Init's total time spent for completing the 1st stage.
7442        // Logged from bootstat.
7443        ANDROID_INIT_STAGE_1 = 19;
7444    }
7445
7446    // Type of the event.
7447    optional DurationEvent event = 1;
7448    // Duration of the event in ms.
7449    optional int64 duration_millis = 2;
7450}
7451
7452/**
7453 * Represents the start of specific boot time event during bootup in ms. This is usually a time
7454 * since boot-up.
7455 *
7456 * Logged from: bootstat and various system server components. Check each enums for details.
7457 */
7458message BootTimeEventElapsedTime {
7459    enum ElapsedTimeEvent {
7460        UNKNOWN = 0;
7461        // Time when init starts 1st stage. Logged from bootstat.
7462        ANDROID_INIT_STAGE_1 = 1;
7463        // Time when sys.boot_completed prop is set.
7464        // Logged from bootstat.
7465        BOOT_COMPLETE = 2;
7466        // BOOT_COMPLETE for a device that uses full-disk encryption.  Note that
7467        // no devices running Android 13 or later use full-disk encryption, as
7468        // it has been replaced by file-based encryption.
7469        BOOT_COMPLETE_ENCRYPTION = 3;
7470        // BOOT_COMPLETE for a device that doesn't use full-disk encryption.
7471        BOOT_COMPLETE_NO_ENCRYPTION = 4;
7472        // Adjusted BOOT_COMPLETE for a device that uses full-disk encryption,
7473        // omitting the decryption time.
7474        BOOT_COMPLETE_POST_DECRYPT = 5;
7475        // BOOT_COMPLETE after factory reset.
7476        FACTORY_RESET_BOOT_COMPLETE = 6;
7477        // BOOT_COMPLETE_NO_ENCRYPTION after factory reset.
7478        FACTORY_RESET_BOOT_COMPLETE_NO_ENCRYPTION = 7;
7479        // BOOT_COMPLETE_POST_DECRYPT after factory reset.
7480        FACTORY_RESET_BOOT_COMPLETE_POST_DECRYPT = 8;
7481        // BOOT_COMPLETE after OTA.
7482        OTA_BOOT_COMPLETE = 9;
7483        // BOOT_COMPLETE_NO_ENCRYPTION after OTA.
7484        OTA_BOOT_COMPLETE_NO_ENCRYPTION = 10;
7485        // BOOT_COMPLETE_POST_DECRYPT after OTA.
7486        OTA_BOOT_COMPLETE_POST_DECRYPT = 11;
7487        // Time when the system starts sending LOCKED_BOOT_COMPLETED broadcast.
7488        // Logged from  f/b/services/.../UserController.java
7489        FRAMEWORK_LOCKED_BOOT_COMPLETED = 12;
7490        // Time when the system starts sending BOOT_COMPLETED broadcast.
7491        // Logged from  f/b/services/.../UserController.java
7492        FRAMEWORK_BOOT_COMPLETED = 13;
7493        // Time when the package manager starts init.
7494        // Logged from f/b/services/.../SystemServer.java
7495        PACKAGE_MANAGER_INIT_START = 14;
7496        // Time when package manager is ready
7497        // Logged from f/b/services/.../SystemServer.java
7498        PACKAGE_MANAGER_INIT_READY = 15;
7499        // Represents the time when user has entered unlock credential for system with user pin.
7500        // Logged from bootstat.
7501        POST_DECRYPT = 16;
7502        // Represents the start of zygote's init.
7503        // Logged from zygote itself.
7504        ZYGOTE_INIT_START = 17;
7505        // Represents the start of secondary zygote's init.
7506        // TODO: add logging to zygote
7507        SECONDARY_ZYGOTE_INIT_START = 18;
7508        // Represents the start of system server's init.
7509        // Logged from f/b/services/.../SystemServer.java
7510        SYSTEM_SERVER_INIT_START = 19;
7511        // Represents the completion of system server's init.
7512        // Logged from f/b/services/.../SystemServer.java
7513        SYSTEM_SERVER_READY = 20;
7514        // Represents the start of launcher during boot-up.
7515        // TODO: add logging
7516        LAUNCHER_START = 21;
7517        // Represents the completion of launcher's initial rendering. User can use other apps from
7518        // launcher from this point.
7519        // TODO: add logging
7520        LAUNCHER_SHOWN = 22;
7521    }
7522
7523    // Type of the event.
7524    optional ElapsedTimeEvent event = 1;
7525    // Time since bootup for the event.
7526    // It should be acquired from SystemClock elapsedRealtime() call or equivalent.
7527    optional int64 time_millis = 2;
7528}
7529
7530/**
7531 * Boot time events with UTC time.
7532 *
7533 * Logged from: bootstat and various system server components. Check each enums for details.
7534 */
7535message BootTimeEventUtcTime {
7536    enum UtcTimeEvent {
7537        UNKNOWN = 0;
7538        // Time of the bootstat's marking of 1st boot after the last factory reset.
7539        // Logged from bootstat.
7540        FACTORY_RESET_RESET_TIME = 1;
7541        // The time when bootstat records FACTORY_RESET_* events. This is close to
7542        // BOOT_COMPLETE time for the current bootup.
7543        // Logged from bootstat.
7544        FACTORY_RESET_CURRENT_TIME = 2;
7545        // DUplicate of FACTORY_RESET_RESET_TIME added for debugging purpose.
7546        // Logged from bootstat.
7547        FACTORY_RESET_RECORD_VALUE = 3;
7548    }
7549
7550    // Type of the event.
7551    optional UtcTimeEvent event = 1;
7552    // UTC time for the event.
7553    optional int64 utc_time_secs = 2;
7554}
7555
7556/**
7557 * Boot time events representing specific error code during bootup.
7558 * Meaning of error code can be different per each event type.
7559 *
7560 * Logged from: bootstat and various system server components. Check each enums for details.
7561 */
7562message BootTimeEventErrorCode {
7563    enum ErrorCodeEvent {
7564        UNKNOWN = 0;
7565        // Linux error code for time() call to get the current UTC time.
7566        // Logged from bootstat.
7567        FACTORY_RESET_CURRENT_TIME_FAILURE = 1;
7568        // Represents UmountStat before the reboot for the current boot up. Error codes defined
7569        // as UMOUNT_STAT_* from init/reboot.cpp.
7570        // Logged from f/b/services/.../BootReceiver.java.
7571        SHUTDOWN_UMOUNT_STAT = 2;
7572        // Reprepsents fie system mounting error code of /data partition for the current boot.
7573        // Error codes defined as combination of FsStatFlags from system/core/fs_mgr/fs_mgr.cpp.
7574        // Logged from f/b/services/.../BootReceiver.java.
7575        FS_MGR_FS_STAT_DATA_PARTITION = 3;
7576    }
7577
7578    // Type of the event.
7579    optional ErrorCodeEvent event = 1;
7580    // error code defined per each event type.
7581    // For example, this can have a value of FsStatFlags.FS_STAT_FULL_MOUNT_FAILED for the event of
7582    // FS_MGR_FS_STAT.
7583    optional int32 error_code = 2;
7584}
7585
7586/**
7587 * Collects Virtual A/B statistics related to the use of dm-snapshot performed
7588 * after an OTA.
7589 *
7590 * Logged from:
7591 *  - system/update_engine/cleanup_previous_update_action.cc
7592 */
7593message SnapshotMergeReported {
7594    // Keep in sync with
7595    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
7596    enum UpdateState {
7597        // No update or merge is in progress.
7598        NONE = 0;
7599        // An update is applying; snapshots may already exist.
7600        INITIATED = 1;
7601        // An update is pending, but has not been successfully booted yet.
7602        UNVERIFIED = 2;
7603        // The kernel is merging in the background.
7604        MERGING = 3;
7605        // Post-merge cleanup steps could not be completed due to a transient
7606        // error, but the next reboot will finish any pending operations.
7607        MERGE_NEEDS_REBOOT = 4;
7608        // Merging is complete, and needs to be acknowledged.
7609        MERGE_COMPLETED = 5;
7610        // Merging failed due to an unrecoverable error.
7611        MERGE_FAILED = 6;
7612        // The update was implicitly cancelled, either by a rollback or a flash
7613        // operation via fastboot. This state can only be returned by WaitForMerge.
7614        CANCELLED = 7;
7615    };
7616
7617    // Status codes correspond to specific failure conditions in
7618    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.cpp
7619    //
7620    // Keep in sync with
7621    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
7622    enum MergeFailureCode {
7623        OK = 0;
7624        READ_STATUS = 1;
7625        GET_TABLE_INFO = 2;
7626        UNKNOWN_TABLE = 3;
7627        GET_TABLE_PARAMS = 4;
7628        ACTIVATE_NEW_TABLE = 5;
7629        ACQUIRE_LOCK = 6;
7630        LIST_SNAPSHOTS = 7;
7631        WRITE_STATUS = 8;
7632        UNKNOWN_TARGET_TYPE = 9;
7633        QUERY_SNAPSHOT_STATUS = 10;
7634        EXPECTED_MERGE_TARGET = 11;
7635        UNMERGED_SECTORS_AFTER_COMPLETION = 12;
7636        UNEXPECTED_MERGE_STATE = 13;
7637        GET_COW_PATH_CONSISTENCY_CHECK = 14;
7638        OPEN_COW_CONSISTENCY_CHECK = 15;
7639        PARSE_COW_CONSISTENCY_CHECK = 16;
7640        OPEN_COW_DIRECT_CONSISTENCY_CHECK = 17;
7641        MEM_ALIGN_CONSISTENCY_CHECK = 18;
7642        DIRECT_READ_CONSISTENCY_CHECK = 19;
7643        WRONG_MERGE_COUNT_CONSISTENCY_CHECK = 20;
7644    };
7645
7646    // Status of the update after the merge attempts.
7647    optional UpdateState final_state = 1;
7648
7649    // Time to complete a merge operation in milliseconds.
7650    // A negative value corresponds to the case in which the merge operation
7651    // was interrupted and resumed (e.g. in case of a system reboot during the
7652    // merge).
7653    optional int64 duration_millis = 2;
7654
7655    // Number of reboots that occurred after issuing and before completing the
7656    // merge of all the snapshot devices.
7657    optional int32 intermediate_reboots = 3;
7658
7659    // The device has been upgraded to Virtual A/B.
7660    optional bool is_vab_retrofit = 4;
7661
7662    // Space that has been temporarily allocated in the /data partition
7663    // containing the dm-snapshot's copy-on-write data generated during a
7664    // Virtual A/B update.
7665    optional int64 cow_file_size_bytes = 5;
7666
7667    // Whether the device enables Virtual A/B compression.
7668    optional bool vab_compression_enabled = 6;
7669
7670    // Whether this update attempt uses Virtual A/B compression.
7671    optional bool vab_compression_used = 7;
7672
7673    // Total size used by COWs, including /data and the super partition.
7674    optional int64 total_cow_size_bytes = 8;
7675
7676    // Sum of the estimated COW fields in the OTA manifest.
7677    optional int64 estimated_cow_size_bytes = 9;
7678
7679    // Time from boot to sys.boot_completed, in milliseconds.
7680    optional int32 boot_complete_time_millis = 10;
7681
7682    // Time from sys.boot_completed to merge start, in milliseconds.
7683    optional int32 boot_complete_to_merge_start_time_millis = 11;
7684
7685    optional MergeFailureCode merge_failure_code = 12;
7686
7687    // Build fingerprint at the time the OTA was downloaded.
7688    optional string source_build_fingerprint = 13;
7689
7690    // Build fingerprint at the time the merge was initiated.
7691    optional string target_build_fingerprint = 14;
7692
7693    // Whether the device enabled userspace snapshots.
7694    optional bool userspace_snapshots_enabled = 15;
7695
7696    // Whether this update attempt used userspace snapshots.
7697    optional bool userspace_snapshots_used = 16;
7698
7699    // Whether the device enabled XOR compression.
7700    optional bool xor_compression_enabled = 17;
7701
7702    // Whether this update attempt used XOR compression.
7703    optional bool xor_compression_used = 18;
7704
7705    // Whether this update attempt used io_uring.
7706    optional bool iouring_used = 19;
7707}
7708
7709/**
7710 * Event representing when BlobStoreManager.Session#commit() is called
7711 *
7712 * Logged from:
7713 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
7714 */
7715message BlobCommitted {
7716    // Uid of the Blob committer
7717    optional int32 uid = 1 [(is_uid) = true];
7718
7719    // Id of the Blob committed
7720    optional int64 blob_id = 2;
7721
7722    // Size of the Blob
7723    optional int64 size = 3;
7724
7725    enum Result {
7726        UNKNOWN = 0;
7727        // Commit Succeeded
7728        SUCCESS = 1;
7729        // Commit Failed: Error occurred during commit
7730        ERROR_DURING_COMMIT = 2;
7731        // Commit Failed: Digest of the data did not match Blob digest
7732        DIGEST_MISMATCH = 3;
7733        // Commit Failed: Allowed count limit exceeded
7734        COUNT_LIMIT_EXCEEDED = 4;
7735    }
7736    optional Result result = 4;
7737}
7738
7739/**
7740 * Event representing when BlobStoreManager#acquireLease() is called
7741 *
7742 * Logged from:
7743 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
7744 */
7745message BlobLeased{
7746    // Uid of the Blob leasee
7747    optional int32 uid = 1 [(is_uid) = true];
7748
7749    // Id of the Blob leased or 0 if the Blob does not exist
7750    optional int64 blob_id = 2;
7751
7752    // Size of the Blob or 0 if the Blob does not exist
7753    optional int64 size = 3;
7754
7755    enum Result {
7756        UNKNOWN = 0;
7757        // Lease Succeeded
7758        SUCCESS = 1;
7759        // Lease Failed: Blob does not exist
7760        BLOB_DNE = 2;
7761        // Lease Failed: Leasee does not have access to the Blob
7762        ACCESS_NOT_ALLOWED = 3;
7763        // Lease Failed: Leasee requested an invalid expiry duration
7764        LEASE_EXPIRY_INVALID = 4;
7765        // Lease Failed: Leasee has exceeded the total data lease limit
7766        DATA_SIZE_LIMIT_EXCEEDED = 5;
7767        // Leasee Failed: Allowed count limit exceeded
7768        COUNT_LIMIT_EXCEEDED = 6;
7769    }
7770    optional Result result = 4;
7771}
7772
7773/**
7774 * Event representing when BlobStoreManager#openBlob() is called
7775 *
7776 * Logged from:
7777 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
7778 */
7779message BlobOpened{
7780    // Uid of the Blob opener
7781    optional int32 uid = 1 [(is_uid) = true];
7782
7783    // Id of the Blob opened or 0 if the Blob does not exist
7784    optional int64 blob_id = 2;
7785
7786    // Size of the Blob or 0 if the Blob does not exist
7787    optional int64 size = 3;
7788
7789    enum Result {
7790        UNKNOWN = 0;
7791        // Open Succeeded
7792        SUCCESS = 1;
7793        // Open Failed: Blob does not exist
7794        BLOB_DNE = 2;
7795        // Open Failed: Opener does not have access to the Blob
7796        ACCESS_NOT_ALLOWED = 3;
7797    }
7798    optional Result result = 4;
7799}
7800
7801/**
7802 * Event to track Jank for various system interactions.
7803 *
7804 * Logged from:
7805 *  frameworks/base/core/java/com/android/internal/jank/FrameTracker.java
7806 *
7807 * Next Tag: 10
7808 */
7809message UIInteractionFrameInfoReported {
7810    optional android.jank.InteractionType interaction_type = 1;
7811
7812    optional android.jank.DisplayResolution display_resolution = 8;
7813
7814    optional android.jank.DisplayRefreshRate display_refresh_rate = 9;
7815
7816    // Number of frames rendered during the interaction.
7817    optional int64 total_frames = 2;
7818
7819    // Number of frames that were skipped in rendering during the interaction.
7820    optional int64 missed_frames = 3;
7821
7822    // Number of frames that were missed in Surface Flinger during the interaction.
7823    optional int64 sf_missed_frames = 5;
7824
7825    // Number of frames that were missed in the app during the interaction.
7826    optional int64 app_missed_frames = 6;
7827
7828    // Maximum time it took to render a single frame during the interaction.
7829    optional int64 max_frame_time_nanos = 4;
7830
7831    // Maximum number of successive frames missed.
7832    optional int64 max_successive_missed_frames = 7;
7833}
7834
7835/**
7836 * Event to track various latencies in SystemUI.
7837 *
7838 * Logged from:
7839 *  frameworks/base/core/java/com/android/internal/util/LatencyTracker.java
7840 */
7841message UIActionLatencyReported {
7842    optional android.jank.ActionType action = 1;
7843
7844    optional int64 latency_millis = 2;
7845}
7846
7847//////////////////////////////////////////////////////////////////////
7848// Pulled atoms below this line //
7849//////////////////////////////////////////////////////////////////////
7850
7851/**
7852 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
7853 *
7854 * Pulled from:
7855 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
7856 */
7857message WifiBytesTransfer {
7858    optional int32 uid = 1 [(is_uid) = true];
7859
7860    optional int64 rx_bytes = 2;
7861
7862    optional int64 rx_packets = 3;
7863
7864    optional int64 tx_bytes = 4;
7865
7866    optional int64 tx_packets = 5;
7867}
7868
7869/**
7870 * Pulls bytes transferred via wifi (separated by foreground and background usage).
7871 *
7872 * Pulled from:
7873 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
7874 */
7875message WifiBytesTransferByFgBg {
7876    optional int32 uid = 1 [(is_uid) = true];
7877
7878    // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
7879    optional bool is_foreground = 2;
7880
7881    optional int64 rx_bytes = 3;
7882
7883    optional int64 rx_packets = 4;
7884
7885    optional int64 tx_bytes = 5;
7886
7887    optional int64 tx_packets = 6;
7888}
7889
7890/**
7891 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
7892 *
7893 * Pulled from:
7894 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
7895 */
7896message MobileBytesTransfer {
7897    optional int32 uid = 1 [(is_uid) = true];
7898
7899    optional int64 rx_bytes = 2;
7900
7901    optional int64 rx_packets = 3;
7902
7903    optional int64 tx_bytes = 4;
7904
7905    optional int64 tx_packets = 5;
7906}
7907
7908/**
7909 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
7910 *
7911 * Pulled from:
7912 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
7913 */
7914message MobileBytesTransferByFgBg {
7915    optional int32 uid = 1 [(is_uid) = true];
7916
7917    // 1 denotes foreground and 0 denotes background. This is called Set in
7918    // NetworkStats.
7919    optional bool is_foreground = 2;
7920
7921    optional int64 rx_bytes = 3;
7922
7923    optional int64 rx_packets = 4;
7924
7925    optional int64 tx_bytes = 5;
7926
7927    optional int64 tx_packets = 6;
7928}
7929
7930/**
7931 * Used for pull network statistics via mobile|wifi networks, and sliced by interesting dimensions.
7932 * Note that the data is expected to be sliced into more dimensions in future. In other words,
7933 * the caller must not assume any row of data is one full report when filtering with a set of
7934 * matching conditions, because future data may represent with multiple rows what is currently
7935 * represented by one.
7936 * To avoid being broken by future slicing, callers must take care to aggregate rows even if they
7937 * query all the existing columns.
7938 *
7939 * Pulled from:
7940 *   StatsPullAtomService (using NetworkStatsService to get NetworkStats)
7941 */
7942message DataUsageBytesTransfer {
7943    // State of this record. Should be NetworkStats#SET_DEFAULT or NetworkStats#SET_FOREGROUND to
7944    // indicate the foreground state, or NetworkStats#SET_ALL to indicate the record is for all
7945    // states combined, not including debug states. See NetworkStats#SET_*.
7946    optional int32 state = 1;
7947
7948    optional int64 rx_bytes = 2;
7949
7950    optional int64 rx_packets = 3;
7951
7952    optional int64 tx_bytes = 4;
7953
7954    optional int64 tx_packets = 5;
7955
7956    // Radio Access Technology (RAT) type of this record, should be one of
7957    // TelephonyManager#NETWORK_TYPE_* constants, or NetworkTemplate#NETWORK_TYPE_ALL to indicate
7958    // the record is for all rat types combined.
7959    optional int32 rat_type = 6;
7960
7961    // Mcc/Mnc read from sim if the record is for a specific subscription, null indicates the
7962    // record is combined across subscriptions.
7963    optional string sim_mcc = 7;
7964    optional string sim_mnc = 8;
7965
7966    // Allows mobile virtual network operators (MVNOs) to be identified with individual IDs.
7967    // See TelephonyManager#getSimCarrierId.
7968    optional int32 carrier_id = 9;
7969
7970    // Enumeration of opportunistic states with an additional ALL state indicates the record is
7971    // combined regardless of the boolean value in its field.
7972    enum DataSubscriptionState {
7973        UNKNOWN = 0; // For server side backward compatibility.
7974        ALL = 1;
7975        OPPORTUNISTIC = 2;
7976        NOT_OPPORTUNISTIC = 3;
7977    }
7978    // Mark whether the subscription is an opportunistic data subscription, and ALL indicates the
7979    // record is combined across opportunistic data subscriptions.
7980    // See {@link SubscriptionManager#setOpportunistic}.
7981    optional DataSubscriptionState opportunistic_data_sub = 10;
7982
7983    // Indicate whether NR is connected, server side could use this with RAT type to determine if
7984    // the record is for 5G NSA (Non Stand Alone) mode, where the primary cell is still LTE and
7985    // network allocates a secondary 5G cell so telephony reports RAT = LTE along with NR state as
7986    // connected.
7987    optional bool is_nr_connected = 11;
7988}
7989
7990/**
7991 * Note: This is a copy from DataUsageBytesTransfer and add a metered field.
7992 * TODO: DataUsageBytesTransfer should be eventually replaced with DataUsageBytesTransferV2.
7993 *
7994 * Used for pull network statistics via mobile|wifi networks, and sliced by interesting dimensions.
7995 * Note that the data is expected to be sliced into more dimensions in future. In other words,
7996 * the caller must not assume any row of data is one full report when filtering with a set of
7997 * matching conditions, because future data may represent with multiple rows what is currently
7998 * represented by one.
7999 * To avoid being broken by future slicing, callers must take care to aggregate rows even if they
8000 * query all the existing columns.
8001 *
8002 * Pulled from:
8003 *   StatsPullAtomService (using NetworkStatsService to get NetworkStats)
8004 */
8005message DataUsageBytesTransferV2 {
8006    // State of this record. Should be NetworkStats#SET_DEFAULT or NetworkStats#SET_FOREGROUND to
8007    // indicate the foreground state, or NetworkStats#SET_ALL to indicate the record is for all
8008    // states combined, not including debug states. See NetworkStats#SET_*.
8009    optional int32 state = 1;
8010
8011    optional int64 rx_bytes = 2;
8012
8013    optional int64 rx_packets = 3;
8014
8015    optional int64 tx_bytes = 4;
8016
8017    optional int64 tx_packets = 5;
8018
8019    // Radio Access Technology (RAT) type of this record, should be one of
8020    // TelephonyManager#NETWORK_TYPE_* constants, or NetworkTemplate#NETWORK_TYPE_ALL to indicate
8021    // the record is for all rat types combined.
8022    optional int32 rat_type = 6;
8023
8024    // Mcc/Mnc read from sim if the record is for a specific subscription, null indicates the
8025    // record is combined across subscriptions.
8026    optional string sim_mcc = 7;
8027    optional string sim_mnc = 8;
8028
8029    // Allows mobile virtual network operators (MVNOs) to be identified with individual IDs.
8030    // See TelephonyManager#getSimCarrierId.
8031    optional int32 carrier_id = 9;
8032
8033    // Enumeration of opportunistic states with an additional DSS_ALL state indicates the record is
8034    // combined regardless of the boolean value in its field.
8035    enum DataSubscriptionState {
8036        DSS_UNKNOWN = 0; // For server side backward compatibility.
8037        DSS_ALL = 1;
8038        DSS_OPPORTUNISTIC = 2;
8039        DSS_NOT_OPPORTUNISTIC = 3;
8040    }
8041    // Mark whether the subscription is an opportunistic data subscription, and ALL indicates the
8042    // record is combined across opportunistic data subscriptions.
8043    // See {@link SubscriptionManager#setOpportunistic}.
8044    optional DataSubscriptionState opportunistic_data_sub = 10;
8045
8046    // Indicate whether NR is connected, server side could use this with RAT type to determine if
8047    // the record is for 5G NSA (Non Stand Alone) mode, where the primary cell is still LTE and
8048    // network allocates a secondary 5G cell so telephony reports RAT = LTE along with NR state as
8049    // connected.
8050    optional bool is_nr_connected = 11;
8051
8052    // Enumeration of metered states.
8053    enum MeteredState {
8054        METERED_UNKNOWN = 0;
8055        METERED_ALL = 1;
8056        METERED_NO = 2;
8057        METERED_YES = 3;
8058    }
8059    // Mark the reported data is metered or non-metered, and METERED_ALL indicates the record is
8060    // combined across metered data.
8061    optional MeteredState metered = 12;
8062}
8063
8064/**
8065 * Pulls bytes transferred via OEM managed networks. Data is split up by which
8066 * type of OEM managed network it is, what transport it went over, and if it was
8067 * in the foreground or background.
8068 *
8069 * Pulled from:
8070 *   StatsPullAtomService
8071 */
8072 message OemManagedBytesTransfer {
8073    optional int32 uid = 1 [(is_uid) = true];
8074
8075    // 1 denotes foreground and 0 denotes background. This is called Set in
8076    // NetworkStats.
8077    optional bool is_foreground = 2;
8078
8079    // Corresponds to the type of OEM managed network, see
8080    // {@link NetworkTemplate#OEM_MANAGED_ANY} and {@code NetworkIdentity#OEM_*}.
8081    optional int32 oem_managed_type = 3;
8082
8083    // Corresponds to the type of transport the bytes were transferred over, see
8084    // {@link NetworkTemplate#transportToMatchRule} and
8085    // {@code NetworkCapabilities#TRANSPORT_*}
8086    optional int32 transport_type = 4;
8087
8088    optional int64 rx_bytes = 5;
8089
8090    optional int64 rx_packets = 6;
8091
8092    optional int64 tx_bytes = 7;
8093
8094    optional int64 tx_packets = 8;
8095  }
8096
8097/**
8098 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
8099 *
8100 * Pulled from:
8101 *   StatsCompanionService
8102 */
8103message BluetoothBytesTransfer {
8104    optional int32 uid = 1 [(is_uid) = true];
8105
8106    optional int64 rx_bytes = 2;
8107
8108    optional int64 tx_bytes = 3;
8109}
8110
8111/**
8112 * Pulls the kernel wakelock durations. This atom is adapted from
8113 * android/internal/os/KernelWakelockStats.java
8114 *
8115 * Pulled from:
8116 *   StatsCompanionService using KernelWakelockReader.
8117 */
8118message KernelWakelock {
8119    optional string name = 1;
8120
8121    optional int32 count = 2;
8122
8123    optional int32 version = 3;
8124
8125    optional int64 time_micros = 4;
8126}
8127
8128/**
8129 * Pulls power state information.
8130 * Pulled from:
8131 *   frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
8132 */
8133message SubsystemSleepState {
8134    // Subsystem name
8135    optional string subsystem_name = 1;
8136    // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
8137    // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
8138    // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
8139    //    powerEntityStateName from the corresponding PowerEntityStateInfo.
8140    optional string subname = 2;
8141    // The number of times it entered, or voted for entering the sleep state
8142    optional uint64 count = 3;
8143    // The length of time spent in, or spent voting for, the sleep state
8144    optional uint64 time_millis = 4;
8145}
8146
8147/**
8148 * Pulls on-device power measurement information.
8149 * Pulled from:
8150 *   frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
8151 */
8152message OnDevicePowerMeasurement {
8153    // Name of the subsystem (to which the rail belongs).
8154    optional string subsystem_name = 1;
8155
8156    // Rail name. The rail lies within the subsystem.
8157    optional string rail_name = 2;
8158
8159    // Time (in ms since boot) at which the rail energy value was measured.
8160    // This may differ slightly from the time that statsd logs this information.
8161    optional uint64 measurement_timestamp_millis = 3;
8162
8163    // Accumulated energy used via the rail since device boot in uWs.
8164    optional uint64 energy_microwatt_secs = 4;
8165}
8166
8167/**
8168 * Pulls Cpu time per cluster per frequency.
8169 * This is tracked by the timeInState eBPF program.
8170 */
8171message CpuTimePerClusterFreq {
8172    optional uint32 cluster = 1;
8173    optional uint32 freq_khz = 2;
8174    // Time spent at this frequency excluding sleep since tracking started.
8175    optional uint64 time_millis = 3;
8176}
8177
8178/**
8179 * Pulls Cpu Time Per Uid.
8180 * Note that isolated process uid time should be attributed to host uids.
8181 */
8182message CpuTimePerUid {
8183    optional int32 uid = 1 [(is_uid) = true];
8184    optional uint64 user_time_micros = 2;
8185    optional uint64 sys_time_micros = 3;
8186}
8187
8188/**
8189 * Pulls Cpu Cycles Per Uid Per Cluster.
8190 * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
8191 * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
8192 * because they are recycled and removed from the underlying data source. All uids are normalized
8193 * to their base uids.
8194 */
8195message CpuCyclesPerUidCluster {
8196    optional int32 uid = 1 [(is_uid) = true];
8197    optional int32 cluster = 2;
8198    // Megacycles, i.e. millions of cycles.
8199    optional int64 mcycles = 3;
8200    // Time excluding sleep since tracking started.
8201    optional int64 time_millis = 4;
8202    // Power estimate: time * average power for frequency / 1000.
8203    optional int64 power_profile_estimate = 5;
8204}
8205
8206/**
8207 * Pulls Cpu Time Per Uid per frequency.
8208 * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
8209 * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
8210 * because they are recycled and removed from the underlying data source. All uids are normalized
8211 * to their base uids.
8212 */
8213message CpuTimePerUidFreq {
8214    optional int32 uid = 1 [(is_uid) = true];
8215    optional uint32 freq_index = 2;
8216    optional uint64 time_millis = 3;
8217}
8218
8219/**
8220  * Pulls Cpu Cycles Per ThreadGroup Per Cluster.
8221  * This is tracked by the timeInState eBPF program.
8222  */
8223message CpuCyclesPerThreadGroupCluster {
8224    enum ThreadGroup {
8225        UNKNOWN_THREAD_GROUP = 0;
8226
8227        // System server threads serving Binder calls.
8228        SYSTEM_SERVER_BINDER = 1;
8229
8230        // All system server threads.
8231        SYSTEM_SERVER = 2;
8232
8233        // All surface flinger threads.
8234        SURFACE_FLINGER = 3;
8235    }
8236    optional ThreadGroup thread_group = 1;
8237
8238    optional int32 cluster = 2;
8239
8240    // Megacycles, i.e. millions of cycles.
8241    optional int64 mcycles = 3;
8242    // Time excluding sleep since tracking started.
8243    optional int64 time_millis = 4;
8244}
8245
8246/**
8247 * Pulls Wifi Controller Activity Energy Info
8248 */
8249message WifiActivityInfo {
8250    // timestamp(wall clock) of record creation
8251    optional uint64 timestamp_millis = 1;
8252    // stack reported state
8253    // TODO: replace this with proto enum
8254    optional int32 stack_state = 2;
8255    // tx time in millis
8256    optional uint64 controller_tx_time_millis = 3;
8257    // rx time in millis
8258    optional uint64 controller_rx_time_millis = 4;
8259    // idle time in millis
8260    optional uint64 controller_idle_time_millis = 5;
8261    // product of current(mA), voltage(V) and time(ms)
8262    optional uint64 controller_energy_used = 6;
8263}
8264
8265/**
8266 * Pulls Modem Activity Energy Info
8267 */
8268message ModemActivityInfo {
8269    // timestamp(wall clock) of record creation
8270    optional uint64 timestamp_millis = 1;
8271    // sleep time in millis.
8272    optional uint64 sleep_time_millis = 2;
8273    // idle time in millis
8274    optional uint64 controller_idle_time_millis = 3;
8275    /**
8276     * Tx power index
8277     * index 0 = tx_power < 0dBm
8278     * index 1 = 0dBm < tx_power < 5dBm
8279     * index 2 = 5dBm < tx_power < 15dBm
8280     * index 3 = 15dBm < tx_power < 20dBm
8281     * index 4 = tx_power > 20dBm
8282     */
8283    // tx time in ms at power level 0
8284    optional uint64 controller_tx_time_pl0_millis = 4;
8285    // tx time in ms at power level 1
8286    optional uint64 controller_tx_time_pl1_millis = 5;
8287    // tx time in ms at power level 2
8288    optional uint64 controller_tx_time_pl2_millis = 6;
8289    // tx time in ms at power level 3
8290    optional uint64 controller_tx_time_pl3_millis = 7;
8291    // tx time in ms at power level 4
8292    optional uint64 controller_tx_time_pl4_millis = 8;
8293    // rx time in ms at power level 5
8294    optional uint64 controller_rx_time_millis = 9;
8295    // product of current(mA), voltage(V) and time(ms)
8296    optional uint64 energy_used = 10 [deprecated=true];
8297}
8298
8299/**
8300 * Pulls Bluetooth Activity Energy Info
8301 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
8302 */
8303message BluetoothActivityInfo {
8304    // timestamp(wall clock) of record creation
8305    optional uint64 timestamp_millis = 1;
8306    // bluetooth stack state
8307    optional int32 bluetooth_stack_state = 2;
8308    // tx time in millis
8309    optional uint64 controller_tx_time_millis = 3;
8310    // rx time in millis
8311    optional uint64 controller_rx_time_millis = 4;
8312    // idle time in millis
8313    optional uint64 controller_idle_time_millis = 5;
8314    // product of current(mA), voltage(V) and time(ms)
8315    optional uint64 energy_used = 6;
8316}
8317
8318/*
8319 * Logs the memory stats for a process.
8320 *
8321 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
8322 */
8323message ProcessMemoryState {
8324    // The uid if available. -1 means not available.
8325    optional int32 uid = 1 [(is_uid) = true];
8326
8327    // The process name.
8328    // Usually package name, "system" for system server.
8329    // Provided by ActivityManagerService.
8330    optional string process_name = 2;
8331
8332    // Current OOM score adjustment. Value read from ProcessRecord.
8333    optional int32 oom_adj_score = 3;
8334
8335    // # of page-faults
8336    optional int64 page_fault = 4;
8337
8338    // # of major page-faults
8339    optional int64 page_major_fault = 5;
8340
8341    // RSS
8342    // Value is read from memory.stat, field total_rss if per-app memory
8343    // cgroups are enabled. Otherwise, value from /proc/pid/stat.
8344    optional int64 rss_in_bytes = 6;
8345
8346    // CACHE
8347    // Value is read from memory.stat, field total_cache if per-app memory
8348    // cgroups are enabled. Otherwise, 0.
8349    optional int64 cache_in_bytes = 7;
8350
8351    // SWAP
8352    // Value is read from memory.stat, field total_swap if per-app memory
8353    // cgroups are enabled. Otherwise, 0.
8354    optional int64 swap_in_bytes = 8;
8355
8356    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always -1.
8357    optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
8358
8359    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
8360    optional int64 start_time_nanos = 10 [deprecated = true];
8361
8362    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
8363    optional int32 anon_rss_and_swap_in_kilobytes = 11 [deprecated = true];
8364}
8365
8366/*
8367 * Logs the memory high-water mark for a process.
8368 *
8369 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
8370 * and for selected native processes.
8371 *
8372 * Pulling this atom resets high-water mark counters for all processes.
8373 */
8374message ProcessMemoryHighWaterMark {
8375    // The uid if available. -1 means not available.
8376    optional int32 uid = 1 [(is_uid) = true];
8377
8378    // The process name.
8379    // Usually package name or process cmdline.
8380    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
8381    optional string process_name = 2;
8382
8383    // Deprecated: use rss_high_water_mark_in_kilobytes instead. This field is
8384    // computed by converting kilobytes to bytes.
8385    optional int64 rss_high_water_mark_in_bytes = 3 [deprecated = true];
8386
8387    // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
8388    // /proc/PID/status.
8389    optional int32 rss_high_water_mark_in_kilobytes = 4;
8390}
8391
8392/*
8393 * Logs the memory stats for a process.
8394 *
8395 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService)
8396 * and for selected native processes.
8397 */
8398message ProcessMemorySnapshot {
8399    // The uid if available. -1 means not available.
8400    optional int32 uid = 1 [(is_uid) = true];
8401
8402    // The process name.
8403    // Usually package name or process cmdline.
8404    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
8405    optional string process_name = 2;
8406
8407    // The pid of the process.
8408    // Allows to disambiguate instances of the process.
8409    optional int32 pid = 3;
8410
8411    // The current OOM score adjustment value.
8412    // Read from ProcessRecord for managed processes.
8413    // Placeholder -1001 (OOM_SCORE_ADJ_MIN - 1, outside of allowed range) for native ones.
8414    optional int32 oom_score_adj = 4;
8415
8416    // The current RSS of the process.
8417    // VmRSS from /proc/pid/status.
8418    optional int32 rss_in_kilobytes = 5;
8419
8420    // The current anon RSS of the process.
8421    // RssAnon from /proc/pid/status.
8422    optional int32 anon_rss_in_kilobytes = 6;
8423
8424    // The current swap size of the process.
8425    // VmSwap from /proc/pid/status.
8426    optional int32 swap_in_kilobytes = 7;
8427
8428    // The sum of rss_in_kilobytes and swap_in_kilobytes.
8429    optional int32 anon_rss_and_swap_in_kilobytes = 8;
8430
8431    // GPU memory usage as measured by the kernel tracepoints
8432    // Equivalent to dumpsys gpu --gpumem
8433    optional int32 gpu_memory_kb = 9;
8434
8435    // Whether or not this process is hosting one or more foregound services.
8436    optional bool has_foreground_services = 10;
8437
8438    // The current rss memory in shared space.
8439    optional int32 shmem_kb = 11;
8440
8441    // The types of the components this process is hosting at the moment this
8442    // snapshot is taken.
8443    // See the available types in HostingComponentType in AppProtoEnums.
8444    optional int32 current_hosting_component_types = 12;
8445
8446    // The historical types of the components this process is or was hosting
8447    // since it's born.
8448    // See the available types in HostingComponentType in AppProtoEnums.
8449    optional int32 historical_hosting_component_types = 13;
8450}
8451
8452/*
8453 * Elapsed real time from SystemClock.
8454 */
8455message SystemElapsedRealtime {
8456    optional uint64 time_millis = 1;
8457}
8458
8459/*
8460 * Up time from SystemClock.
8461 */
8462message SystemUptime {
8463    // Milliseconds since the system was booted.
8464    // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
8465    // for external input).
8466    // It is not affected by clock scaling, idle, or other power saving mechanisms.
8467    optional uint64 uptime_millis = 1;
8468}
8469
8470/*
8471 * Reads from /proc/uid_concurrent_active_time which has the format:
8472 * active: X (X is # cores)
8473 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
8474 * [uid1]: [time-0] [time-1] [time-2] ... ...
8475 * ...
8476 * Time-N means the CPU time a UID spent running concurrently with N other processes.
8477 * The file contains a monotonically increasing count of time for a single boot.
8478 */
8479message CpuActiveTime {
8480    optional int32 uid = 1 [(is_uid) = true];
8481    optional uint64 time_millis = 2;
8482}
8483
8484/**
8485 * Reads from /proc/uid_concurrent_policy_time which has the format:
8486 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
8487 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
8488 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
8489 * ...
8490 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
8491 * The file contains a monotonically increasing count of time for a single boot.
8492 */
8493message CpuClusterTime {
8494    optional int32 uid = 1 [(is_uid) = true];
8495    optional int32 cluster_index = 2;
8496    optional uint64 time_millis = 3;
8497}
8498
8499/*
8500 * Pulls free disk space, for data, system partition and temporary directory.
8501 */
8502message DiskSpace {
8503    // available bytes in data partition
8504    optional uint64 data_available_bytes = 1;
8505    // available bytes in system partition
8506    optional uint64 system_available_bytes = 2;
8507    // available bytes in download cache or temp directories
8508    optional uint64 temp_available_bytes = 3;
8509}
8510
8511/**
8512 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
8513 *
8514 * Pulled from StatsCompanionService.java
8515 */
8516message RemainingBatteryCapacity {
8517    optional int32 charge_micro_ampere_hour = 1;
8518}
8519
8520/**
8521 * Pulls battery capacity, which is the battery capacity when full in uAh.
8522 * Pulled from:
8523 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
8524 */
8525message FullBatteryCapacity {
8526    optional int32 capacity_micro_ampere_hour = 1;
8527}
8528
8529/**
8530 * Pulls battery voltage.
8531 * Pulled from:
8532 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
8533 */
8534message BatteryVoltage {
8535    // The voltage of the battery, in millivolts.
8536    optional int32 voltage_millivolt = 1;
8537}
8538
8539/**
8540 * Pulls battery level (percent full, from 0 to 100).
8541 *
8542 * Pulled from:
8543 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
8544 */
8545message BatteryLevel {
8546    // Battery level. Should be in [0, 100].
8547    optional int32 battery_level = 1;
8548}
8549
8550/**
8551 * Pulls the temperature of various parts of the device.
8552 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
8553 *
8554 * Pulled from StatsCompanionService.java
8555 */
8556message Temperature {
8557    // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
8558    optional android.os.TemperatureTypeEnum sensor_location = 1;
8559
8560    // The name of the temperature source. Eg. CPU0
8561    optional string sensor_name = 2;
8562
8563    // Temperature in tenths of a degree C.
8564    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
8565    optional int32 temperature_deci_celsius = 3;
8566
8567    // Relative severity of the throttling, see enum definition.
8568    optional android.os.ThrottlingSeverityEnum severity = 4;
8569}
8570
8571/**
8572 * Pulls the statistics of calls to Binder.
8573 *
8574 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
8575 * config on the device.
8576 *
8577 * Next tag: 15
8578 */
8579message BinderCalls {
8580    // UID of the process responsible for the binder transaction. It will be set if the process
8581    // executing the binder transaction attribute the transaction to another uid using
8582    // Binder.setThreadWorkSource().
8583    //
8584    // If not set, the value will be -1.
8585    optional int32 uid = 1 [(is_uid) = true];
8586    // UID of the process executing the binder transaction.
8587    optional int32 direct_caller_uid = 14;
8588    // Fully qualified class name of the API call.
8589    //
8590    // This is a system server class name.
8591    //
8592    // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
8593    // gets recycled and we have isolated uids, we might attribute the data incorrectly.
8594    // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
8595    // commonly used APIs.
8596    optional string service_class_name = 2;
8597    // Method name of the API call. It can also be a transaction code if we cannot
8598    // resolve it to a name. See Binder#getTransactionName.
8599    //
8600    // This is a system server method name.
8601    optional string service_method_name = 3;
8602    // Total number of API calls.
8603    optional int64 call_count = 4;
8604    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
8605    optional bool screen_interactive = 13;
8606    // Total number of API calls we have data recorded for. If we collected data for all the calls,
8607    // call_count will be equal to recorded_call_count.
8608    //
8609    // If recorded_call_count is different than call_count, it means data collection has been
8610    // sampled. All the fields below will be sampled in this case.
8611    optional int64 recorded_call_count = 12;
8612    // Number of exceptions thrown by the API.
8613    optional int64 recorded_exception_count = 5;
8614    // Total latency of all API calls.
8615    // Average can be computed using total_latency_micros / recorded_call_count.
8616    optional int64 recorded_total_latency_micros = 6;
8617    // Maximum latency of one API call.
8618    optional int64 recorded_max_latency_micros = 7;
8619    // Total CPU usage of all API calls.
8620    // Average can be computed using total_cpu_micros / recorded_call_count.
8621    // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
8622    optional int64 recorded_total_cpu_micros = 8;
8623    // Maximum CPU usage of one API call.
8624    optional int64 recorded_max_cpu_micros = 9;
8625    // Maximum parcel reply size of one API call.
8626    optional int64 recorded_max_reply_size_bytes = 10;
8627    // Maximum parcel request size of one API call.
8628    optional int64 recorded_max_request_size_bytes = 11;
8629}
8630
8631/**
8632 * Pulls the statistics of exceptions during calls to Binder.
8633 *
8634 * Binder stats are cumulative from boot unless somebody reset the data using
8635 * > adb shell dumpsys binder_calls_stats --reset
8636 */
8637message BinderCallsExceptions {
8638    // Exception class name, e.g. java.lang.IllegalArgumentException.
8639    //
8640    // This is an exception class name thrown by the system server.
8641    optional string exception_class_name = 1;
8642    // Total number of exceptions.
8643    optional int64 exception_count = 2;
8644}
8645
8646/**
8647 * Pulls the statistics of message dispatching on HandlerThreads.
8648 *
8649 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
8650 * config on the device.
8651 *
8652 * Next tag: 11
8653 */
8654message LooperStats {
8655    // The uid that made a call to the System Server and caused the message to be enqueued.
8656    optional int32 uid = 1 [(is_uid) = true];
8657
8658    // Fully qualified class name of the handler target class.
8659    //
8660    // This field does not contain PII. This is a system server class name.
8661    optional string handler_class_name = 2;
8662
8663    // The name of the thread that runs the Looper.
8664    //
8665    // This field does not contain PII. This is a system server thread name.
8666    optional string looper_thread_name = 3;
8667
8668    // The name of the dispatched message.
8669    //
8670    // This field does not contain PII. This is a system server constant or class
8671    // name.
8672    optional string message_name = 4;
8673
8674    // Total number of successfully dispatched messages.
8675    optional int64 message_count = 5;
8676
8677    // Total number of messages that failed dispatching.
8678    optional int64 exception_count = 6;
8679
8680    // Total number of processed messages we have data recorded for. If we
8681    // collected data for all the messages, message_count will be equal to
8682    // recorded_message_count.
8683    //
8684    // If recorded_message_count is different than message_count, it means data
8685    // collection has been sampled. The fields below will be sampled in this case.
8686    optional int64 recorded_message_count = 7;
8687
8688    // Total latency of all processed messages.
8689    // Average can be computed using recorded_total_latency_micros /
8690    // recorded_message_count.
8691    optional int64 recorded_total_latency_micros = 8;
8692
8693    // Total CPU usage of all processed message.
8694    // Average can be computed using recorded_total_cpu_micros /
8695    // recorded_message_count. Total can be computed using
8696    // recorded_total_cpu_micros / recorded_message_count * message_count.
8697    optional int64 recorded_total_cpu_micros = 9;
8698
8699    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
8700    optional bool screen_interactive = 10;
8701
8702    // Max recorded CPU usage of all processed messages.
8703    optional int64 recorded_max_cpu_micros = 11;
8704
8705    // Max recorded latency of all processed messages.
8706    optional int64 recorded_max_latency_micros = 12;
8707
8708    // Total number of messages we tracked the dispatching delay for. If we
8709    // collected data for all the messages, message_count will be equal to
8710    // recorded_delay_message_count.
8711    //
8712    // If recorded_delay_message_count is different than message_count, it means data
8713    // collection has been sampled or/and not all messages specified the target dispatch time.
8714    // The fields below will be sampled in this case.
8715    optional int64 recorded_delay_message_count = 13;
8716
8717    // Total dispatching delay of all processed messages.
8718    // Calculated as a difference between the target dispatching time (Message.when)
8719    // and the actual dispatching time.
8720    // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
8721    optional int64 recorded_total_delay_millis = 14;
8722
8723    // Max dispatching delay of all processed messages.
8724    // Calculated as a difference between the target dispatching time (Message.when)
8725    // and the actual dispatching time.
8726    optional int64 recorded_max_delay_millis = 15;
8727}
8728
8729/**
8730 * Pulls disk information, such as write speed and latency.
8731 */
8732message DiskStats {
8733    // Time taken to open, write 512B to, and close a file.
8734    // -1 if error performing the check.
8735    optional int64 data_write_latency_millis = 1;
8736
8737    optional bool file_based_encryption = 2;
8738
8739    // Recent disk write speed in kB/s.
8740    // -1 if error querying storageed.
8741    // 0 if data is unavailable.
8742    optional int32 recent_disk_write_speed = 3;
8743}
8744
8745
8746/**
8747 * Free and total bytes of the Data, Cache, System, and Metadata partitions.
8748 */
8749message DirectoryUsage {
8750    enum Directory {
8751        UNKNOWN = 0;
8752        DATA = 1;
8753        CACHE = 2;
8754        SYSTEM = 3;
8755        METADATA = 4;
8756    }
8757    optional Directory directory = 1;
8758    optional int64 free_bytes = 2;
8759    optional int64 total_bytes = 3;
8760}
8761
8762
8763/**
8764 * Size of an application: apk size, data size, and cache size.
8765 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
8766 * Information is only reported for apps with the primary user (user 0).
8767 * Sizes are aggregated by package name.
8768 */
8769message AppSize {
8770    // Including uids will involve modifying diskstats logic.
8771    optional string package_name = 1;
8772    // App size in bytes. -1 if unavailable.
8773    optional int64 app_size_bytes = 2;
8774    // App data size in bytes. -1 if unavailable.
8775    optional int64 app_data_size_bytes = 3;
8776    // App cache size in bytes. -1 if unavailable.
8777    optional int64 app_cache_size_bytes = 4;
8778    // Time that the cache file was produced.
8779    // Uses System.currentTimeMillis(), which is wall clock time.
8780    optional int64 cache_time_millis = 5;
8781}
8782
8783
8784/**
8785 * Size of a particular category. Eg: photos, videos.
8786 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
8787 */
8788message CategorySize {
8789    enum Category {
8790        UNKNOWN = 0;
8791        APP_SIZE = 1;
8792        APP_DATA_SIZE = 2;
8793        APP_CACHE_SIZE = 3;
8794        PHOTOS = 4;
8795        VIDEOS = 5;
8796        AUDIO = 6;
8797        DOWNLOADS = 7;
8798        SYSTEM = 8;
8799        OTHER = 9;
8800    }
8801    optional Category category = 1;
8802    // Category size in bytes.
8803    optional int64 size_bytes = 2;
8804    // Time that the cache file was produced.
8805    // Uses System.currentTimeMillis(), which is wall clock time.
8806    optional int64 cache_time_millis = 3;
8807}
8808
8809/**
8810 * Pulls per uid I/O stats. The stats are cumulative since boot.
8811 *
8812 * Read/write bytes are I/O events from a storage device
8813 * Read/write chars are data requested by read/write syscalls, and can be
8814 *   satisfied by caching.
8815 *
8816 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
8817 */
8818message DiskIo {
8819    optional int32 uid = 1 [(is_uid) = true];
8820    optional int64 fg_chars_read = 2;
8821    optional int64 fg_chars_write = 3;
8822    optional int64 fg_bytes_read = 4;
8823    optional int64 fg_bytes_write = 5;
8824    optional int64 bg_chars_read = 6;
8825    optional int64 bg_chars_write = 7;
8826    optional int64 bg_bytes_read = 8;
8827    optional int64 bg_bytes_write = 9;
8828    optional int64 fg_fsync = 10;
8829    optional int64 bg_fsync= 11;
8830}
8831
8832
8833/**
8834 * Pulls the number of fingerprints for each user.
8835 *
8836 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
8837 */
8838message NumFingerprintsEnrolled {
8839    // The associated user. Eg: 0 for owners, 10+ for others.
8840    // Defined in android/os/UserHandle.java
8841    optional int32 user = 1;
8842    // Number of fingerprints registered to that user.
8843    optional int32 num_fingerprints_enrolled = 2;
8844}
8845
8846/**
8847 * Pulls the number of faces for each user.
8848 *
8849 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
8850 */
8851message NumFacesEnrolled {
8852    // The associated user. Eg: 0 for owners, 10+ for others.
8853    // Defined in android/os/UserHandle.java
8854    optional int32 user = 1;
8855    // Number of faces registered to that user.
8856    optional int32 num_faces_enrolled = 2;
8857}
8858/**
8859 * A mapping of role holder -> role
8860 */
8861message RoleHolder {
8862    // uid of the role holder
8863    optional int32 uid = 1 [(is_uid) = true];
8864
8865    // package name of the role holder
8866    optional string package_name = 2;
8867
8868    // the role held
8869    optional string role = 3;
8870}
8871
8872message AggStats {
8873    // These are all in byte resolution.
8874    optional int64 min = 1 [deprecated = true];
8875    optional int64 average = 2 [deprecated = true];
8876    optional int64 max = 3 [deprecated = true];
8877
8878    // These are all in kilobyte resolution. Can fit in int32, so smaller on the wire than the above
8879    // int64 fields.
8880    optional int32 mean_kb = 4;
8881    optional int32 max_kb = 5;
8882}
8883
8884// A reduced subset of process states; reducing the number of possible states allows more
8885// aggressive device-side aggregation of statistics and hence reduces metric upload size.
8886enum ProcessStateAggregated {
8887    PROCESS_STATE_UNKNOWN = 0;
8888    // Persistent system process.
8889    PROCESS_STATE_PERSISTENT = 1;
8890    // Top activity; actually any visible activity.
8891    PROCESS_STATE_TOP = 2;
8892    // Process binding to top or a foreground service.
8893    PROCESS_STATE_BOUND_TOP_OR_FGS = 3;
8894    // Processing running a foreground service.
8895    PROCESS_STATE_FGS = 4;
8896    // Important foreground process (ime, wallpaper, etc).
8897    PROCESS_STATE_IMPORTANT_FOREGROUND = 5;
8898    // Important background process.
8899    PROCESS_STATE_BACKGROUND = 6;
8900    // Process running a receiver.
8901    PROCESS_STATE_RECEIVER = 7;
8902    // All kinds of cached processes.
8903    PROCESS_STATE_CACHED = 8;
8904}
8905
8906// Next tag: 13
8907message ProcessStatsStateProto {
8908    optional android.service.procstats.ScreenState screen_state = 1;
8909
8910    optional android.service.procstats.MemoryState memory_state = 2 [deprecated = true];
8911
8912    // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
8913    // and not frameworks/base/core/java/android/app/ActivityManager.java
8914    optional android.service.procstats.ProcessState process_state = 3 [deprecated = true];
8915
8916    optional ProcessStateAggregated process_state_aggregated = 10;
8917
8918    // Millisecond uptime duration spent in this state
8919    optional int64 duration_millis = 4 [deprecated = true];
8920    // Same as above, but with minute resolution so it fits into an int32.
8921    optional int32 duration_minutes = 11;
8922
8923    // Millisecond elapsed realtime duration spent in this state
8924    optional int64 realtime_duration_millis = 9 [deprecated = true];
8925    // Same as above, but with minute resolution so it fits into an int32.
8926    optional int32 realtime_duration_minutes = 12;
8927
8928    // # of samples taken
8929    optional int32 sample_size = 5;
8930
8931    // PSS is memory reserved for this process
8932    optional AggStats pss = 6 [deprecated = true];
8933
8934    // USS is memory shared between processes, divided evenly for accounting
8935    optional AggStats uss = 7 [deprecated = true];
8936
8937    // RSS is memory resident for this process
8938    optional AggStats rss = 8;
8939}
8940
8941// Next Tag: 8
8942message ProcessStatsProto {
8943    // Name of process.
8944    optional string process = 1;
8945
8946    // Uid of the process.
8947    optional int32 uid = 2 [(is_uid) = true];
8948
8949    // Information about how often kills occurred
8950    message Kill {
8951        // Count of excessive CPU kills
8952        optional int32 cpu = 1;
8953
8954        // Count of kills when cached
8955        optional int32 cached = 2;
8956
8957        // PSS stats during cached kill
8958        optional AggStats cached_pss = 3;
8959    }
8960    optional Kill kill = 3 [deprecated = true];
8961
8962    // Time and memory spent in various states.
8963    repeated ProcessStatsStateProto states = 5;
8964
8965    // Total time process has been running...  screen_state, memory_state, and process_state
8966    // will not be set.
8967    optional ProcessStatsStateProto total_running_state = 6;
8968
8969    // Association data for this process in this state;
8970    // each entry here is one association.
8971    repeated ProcessStatsAssociationProto assocs = 7;
8972}
8973
8974// Next Tag: 6
8975message ProcessStatsAssociationProto {
8976    // Procss Name of the associated process (client process of service binding)
8977    optional string assoc_process_name = 1;
8978
8979    // Package Name of the associated package (client package of service binding)
8980    optional string assoc_package_name = 2 [deprecated = true];
8981
8982    // UID of the associated process/package (client package of service binding)
8983    optional int32 assoc_uid = 5 [(is_uid) = true];
8984
8985    // Total count of the times this association (service binding) appeared.
8986    optional int32 total_count = 3;
8987
8988    // Uptime total duration in seconds this association (service binding) was around.
8989    optional int32 total_duration_secs = 4;
8990}
8991
8992message PackageServiceOperationStatsProto {
8993    // Operate enum: Started, Foreground, Bound, Executing
8994    optional android.service.procstats.ServiceOperationState operation = 1;
8995
8996    // Number of times the service was in this operation.
8997    optional int32 count = 2;
8998
8999    // Information about a state the service can be in.
9000    message StateStats {
9001        // Screen state enum.
9002        optional android.service.procstats.ScreenState screen_state = 1;
9003        // Memory state enum.
9004        optional android.service.procstats.MemoryState memory_state = 2;
9005
9006        // duration in milliseconds.
9007        optional int64 duration_millis = 3;
9008        // Millisecond elapsed realtime duration spent in this state
9009        optional int64 realtime_duration_millis = 4;
9010    }
9011    repeated StateStats state_stats = 3;
9012}
9013
9014message PackageServiceStatsProto {
9015    // Name of service component.
9016    optional string service_name = 1;
9017
9018    // The operation stats.
9019    // The package_name, package_uid, package_version, service_name will not be set to save space.
9020    repeated PackageServiceOperationStatsProto operation_stats = 2;
9021}
9022
9023message PackageAssociationSourceProcessStatsProto {
9024    // Uid of the process.
9025    optional int32 process_uid = 1;
9026    // Process name.
9027    optional string process_name = 2;
9028    // Package name.
9029    optional string package_name = 7;
9030    // Total count of the times this association appeared.
9031    optional int32 total_count = 3;
9032
9033    // Millisecond uptime total duration this association was around.
9034    optional int64 total_duration_millis = 4;
9035
9036    // Total count of the times this association became actively impacting its target process.
9037    optional int32 active_count = 5;
9038
9039    // Information on one source in this association.
9040    message StateStats {
9041        // Process state enum.
9042        optional android.service.procstats.ProcessState process_state = 1;
9043        // Millisecond uptime duration spent in this state
9044        optional int64 duration_millis = 2;
9045        // Millisecond elapsed realtime duration spent in this state
9046        optional int64 realtime_duration_mmillis = 3;
9047    }
9048    repeated StateStats active_state_stats = 6;
9049}
9050
9051message PackageAssociationProcessStatsProto {
9052    // Name of the target component.
9053    optional string component_name = 1;
9054    // Information on one source in this association.
9055    repeated PackageAssociationSourceProcessStatsProto sources = 2;
9056}
9057
9058
9059message ProcessStatsPackageProto {
9060    // Name of package.
9061    optional string package = 1;
9062
9063    // Uid of the package.
9064    optional int32 uid = 2;
9065
9066    // Version of the package.
9067    optional int64 version = 3;
9068
9069    // Stats for each process running with the package loaded in to it.
9070    repeated ProcessStatsProto process_stats = 4;
9071
9072    // Stats for each of the package's services.
9073    repeated PackageServiceStatsProto service_stats = 5;
9074
9075    // Stats for each association with the package.
9076    repeated PackageAssociationProcessStatsProto association_stats = 6;
9077}
9078
9079message ProcessStatsSectionProto {
9080    // Elapsed realtime at start of report.
9081    optional int64 start_realtime_millis = 1;
9082
9083    // Elapsed realtime at end of report.
9084    optional int64 end_realtime_millis = 2;
9085
9086    // CPU uptime at start of report.
9087    optional int64 start_uptime_millis = 3;
9088
9089    // CPU uptime at end of report.
9090    optional int64 end_uptime_millis = 4;
9091
9092    // System runtime library. e.g. "libdvm.so", "libart.so".
9093    optional string runtime = 5;
9094
9095    // whether kernel reports swapped pss.
9096    optional bool has_swapped_pss = 6;
9097
9098    // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
9099    enum Status {
9100        STATUS_UNKNOWN = 0;
9101        STATUS_COMPLETE = 1;
9102        STATUS_PARTIAL = 2;
9103        STATUS_SHUTDOWN = 3;
9104        STATUS_SYSPROPS = 4;
9105    }
9106    repeated Status status = 7;
9107
9108    // Number of pages available of various types and sizes, representation fragmentation.
9109    repeated ProcessStatsAvailablePagesProto available_pages = 10;
9110
9111    // Stats for each process.
9112    repeated ProcessStatsProto process_stats = 8;
9113
9114    // Stats for each package.
9115    repeated ProcessStatsPackageProto package_stats = 9;
9116}
9117
9118message ProcessStatsAvailablePagesProto {
9119    // Node these pages are in (as per /proc/pagetypeinfo)
9120    optional int32 node = 1;
9121
9122    // Zone these pages are in (as per /proc/pagetypeinfo)
9123    optional string zone = 2;
9124
9125    // Label for the type of these pages (as per /proc/pagetypeinfo)
9126    optional string label = 3;
9127
9128    // Distribution of number of pages available by order size.  First entry in array is
9129    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
9130    repeated int32 pages_per_order = 4;
9131}
9132
9133/**
9134 * Pulled from ProcessStatsService.java
9135 */
9136message ProcStats {
9137    optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
9138    // Data pulled from device into this is sometimes sharded across multiple atoms to work around
9139    // a size limit. When this happens, this shard ID will contain an increasing 1-indexed integer
9140    // with the number of this shard.
9141    optional int32 shard_id = 2;
9142}
9143
9144/**
9145 * Pulled from ProcessStatsService.java
9146 */
9147message ProcStatsPkgProc {
9148    optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
9149}
9150
9151// Next Tag: 2
9152message PackageRemoteViewInfoProto {
9153    optional string package_name = 1;
9154    // add per-package additional info here (like channels)
9155}
9156
9157// Next Tag: 2
9158message NotificationRemoteViewsProto {
9159    repeated PackageRemoteViewInfoProto package_remote_view_info = 1;
9160}
9161
9162/**
9163 * Pulled from NotificationManagerService.java
9164 */
9165message NotificationRemoteViews {
9166    optional NotificationRemoteViewsProto notification_remote_views = 1 [(log_mode) = MODE_BYTES];
9167}
9168
9169/**
9170 * Atom that contains a list of a package's preferences, pulled from NotificationManagerService.java
9171 */
9172message PackageNotificationPreferences {
9173    // Uid under which the package is installed.
9174    optional int32 uid = 1 [(is_uid) = true];
9175    // Notification importance, which specifies when and how a notification is displayed.
9176    // Specified under core/java/android/app/NotificationManager.java.
9177    optional int32 importance = 2;
9178    // Lockscreen visibility as set by the user.
9179    optional int32 visibility = 3;
9180    // Bitfield mask indicating what fields were locked by the user (see LockableAppfields in
9181    // PreferencesHelper.java)
9182    optional int32 user_locked_fields = 4;
9183    // Indicates if the package importance was set by the user (rather than system default).
9184    optional bool user_set_importance = 5;
9185    // State of the full screen intent permission for this package.
9186    enum FsiState {
9187        // This package did not declare the full screen intent permission in its manifest.
9188        NOT_REQUESTED = 0;
9189        // This package has the full screen intent permission.
9190        GRANTED = 1;
9191        // This package does not have the full screen intent permission.
9192        DENIED = 2;
9193    }
9194    optional FsiState fsi_state = 6;
9195    // True if the current full screen intent permission state for this package was set by the user.
9196    // This is only set when the FSI permission is requested by the app.
9197    optional bool is_fsi_permission_user_set = 7;
9198}
9199
9200/**
9201 * Atom that contains a list of a package's channel preferences, pulled from
9202 * NotificationManagerService.java.
9203 */
9204message PackageNotificationChannelPreferences {
9205    // Uid under which the package is installed.
9206    optional int32 uid = 1 [(is_uid) = true];
9207    // Channel's ID. Should always be available.
9208    optional string channel_id = 2;
9209    // Channel's name. Should always be available.
9210    optional string channel_name = 3;
9211    // Channel's description. Optionally set by the channel creator.
9212    optional string description = 4;
9213    // Notification importance, which specifies when and how a notification is displayed. Specified
9214    // under core/java/android/app/NotificationManager.java.
9215    optional int32 importance = 5;
9216    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
9217    // at core/java/android/app/NotificationChannel.java
9218    optional int32 user_locked_fields = 6;
9219    // Indicates if the channel was deleted by the app.
9220    optional bool is_deleted = 7;
9221    // Indicates if the channel was marked as a conversation by the app.
9222    optional bool is_conversation = 8;
9223    // Indicates if the channel is a conversation that was demoted by the user.
9224    optional bool is_demoted_conversation = 9;
9225    // Indicates if the channel is a conversation that was marked as important by the user.
9226    optional bool is_important_conversation = 10;
9227}
9228
9229/**
9230 * Atom that contains a list of a package's channel group preferences, pulled from
9231 * NotificationManagerService.java.
9232 */
9233message PackageNotificationChannelGroupPreferences {
9234    // Uid under which the package is installed.
9235    optional int32 uid = 1 [(is_uid) = true];
9236    // Channel Group's ID. Should always be available.
9237    optional string group_id = 2;
9238    // Channel Group's name. Should always be available.
9239    optional string group_name = 3;
9240    // Channel Group's description. Optionally set by group creator.
9241    optional string description = 4;
9242    // Indicates if notifications from this channel group are blocked.
9243    optional bool is_blocked = 5;
9244    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
9245    // at core/java/android/app/NotificationChannelGroup.java
9246    optional int32 user_locked_fields = 6;
9247}
9248
9249message PowerProfileProto {
9250    optional double cpu_suspend = 1;
9251
9252    optional double cpu_idle = 2;
9253
9254    optional double cpu_active = 3;
9255
9256    message CpuCluster {
9257        optional int32 id = 1;
9258        optional double cluster_power = 2;
9259        optional int32 cores = 3;
9260        repeated int64 speed = 4;
9261        repeated double core_power = 5;
9262    }
9263
9264    repeated CpuCluster cpu_cluster = 40;
9265
9266    optional double wifi_scan = 4;
9267
9268    optional double wifi_on = 5;
9269
9270    optional double wifi_active = 6;
9271
9272    optional double wifi_controller_idle = 7;
9273
9274    optional double wifi_controller_rx = 8;
9275
9276    optional double wifi_controller_tx = 9;
9277
9278    repeated double wifi_controller_tx_levels = 10;
9279
9280    optional double wifi_controller_operating_voltage = 11;
9281
9282    optional double bluetooth_controller_idle = 12;
9283
9284    optional double bluetooth_controller_rx = 13;
9285
9286    optional double bluetooth_controller_tx = 14;
9287
9288    optional double bluetooth_controller_operating_voltage = 15;
9289
9290    optional double modem_controller_sleep = 16;
9291
9292    optional double modem_controller_idle = 17;
9293
9294    optional double modem_controller_rx = 18;
9295
9296    repeated double modem_controller_tx = 19;
9297
9298    optional double modem_controller_operating_voltage = 20;
9299
9300    optional double gps_on = 21;
9301
9302    repeated double gps_signal_quality_based = 22;
9303
9304    optional double gps_operating_voltage = 23;
9305
9306    optional double bluetooth_on = 24;
9307
9308    optional double bluetooth_active = 25;
9309
9310    optional double bluetooth_at_cmd = 26;
9311
9312    optional double ambient_display = 27;
9313
9314    optional double screen_on = 28;
9315
9316    optional double radio_on = 29;
9317
9318    optional double radio_scanning = 30;
9319
9320    optional double radio_active = 31;
9321
9322    optional double screen_full = 32;
9323
9324    optional double audio = 33;
9325
9326    optional double video = 34;
9327
9328    optional double flashlight = 35;
9329
9330    optional double memory = 36;
9331
9332    optional double camera = 37;
9333
9334    optional double wifi_batched_scan = 38;
9335
9336    optional double battery_capacity = 39;
9337}
9338
9339/**
9340 * power_profile.xml and other constants for power model calculations.
9341 * Pulled from PowerProfile.java
9342 */
9343message PowerProfile {
9344    optional PowerProfileProto power_profile = 1 [(log_mode) = MODE_BYTES];
9345}
9346
9347/**
9348 * Logs when a user restriction was added or removed.
9349 *
9350 * Logged from:
9351 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
9352 */
9353message UserRestrictionChanged {
9354    // The raw string of the user restriction as defined in UserManager.
9355    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
9356    optional string restriction = 1;
9357    // Whether the restriction is enabled or disabled.
9358    optional bool enabled = 2;
9359}
9360
9361/**
9362 * Pulls process user time and system time. Puller takes a snapshot of all pids
9363 * in the system and returns cpu stats for those that are working at the time.
9364 * Dead pids will be dropped. Kernel processes are excluded.
9365 * Min cool-down is 5 sec.
9366 */
9367message ProcessCpuTime {
9368    optional int32 uid = 1 [(is_uid) = true];
9369
9370    optional string process_name = 2;
9371    // Process cpu time in user space, cumulative from boot/process start
9372    optional int64 user_time_millis = 3;
9373    // Process cpu time in system space, cumulative from boot/process start
9374    optional int64 system_time_millis = 4;
9375}
9376
9377/**
9378 * Pulls the CPU usage for each thread.
9379 *
9380 * Read from /proc/$PID/task/$TID/time_in_state files.
9381 *
9382 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
9383 * time_in_state files not being present on some phones, have not been addressed. These should be
9384 * considered before a public release.
9385 */
9386message CpuTimePerThreadFreq {
9387    // UID that owns the process.
9388    optional int32 uid = 1 [(is_uid) = true];
9389    // ID of the process.
9390    optional int32 process_id = 2;
9391    // ID of the thread.
9392    optional int32 thread_id = 3;
9393    // Name of the process taken from `/proc/$PID/cmdline`.
9394    optional string process_name = 4;
9395    // Name of the thread taken from `/proc/$PID/task/$TID/comm`
9396    optional string thread_name = 5;
9397
9398    // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
9399    // are given in KHz, and time is given in milliseconds since the thread started. All eight
9400    // frequencies are given here as the alternative is sending eight separate atoms. This method
9401    // significantly reduces the amount of data created
9402    optional int32 frequency1_khz = 6;
9403    optional int32 time1_millis = 7;
9404    optional int32 frequency2_khz = 8;
9405    optional int32 time2_millis = 9;
9406    optional int32 frequency3_khz = 10;
9407    optional int32 time3_millis = 11;
9408    optional int32 frequency4_khz = 12;
9409    optional int32 time4_millis = 13;
9410    optional int32 frequency5_khz = 14;
9411    optional int32 time5_millis = 15;
9412    optional int32 frequency6_khz = 16;
9413    optional int32 time6_millis = 17;
9414    optional int32 frequency7_khz = 18;
9415    optional int32 time7_millis = 19;
9416    optional int32 frequency8_khz = 20;
9417    optional int32 time8_millis = 21;
9418}
9419
9420/**
9421 * Pulls information about the device's build.
9422 */
9423message BuildInformation {
9424    // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
9425    // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
9426    optional string fingerprint = 1;
9427
9428    // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
9429    optional string brand = 2;
9430
9431    // Build.PRODUCT. The name of the overall product.
9432    optional string product = 3;
9433
9434    // Build.DEVICE. The name of the industrial design.
9435    optional string device = 4;
9436
9437    // Build.VERSION.RELEASE. The user-visible version string.  E.g., "1.0" or "3.4b5" or "bananas".
9438    optional string version_release = 5;
9439
9440    // Build.ID. E.g. a label like "M4-rc20".
9441    optional string id = 6;
9442
9443    // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
9444    // represent this build.
9445    optional string version_incremental = 7;
9446
9447    // Build.TYPE. The type of build, like "user" or "eng".
9448    optional string type = 8;
9449
9450    // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
9451    optional string tags = 9;
9452}
9453
9454/**
9455 * Logs information about mismatched caller for content capture.
9456 *
9457 * Logged from:
9458 *   frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java
9459 */
9460message ContentCaptureCallerMismatchReported {
9461    optional string intended_package = 1;
9462    optional string calling_package = 2;
9463}
9464
9465/**
9466 * Logs information about content capture service events.
9467 *
9468 * Logged from:
9469 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
9470 */
9471message ContentCaptureServiceEvents {
9472    // The type of event.
9473    enum Event {
9474        UNKNOWN = 0;
9475        ON_CONNECTED = 1;
9476        ON_DISCONNECTED = 2;
9477        SET_WHITELIST = 3;
9478        SET_DISABLED = 4;
9479        ON_USER_DATA_REMOVED = 5;
9480        ON_DATA_SHARE_REQUEST = 6;
9481        ACCEPT_DATA_SHARE_REQUEST = 7;
9482        REJECT_DATA_SHARE_REQUEST = 8;
9483        DATA_SHARE_WRITE_FINISHED = 9;
9484        DATA_SHARE_ERROR_IOEXCEPTION = 10;
9485        DATA_SHARE_ERROR_EMPTY_DATA = 11;
9486        DATA_SHARE_ERROR_CLIENT_PIPE_FAIL = 12;
9487        DATA_SHARE_ERROR_SERVICE_PIPE_FAIL = 13;
9488        DATA_SHARE_ERROR_CONCURRENT_REQUEST = 14;
9489        DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED = 15;
9490        ON_REMOTE_SERVICE_DIED = 16;
9491    }
9492    optional Event event = 1;
9493    // component/package of content capture service.
9494    optional string service_info = 2;
9495    // component/package of target.
9496    // it's a concatenated list of component/package for SET_WHITELIST event
9497    // separated by " ".
9498    // Deprecated: should not log app package
9499    optional string target_info = 3 [deprecated = true];
9500    // The number of packages in the allow list
9501    optional int32 set_allowlist_package_count = 4;
9502    // The number of activities in the allow list
9503    optional int32 set_allowlist_activity_count = 5;
9504}
9505
9506/**
9507 * Logs information about content capture session events.
9508 *
9509 * Logged from:
9510 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
9511 */
9512message ContentCaptureSessionEvents {
9513    // The type of event.
9514    enum Event {
9515        UNKNOWN = 0;
9516        ON_SESSION_STARTED = 1;
9517        ON_SESSION_FINISHED = 2;
9518        SESSION_NOT_CREATED = 3;
9519    }
9520    optional int32 session_id = 1;
9521    optional Event event = 2;
9522    // (n/a on session finished)
9523    optional int32 state_flags = 3;
9524    // component/package of content capture service.
9525    optional string service_info = 4;
9526    // component/package of app.
9527    // (n/a on session finished)
9528    // Deprecated: should not log app package
9529    optional string app_info = 5 [deprecated = true];
9530    optional bool is_child_session = 6;
9531}
9532
9533/**
9534 * Logs information about session being flushed.
9535 *
9536 * Logged from:
9537 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
9538 */
9539message ContentCaptureFlushed {
9540    optional int32 session_id = 1;
9541    // component/package of content capture service.
9542    optional string service_info = 2;
9543    // component/package of app.
9544    // Deprecated: should not log app package
9545    optional string app_info = 3 [deprecated = true];
9546    // session start/finish events
9547    optional int32 child_session_started = 4;
9548    optional int32 child_session_finished = 5;
9549    // count of view events.
9550    optional int32 view_appeared_count = 6;
9551    optional int32 view_disappeared_count = 7;
9552    optional int32 view_text_changed_count = 8;
9553
9554    // Flush stats.
9555    optional int32 max_events = 9;
9556    optional int32 idle_flush_freq = 10;
9557    optional int32 text_flush_freq = 11;
9558    optional int32 flush_reason = 12;
9559}
9560
9561/**
9562 * Pulls on-device BatteryStats power use calculations for the overall device.
9563 */
9564message DeviceCalculatedPowerUse {
9565    // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
9566    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
9567    // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
9568    optional int64 computed_power_nano_amp_secs = 1;
9569}
9570
9571// Keep in sync with frameworks/base/core/proto/android/os/batteryusagestats.proto
9572/**
9573 * Represents a device's BatteryUsageStats, with power usage information about the device
9574 * and each app.
9575 */
9576message BatteryUsageStatsAtomsProto {
9577
9578    // The session start timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
9579    // All data is no older than this time.
9580    optional int64 session_start_millis = 1;
9581
9582    // The session end timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
9583    // All data is no more recent than this time.
9584    optional int64 session_end_millis = 2;
9585
9586    // Length that the reported data covered. This usually will be equal to the entire session,
9587    // session_end_millis - session_start_millis, but may not be if some data during this time frame
9588    // is missing.
9589    optional int64 session_duration_millis = 3;
9590
9591    // Represents usage of a consumer, storing all of its power component usage.
9592    message BatteryConsumerData {
9593        // Total power consumed by this BatteryConsumer (including all of its PowerComponents).
9594        // May not equal the sum of the PowerComponentUsage due to under- or over-estimations.
9595        // Multiply by 1/36 to obtain mAh.
9596        optional int64 total_consumed_power_deci_coulombs = 1;
9597
9598        // Represents power and time usage of a particular power component.
9599        message PowerComponentUsage {
9600            // Holds android.os.PowerComponentEnum, or custom component value between 1000 and 9999.
9601            // Evidently, if one attempts to write an int to an enum field that is out of range, it
9602            // is treated as 0, so we must make this an int32.
9603            optional int32 component = 1;
9604
9605            // Power consumed by this component. Multiply by 1/36 to obtain mAh.
9606            optional int64 power_deci_coulombs = 2;
9607
9608            optional int64 duration_millis = 3;
9609        }
9610        repeated PowerComponentUsage power_components = 2;
9611
9612        // Represents a slice of power attribution, e.g. "cpu while in the background"
9613        // or "wifi when running a background service".  Queries that care about
9614        // PowerComponentUsage slices need to be aware of all supported dimensions.
9615        // There are no roll-ups included in the slices - it is up to the clients
9616        // of this data to aggregate values as needed.
9617        message PowerComponentUsageSlice {
9618            optional PowerComponentUsage power_component = 1;
9619
9620            enum ProcessState {
9621                UNSPECIFIED = 0;
9622                FOREGROUND = 1;
9623                BACKGROUND = 2;
9624                FOREGROUND_SERVICE = 3;
9625            }
9626
9627            optional ProcessState process_state = 2;
9628        }
9629
9630        repeated PowerComponentUsageSlice slices = 3;
9631    }
9632
9633    // Total power usage for the device during this session.
9634    optional BatteryConsumerData device_battery_consumer = 4;
9635
9636    // Power usage by a uid during this session.
9637    message UidBatteryConsumer {
9638        optional int32 uid = 1 [(is_uid) = true];
9639        optional BatteryConsumerData battery_consumer_data = 2;
9640        // DEPRECATED Use time_in_state instead.
9641        optional int64 time_in_foreground_millis = 3 [deprecated = true];
9642        // DEPRECATED Use time_in_state instead.
9643        optional int64 time_in_background_millis = 4 [deprecated = true];
9644
9645        message TimeInState {
9646            enum ProcessState {
9647                UNSPECIFIED = 0;
9648                FOREGROUND = 1;
9649                BACKGROUND = 2;
9650                FOREGROUND_SERVICE = 3;
9651            }
9652
9653            optional ProcessState process_state = 1;
9654            optional int64 time_in_state_millis = 2;
9655        }
9656
9657        repeated TimeInState time_in_state = 5;
9658    }
9659    repeated UidBatteryConsumer uid_battery_consumers = 5;
9660
9661    // Sum of all discharge percentage point drops during the reported session.
9662    optional int32 session_discharge_percentage = 6;
9663
9664    // Total amount of time battery was discharging during the reported session
9665    optional int64 discharge_duration_millis = 7;
9666
9667    // Notes the power model used for a power component.
9668    message PowerComponentModel {
9669        // Holds android.os.PowerComponentEnum, or custom component value between 1000 and 9999.
9670        optional int32 component = 1;
9671
9672        enum PowerModel {
9673            UNDEFINED = 0;
9674            POWER_PROFILE = 1;
9675            MEASURED_ENERGY = 2;
9676        }
9677
9678        optional PowerModel power_model = 2;
9679    }
9680
9681    // The power model used for each power component.
9682    repeated PowerComponentModel component_models = 8;
9683}
9684
9685/**
9686 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
9687 * using the best data available.
9688 *
9689 * Includes the data since the last time statsd pulled this atom (i.e. since the
9690 * last-BatteryStats-reset-prior-to-last-statsd-pull) until the most recent BatteryStats reset.
9691 *
9692 * Does NOT include data after the most recent reset (use BatteryUsageStatsSinceReset too for that).
9693 *
9694 * Pulled from BatteryManager.getBatteryUsageStats().
9695 */
9696message BatteryUsageStatsBeforeReset {
9697    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
9698}
9699
9700/**
9701 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
9702 * using the best data available.
9703 *
9704 * Includes all data since the most recent BatteryStats reset event, but none prior to it.
9705 *
9706 * Pulled from BatteryManager.getBatteryUsageStats().
9707 */
9708message BatteryUsageStatsSinceReset {
9709    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
9710}
9711
9712/**
9713 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
9714 * using only PowerProfile Model data (even if better data is available).
9715 *
9716 * Includes all data since the most recent BatteryStats reset event, but none prior to it.
9717 *
9718 * @see android.os.BatteryUsageStatsQuery#FLAG_BATTERY_USAGE_STATS_POWER_PROFILE_MODEL
9719 * Pulled from BatteryManager.getBatteryUsageStats().
9720 */
9721message BatteryUsageStatsSinceResetUsingPowerProfileModel {
9722    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
9723}
9724
9725/**
9726 * Logs device policy features.
9727 *
9728 * Logged from:
9729 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
9730 *   packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
9731 */
9732message DevicePolicyEvent {
9733    // The event id - unique for each event.
9734    optional android.stats.devicepolicy.EventId event_id = 1;
9735    // The admin package name.
9736    optional string admin_package_name = 2;
9737    // A generic integer parameter.
9738    optional int32 integer_value = 3;
9739    // A generic boolean parameter.
9740    optional bool boolean_value = 4;
9741    // A parameter specifying a time period in milliseconds.
9742    optional uint64 time_period_millis = 5;
9743    // A parameter specifying a list of package names, bundle extras or string parameters.
9744    optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
9745}
9746
9747/**
9748 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
9749 *
9750 * Logged from:
9751 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9752 */
9753message DocsUILaunchReported {
9754    optional android.stats.docsui.LaunchAction launch_action = 1;
9755    optional bool has_initial_uri = 2;
9756    optional android.stats.docsui.MimeType mime_type = 3;
9757    optional android.stats.docsui.Root initial_root = 4;
9758}
9759
9760/**
9761 * Logs root/app visited event in file managers/picker. Call this when the user
9762 * taps on root/app in hamburger menu.
9763 *
9764 * Logged from:
9765 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9766 */
9767message DocsUIRootVisitedReported {
9768    optional android.stats.docsui.ContextScope scope = 1;
9769    optional android.stats.docsui.Root root = 2;
9770}
9771
9772/**
9773 * Logs file operation stats. Call this when a file operation has completed.
9774 *
9775 * Logged from:
9776 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9777 */
9778message DocsUIFileOperationReported {
9779    optional android.stats.docsui.Provider provider = 1;
9780    optional android.stats.docsui.FileOperation file_op = 2;
9781}
9782
9783/**
9784 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
9785 * mode.
9786 *
9787 * Logged from:
9788 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9789 */
9790message DocsUIFileOperationCopyMoveModeReported {
9791    optional android.stats.docsui.FileOperation file_op = 1;
9792    optional android.stats.docsui.CopyMoveOpMode mode = 2;
9793}
9794
9795
9796/**
9797 * Logs file sub operation stats. Call this when a file operation has failed.
9798 *
9799 * Logged from:
9800 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9801 */
9802message DocsUIFileOperationFailureReported {
9803    optional android.stats.docsui.Authority authority = 1;
9804    optional android.stats.docsui.SubFileOperation sub_op = 2;
9805}
9806
9807/**
9808* Logs the cancellation of a file operation. Call this when a job is canceled
9809*
9810* Logged from:
9811*     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9812*/
9813message DocsUIFileOperationCanceledReported {
9814    optional android.stats.docsui.FileOperation file_op = 1;
9815}
9816
9817/**
9818 * Logs startup time in milliseconds.
9819 *
9820 * Logged from:
9821 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9822 */
9823message DocsUIStartupMsReported {
9824    optional int32 startup_millis = 1;
9825}
9826
9827/**
9828 * Logs the action that was started by user.
9829 *
9830 * Logged from:
9831 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9832 */
9833message DocsUIUserActionReported {
9834    optional android.stats.docsui.UserAction action = 1;
9835}
9836
9837/**
9838 * Logs the invalid type when invalid scoped access is requested.
9839 *
9840 * Logged from:
9841 *     package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
9842 */
9843message DocsUIInvalidScopedAccessRequestReported {
9844    optional android.stats.docsui.InvalidScopedAccess type = 1;
9845}
9846
9847/**
9848 * Logs the package name that launches docsui picker mode.
9849 *
9850 * Logged from:
9851 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9852 */
9853message DocsUIPickerLaunchedFromReported {
9854    optional string package_name = 1;
9855}
9856
9857/**
9858 * Logs the search type.
9859 *
9860 * Logged from:
9861 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9862 */
9863message DocsUISearchTypeReported {
9864    optional android.stats.docsui.SearchType search_type = 1;
9865}
9866
9867/**
9868 * Logs the search mode.
9869 *
9870 * Logged from:
9871 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9872 */
9873message DocsUISearchModeReported {
9874    optional android.stats.docsui.SearchMode search_mode = 1;
9875}
9876
9877/**
9878 * Logs the pick result information.
9879 *
9880 * Logged from:
9881 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9882 */
9883message DocsUIPickResultReported {
9884    optional int32 total_action_count = 1;
9885    optional int64 duration_millis = 2;
9886    optional int32 file_count= 3;
9887    optional bool is_searching = 4;
9888    optional android.stats.docsui.Root picked_from = 5;
9889    optional android.stats.docsui.MimeType mime_type = 6;
9890    optional int32 repeatedly_pick_times = 7;
9891}
9892
9893/** Logs the drag and drop of files.
9894
9895 * Logged from:
9896 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
9897 */
9898message DocsUIDragAndDropReported {
9899    optional bool drag_initiated_from_docsui = 1;
9900}
9901
9902/**
9903 * Logs when an app's memory is compacted.
9904 *
9905 * Logged from:
9906 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9907 */
9908message AppCompacted {
9909  // The pid of the process being compacted.
9910  optional int32 pid = 1;
9911
9912  // The name of the process being compacted.
9913  optional string process_name = 2;
9914
9915  // The type of compaction.
9916  enum Action {
9917    UNKNOWN = 0;
9918    SOME = 1;
9919    FULL = 2;
9920    PERSISTENT = 3;
9921    BFGS = 4;
9922  }
9923  optional Action action = 3;
9924
9925  // Total RSS in kilobytes consumed by the process prior to compaction.
9926  optional int64 before_rss_total_kilobytes = 4;
9927
9928  // File RSS in kilobytes consumed by the process prior to compaction.
9929  optional int64 before_rss_file_kilobytes = 5;
9930
9931  // Anonymous RSS in kilobytes consumed by the process prior to compaction.
9932  optional int64 before_rss_anon_kilobytes = 6;
9933
9934  // Swap in kilobytes consumed by the process prior to compaction.
9935  optional int64 before_swap_kilobytes = 7;
9936
9937  // Total RSS in kilobytes consumed by the process after compaction.
9938  optional int64 after_rss_total_kilobytes = 8;
9939
9940  // File RSS in kilobytes consumed by the process after compaction.
9941  optional int64 after_rss_file_kilobytes = 9;
9942
9943  // Anonymous RSS in kilobytes consumed by the process after compaction.
9944  optional int64 after_rss_anon_kilobytes = 10;
9945
9946  // Swap in kilobytes consumed by the process after compaction.
9947  optional int64 after_swap_kilobytes = 11;
9948
9949  // The time taken to perform compaction in milliseconds.
9950  optional int64 time_to_compact_millis = 12;
9951
9952  // The last compaction action performed for this app.
9953  optional Action last_action = 13;
9954
9955  // The last time that compaction was attempted on this process in milliseconds
9956  // since boot, not including sleep (see SystemClock.uptimeMillis()).
9957  optional int64 last_compact_timestamp_ms_since_boot = 14;
9958
9959  // The "setAdj" (i.e. previous) oom_score_adj at the time of compaction.
9960  optional int32 oom_score_adj = 15;
9961
9962  // The process state at the time of compaction.
9963  optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
9964
9965  // Free ZRAM in kilobytes before compaction.
9966  optional int64 before_zram_free_kilobytes = 17;
9967
9968  // Free ZRAM in kilobytes after compaction.
9969  optional int64 after_zram_free_kilobytes = 18;
9970}
9971
9972message AppCompactedV2 {
9973  // UID of the process being compacted
9974  optional int32 uid = 1 [(is_uid) = true];
9975
9976  // Process state for compacted process
9977  optional int32 proc_state = 2;
9978
9979  // Current OOM Adjust at the time of compaction, this would correspond to any newly set oom adj.
9980  optional int32 current_oom_adj = 3;
9981
9982  // Delta Anon RSS reduced with compaction computed as RSS Before - RSS After.
9983  optional int64 delta_anon_rss = 4;
9984
9985  // Physical ZRAM Consumed during compaction
9986  optional int64 zram_consumed = 5;
9987
9988  // CPU time spent compacting
9989  optional float compact_cpu_time = 6;
9990
9991  // Anon RSS of the process prior to being compacted
9992  optional int64 original_anon_rss = 7;
9993
9994  // Reason for the OOM adj change
9995  optional android.app.OomChangeReasonEnum oom_change_reason = 8;
9996}
9997
9998/**
9999 * Represents an event that logs information about a successful switch to an upstream network.
10000 */
10001message UpstreamEvent {
10002  // Indicates the transport type of network.
10003  optional android.stats.connectivity.UpstreamType upstream_type = 1;
10004
10005  // The duration of network usage.
10006  optional int64 duration_millis = 2;
10007
10008  // The amount of data received from tethered clients.
10009  optional int64 tx_bytes = 3;
10010
10011  // The amount of data received from remote.
10012  optional int64 rx_bytes = 4;
10013}
10014
10015message UpstreamEvents {
10016  repeated UpstreamEvent upstream_event = 1;
10017}
10018
10019/**
10020 * Logs when a Tethering event occurs.
10021 *
10022 */
10023message NetworkTetheringReported {
10024  // Tethering error code
10025  optional android.stats.connectivity.ErrorCode error_code = 1;
10026
10027  // Tethering downstream type
10028  optional android.stats.connectivity.DownstreamType downstream_type = 2;
10029
10030  // Transport type of upstream network
10031  optional android.stats.connectivity.UpstreamType upstream_type = 3 [deprecated = true];
10032
10033  // The user type of switching tethering
10034  optional android.stats.connectivity.UserType user_type= 4;
10035
10036  // Log each transport type of upstream network event
10037  optional UpstreamEvents upstream_events = 5  [(log_mode) = MODE_BYTES];
10038
10039  // A time period that a downstreams exists
10040  optional int64 duration_millis = 6;
10041}
10042
10043/**
10044 * Logs NSD(Network service discovery) client session
10045 *
10046 * Log from:
10047 *     packages/modules/Connectivity/service-t/src/com/android/server/NsdService
10048 */
10049message NetworkNsdReported {
10050  // Indicate if the device is using the legacy or the new implementation
10051  optional bool is_legacy = 1;
10052
10053  // It is a random number to represent different clients. Each client is an app on the device.
10054  optional int32 client_id = 2;
10055
10056  // It is a increment_number to represent different transactions.
10057  // Each transaction is a request from an app client.
10058  optional int32 transaction_id = 3;
10059
10060  // Indicate the service in resolution is a known service in the discovered services cache
10061  optional bool is_known_service = 4;
10062
10063  // Record each NSD session type
10064  optional android.stats.connectivity.NsdEventType type = 5;
10065
10066  // The process duration of the event in milli-second
10067  optional int64 event_duration_millisec = 6;
10068
10069  // Record each mdns query result
10070  optional android.stats.connectivity.MdnsQueryResult query_result = 7;
10071
10072  // Count of services in cache at the end of discovery
10073  optional int32 found_service_count = 8;
10074
10075  // Count of found callback when discovery is stopped
10076  optional int32 found_callback_count = 9;
10077
10078  // Count of lost callback when discovery is stopped
10079  optional int32 lost_callback_count = 10;
10080
10081  // Record query service count before unregistered service
10082  optional int32 replied_requests_count = 11;
10083
10084  // Record sent query count before stopped discovery
10085  optional int32 sent_query_count = 12;
10086
10087  // Record sent packet count before unregistered service
10088  optional int32 sent_packet_count = 13;
10089
10090  // Record number of conflict during probing
10091  optional int32 conflict_during_probing_count = 14;
10092
10093  // Record number of conflict after probing
10094  optional int32 conflict_after_probing_count = 15;
10095
10096  // The random number between 0 ~ 999 for sampling
10097  optional int32 random_number = 16;
10098}
10099
10100/**
10101 * Logs a DNS lookup operation initiated by the system resolver on behalf of an application
10102 * invoking native APIs such as getaddrinfo() or Java APIs such as Network#getAllByName().
10103 *
10104 * The NetworkDnsEventReported message represents the entire lookup operation, which may
10105 * result one or more queries to the recursive DNS resolvers. Those are individually logged
10106 * in DnsQueryEvents to enable computing error rates and network latency and timeouts
10107 * broken up by query type, transport, network interface, etc.
10108 */
10109message NetworkDnsEventReported {
10110    optional android.stats.dnsresolver.EventType event_type = 1;
10111
10112    optional android.stats.dnsresolver.ReturnCode return_code = 2;
10113
10114    // The latency in microseconds of the entire DNS lookup operation.
10115    optional int32 latency_micros = 3;
10116
10117    // Only valid for event_type = EVENT_GETADDRINFO.
10118    optional int32 hints_ai_flags = 4;
10119
10120    // Flags passed to android_res_nsend() defined in multinetwork.h
10121    // Only valid for event_type = EVENT_RESNSEND.
10122    optional int32 res_nsend_flags = 5;
10123
10124    optional android.stats.dnsresolver.NetworkType network_type = 6;
10125
10126    // The DNS over TLS mode on a specific netId.
10127    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7;
10128
10129    // Additional pass-through fields opaque to statsd.
10130    // The DNS resolver Mainline module can add new fields here without requiring an OS update.
10131    optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES];
10132
10133    // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom.
10134    optional int32 sampling_rate_denom = 9;
10135
10136    // UID sends the DNS query.
10137    optional int32 uid = 10 [(is_uid) = true];
10138}
10139
10140/**
10141 * logs the number of DNS servers supported by the protocol
10142 */
10143message NetworkDnsServerSupportReported {
10144    // The network type of the network
10145    optional android.stats.dnsresolver.NetworkType network_type = 1;
10146
10147    // The private DNS mode of the network
10148    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 2;
10149
10150    // Stores the state of all DNS servers for this network
10151    optional android.stats.dnsresolver.Servers servers = 3 [(log_mode) = MODE_BYTES];
10152}
10153
10154/**
10155 * The NetworkDnsHandshakeReported message describes a DoT or DoH handshake operation along with
10156 * its result, cause, network latency, TLS version, etc.
10157 *
10158 */
10159message NetworkDnsHandshakeReported {
10160  optional android.stats.dnsresolver.Protocol protocol = 1;
10161
10162  optional android.stats.dnsresolver.HandshakeResult result = 2;
10163
10164  optional android.stats.dnsresolver.HandshakeCause cause = 3;
10165
10166  optional android.stats.dnsresolver.NetworkType network_type = 4;
10167
10168  optional android.stats.dnsresolver.PrivateDnsModes private_dns_mode = 5;
10169
10170  // The latency in microseconds of the entire handshake operation.
10171  optional int32 latency_micros = 6;
10172
10173  // Number of bytes sent in a handshake.
10174  optional int32 bytes_sent = 7;
10175
10176  // Number of bytes received in a handshake.
10177  optional int32 bytes_received = 8;
10178
10179  // Number of round-trips.
10180  optional int32 round_trips = 9;
10181
10182  // True if TLS session cache hit.
10183  optional bool tls_session_cache_hit = 10;
10184
10185  // 2 = TLS 1.2, 3 = TLS 1.3
10186  optional int32 tls_version = 11;
10187
10188  // True if the handshake requires verifying the private DNS provider hostname.
10189  optional bool hostname_verification = 12;
10190
10191  // Only present when protocol = PROTO_DOH.
10192  optional int32 quic_version = 13;
10193
10194  optional int32 server_index = 14;
10195
10196  // The sampling-rate of this event is 1/sampling_rate_denom.
10197  optional int32 sampling_rate_denom = 15;
10198}
10199
10200/**
10201 * logs the CapportApiData info
10202 * Logged from:
10203 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
10204 */
10205message CapportApiData {
10206    // The TTL of the network connection provided by captive portal
10207    optional int32 remaining_ttl_secs = 1;
10208
10209    // The limit traffic data of the network connection provided by captive portal
10210    optional int32 remaining_bytes = 2;
10211
10212    // Is portal url option included in the DHCP packet (Yes, No)
10213    optional bool has_portal_url = 3;
10214
10215    // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
10216    optional bool has_venue_info = 4;
10217}
10218
10219/**
10220 * logs a network Probe Event
10221 * Logged from:
10222 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
10223 */
10224message ProbeEvent {
10225    // The probe type (http or https, or captive portal API...)
10226    optional android.stats.connectivity.ProbeType probe_type = 1;
10227
10228    // The latency in microseconds of the probe event
10229    optional int32 latency_micros = 2;
10230
10231    // The result of the probe event
10232    optional android.stats.connectivity.ProbeResult probe_result = 3;
10233
10234    // The CaptivePortal API info
10235    optional CapportApiData capport_api_data = 4;
10236}
10237
10238/**
10239 * log each ProbeEvent in ProbeEvents
10240 * Logged from:
10241 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
10242 */
10243message ProbeEvents {
10244    // Record probe event during the validation
10245    repeated ProbeEvent probe_event = 1;
10246}
10247
10248/**
10249 * The DHCP (Dynamic Host Configuration Protocol) session info
10250 * Logged from:
10251 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
10252 */
10253message DhcpSession {
10254    // The DHCP Feature(s) enabled in this session
10255    repeated android.stats.connectivity.DhcpFeature used_features = 1;
10256
10257    // The discover packet (re)transmit count
10258    optional int32 discover_count = 2;
10259
10260    // The request packet (re)transmit count
10261    optional int32 request_count = 3;
10262
10263    // The IPv4 address conflict count
10264    // (only be meaningful when duplicate address detection is enabled)
10265    optional int32 conflict_count = 4;
10266
10267    // The DHCP packet parsing error code in this session
10268    // (defined in android.net.metrics.DhcpErrorEvent)
10269    repeated android.stats.connectivity.DhcpErrorCode error_code = 5;
10270
10271    // The result of DHCP hostname transliteration
10272    optional android.stats.connectivity.HostnameTransResult ht_result = 6;
10273}
10274
10275/**
10276 * Logs Network IP provisioning event
10277 * Logged from:
10278 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
10279 */
10280message NetworkIpProvisioningReported {
10281    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
10282    optional android.stats.connectivity.TransportType transport_type = 1;
10283
10284    // The latency in microseconds of IP Provisioning over IPV4
10285    optional int32 ipv4_latency_micros = 2;
10286
10287    // The latency in microseconds of IP Provisioning over IPV6
10288    optional int32 ipv6_latency_micros = 3;
10289
10290    // The time duration between provisioning start and end (success or failure)
10291    optional int64 provisioning_duration_micros = 4;
10292
10293    // The specific disconnect reason for this IP provisioning
10294    optional android.stats.connectivity.DisconnectCode disconnect_code = 5;
10295
10296    // Log DHCP session info (Only valid for IPv4)
10297    optional DhcpSession dhcp_session = 6 [(log_mode) = MODE_BYTES];
10298
10299    // The random number between 0 ~ 999 for sampling
10300    optional int32 random_number = 7;
10301
10302    // Check which IPv6 provisioning mode is used for current connection
10303    optional android.stats.connectivity.Ipv6ProvisioningMode ipv6_provisioning_mode = 8;
10304}
10305
10306/**
10307 * Logs Network DHCP Renew event
10308 * Logged from:
10309 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
10310 */
10311message NetworkDhcpRenewReported {
10312    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
10313    optional android.stats.connectivity.TransportType transport_type = 1;
10314
10315    // The request packet (re)transmit count
10316    optional int32 request_count = 2;
10317
10318    // The latency in microseconds of DHCP Renew
10319    optional int32 latency_micros = 3;
10320
10321    // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
10322    optional android.stats.connectivity.DhcpErrorCode error_code = 4;
10323
10324    // The result of DHCP renew
10325    optional android.stats.connectivity.DhcpRenewResult renew_result = 5;
10326
10327    // The random number between 0 ~ 999 for sampling
10328    optional int32 random_number = 6;
10329}
10330
10331/**
10332 * Logs Network Validation event
10333 * Logged from:
10334 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
10335 */
10336message NetworkValidationReported {
10337    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
10338    optional android.stats.connectivity.TransportType transport_type = 1;
10339
10340    // Record each probe event
10341    optional ProbeEvents probe_events = 2 [(log_mode) = MODE_BYTES];
10342
10343    // The result of the network validation
10344    optional android.stats.connectivity.ValidationResult validation_result = 3;
10345
10346    // The latency in microseconds of network validation
10347    optional int32 latency_micros = 4;
10348
10349    // The validation index (the first validation attempt or second, third...)
10350    optional int32 validation_index = 5;
10351
10352    // The random number between 0 ~ 999 for sampling
10353    optional int32 random_number = 6;
10354}
10355
10356/**
10357 * Logs NetworkStack Quirk event
10358 * Logged from:
10359 * packages/modules/NetworkStack/src/com/android/networkstack/
10360 */
10361message NetworkStackQuirkReported {
10362    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
10363    optional android.stats.connectivity.TransportType transport_type = 1;
10364
10365    // Record each Quirk event
10366    optional android.stats.connectivity.NetworkQuirkEvent event = 2;
10367}
10368
10369/**
10370 * Logs Neighbor Unreachability Detection event
10371 * Logged from:
10372 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpReachabilityMonitorMetrics.java
10373 */
10374message NetworkIpReachabilityMonitorReported {
10375    // Neighbor Unreachability Detection event.
10376    optional android.stats.connectivity.NudEventType event_type = 1;
10377
10378    // NUD probe based on IPv4 ARP or IPv6 ND packet.
10379    optional android.stats.connectivity.IpType ip_type = 2;
10380
10381    // NUD neighbor type, default gateway, DNS server or both.
10382    optional android.stats.connectivity.NudNeighborType neighbor_type = 3;
10383}
10384
10385/**
10386 * Logs when system default network changes.
10387 */
10388message SystemDefaultNetworkChanged {
10389    // Active transport types encoded as a 32 bit integer.
10390    // The integer will have n-th bit set if there was an active transport type of value n.
10391    // See packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
10392    optional int32 transport_types = 1 [
10393        (state_field_option).exclusive_state = true,
10394        (state_field_option).nested = false
10395    ];
10396}
10397
10398/**
10399 * Logs when a data stall event occurs.
10400 *
10401 * Log from:
10402 *     packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
10403 */
10404message DataStallEvent {
10405    // Data stall evaluation type.
10406    // See packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
10407    // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
10408    optional int32 evaluation_type = 1;
10409    // See definition in data_stall_event.proto.
10410    optional com.android.server.connectivity.ProbeResult validation_result = 2;
10411    // See definition in data_stall_event.proto.
10412    optional android.net.Transport network_type = 3;
10413    // See definition in data_stall_event.proto.
10414    optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
10415    // See definition in data_stall_event.proto.
10416    optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
10417    // See definition in data_stall_event.proto.
10418    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
10419    // The tcp packets fail rate from the latest tcp polling.
10420    optional int32 tcp_fail_rate = 7;
10421    // Number of packets sent since the last received packet.
10422    optional int32 tcp_sent_since_last_recv = 8;
10423}
10424
10425/*
10426 * Logs when RescueParty resets some set of experiment flags.
10427 *
10428 * Logged from:
10429 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
10430 */
10431message RescuePartyResetReported {
10432    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
10433    optional int32 rescue_level = 1;
10434    optional string rescue_level_string = 2;
10435}
10436
10437/**
10438 * Logs when signed config is received from an APK, and if that config was applied successfully.
10439 * Logged from:
10440 *   frameworks/base/services/core/java/com/android/server/signedconfig/SignedConfigService.java
10441 */
10442message SignedConfigReported {
10443    enum Type {
10444        UNKNOWN_TYPE = 0;
10445        GLOBAL_SETTINGS = 1;
10446    }
10447    optional Type type = 1;
10448
10449    // The final status of the signed config received.
10450    enum Status {
10451        UNKNOWN_STATUS = 0;
10452        APPLIED = 1;
10453        BASE64_FAILURE_CONFIG = 2;
10454        BASE64_FAILURE_SIGNATURE = 3;
10455        SECURITY_EXCEPTION = 4;
10456        INVALID_CONFIG = 5;
10457        OLD_CONFIG = 6;
10458        SIGNATURE_CHECK_FAILED = 7;
10459        NOT_APPLICABLE = 8;
10460        SIGNATURE_CHECK_FAILED_PROD_KEY_ABSENT = 9;
10461    }
10462    optional Status status = 2;
10463
10464    // The version of the signed config processed.
10465    optional int32 version = 3;
10466
10467    // The package name that the config was extracted from.
10468    optional string from_package = 4;
10469
10470    enum Key {
10471        NO_KEY = 0;
10472        DEBUG = 1;
10473        PRODUCTION = 2;
10474    }
10475    // Which key was used to verify the config.
10476    optional Key verified_with = 5;
10477}
10478
10479/*
10480 * Logs GNSS Network-Initiated (NI) location events.
10481 *
10482 * Logged from:
10483 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
10484 */
10485message GnssNiEventReported {
10486    // The type of GnssNiEvent.
10487    enum EventType {
10488        UNKNOWN = 0;
10489        NI_REQUEST = 1;
10490        NI_RESPONSE = 2;
10491    }
10492    optional EventType event_type = 1;
10493
10494    // An ID generated by HAL to associate NI notifications and UI responses.
10495    optional int32 notification_id = 2;
10496
10497    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
10498    optional android.server.location.GnssNiType ni_type = 3;
10499
10500    // NI requires notification.
10501    optional bool need_notify = 4;
10502
10503    // NI requires verification.
10504    optional bool need_verify = 5;
10505
10506    // NI requires privacy override, no notification/minimal trace.
10507    optional bool privacy_override = 6;
10508
10509    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
10510    // seconds.
10511    optional int32 timeout = 7;
10512
10513    // Default response when timeout.
10514    optional android.server.location.GnssUserResponseType default_response = 8;
10515
10516    // String representing the requester of the network inititated location request.
10517    optional string requestor_id = 9;
10518
10519    // Notification message text string representing the service(for eg. SUPL-service) who sent the
10520    // network initiated location request.
10521    optional string text = 10;
10522
10523    // requestorId decoding scheme.
10524    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;
10525
10526    // Notification message text decoding scheme.
10527    optional android.server.location.GnssNiEncodingType text_encoding = 12;
10528
10529    // True if SUPL ES is enabled.
10530    optional bool is_supl_es_enabled = 13;
10531
10532    // True if GNSS location is enabled.
10533    optional bool is_location_enabled = 14;
10534
10535    // GNSS NI responses which define the response in NI structures.
10536    optional android.server.location.GnssUserResponseType user_response = 15;
10537}
10538
10539/**
10540 * Logs GNSS non-framework (NFW) location notification.
10541 *
10542 * Logged from:
10543 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
10544 */
10545message GnssNfwNotificationReported {
10546    // Package name of the Android proxy application representing the non-framework entity that
10547    // requested location. Set to empty string if unknown.
10548    optional string proxy_app_package_name = 1;
10549
10550    // Protocol stack that initiated the non-framework location request.
10551    optional android.server.location.NfwProtocolStack protocol_stack = 2;
10552
10553    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
10554    // set to empty string. This field is opaque to the framework and used for logging purposes.
10555    optional string other_protocol_stack_name = 3;
10556
10557    // Source initiating/receiving the location information.
10558    optional android.server.location.NfwRequestor requestor = 4;
10559
10560    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
10561    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
10562    // and used for logging purposes.
10563    optional string requestor_id = 5;
10564
10565    // Indicates whether location information was provided for this request.
10566    optional android.server.location.NfwResponseType response_type = 6;
10567
10568    // True if the device is in user initiated emergency session.
10569    optional bool in_emergency_mode = 7;
10570
10571    // True if cached location is provided.
10572    optional bool is_cached_location = 8;
10573
10574    // True if proxy app permission mismatch between framework and GNSS HAL.
10575    optional bool is_permission_mismatched = 9;
10576}
10577
10578/**
10579 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
10580 *
10581 * Logged from:
10582 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
10583 */
10584message GnssConfigurationReported {
10585    // SUPL host name.
10586    optional string supl_host = 1;
10587
10588    // SUPL port number.
10589    optional int32 supl_port = 2;
10590
10591    // C2K host name.
10592    optional string c2k_host = 3;
10593
10594    // C2K port number.
10595    optional int32 c2k_port = 4;
10596
10597    // The SUPL version requested by Carrier.
10598    optional int32 supl_ver = 5;
10599
10600    // The SUPL mode.
10601    optional android.server.location.SuplMode supl_mode = 6;
10602
10603    // True if NI emergency SUPL restrictions is enabled.
10604    optional bool supl_es = 7;
10605
10606    // LTE Positioning Profile settings
10607    optional android.server.location.LppProfile lpp_profile = 8;
10608
10609    // Positioning protocol on A-Glonass system.
10610    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;
10611
10612    // True if emergency PDN is used. Otherwise, regular PDN is used.
10613    optional bool use_emergency_pdn_for_emergency_supl= 10;
10614
10615    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
10616    optional android.server.location.GpsLock gps_lock = 11;
10617
10618    // Number of seconds to extend the emergency session duration post emergency call.
10619    optional int32 es_extension_sec = 12;
10620
10621    // The full list of package names of proxy Android applications representing the non-framework
10622    // location access entities (on/off the device) for which the framework user has granted
10623    // non-framework location access permission. The package names are concatenated in one string
10624    // with spaces as separators.
10625    optional string enabled_proxy_app_package_name_list = 13;
10626}
10627
10628/**
10629 * Logs GNSS PSDS downloads as defined in IGnssPsds.aidl.
10630 *
10631 * Logged from:
10632 *   frameworks/base/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java
10633 */
10634message GnssPsdsDownloadReported {
10635    // PSDS type as defined in PsdsType.aidl
10636    optional int32 psds_type = 1;
10637}
10638
10639/**
10640 * Logs when a NFC device's error occurred.
10641 * Logged from:
10642 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
10643 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
10644 */
10645message NfcErrorOccurred {
10646    enum Type {
10647        UNKNOWN = 0;
10648        CMD_TIMEOUT = 1;
10649        ERROR_NOTIFICATION = 2;
10650        AID_OVERFLOW = 3;
10651        // HCE stands for Host Card Emulation
10652        HCE_LATE_BINDING = 4;
10653        NFC_ACCESS_CHECK_ERROR = 5;
10654        SE_INCORRECT_FORMAT = 6;
10655    }
10656    optional Type type = 1;
10657    // If it's nci cmd timeout, log the timeout command.
10658    optional uint32 nci_cmd = 2;
10659
10660    optional uint32 error_ntf_status_code = 3;
10661}
10662
10663/**
10664 * Logs when a NFC device's state changed event
10665 * Logged from:
10666 *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
10667 */
10668message NfcStateChanged {
10669    enum State {
10670        UNKNOWN = 0;
10671        OFF = 1;
10672        ON = 2;
10673        ON_LOCKED = 3; // Secure Nfc enabled.
10674        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
10675    }
10676    optional State state = 1 [
10677        (state_field_option).exclusive_state = true,
10678        (state_field_option).nested = false
10679    ];
10680}
10681
10682/**
10683 * Logs when a NFC Beam Transaction occurred.
10684 * Logged from:
10685 *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
10686 */
10687message NfcBeamOccurred {
10688    enum Operation {
10689        UNKNOWN = 0;
10690        SEND = 1;
10691        RECEIVE = 2;
10692    }
10693    optional Operation operation = 1;
10694}
10695
10696/**
10697 * Logs when a NFC Card Emulation Transaction occurred.
10698 * Logged from:
10699 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
10700 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
10701 */
10702message NfcCardemulationOccurred {
10703    enum Category {
10704        UNKNOWN = 0;
10705        // HCE stands for Host Card Emulation
10706        HCE_PAYMENT = 1;
10707        HCE_OTHER = 2;
10708        OFFHOST = 3;
10709        OFFHOST_PAYMENT = 4;
10710        OFFHOST_OTHER = 5;
10711        FAILED_NO_ROUTING = 6;
10712        FAILED_HCE_PAYMENT_WRONG_SETTING = 7;
10713        FAILED_HCE_OTHER_WRONG_SETTING = 8;
10714        FAILED_HCE_PAYMENT_DISCONNECTED_BEFORE_BOUND = 9;
10715        FAILED_HCE_OTHER_DISCONNECTED_BEFORE_BOUND = 10;
10716        FAILED_HCE_PAYMENT_DISCONNECTED_BEFORE_RESPONSE = 11;
10717        FAILED_HCE_OTHER_DISCONNECTED_BEFORE_RESPONSE = 12;
10718    }
10719    // Transaction belongs to HCE payment or HCE other category, or offhost.
10720    optional Category category = 1;
10721    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
10722    optional string se_name = 2;
10723
10724    optional int32 uid = 3 [(is_uid) = true];
10725}
10726
10727/**
10728 * Logs when a NFC Tag event occurred.
10729 * Logged from:
10730 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
10731 */
10732message NfcTagOccurred {
10733    enum Type {
10734        UNKNOWN = 0;
10735        URL = 1;
10736        BT_PAIRING = 2;
10737        PROVISION = 3;
10738        WIFI_CONNECT = 4;
10739        // Successful App Launch
10740        APP_LAUNCH = 5;
10741        // No suitable action found
10742        OTHERS = 6;
10743        // Dispatch event when service is in foreground
10744        FOREGROUND_DISPATCH = 7;
10745        // App Launch mute from android.nfc.action.NDEF_DISCOVERED
10746        APP_LAUNCH_NDEF_MUTE = 8;
10747        // App Launch mute from android.nfc.action.TECH_DISCOVERED
10748        APP_LAUNCH_TECH_MUTE = 9;
10749        // App Launch mute from android.nfc.action.TAG_DISCOVERED
10750        APP_LAUNCH_TAG_MUTE = 10;
10751    }
10752    optional Type type = 1;
10753
10754    optional int32 uid = 2 [(is_uid) = true];
10755    // Supported RF Technologies of the Tag
10756    repeated android.nfc.RFTechnologyType rf_types = 3;
10757    // Use for BT_PAIRING Type
10758    optional android.bluetooth.MajorClassEnum bt_device_type = 4;
10759    // Use for BT_PAIRING Type
10760    // Should be empty for HEALTH and UNKNOWN MajorClassEnum
10761    optional string bt_device_info = 5;
10762}
10763
10764/**
10765 * Logs NFC tag type when tag occurred
10766 * Logged from:
10767 *     packages/apps/Nfc/nci/jni/NfcTag.cpp
10768 */
10769message NfcTagTypeOccurred {
10770    optional android.nfc.NfcTagType type = 1;
10771}
10772
10773/**
10774 * Logs when Hce transaction triggered
10775 * Logged from:
10776 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
10777 */
10778message NfcHceTransactionOccurred {
10779    // The latency period(in microseconds) it took for the first HCE data
10780    // exchange.
10781    optional uint32 latency_micros = 1;
10782}
10783
10784/**
10785 * Logs when AID conflict occurred
10786 * Logged from:
10787 * packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
10788*/
10789message NfcAIDConflictOccurred {
10790    optional string conflicting_aid = 1;
10791}
10792
10793/**
10794 * Logs when reader app conflict occurred
10795 * Logged from:
10796 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
10797*/
10798message NfcReaderConflictOccurred {
10799}
10800
10801/**
10802 * Logs when user changed screen resolution
10803 * Logged from:
10804 *     packages/apps/Settings/src/com/android/settings/display/ScreenResolutionFragment.java
10805*/
10806message UserSelectedResolution {
10807    optional int32 display_id = 1;
10808    // display resolution
10809    optional int32 width = 2;
10810    optional int32 height = 3;
10811}
10812
10813/**
10814 * Logs when SecureElement state event changed
10815 * Logged from:
10816 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
10817 */
10818message SeStateChanged {
10819    enum State {
10820        UNKNOWN = 0;
10821        INITIALIZED = 1;
10822        DISCONNECTED = 2;
10823        CONNECTED = 3;
10824        HALCRASH = 4;
10825    }
10826    optional State state = 1;
10827
10828    optional string state_change_reason = 2;
10829    // SIMx or eSEx.
10830    optional string terminal = 3;
10831}
10832
10833/**
10834 * Information about a permission grant request
10835 */
10836message PermissionGrantRequestResultReported {
10837    // unique value identifying an API call. A API call might result in multiple of these atoms
10838    optional int64 request_id = 1;
10839
10840    // UID of package requesting the permission grant
10841    optional int32 uid = 2 [(is_uid) = true];
10842
10843    // Name of package requesting the permission grant
10844    optional string package_name = 3;
10845
10846    // The permission to be granted
10847    optional string permission_name = 4;
10848
10849    // If the permission was explicitly requested via the API or added by the system
10850    optional bool is_implicit = 5;
10851
10852    enum Result {
10853        UNDEFINED = 0;
10854        // permission request was ignored
10855        IGNORED = 1;
10856        // permission request was ignored because it was user fixed
10857        IGNORED_USER_FIXED = 2;
10858        // permission request was ignored because it was policy fixed
10859        IGNORED_POLICY_FIXED = 3;
10860        // permission was granted by user action
10861        USER_GRANTED = 4;
10862        // permission was automatically granted
10863        AUTO_GRANTED = 5;
10864        // permission was denied by user action
10865        USER_DENIED = 6;
10866        // permission was denied with prejudice by the user
10867        USER_DENIED_WITH_PREJUDICE = 7;
10868        // permission was automatically denied
10869        AUTO_DENIED = 8;
10870        // permission request was ignored because permission is restricted
10871        IGNORED_RESTRICTED_PERMISSION = 9;
10872        // one time permission was granted by user action
10873        USER_GRANTED_ONE_TIME = 10;
10874        // user ignored request by leaving the request screen without choosing any option
10875        USER_IGNORED = 11;
10876        // user granted the permission after being linked to settings
10877        USER_GRANTED_IN_SETTINGS = 12;
10878        // user denied the permission after being linked to settings
10879        USER_DENIED_IN_SETTINGS = 13;
10880        // user denied the permission with prejudice after being linked to settings
10881        USER_DENIED_WITH_PREJUDICE_IN_SETTINGS = 14;
10882        // permission was automatically revoked after one-time permission expired
10883        AUTO_ONE_TIME_PERMISSION_REVOKED = 15;
10884        // permission was automatically revoked for unused app
10885        AUTO_UNUSED_APP_PERMISSION_REVOKED = 16;
10886        // the user selected media with the photo picker
10887        PHOTOS_SELECTED = 17;
10888    }
10889    // The result of the permission grant
10890    optional Result result = 6;
10891
10892    // Whether Permission Rationale was shown on grant dialog
10893    optional bool permission_rationale_shown = 7;
10894
10895    // Whether the package was restricted by ECM
10896    optional bool is_package_restricted_by_enhanced_confirmation = 8;
10897}
10898
10899/**
10900 * Logs when Omapi API used
10901 * Logged from:
10902 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
10903 */
10904message SeOmapiReported {
10905    enum Operation {
10906        UNKNOWN = 0;
10907        OPEN_CHANNEL = 1;
10908    }
10909    optional Operation operation = 1;
10910    // SIMx or eSEx.
10911    optional string terminal = 2;
10912
10913    optional string package_name = 3;
10914}
10915
10916/**
10917  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
10918  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
10919  * Logged from:
10920  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
10921  */
10922message BroadcastDispatchLatencyReported {
10923    optional int64 dispatch_latency_millis = 1;
10924}
10925
10926/**
10927   * Logs AttentionManagerService attention check result.
10928   *
10929   * Logged from:
10930   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
10931   */
10932message AttentionManagerServiceResultReported {
10933    // See core/java/android/service/attention/AttentionService.java
10934    enum AttentionCheckResult {
10935        UNKNOWN = 20;
10936        ATTENTION_SUCCESS_ABSENT = 0;
10937        ATTENTION_SUCCESS_PRESENT = 1;
10938        ATTENTION_FAILURE_UNKNOWN = 2;
10939        ATTENTION_FAILURE_CANCELLED = 3;
10940        ATTENTION_FAILURE_PREEMPTED = 4;
10941        ATTENTION_FAILURE_TIMED_OUT = 5;
10942        ATTENTION_FAILURE_CAMERA_PERMISSION_ABSENT = 6;
10943    }
10944    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
10945}
10946
10947/**
10948 * Logs when an adb connection changes state.
10949 *
10950 * Logged from:
10951 *     frameworks/base/services/core/java/com/android/server/adb/AdbDebuggingManager.java
10952 */
10953message AdbConnectionChanged {
10954    // The last time this system connected via adb, or 0 if the 'always allow' option was not
10955    // previously selected for this system.
10956    optional int64 last_connection_time_millis = 1;
10957
10958    // The time in ms within which a subsequent connection from an 'always allow' system is allowed
10959    // to reconnect via adb without user interaction.
10960    optional int64 auth_window_millis = 2;
10961
10962    // The state of the adb connection from frameworks/proto_logging/stats/enums/debug/enums.proto.
10963    optional android.debug.AdbConnectionStateEnum state = 3;
10964
10965    // True if the 'always allow' option was selected for this system.
10966    optional bool always_allow = 4;
10967}
10968
10969/*
10970 * Logs the reported speech DSP status.
10971 *
10972 * Logged from:
10973 *  Vendor audio implementation.
10974 */
10975message SpeechDspStatReported {
10976    // The total Speech DSP uptime in milliseconds.
10977    optional int32 total_uptime_millis = 1;
10978    // The total Speech DSP downtime in milliseconds.
10979    optional int32 total_downtime_millis = 2;
10980    optional int32 total_crash_count = 3;
10981    optional int32 total_recover_count = 4;
10982}
10983
10984/**
10985 * Logs USB connector contaminant status.
10986 *
10987 * Logged from: USB Service.
10988 */
10989message UsbContaminantReported {
10990    optional string id = 1;
10991    optional android.service.ContaminantPresenceStatus status = 2;
10992}
10993
10994/**
10995 * This atom is for debugging purpose.
10996 */
10997message DebugElapsedClock {
10998    // Monotically increasing value for each pull.
10999    optional int64 pull_count = 1;
11000    // Time from System.elapsedRealtime.
11001    optional int64 elapsed_clock_millis = 2;
11002    // Time from System.elapsedRealtime.
11003    optional int64 same_elapsed_clock_millis = 3;
11004    // Diff between current elapsed time and elapsed time from previous pull.
11005    optional int64 elapsed_clock_diff_millis = 4;
11006
11007    enum Type {
11008      TYPE_UNKNOWN = 0;
11009      ALWAYS_PRESENT = 1;
11010      PRESENT_ON_ODD_PULLS = 2;
11011    }
11012    // Type of behavior for the pulled data.
11013    optional Type type = 5;
11014}
11015
11016/**
11017 * This atom is for debugging purpose.
11018 */
11019message DebugFailingElapsedClock {
11020    // Monotically increasing value for each pull.
11021    optional int64 pull_count = 1;
11022    // Time from System.elapsedRealtime.
11023    optional int64 elapsed_clock_millis = 2;
11024    // Time from System.elapsedRealtime.
11025    optional int64 same_elapsed_clock_millis = 3;
11026    // Diff between current elapsed time and elapsed time from previous pull.
11027    optional int64 elapsed_clock_diff_millis = 4;
11028}
11029
11030/** Logs System UI bubbles event changed.
11031 *
11032 * Logged from:
11033 *     frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen
11034 */
11035message SplitscreenUIChanged {
11036    // User interactions with splitscreen
11037    enum Action {
11038        UNKNOWN_ACTION = 0;
11039        ENTER = 1;
11040        EXIT = 2;
11041        APP_CHANGE = 3;
11042        RESIZE = 4;
11043        SWAP = 5;
11044    }
11045
11046    // The physical side on the device of the split
11047    enum Position {
11048        UNKNOWN_POSITION = 0;
11049        LEFT = 1;
11050        RIGHT = 2;
11051        TOP = 3;
11052        BOTTOM = 4;
11053    }
11054
11055    // The reason for entering splitscreen
11056    enum EnterReason {
11057        UNKNOWN_ENTER = 0;
11058        OVERVIEW = 1; // Deprecated, use LAUNCHER
11059        DRAG_LEFT = 2;
11060        DRAG_TOP = 3;
11061        DRAG_RIGHT = 4;
11062        DRAG_BOTTOM = 5;
11063        LAUNCHER = 6;
11064        MULTI_INSTANCE = 7;
11065        NOTIFICATIONS = 8;
11066    }
11067
11068    // The reason for exiting splitscreen
11069    enum ExitReason {
11070        UNKNOWN_EXIT = 0;
11071        DRAG_DIVIDER = 1;
11072        RETURN_HOME = 2;
11073        SCREEN_LOCKED = 3;
11074        SCREEN_LOCKED_SHOW_ON_TOP = 4;
11075        DEVICE_FOLDED = 5;
11076        ROOT_TASK_VANISHED = 6;
11077        APP_FINISHED = 7;
11078        APP_DOES_NOT_SUPPORT_MULTIWINDOW = 8;
11079        CHILD_TASK_ENTER_PIP = 9;
11080        RECREATE_SPLIT = 10;
11081        FULLSCREEN_SHORTCUT = 11;
11082        DESKTOP_MODE = 12;
11083        FULLSCREEN_REQUEST = 13;
11084    }
11085
11086    // The event action
11087    optional Action action = 1;
11088    // What triggered splitscreen (if the action is ENTER)
11089    optional EnterReason enter_reason = 2;
11090    // What triggered leaving splitscreen (if the action is EXIT)
11091    optional ExitReason exit_reason = 3;
11092    // The ratio of split between the main/side stages
11093    optional float split_ratio = 4;
11094    // Data about the main stage in split
11095    optional Position main_stage_position = 5;
11096    optional int32 main_stage_uid = 6 [(is_uid) = true];
11097    // Data about the side stage in split
11098    optional Position side_stage_position = 7;
11099    optional int32 side_stage_uid = 8 [(is_uid) = true];
11100    // The drag session id (if the enter_trigger was DRAG)
11101    optional int32 drag_instance_id = 9;
11102    // An identifier used to identify a splitscreen session
11103    optional int32 instance_id = 10;
11104}
11105
11106/** Logs System UI bubbles event changed.
11107 *
11108 * Logged from:
11109 *     frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles
11110 */
11111message BubbleUIChanged {
11112
11113    // The app package that is posting the bubble.
11114    optional string package_name = 1;
11115
11116    // The notification channel that is posting the bubble.
11117    optional string notification_channel = 2;
11118
11119    // The notification id associated with the posted bubble.
11120    optional int32 notification_id = 3;
11121
11122    // The position of the bubble within the bubble stack.
11123    optional int32 position = 4;
11124
11125    // The total number of bubbles within the bubble stack.
11126    optional int32 total_number = 5;
11127
11128    // User interactions with the bubble.
11129    enum Action {
11130        UNKNOWN = 0;
11131        POSTED = 1;
11132        UPDATED = 2;
11133        EXPANDED = 3;
11134        COLLAPSED = 4;
11135        DISMISSED = 5;
11136        STACK_DISMISSED = 6;
11137        STACK_MOVED = 7;
11138        HEADER_GO_TO_APP = 8;
11139        HEADER_GO_TO_SETTINGS = 9;
11140        PERMISSION_OPT_IN = 10;
11141        PERMISSION_OPT_OUT = 11;
11142        PERMISSION_DIALOG_SHOWN = 12;
11143        SWIPE_LEFT = 13;
11144        SWIPE_RIGHT = 14;
11145        STACK_EXPANDED = 15;
11146        FLYOUT = 16;
11147    }
11148    optional Action action = 6;
11149
11150    // Normalized screen position of the bubble stack. The range is between 0 and 1.
11151    optional float normalized_x_position = 7;
11152    optional float normalized_y_position = 8;
11153
11154    // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
11155    optional bool is_unread = 9;
11156
11157    // Whether the bubble is an on-going one.
11158    optional bool is_ongoing = 10;
11159
11160    // Whether the bubble is produced by an app running in foreground.
11161    // This is deprecated and the value should be ignored.
11162    optional bool is_foreground = 11 [deprecated = true];
11163}
11164
11165/**
11166  * Logs System UI bubbles developer errors.
11167  *
11168  * Logged from:
11169  *   frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
11170  */
11171message BubbleDeveloperErrorReported {
11172
11173    // The app package that is posting the bubble.
11174    optional string package_name = 1;
11175
11176    // Bubble developer error type enums.
11177    enum Error {
11178        UNKNOWN = 0;
11179        ACTIVITY_INFO_MISSING = 1;
11180        ACTIVITY_INFO_NOT_RESIZABLE = 2;
11181        DOCUMENT_LAUNCH_NOT_ALWAYS = 3;
11182    }
11183    optional Error error = 2 [default = UNKNOWN];
11184}
11185
11186/**
11187 * Logs that a job-specific constraint for a scheduled job has changed.
11188 * DeviceWideJobConstraintChanged will cover constraints that are normally the same for all jobs.
11189 *
11190 * Logged from:
11191 *     frameworks/base/services/core/java/com/android/server/job/controllers/JobStatus.java
11192 */
11193message ScheduledJobConstraintChanged {
11194    repeated AttributionNode attribution_node = 1;
11195
11196    // Name of the job.
11197    optional string job_name = 2;
11198
11199    optional com.android.server.job.ConstraintEnum constraint = 3;
11200
11201    enum State {
11202        UNKNOWN = 0;
11203        UNSATISFIED = 1;
11204        SATISFIED = 2;
11205    }
11206    optional State state = 4;
11207}
11208
11209/**
11210 * Logs that a device-state-level JobScheduler constraint has changed. This doesn't take individual
11211 * job or app characteristics into account. Individual jobs may have a different satisfaction value
11212 * based on special policies. Individual job constraints (eg. connectivity or prefetch) are not
11213 * logged in this atom.
11214 *
11215 * Logged from:
11216 *     frameworks/base/services/core/java/com/android/server/job/controllers/<*>.java
11217 */
11218message DeviceWideJobConstraintChanged {
11219    optional com.android.server.job.ConstraintEnum constraint = 1 [
11220        (state_field_option).primary_field = true,
11221        (is_uid) = false
11222    ];
11223
11224    enum State {
11225        UNKNOWN = 0;
11226        UNSATISFIED = 1;
11227        SATISFIED = 2;
11228    }
11229    optional State state = 2 [
11230        (state_field_option).exclusive_state = true,
11231        (state_field_option).nested = false
11232    ];
11233}
11234
11235/**
11236 * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
11237 * returns true.
11238 *
11239 * Logged from:
11240 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
11241 */
11242message ScreenTimeoutExtensionReported {
11243    // Describes how many times in a row did the power manager reset the screen off timeout.
11244    optional uint32 consecutive_timeout_extended_count = 1;
11245}
11246
11247/*
11248* Logs number of milliseconds it takes to start a process.
11249* The definition of app process start time is from the app launch time to
11250* the time that Zygote finished forking the app process and loaded the
11251* application package's java classes.
11252
11253* This metric is different from AppStartOccurred which is for foreground
11254* activity only.
11255
11256* ProcessStartTime can report all processes (both foreground and background)
11257* start time.
11258*
11259* Logged from:
11260*   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
11261*/
11262message ProcessStartTime {
11263    // The uid of the ProcessRecord.
11264    optional int32 uid = 1 [(is_uid) = true];
11265
11266    // The process pid.
11267    optional int32 pid = 2;
11268
11269    // The process name.
11270    // Usually package name, "system" for system server.
11271    // Provided by ActivityManagerService.
11272    // Do not fetch this field from device to save storage space, use uid field induced
11273    // package name as process name.
11274    optional string process_name = 3;
11275
11276    enum StartType {
11277        UNKNOWN = 0;
11278        WARM = 1;
11279        HOT = 2;
11280        COLD = 3;
11281    }
11282
11283    // The start type.
11284    optional StartType type = 4;
11285
11286    // The elapsed realtime at the start of the process.
11287    optional int64 process_start_time_millis = 5;
11288
11289    // Number of milliseconds it takes to reach bind application.
11290    optional int32 bind_application_delay_millis = 6;
11291
11292    // Number of milliseconds it takes to finish start of the process.
11293    optional int32 process_start_delay_millis = 7;
11294
11295    // hostingType field in ProcessRecord, the component type such as "activity",
11296    // "service", "content provider", "broadcast" or other strings.
11297    // deprecatd by enum type field hosting_type_id to reduce storage space usage by
11298    // string type.
11299    // Do not fetch this field from device to save storage space.
11300    optional string hosting_type = 8 [deprecated = true];
11301
11302    // hostingNameStr field in ProcessRecord. The component class name that runs
11303    // in this process.
11304    // Do not fetch this field from device to save storage space.
11305    optional string hosting_name = 9;
11306
11307    // Broadcast action name.
11308    optional string broadcast_action_name = 10;
11309
11310    enum HostingTypeId {
11311        HOSTING_TYPE_UNKNOWN = 0;
11312        HOSTING_TYPE_ACTIVITY = 1;
11313        HOSTING_TYPE_ADDED_APPLICATION = 2;
11314        HOSTING_TYPE_BACKUP = 3;
11315        HOSTING_TYPE_BROADCAST = 4;
11316        HOSTING_TYPE_CONTENT_PROVIDER = 5;
11317        HOSTING_TYPE_LINK_FAIL = 6;
11318        HOSTING_TYPE_ON_HOLD = 7;
11319        HOSTING_TYPE_NEXT_ACTIVITY = 8;
11320        HOSTING_TYPE_NEXT_TOP_ACTIVITY = 9;
11321        HOSTING_TYPE_RESTART = 10;
11322        HOSTING_TYPE_SERVICE = 11;
11323        HOSTING_TYPE_SYSTEM = 12;
11324        HOSTING_TYPE_TOP_ACTIVITY = 13;
11325        HOSTING_TYPE_EMPTY = 14;
11326    }
11327
11328    optional HostingTypeId hosting_type_id = 11;
11329
11330    enum TriggerType {
11331        TRIGGER_TYPE_UNKNOWN = 0;
11332        TRIGGER_TYPE_ALARM = 1;
11333        TRIGGER_TYPE_PUSH_MESSAGE = 2;
11334        TRIGGER_TYPE_PUSH_MESSAGE_OVER_QUOTA = 3;
11335        TRIGGER_TYPE_JOB = 4;
11336    }
11337
11338    optional TriggerType trigger_type = 12;
11339}
11340
11341/**
11342 * Track Media Codec usage (nested proto version)
11343 *   This atom is being deprecated in favor of MediaCodecReported which has a
11344 *   flattened CodecData to enable field filtering. The data is identical
11345 *   except MediaCodecReported also has the playback_duration field.
11346 * Logged from:
11347 *   frameworks/av/media/libstagefright/MediaCodec.cpp
11348 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
11349 */
11350message MediametricsCodecReported {
11351    optional int64 timestamp_nanos = 1;
11352    optional string package_name = 2;
11353    optional int64 package_version_code = 3;
11354    optional int64 media_apex_version = 4;
11355
11356    optional android.stats.mediametrics_message.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11357}
11358
11359/**
11360 * Track Media Codec usage
11361 *   This atom is the new version of MediametricsCodecReported and has a
11362 *   flattened CodecData to enable field filtering. The data is identical
11363 *   except for the addition of the playback_duration field.
11364 * Logged from:
11365 *   frameworks/av/media/libstagefright/MediaCodec.cpp
11366 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
11367 *
11368 * Next Tag: 79
11369 */
11370message MediaCodecReported {
11371    optional int64 timestamp_nanos = 1;
11372    // The inclusion of package name in a metric should be carefully analyzed to
11373    // determine if it is absolutely necessary for system health. It is strongly
11374    // discouraged to collect the package name along with other metrics (e.g.
11375    // playback duration).
11376    optional string package_name = 2;
11377    optional int64 package_version_code = 3;
11378    optional int64 media_apex_version = 4;
11379    // The name of the codec.
11380    // eg. `OMX.google.aac.decoder`
11381    optional string codec = 5;
11382    // The mime type. e.g. "audio/vorbis"
11383    optional string mime = 6;
11384    // The codec mode. i.e. video or audio.
11385    optional string mode = 7;
11386    // 1 if this is an encoder, 0 if this is a decoder.
11387    optional int32 encoder = 8;
11388    // 0, 1
11389    optional int32 secure = 9;
11390    // The video width in pixels.
11391    optional int32 width = 10;
11392    // The video height in pixels.
11393    optional int32 height = 11;
11394    // The rotation of the video in degrees
11395    // 0, 90, 180, 270
11396    optional int32 rotation = 12;
11397    // 1 if the codec uses crypto/drm, 0 otherwise.
11398    optional int32 crypto = 13;
11399    // The codec profile. The values are dependent on the codec type.
11400    // 0..n
11401    optional int32 profile = 14;
11402    // The coding level. The values are dependent on the codec type.
11403    // 0..n
11404    optional int32 level = 15;
11405    // The maximum allowed width during a particular codec session.
11406    // 0..n
11407    optional int32 max_width = 16;
11408    // The maximum allowed height during a particular codec session.
11409    // 0..n
11410    optional int32 max_height = 17;
11411    // Indicating which error condition caused the codec to reset to an
11412    // uninitialized state.
11413    optional int32 error_code = 18;
11414    // The error state.
11415    // The emitted values are descriptive:  UNINITIALIZED, INITIALIZING,
11416    // INITIALIZED, CONFIGURING, CONFIGURED, STARTING, STARTED, FLUSHING, FLUSHED,
11417    // STOPPING, and RELEASING.
11418    // In the event of an internal codec error setting the state outside of these
11419    // values, the invalid value will be encoded as a string (e.g., “17”).
11420    optional string error_state = 19;
11421    // The max latency in us.
11422    // The latency is from the time when the MediaCodec sends the ‘raw’ frame to
11423    // the media codec service to when the decoded frame arrives back in
11424    // MediaCodec’s possession.
11425    optional int64 latency_max = 20;
11426    // The min latency in us.
11427    optional int64 latency_min = 21;
11428    // The average latency in us.
11429    optional int64 latency_avg = 22;
11430    // The number of buffers included in the avg/min/max calculation above.
11431    optional int64 latency_count = 23;
11432    // The number of packets received back from the code where a latency could not
11433    // be determined, and therefore they aren't included in the avg/min/max
11434    // calculations above.
11435    optional int64 latency_unknown = 24;
11436    // Error returned by queueInputBuffer.
11437    optional int32 queue_input_buffer_error = 25;
11438    // Error returned by queueSecureInputBuffer.
11439    optional int32 queue_secure_input_buffer_error = 26;
11440    // These modes are primarily for videos.
11441    // CQ = constant quality
11442    // CBR = constant bit rate
11443    // VBR = variable bitrate
11444    optional string bitrate_mode = 27;
11445    // The bitrate presented to the underlying codec, after any modifications by
11446    // the framework to ensure a minimum quality.
11447    // If the framework changed this, the app-requested bitrate is in
11448    // original_bitrate.
11449    optional int32 bitrate = 28;
11450    // 0..n
11451    optional int64 lifetime_millis = 29;
11452    optional int64 playback_duration_seconds = 30;
11453    optional string log_session_id = 31;
11454    optional int32 channel_count = 32;
11455    optional int32 sample_rate = 33;
11456    // Total bytes produced by an encoder. When divided by video_encode_duration_us
11457    // this yields the encoding's realized bitrate.
11458    optional int64 video_encode_bytes = 34;
11459    optional int64 video_encode_frames = 35;
11460    optional int64 video_input_bytes = 36;
11461    optional int64 video_input_frames = 37;
11462    // The duration of the encoded video; NOT the encoding process duration
11463    optional int64 video_encode_duration_us = 38;
11464    optional int32 color_format = 39;
11465    optional float frame_rate = 40;
11466    optional float capture_rate = 41;
11467    optional float operating_rate = 42;
11468    optional int32 priority = 43;
11469    optional int32 video_qp_i_min = 44;
11470    optional int32 video_qp_i_max = 45;
11471    optional int32 video_qp_p_min = 46;
11472    optional int32 video_qp_p_max = 47;
11473    optional int32 video_qp_b_min = 48;
11474    optional int32 video_qp_b_max = 49;
11475    // The app-requested bitrate, present only if the framework modified the
11476    // bitrate before passing it to the underlying codec.
11477    optional int32 original_bitrate = 50;
11478    optional int32 shaping_enhanced = 51;
11479    optional int32 original_video_qp_i_min = 52;
11480    optional int32 original_video_qp_i_max = 53;
11481    optional int32 original_video_qp_p_min = 54;
11482    optional int32 original_video_qp_p_max = 55;
11483    optional int32 original_video_qp_b_min = 56;
11484    optional int32 original_video_qp_b_max = 57;
11485    optional int32 config_color_standard = 58;
11486    optional int32 config_color_range = 59;
11487    optional int32 config_color_transfer = 60;
11488    optional int32 parsed_color_standard = 61;
11489    optional int32 parsed_color_range = 62;
11490    optional int32 parsed_color_transfer = 63;
11491    optional int32 hdr_static_info = 64;
11492    optional int32 hdr10_plus_info = 65;
11493    optional int32 hdr_format = 66;
11494    // Randomly generated Codec ID for:
11495    // - correlating MediaCodecStarted and MediaCodecStopped for
11496    // more codec configuration parameters.
11497    // @since U
11498    optional int64 codec_id = 67;
11499    optional int32 array_mode = 68;
11500    optional int32 operation_mode = 69;
11501    optional int32 output_surface = 70;
11502    optional int32 app_max_input_size = 71;
11503    optional int32 used_max_input_size = 72;
11504    optional int32 codec_max_input_size = 73;
11505    optional int32 flush_count = 74;
11506    optional int32 set_surface_count = 75;
11507    optional int32 resolution_change_count = 76;
11508    optional int32 component_color_format = 77;
11509    // caller_uid replaces packagename
11510    // @Since U-QPR2
11511    optional int32 caller_uid = 78 [(is_uid) = true];
11512    optional int64 pixel_format = 79;
11513    // !!! WARNING
11514    // Keep synchronized with MediametricsCodecReported.CodecData in
11515    // mediametrics_message.proto.
11516    // Also keep AStatsEvent serialization synchronized in statsd_codec.cpp
11517    // !!! WARNING
11518}
11519
11520/**
11521 * Track Media Extractor (pulling video/audio streams out of containers) usage
11522 * Logged from:
11523 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
11524 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
11525 */
11526message MediametricsExtractorReported {
11527    optional int64 timestamp_nanos = 1;
11528    optional string package_name = 2;
11529    optional int64 package_version_code = 3;
11530    optional int64 media_apex_version = 4;
11531
11532    optional android.stats.mediametrics_message.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11533}
11534
11535/**
11536 * Track MediaParser (parsing video/audio streams from containers) usage
11537 * Logged from:
11538 *
11539 *   frameworks/av/services/mediametrics/statsd_mediaparser.cpp
11540 *   frameworks/base/apex/media/framework/jni/android_media_MediaParserJNI.cpp
11541 */
11542message MediametricsMediaParserReported {
11543    optional int64 timestamp_nanos = 1;
11544    optional string package_name = 2;
11545    optional int64 package_version_code = 3;
11546
11547    // MediaParser specific data.
11548    /**
11549     * The name of the parser selected for parsing the media, or an empty string
11550     * if no parser was selected.
11551     */
11552    optional string parser_name = 4;
11553    /**
11554     * Whether the parser was created by name. 1 represents true, and 0
11555     * represents false.
11556     */
11557    optional int32 created_by_name = 5;
11558    /**
11559     * The parser names in the sniffing pool separated by "|".
11560     */
11561    optional string parser_pool = 6;
11562    /**
11563     * The fully qualified name of the last encountered exception, or an empty
11564     * string if no exception was encountered.
11565     */
11566    optional string last_exception = 7;
11567    /**
11568     * The size of the parsed media in bytes, or -1 if unknown. Note this value
11569     * contains intentional random error to prevent media content
11570     * identification.
11571     */
11572    optional int64 resource_byte_count = 8;
11573    /**
11574     * The duration of the media in milliseconds, or -1 if unknown. Note this
11575     * value contains intentional random error to prevent media content
11576     * identification.
11577     */
11578    optional int64 duration_millis = 9;
11579    /**
11580     * The MIME types of the tracks separated by "|".
11581     */
11582    optional string track_mime_types = 10;
11583    /**
11584     * The tracks' RFC 6381 codec strings separated by "|".
11585     */
11586    optional string track_codecs = 11;
11587    /**
11588     * Concatenation of the parameters altered by the client, separated by "|".
11589     */
11590    optional string altered_parameters = 12;
11591    /**
11592     * The video width in pixels, or -1 if unknown or not applicable.
11593     */
11594    optional int32 video_width = 13;
11595    /**
11596     * The video height in pixels, or -1 if unknown or not applicable.
11597     */
11598    optional int32 video_height = 14;
11599    /**
11600     * Session id for correlating playback metrics.
11601     */
11602    optional string log_session_id = 15;
11603}
11604
11605/**
11606 * Track how we arbitrate between microphone/input requests.
11607 * Logged from
11608 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
11609 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
11610 */
11611message MediametricsAudiopolicyReported {
11612    optional int64 timestamp_nanos = 1;
11613    optional string package_name = 2;
11614    optional int64 package_version_code = 3;
11615    optional int64 media_apex_version = 4;
11616
11617    optional android.stats.mediametrics_message.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11618}
11619
11620/**
11621 * Track how we arbitrate between microphone requests.
11622 * Logged from
11623 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
11624 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
11625 */
11626message MediametricsAudiorecordReported {
11627    optional int64 timestamp_nanos = 1;
11628    optional string package_name = 2;
11629    optional int64 package_version_code = 3;
11630    optional int64 media_apex_version = 4;
11631
11632    optional android.stats.mediametrics_message.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11633
11634    // Android S
11635    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
11636    // An empty string means no session id is set.
11637    optional string log_session_id = 6;
11638}
11639
11640/**
11641 * Track how we arbitrate between microphone/input requests.
11642 * Logged from
11643 *   frameworks/av/media/libnblog/ReportPerformance.cpp
11644 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
11645 */
11646message MediametricsAudiothreadReported {
11647    optional int64 timestamp_nanos = 1;
11648    optional string package_name = 2;
11649    optional int64 package_version_code = 3;
11650    optional int64 media_apex_version = 4;
11651
11652    optional android.stats.mediametrics_message.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11653}
11654
11655/**
11656 * Track how we arbitrate between microphone/input requests.
11657 * Logged from
11658 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
11659 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
11660 */
11661message MediametricsAudiotrackReported {
11662    optional int64 timestamp_nanos = 1;
11663    optional string package_name = 2;
11664    optional int64 package_version_code = 3;
11665    optional int64 media_apex_version = 4;
11666
11667    optional android.stats.mediametrics_message.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11668
11669    // Android S
11670    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
11671    // An empty string means no session id is set.
11672    optional string log_session_id = 6;
11673}
11674
11675/**
11676 * Track information about a MIDI Device.
11677 * This is logged when device connections close or devices are disconnected.
11678 * This is used to evaluate MIDI activity.
11679 *
11680 * Logged from
11681 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
11682 */
11683message MediametricsMidiDeviceCloseReported {
11684    // The UID of the app or service that disconnects the device
11685    optional int32 uid = 1;
11686    // Device Id from MidiDeviceInfo. After a restart, this starts at 1 for the first device.
11687    // This increments each time a new MIDI device is added.
11688    // See Id in frameworks/base/media/java/android/media/midi/MidiDeviceInfo.java
11689    optional int32 midi_device_id = 2;
11690    // Input port count as defined in MidiDeviceInfo.java
11691    optional int32 input_port_count = 3;
11692    // Output port count as defined in MidiDeviceInfo.java
11693    optional int32 output_port_count = 4;
11694    // Type of device (USB, Virtual, Bluetooth)
11695    optional android.media.midi.MidiDeviceInfoType device_type = 5;
11696    // Whether the device is shared to other apps. Uses MidiDeviceInfo.isPrivate().
11697    optional bool is_shared = 6;
11698    // Whether Universal MIDI Packets are used for this device by default.
11699    // Uses MidiDeviceInfo.getDefaultProtocol()
11700    optional bool supports_ump = 7;
11701    // Whether ALSA is used by this device.
11702    // Checks whether MidiDeviceInfo.getProperties() contains PROPERTY_ALSA_CARD.
11703    optional bool using_alsa = 8;
11704    // Duration in nanoseconds in which there was an open device connection.
11705    optional int64 duration_ns = 9;
11706    // Number of times this device had an add device connection attempt.
11707    optional int32 opened_count = 10;
11708    // Number of times this device had a remove device connection attempt.
11709    optional int32 closed_count = 11;
11710    // Whether the device has disconnected.
11711    optional bool device_disconnected = 12;
11712    // Number of bytes passed from the input ports of the device.
11713    optional int32 total_input_bytes = 13;
11714    // Number of bytes passed from the output ports of the device.
11715    optional int32 total_output_bytes = 14;
11716}
11717
11718/**
11719 * Track information about DRM framework performance
11720 * Logged from
11721 *   frameworks/av/drm/libmediadrm/DrmHal.cpp
11722 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
11723 */
11724message MediametricsMediadrmReported {
11725    optional int64 timestamp_nanos = 1;
11726    optional string package_name = 2;
11727    optional int64 package_version_code = 3;
11728    optional int64 media_apex_version = 4;
11729
11730    // vendor+description tell about which DRM plugin is in use on this device
11731    optional string vendor = 5;
11732    optional string description = 6;
11733    // from frameworks/av/drm/libmediadrm/protos/metrics.proto
11734    optional bytes framework_stats = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
11735}
11736
11737/**
11738 * Track information about the widevine DRM plugin performance
11739 * Logged from
11740 *   vendor/widevine/libwvdrmengine/cdm/metrics
11741 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
11742 *
11743 * TODO b/182382094 -remove after migrated mediadrm metrics
11744 * reporting to statsd.
11745 */
11746message MediametricsDrmWidevineReported {
11747    optional int64 timestamp_nanos = 1;
11748    optional string package_name = 2;
11749    optional int64 package_version_code = 3;
11750    optional int64 media_apex_version = 4;
11751
11752    optional bytes vendor_specific_stats = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11753}
11754
11755/**
11756 * Track information about recordings (e.g. camcorder)
11757 * Logged from
11758 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
11759 *   frameworks/av/services/mediaanalytics/statsd_recorder.cpp
11760 */
11761message MediametricsRecorderReported {
11762    optional int64 timestamp_nanos = 1;
11763    optional string package_name = 2;
11764    optional int64 package_version_code = 3;
11765    optional int64 media_apex_version = 4;
11766
11767    optional android.stats.mediametrics_message.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11768}
11769
11770/**
11771 * Track Media Player usage
11772 * Logged from:
11773 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
11774 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
11775 */
11776message MediametricsNuPlayerReported {
11777    optional int64 timestamp_nanos = 1;
11778    optional string package_name = 2;
11779    optional int64 package_version_code = 3;
11780    optional int64 media_apex_version = 4;
11781
11782    optional android.stats.mediametrics_message.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
11783}
11784
11785/**
11786 * Track Legacy DRM usage
11787 * Logged from
11788 *   frameworks/av/drm/drmserver/DrmManager.cpp
11789 */
11790message MediametricsDrmManagerReported {
11791    optional int64 timestamp_nanos = 1;
11792    optional string package_name = 2;
11793    optional int64 package_version_code = 3;
11794    optional int64 media_apex_version = 4;
11795
11796    enum Method {
11797        METHOD_NOT_FOUND       = -1;
11798        GET_CONSTRAINTS        =  0;
11799        GET_METADATA           =  1;
11800        CAN_HANDLE             =  2;
11801        PROCESS_DRM_INFO       =  3;
11802        ACQUIRE_DRM_INFO       =  4;
11803        SAVE_RIGHTS            =  5;
11804        GET_ORIGINAL_MIME_TYPE =  6;
11805        GET_DRM_OBJECT_TYPE    =  7;
11806        CHECK_RIGHTS_STATUS    =  8;
11807        REMOVE_RIGHTS          =  9;
11808        REMOVE_ALL_RIGHTS      = 10;
11809        OPEN_CONVERT_SESSION   = 11;
11810        OPEN_DECRYPT_SESSION   = 12;
11811    }
11812
11813    // plugin_id+description inform which Legacy DRM plugins are still in use on device
11814    optional string plugin_id = 5;
11815    optional string description = 6;
11816    optional Method method = 7;
11817    optional string mime_types = 8;
11818
11819    optional int64 get_constraints_count =  9;
11820    optional int64 get_metadata_count = 10;
11821    optional int64 can_handle_count = 11;
11822    optional int64 process_drm_info_count = 12;
11823    optional int64 acquire_drm_info_count = 13;
11824    optional int64 save_rights_count = 14;
11825    optional int64 get_original_mime_type_count = 15;
11826    optional int64 get_drm_object_type_count = 16;
11827    optional int64 check_rights_status_count = 17;
11828    optional int64 remove_rights_count = 18;
11829    optional int64 remove_all_rights_count = 19;
11830    optional int64 open_convert_session_count = 20;
11831    optional int64 open_decrypt_session_count = 21;
11832}
11833
11834/**
11835 * State of a all permission requested by a all package
11836 * Pulled from: StatsCompanionService
11837*/
11838message DangerousPermissionState {
11839    // Name of the permission
11840    optional string permission_name = 1;
11841
11842    // Uid of the package
11843    optional int32 uid = 2 [(is_uid) = true];
11844
11845    // Package requesting the permission
11846    optional string package_name = 3;
11847
11848    // If the permission is granted to the uid
11849    optional bool is_granted = 4;
11850
11851    // Permission flags as per android.content.pm.PermissionFlags
11852    optional int32 permission_flags = 5;
11853
11854    // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
11855    optional int32 protection_flags = 6;
11856}
11857
11858/**
11859 * Logs when a package is denied access to a device identifier based on the new access requirements.
11860 *
11861 * Logged from:
11862 *     frameworks/base/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
11863 */
11864message DeviceIdentifierAccessDenied {
11865    // The name of the package denied access to the requested device identifier.
11866    optional string package_name = 1;
11867
11868    // The name of the device identifier method the package attempted to invoke.
11869    optional string method_name = 2;
11870
11871    // True if the package is preinstalled.
11872    // Starting from Android 11, this boolean is not set and will always be false.
11873    optional bool is_preinstalled = 3 [deprecated = true];
11874
11875    // True if the package is privileged.
11876    // Starting from Android 11, this boolean is not set and will always be false.
11877    optional bool is_priv_app = 4 [deprecated = true];
11878}
11879
11880/**
11881 * Pulls the ongoing mainline install train version code.
11882 * Pulled from StatsCompanionService
11883 */
11884message TrainInfo {
11885    optional int64 train_version_code = 1;
11886
11887    optional TrainExperimentIds train_experiment_id = 2 [(log_mode) = MODE_BYTES];
11888
11889    optional string train_name = 3;
11890
11891    enum Status {
11892        UNKNOWN = 0;
11893        INSTALL_REQUESTED = 1;
11894        INSTALL_STARTED = 2;
11895        INSTALL_STAGED_NOT_READY = 3;
11896        INSTALL_STAGED_READY = 4;
11897        INSTALL_SUCCESS = 5;
11898        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
11899        // and INSTALL_FAILURE_COMMIT.
11900        INSTALL_FAILURE = 6  [deprecated = true];
11901        // This enum is for installs that are manually cancelled via the Manual Update UI.
11902        INSTALL_CANCELLED = 7;
11903        INSTALLER_ROLLBACK_REQUESTED = 8;
11904        INSTALLER_ROLLBACK_INITIATED = 9;
11905        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
11906        INSTALLER_ROLLBACK_STAGED = 11;
11907        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
11908        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
11909        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
11910        INSTALLER_ROLLBACK_SUCCESS = 15;
11911        INSTALLER_ROLLBACK_FAILURE = 16;
11912        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
11913        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
11914        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
11915        INSTALL_STAGED_CANCEL_REQUESTED = 20;
11916        INSTALL_STAGED_CANCEL_SUCCESS = 21;
11917        INSTALL_STAGED_CANCEL_FAILURE = 22;
11918        INSTALL_FAILURE_DOWNLOAD = 23;
11919        INSTALL_FAILURE_STATE_MISMATCH = 24;
11920        INSTALL_FAILURE_COMMIT = 25;
11921        REBOOT_TRIGGERED = 26;
11922    }
11923    optional Status status = 4;
11924}
11925
11926/*
11927 * Information about the time zone data on a device.
11928 */
11929message TimeZoneDataInfo {
11930    // A version identifier for the data set on device. e.g. "2018i"
11931    optional string tzdb_version = 1;
11932}
11933
11934/**
11935 * Logs the GPU stats global health information.
11936 *
11937 * Logged from:
11938 *   frameworks/native/services/gpuservice/gpustats/
11939 */
11940message GpuStatsGlobalInfo {
11941    // Package name of the gpu driver.
11942    optional string driver_package_name = 1;
11943
11944    // Version name of the gpu driver.
11945    optional string driver_version_name = 2;
11946
11947    // Version code of the gpu driver.
11948    optional int64 driver_version_code = 3;
11949
11950    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
11951    optional int64 driver_build_time = 4;
11952
11953    // Total count of the gl driver gets loaded.
11954    optional int64 gl_loading_count = 5;
11955
11956    // Total count of the gl driver fails to be loaded.
11957    optional int64 gl_loading_failure_count = 6;
11958
11959    // Total count of the Vulkan driver gets loaded.
11960    optional int64 vk_loading_count = 7;
11961
11962    // Total count of the Vulkan driver fails to be loaded.
11963    optional int64 vk_loading_failure_count = 8;
11964
11965    // Api version of the system Vulkan driver.
11966    optional int32 vulkan_version = 9;
11967
11968    // Api version of the system CPU Vulkan driver.
11969    optional int32 cpu_vulkan_version = 10;
11970
11971    // Api version of the system GLES driver.
11972    optional int32 gles_version = 11;
11973
11974    // Total count of the angle driver gets loaded.
11975    optional int64 angle_loading_count = 12;
11976
11977    // Total count of the angle driver fails to be loaded.
11978    optional int64 angle_loading_failure_count = 13;
11979}
11980
11981/**
11982 * GPU driver loading time info.
11983 */
11984message GpuDriverLoadingTime {
11985    // List of all the driver loading times for this app. The list size is
11986    // capped at 16 (GpuStats::MAX_NUM_LOADING_TIMES).
11987    repeated int64 driver_loading_time = 1;
11988}
11989
11990/**
11991 * Logs the GPU stats per app health information.
11992 *
11993 * Logged from:
11994 *   frameworks/native/services/gpuservice/gpustats/
11995 */
11996message GpuStatsAppInfo {
11997    // Package name of the application that loads the gpu driver. Total number
11998    // of different packages is capped at 100.
11999    optional string app_package_name = 1;
12000
12001    // Version code of the gpu driver this app loads.
12002    optional int64 driver_version_code = 2;
12003
12004    // gl driver loading time info.
12005    optional GpuDriverLoadingTime gl_driver_loading_time = 3
12006            [(android.os.statsd.log_mode) = MODE_BYTES];
12007
12008    // Vulkan driver loading time info.
12009    optional GpuDriverLoadingTime vk_driver_loading_time = 4
12010            [(android.os.statsd.log_mode) = MODE_BYTES];
12011
12012    // Angle driver loading time info.
12013    optional GpuDriverLoadingTime angle_driver_loading_time = 5
12014            [(android.os.statsd.log_mode) = MODE_BYTES];
12015
12016    // CPU Vulkan implementation is in use.
12017    optional bool cpu_vulkan_in_use = 6;
12018
12019    // App is not doing pre-rotation correctly.
12020    optional bool false_prerotation = 7;
12021
12022    // App creates GLESv1 context.
12023    optional bool gles_1_in_use = 8;
12024
12025    // ANGLE in use for the app.
12026    optional bool angle_in_use = 9;
12027
12028    // App created a GLES context.
12029    // Introduced in Android 14.
12030    optional bool created_gles_context = 10;
12031
12032    // App created a Vulkan device.
12033    // Introduced in Android 14.
12034    optional bool created_vulkan_device = 11;
12035
12036    // App created a Vulkan swapchain.
12037    // Introduced in Android 14.
12038    optional bool created_vulkan_swapchain = 12;
12039
12040    // Vulkan API version information from applicationInfo.
12041    // Introduced in Android 14.
12042    optional int32 vulkan_api_version = 13;
12043
12044    // Bitmask of enabled features when creating Vulkan devices.
12045    // Introduced in Android 14.
12046    optional int64 vulkan_device_features_enabled = 14;
12047
12048    // Hash values of enabled Vulkan instance extensions.
12049    // The list size is capped at 100 (GpuStatsAppInfo::MAX_NUM_EXTENSIONS).
12050    // Introduced in Android 14.
12051    repeated int32 vulkan_instance_extensions_enabled = 15;
12052
12053    // Hash values of enabled Vulkan device extensions.
12054    // The list size is capped at 100 (GpuStatsAppInfo::MAX_NUM_EXTENSIONS).
12055    // Introduced in Android 14.
12056    repeated int32 vulkan_device_extensions_enabled = 16;
12057
12058    // Hash values of engine name from VkApplicationInfo
12059    repeated string vulkan_engine_names = 17;
12060}
12061
12062/*
12063 * Logs the size of the system ion heap.
12064 *
12065 * Pulled from StatsCompanionService.
12066 */
12067message SystemIonHeapSize {
12068    // Deprecated due to limited support of ion stats in debugfs.
12069    // Use `IonHeapSize` instead.
12070    option deprecated = true;
12071
12072    // Size of the system ion heap in bytes.
12073    // Read from debugfs.
12074    optional int64 size_in_bytes = 1;
12075}
12076
12077/*
12078 * Logs the total size of the ion heap.
12079 *
12080 * Pulled from StatsCompanionService.
12081 */
12082message IonHeapSize {
12083    // Total size of all ion heaps in kilobytes.
12084    // Read from: /sys/kernel/ion/total_heaps_kb.
12085    optional int32 total_size_kb = 1;
12086}
12087
12088/*
12089 * Logs the per-process size of the system ion heap.
12090 *
12091 * Pulled from StatsCompanionService.
12092 */
12093message ProcessSystemIonHeapSize {
12094    // The uid if available. -1 means not available.
12095    optional int32 uid = 1 [(is_uid) = true];
12096
12097    // The process name (from /proc/PID/cmdline).
12098    optional string process_name = 2;
12099
12100    // Sum of sizes of all allocations.
12101    optional int32 total_size_in_kilobytes = 3;
12102
12103    // Number of allocations.
12104    optional int32 allocation_count = 4;
12105
12106    // Size of the largest allocation.
12107    optional int32 max_size_in_kilobytes = 5;
12108}
12109
12110/*
12111 * Logs system-wide (primarily kernel) memory stats. Sourced from
12112 * /proc/meminfo unless explicitly stated otherwise.
12113 *
12114 * Pulled from StatsCompanionService.
12115 */
12116message SystemMemory {
12117    // /proc/meminfo SUnreclaim
12118    optional int32 unreclaimable_slab_kb = 1;
12119
12120    // /proc/meminfo VmallocUsed
12121    optional int32 vmalloc_used_kb = 2;
12122
12123    // /proc/meminfo PageTables
12124    optional int32 page_tables_kb = 3;
12125
12126    // /proc/meminfo KernelStack
12127    optional int32 kernel_stack_kb = 4;
12128
12129    // Total unreclaimable ion.
12130    // Reported from os.Debug.getIonHeapsSizeKb (R+)
12131    optional int32 total_ion_kb = 5;
12132
12133    // Measures for the amount of memory we could not account for.
12134    // Essentially points to kernel allocations (as all userspace allocs are
12135    // already tracked).
12136    // Device-specific.
12137    optional int32 unaccounted_kb = 6;
12138
12139    // GPU kernel driver allocations.
12140    // Can overlap with ion memory.
12141    // Reported from os.Debug.getGpuTotalUsageKb (S+)
12142    optional int32 gpu_total_usage_kb = 7;
12143
12144    // GPU kernel driver private allocations.
12145    // Does not overlap with ion memory
12146    // Computed as total usage - Debug.getGpuDmaBufUsageKb()
12147    // Only available on supported kernel versions (5.4+)
12148    optional int32 gpu_private_usage_kb = 8;
12149
12150    // Total DMABUF memory allocations
12151    // Reported from os.Debug.getDmabufTotalExportedKb (S+)
12152    optional int32 dmabuf_total_exported_kb = 9;
12153
12154    // Total shmem allocations
12155    optional int32 shmem_kb = 10;
12156
12157    // Total usable memory
12158    optional int32 total_kb = 11;
12159
12160    // Memory not in use
12161    optional int32 free_kb = 12;
12162
12163    // Memory available for starting new applications without swapping
12164    optional int32 available_kb = 13;
12165
12166    // Memory in active use
12167    optional int32 active_kb = 14;
12168
12169    // Memory not in active use (swappable/reclaimable)
12170    optional int32 inactive_kb = 15;
12171
12172    // Anonymous memory in active use
12173    optional int32 active_anon_kb = 16;
12174
12175    // Anonymous memory not in active use
12176    optional int32 inactive_anon_kb = 17;
12177
12178    // Page cache memory in active use
12179    optional int32 active_file_kb = 18;
12180
12181    // Page cache memory not in active use
12182    optional int32 inactive_file_kb = 19;
12183
12184    // Total swap
12185    optional int32 swap_total_kb = 20;
12186
12187    // Free swap
12188    optional int32 swap_free_kb = 21;
12189
12190    // Total amount of CMA reserved for the kernel
12191    optional int32 cma_total_kb = 22;
12192
12193    // CMA free for the kernel to use
12194    optional int32 cma_free_kb = 23;
12195}
12196
12197/*
12198 * Log dmabuf memory retained by userspace processes.
12199 * Pulled from StatsPullAtomService.
12200 */
12201 message ProcessDmabufMemory {
12202  // The uid if available. -1 means not available.
12203  optional int32 uid = 1 [(is_uid) = true];
12204
12205  // The process name (from ActivityManager).
12206  optional string process_name = 2;
12207
12208  // OOM adj score.
12209  optional int32 oom_adj_score = 3;
12210
12211  // Size of dmabufs retained by the process. The buffers are either mapped,
12212  // retained via an fd, or both.
12213  // Only available on supported kernel versions (5.4+). When unavailable, set
12214  // to -1.
12215  optional int32 retained_dmabuf_kb = 4;
12216
12217  // Number of buffers retained by the process (mapped / fd).
12218  // Only available on supported kernel versions (5.4+). When unavailable, set
12219  // to -1.
12220  optional int32 retained_dmabuf_count = 5;
12221
12222  // Size of dmabufs mapped to the process address space.
12223  optional int32 mapped_dmabuf_kb = 6 [deprecated = true];
12224
12225  // Number of dmabufs mapped to the process address space.
12226  optional int32 mapped_dmabuf_count = 7 [deprecated = true];
12227
12228  // Size of dmabufs mapped to the process address space that are also
12229  // mapped to the SurfaceFlinger address space. This indicates memory
12230  // being used by graphics compositing layers. If this data row pertains
12231  // to SurfaceFlinger itself, then the below field holds the size of all
12232  // dmabuifs that are shared with any other process. The delta between
12233  // this field and retained_dmabuf_kb, above, is private dmabufs that
12234  // SurfaceFlinger is holding but are not shared with other processes.
12235  optional int32 surfaceflinger_shared_dmabuf_kb = 8;
12236  // As above, but total number of all dmabufs shared with SurfaceFlinger.
12237  optional int32 surfaceflinger_shared_dmabuf_count = 9;
12238}
12239
12240/**
12241 * Push network stack events.
12242 *
12243 * Log from:
12244 *     frameworks/base/packages/NetworkStack/
12245 */
12246message NetworkStackReported {
12247    // The id that indicates the event reported from NetworkStack.
12248    optional int32 event_id = 1;
12249    // The data for the reported events.
12250    optional android.stats.connectivity.NetworkStackEventData network_stack_event = 2 [(log_mode) = MODE_BYTES];
12251}
12252
12253/**
12254 * Logs the apps that are installed on the external storage.
12255 * Pulled from:
12256 *   StatsCompanionService
12257 */
12258message AppsOnExternalStorageInfo {
12259    // The type of the external storage.
12260    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
12261    // The name of the package that is installed on the external storage.
12262    optional string package_name = 2;
12263}
12264
12265/**
12266 * Logs the settings related to Face.
12267 * Logged from:
12268 *   frameworks/base/services/core/java/com/android/server/stats
12269 */
12270message FaceSettings {
12271    // Whether or not face unlock is allowed on Keyguard.
12272    optional bool unlock_keyguard_enabled = 1;
12273    // Whether or not face unlock dismisses the Keyguard.
12274    optional bool unlock_dismisses_keyguard = 2;
12275    // Whether or not face unlock requires attention.
12276    optional bool unlock_attention_required = 3;
12277    // Whether or not face unlock is allowed for apps (through BiometricPrompt).
12278    optional bool unlock_app_enabled = 4;
12279    // Whether or not face unlock always requires user confirmation.
12280    optional bool unlock_always_require_confirmation = 5;
12281    // Whether or not a diverse set of poses are required during enrollment.
12282    optional bool unlock_diversity_required = 6;
12283}
12284
12285/**
12286 * Logs cooling devices maintained by the kernel.
12287 *
12288 * Pulled from StatsCompanionService.java
12289 */
12290message CoolingDevice {
12291    // The type of cooling device being reported. Eg. CPU, GPU...
12292    optional android.os.CoolingTypeEnum device_location = 1;
12293    // The name of the cooling device source. Eg. CPU0
12294    optional string device_name = 2;
12295    // Current throttle state of the cooling device. The value can any unsigned
12296    // integer between 0 and max_state defined in its driver. 0 means device is
12297    // not in throttling, higher value means deeper throttling.
12298    optional int32 state = 3;
12299}
12300
12301/**
12302 * Intelligence has several counter-type events that don't warrant a
12303 * full separate atom. These are primarily API call counters but also include
12304 * counters for feature usage and specific failure modes.
12305 *
12306 * Logged from the Intelligence mainline module.
12307 */
12308message IntelligenceEventReported {
12309  // The event type.
12310  optional android.stats.intelligence.EventType event_id = 1;
12311  // Success, failure.
12312  optional android.stats.intelligence.Status status = 2;
12313  // How many times the event occured (to report a batch of high frequency events).
12314  optional int32 count = 3;
12315  // How long the event took (sum of durations if count > 1)
12316  optional int64 duration_millis = 4;
12317}
12318
12319/**
12320 * Logs when Car Power state changed.
12321 *
12322 * Logged from:
12323 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
12324 */
12325message CarPowerStateChanged {
12326    // States come from CpmsState in CarPowerManagementService.java.
12327    enum State {
12328       WAIT_FOR_VHAL = 0;
12329       ON = 1;
12330       SHUTDOWN_PREPARE = 2;
12331       WAIT_FOR_FINISH = 3;
12332       SUSPEND = 4;
12333       SIMULATE_SLEEP = 5;
12334    }
12335    optional State state = 1;
12336}
12337
12338/**
12339 * Logs when Car User Hal is requested to switch/create/remove user.
12340 *
12341 * Logged from:
12342 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
12343 */
12344message CarUserHalModifyUserRequestReported {
12345    // Request id for the request.
12346    optional int32 request_id = 1;
12347    // Request type.
12348    enum RequestType {
12349        UNKNOWN = 0;
12350        // Car user manager requested user switch.
12351        SWITCH_REQUEST_ANDROID = 1;
12352        // OEM requested User switch.
12353        SWITCH_REQUEST_OEM = 2;
12354        // Hal switch requested after android switch using activity manager.
12355        SWITCH_REQUEST_LEGACY = 3;
12356        // Create User
12357        CREATE_REQUEST = 4;
12358        // Remove User
12359        REMOVE_REQUEST = 5;
12360    }
12361    optional RequestType request_type = 2;
12362    // Android User id of the current user which can only be 0, 10, 11 and so on.
12363    // -1 if not available.
12364    optional int32 user_id = 3;
12365    // VHAL flags of the current user. (-1 if not available)
12366    optional int32 user_flags = 4;
12367    // Android User id of the target user for switch/create/remove. It can only
12368    // be 0, 10, 11 and so on. -1 if not available.
12369    optional int32 target_user_id = 5;
12370    // VHAL flags of the target user for switch/create/remove. (-1 if not available)
12371    optional int32 target_user_flags = 6;
12372    // Request timeout Milliseconds (-1 if not available)
12373    optional int32 timeout_millis = 7;
12374}
12375
12376/**
12377 * Logs when Car User Hal responds to switch/create user request.
12378 *
12379 * Logged from:
12380 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
12381 */
12382message CarUserHalModifyUserResponseReported {
12383    // Request id of the request associated with the response.
12384    optional int32 request_id = 1;
12385    // Car user hal callback status.
12386    enum CallbackStatus {
12387        UNKNOWN = 0;
12388        // Hal response was invalid.
12389        INVALID = 1;
12390        // Hal response was ok.
12391        OK = 2;
12392        // Hal timeout during set call.
12393        HAL_SET_TIMEOUT = 3;
12394        // Hal response timeout.
12395        HAL_RESPONSE_TIMEOUT = 4;
12396        // Hal responded with wrong info.
12397        WRONG_HAL_RESPONSE = 5;
12398        // Hal is processing multiple requests simultaneously.
12399        CONCURRENT_OPERATION = 6;
12400    }
12401    optional CallbackStatus callback_status = 2;
12402
12403    // Hal request status for user switch/create/remove.
12404    enum HalRequestStatus {
12405        UNSPECIFIED = 0;
12406        // Hal request for user switch/create is successful.
12407        SUCCESS = 1;
12408        // Hal request for user switch/create failed.
12409        FAILURE = 2;
12410    }
12411    optional HalRequestStatus request_status = 3;
12412}
12413
12414/**
12415 * Logs when post switch response is posted to Car User Hal.
12416 *
12417 * Logged from:
12418 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
12419 */
12420message CarUserHalPostSwitchResponseReported {
12421    // Request id.
12422    optional int32 request_id = 1;
12423
12424    // Android user switch status.
12425    enum UserSwitchStatus {
12426        UNKNOWN = 0;
12427        // Android user switch is successful.
12428        SUCCESS = 1;
12429        // Android user switch failed.
12430        FAILURE = 2;
12431    }
12432    optional UserSwitchStatus switch_status = 2;
12433}
12434
12435/**
12436 * Logs when initial user information is requested from Car User Hal.
12437 *
12438 * Logged from:
12439 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
12440 */
12441message CarUserHalInitialUserInfoRequestReported {
12442    // Request id for the request.
12443    optional int32 request_id = 1;
12444
12445    // Request type for initial user information.
12446    enum InitialUserInfoRequestType {
12447        UNKNOWN = 0;
12448        // At the first time Android was booted (or after a factory reset).
12449        FIRST_BOOT = 1;
12450        // At the first time Android was booted after the system was updated.
12451        FIRST_BOOT_AFTER_OTA = 2;
12452        // When Android was booted "from scratch".
12453        COLD_BOOT = 3;
12454        // When Android was resumed after the system was suspended to memory.
12455        RESUME = 4;
12456    }
12457    optional InitialUserInfoRequestType request_type = 2;
12458    // Request timeout Milliseconds (-1 if not available)
12459    optional int32 timeout_millis = 3;
12460}
12461
12462/**
12463 * Logs when Car User Hal responds to initial user information requests.
12464 *
12465 * Logged from:
12466 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
12467 */
12468message CarUserHalInitialUserInfoResponseReported {
12469    // Request id of the request associated with the response.
12470    optional int32 request_id = 1;
12471    // Car user hal callback status.
12472    enum CallbackStatus {
12473        UNKNOWN = 0;
12474        // Hal response was invalid.
12475        INVALID = 1;
12476        // Hal response was ok.
12477        OK = 2;
12478        // Hal timeout during set call.
12479        HAL_SET_TIMEOUT = 3;
12480        // Hal response timeout.
12481        HAL_RESPONSE_TIMEOUT = 4;
12482        // Hal responded with wrong info.
12483        WRONG_HAL_RESPONSE = 5;
12484        // Hal is processing multiple requests simultaneously.
12485        CONCURRENT_OPERATION = 6;
12486    }
12487    optional CallbackStatus callback_status = 2;
12488    // Response for initial user information request.
12489    enum InitialUserInfoResponseAction {
12490        UNSPECIFIED = 0;
12491        // Let the Android System decide what to do.
12492        DEFAULT = 1;
12493        // Switch to an existing Android user.
12494        SWITCH = 2;
12495        // Create a new Android user (and switch to it).
12496        CREATE = 3;
12497    }
12498    optional InitialUserInfoResponseAction response_action = 3;
12499    // Android User id of the target user which can only be 0, 10, 11 and so on.
12500    // -1 if not available.
12501    optional int32 target_user = 4;
12502    // VHAL flags of the current user. (-1 if not available)
12503    optional int32 target_user_flags = 5;
12504    // User locales
12505    optional string user_locales = 6;
12506}
12507
12508/**
12509 * Logs when set user association is requested from Car User Hal.
12510 *
12511 * Logged from:
12512 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
12513 */
12514message CarUserHalUserAssociationRequestReported {
12515    // Request id for the request.
12516    optional int32 request_id = 1;
12517    // Request type.
12518    enum RequestType {
12519        UNKNOWN = 0;
12520        // For setting user association information.
12521        SET = 1;
12522        // For getting user association information.
12523        GET = 2;
12524    }
12525    optional RequestType request_type = 2;
12526    // Android User id of the current user which can only be 0, 10, 11 and so on.
12527    // -1 if not available.
12528    optional int32 current_user_id = 3;
12529    // VHAL flags of the current user. (-1 if not available)
12530    optional int32 current_user_flags = 4;
12531    // Number of the set associations requested.
12532    optional int32 number_associations = 5;
12533    // Concatenated string for the types from set associations request.
12534    // This is a string converted from an array of integers.
12535    optional string user_identification_association_types = 6;
12536    // Concatenated string for the values from set associations request.
12537    // This is a string converted from an array of integers.
12538    optional string user_identification_association_values = 7;
12539}
12540
12541/**
12542 * Logs when Car User Hal responds to set user association requests.
12543 *
12544 * Logged from:
12545 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
12546 */
12547message CarUserHalSetUserAssociationResponseReported {
12548    // Request id of the request associated with the response.
12549    optional int32 request_id = 1;
12550    // Car user hal callback status.
12551    enum CallbackStatus {
12552        UNKNOWN = 0;
12553        // Hal response was invalid.
12554        INVALID = 1;
12555        // Hal response was ok.
12556        OK = 2;
12557        // Hal timeout during set call.
12558        HAL_SET_TIMEOUT = 3;
12559        // Hal response timeout.
12560        HAL_RESPONSE_TIMEOUT = 4;
12561        // Hal responded with wrong info.
12562        WRONG_HAL_RESPONSE = 5;
12563        // Hal is processing multiple requests simultaneously.
12564        CONCURRENT_OPERATION = 6;
12565    }
12566    optional CallbackStatus callback_status = 2;
12567    // Number of the set associations in the response.
12568    optional int32 number_associations = 3;
12569    // Concatenated string for the types from set associations request.
12570    // This is a string converted from an array of integers.
12571    optional string user_identification_association_types = 4;
12572    // Concatenated string for the values from set associations request.
12573    // This is a string converted from an array of integers.
12574    optional string user_identification_association_values = 5;
12575}
12576
12577/**
12578 * Logs whether GarageMode is entered.
12579 *
12580 * Logged from:
12581 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
12582 */
12583message GarageModeInfo {
12584    // Whether GarageMode is entered.
12585    optional bool is_garage_mode = 1;
12586}
12587
12588/**
12589 * Historical app ops data per package.
12590 */
12591message AppOps {
12592    // Uid of the package requesting the op
12593    optional int32 uid = 1 [(is_uid) = true];
12594
12595    // Name of the package performing the op
12596    optional string package_name = 2;
12597
12598    // operation id
12599    optional android.app.AppOpEnum op_id = 3 [default = APP_OP_NONE];
12600
12601    // The number of times the op was granted while the app was in the
12602    // foreground (only for trusted requests)
12603    optional int64 trusted_foreground_granted_count = 4;
12604
12605    // The number of times the op was granted while the app was in the
12606    // background (only for trusted requests)
12607    optional int64 trusted_background_granted_count = 5;
12608
12609    // The number of times the op was rejected while the app was in the
12610    // foreground (only for trusted requests)
12611    optional int64 trusted_foreground_rejected_count = 6;
12612
12613    // The number of times the op was rejected while the app was in the
12614    // background (only for trusted requests)
12615    optional int64 trusted_background_rejected_count = 7;
12616
12617    // For long-running operations, total duration of the operation
12618    // while the app was in the foreground (only for trusted requests)
12619    optional int64 trusted_foreground_duration_millis = 8;
12620
12621    // For long-running operations, total duration of the operation
12622    // while the app was in the background (only for trusted requests)
12623    optional int64 trusted_background_duration_millis = 9;
12624
12625    // Whether AppOps is guarded by Runtime permission
12626    optional bool is_runtime_permission = 10;
12627}
12628
12629/**
12630 * Historical app ops data per package and attribution tag.
12631 */
12632message AttributedAppOps {
12633    // Uid of the package requesting the op
12634    optional int32 uid = 1 [(is_uid) = true];
12635
12636    // Name of the package performing the op
12637    optional string package_name = 2;
12638
12639    // tag; provided by developer when accessing related API, limited at 50 chars by API.
12640    // Attributions must be provided through manifest using <attribution> tag available in R and
12641    // above.
12642    optional string tag = 3;
12643
12644    // operation id
12645    optional android.app.AppOpEnum op = 4 [default = APP_OP_NONE];
12646
12647    // The number of times the op was granted while the app was in the
12648    // foreground (only for trusted requests)
12649    optional int64 trusted_foreground_granted_count = 5;
12650
12651    // The number of times the op was granted while the app was in the
12652    // background (only for trusted requests)
12653    optional int64 trusted_background_granted_count = 6;
12654
12655    // The number of times the op was rejected while the app was in the
12656    // foreground (only for trusted requests)
12657    optional int64 trusted_foreground_rejected_count = 7;
12658
12659    // The number of times the op was rejected while the app was in the
12660    // background (only for trusted requests)
12661    optional int64 trusted_background_rejected_count = 8;
12662
12663    // For long-running operations, total duration of the operation
12664    // while the app was in the foreground (only for trusted requests)
12665    optional int64 trusted_foreground_duration_millis = 9;
12666
12667    // For long-running operations, total duration of the operation
12668    // while the app was in the background (only for trusted requests)
12669    optional int64 trusted_background_duration_millis = 10;
12670
12671    // Whether AppOps is guarded by Runtime permission
12672    optional bool is_runtime_permission = 11;
12673
12674    // Sampling rate used on device, from 0 to 100
12675    optional int32 sampling_rate = 12;
12676}
12677
12678/**
12679 * Location Manager API Usage information(e.g. API under usage,
12680 * API call's parameters).
12681 * Logged from:
12682 *  frameworks/base/services/core/java/com/android/server/LocationManagerService.java
12683 */
12684message LocationManagerApiUsageReported {
12685
12686    // Indicating if usage starts or usage ends.
12687    optional android.stats.location.UsageState state = 1;
12688
12689    // LocationManagerService's API in use.
12690    // We can identify which API from LocationManager is
12691    // invoking current LMS API by the combination of
12692    // API parameter(e.g. is_listener_null, is_intent_null,
12693    // is_location_request_null)
12694    optional android.stats.location.LocationManagerServiceApi api_in_use = 2;
12695
12696    // Name of the package calling the API.
12697    optional string calling_package_name = 3;
12698
12699    // Type of the location provider.
12700    optional android.stats.location.ProviderType provider = 4;
12701
12702    // Quality of the location request
12703    optional android.stats.location.LocationRequestQuality quality = 5;
12704
12705    // The desired interval for active location updates, in milliseconds.
12706    // Bucketized to reduce cardinality.
12707    optional android.stats.location.LocationRequestIntervalBucket bucketized_interval = 6;
12708
12709    // Minimum distance between location updates, in meters.
12710    // Bucketized to reduce cardinality.
12711    optional android.stats.location.SmallestDisplacementBucket
12712            bucketized_smallest_displacement = 7;
12713
12714    // The number of location updates.
12715    optional int64 num_updates = 8;
12716
12717    // The request expiration time, in millisecond since boot.
12718    // Bucketized to reduce cardinality.
12719    optional android.stats.location.ExpirationBucket
12720            bucketized_expire_in = 9;
12721
12722    // Type of Callback passed in for this API.
12723    optional android.stats.location.CallbackType callback_type = 10;
12724
12725    // The radius of the central point of the alert
12726    // region, in meters. Only for API REQUEST_GEOFENCE.
12727    // Bucketized to reduce cardinality.
12728    optional android.stats.location.GeofenceRadiusBucket bucketized_radius = 11;
12729
12730    // Activity Importance of API caller.
12731    // Categorized to 3 types that are interesting from location's perspective.
12732    optional android.stats.location.ActivityImportance activiy_importance = 12;
12733
12734    // Attribution tag passed to this API.
12735    optional string attribution_tag = 13;
12736}
12737
12738/**
12739 * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
12740 */
12741message ReviewPermissionsFragmentResultReported {
12742    // unique value identifying a permission group change. A permission group change might result
12743    // in multiple of these atoms
12744    optional int64 change_id = 1;
12745
12746    // UID of package the permission belongs to
12747    optional int32 uid = 2 [(is_uid) = true];
12748
12749    // Name of package the permission belongs to
12750    optional string package_name = 3;
12751
12752    // The permission to be granted
12753    optional string permission_name = 4;
12754
12755    // The result of the permission grant
12756    optional bool permission_granted = 5;
12757}
12758
12759/**
12760* Information about results of permission upgrade by RuntimePermissionsUpgradeController
12761* Logged from: RuntimePermissionUpdgradeController
12762*/
12763message RuntimePermissionsUpgradeResult {
12764    // Permission granted as result of upgrade
12765    optional string permission_name = 1;
12766
12767    // UID of package granted permission
12768    optional int32 uid = 2 [(is_uid) = true];
12769
12770    // Name of package granted permission
12771    optional string package_name = 3;
12772}
12773
12774/**
12775* Information about a buttons presented in GrantPermissionsActivity and choice made by user
12776*/
12777message GrantPermissionsActivityButtonActions {
12778    // Permission granted as result of upgrade
12779    optional string permission_group_name = 1;
12780
12781    // UID of package granted permission
12782    optional int32 uid = 2 [(is_uid) = true];
12783
12784    // Name of package requesting permission
12785    optional string package_name = 3;
12786
12787    // Buttons presented in the dialog - bit flags, bit numbers are in accordance with
12788    // LABEL_ constants in GrantPermissionActivity.java
12789    optional int32 buttons_presented = 4;
12790
12791    // Button clicked by user - same as bit flags in buttons_presented with only single bit set
12792    optional int32 button_clicked = 5;
12793
12794    // id which identifies single session of user interacting with permission controller
12795    optional int64 session_id = 6;
12796
12797    // Target SDK of the package
12798    optional int32 target_sdk = 7;
12799
12800    // Selected precision of the location permission - bit flags indicate which
12801    // locations were chosen
12802    optional int32 selected_precision = 8;
12803
12804    // Whether Permission Rationale was shown on grant permission activity
12805    optional bool permission_rationale_shown = 9;
12806}
12807
12808/**
12809 * Information about LocationAccessCheck notification presented to user
12810 */
12811message LocationAccessCheckNotificationAction {
12812
12813    // id which identifies single session of user interacting with permission controller
12814    optional int64 session_id = 1;
12815
12816    // Uid of package for which location access check is presented
12817    optional int32 package_uid = 2;
12818
12819    // Name of package for which location access check is presented
12820    optional string package_name = 3;
12821
12822    enum Result {
12823        UNDEFINED = 0;
12824        // notification was presented to the user
12825        NOTIFICATION_PRESENTED = 1;
12826        // notification was declined by the user
12827        NOTIFICATION_DECLINED = 2;
12828        // notification was clicked by the user
12829        NOTIFICATION_CLICKED = 3;
12830    }
12831
12832    // View / interaction recorded
12833    optional Result result = 4;
12834}
12835
12836/**
12837 * Information about a permission grant or revoke made by user inside AppPermissionFragment
12838 */
12839message AppPermissionFragmentActionReported {
12840    // id which identifies single session of user interacting with permission controller
12841    optional int64 session_id = 1;
12842
12843    // unique value identifying a permission group change. A permission group change might result
12844    // in multiple of these atoms
12845    optional int64 change_id = 2;
12846
12847    // UID of package the permission belongs to
12848    optional int32 uid = 3 [(is_uid) = true];
12849
12850    // Name of package the permission belongs to
12851    optional string package_name = 4;
12852
12853    // The permission to be granted
12854    optional string permission_name = 5;
12855
12856    // The result of the permission grant
12857    optional bool permission_granted = 6;
12858
12859    // State of Permission Flags after grant as per android.content.pm.PermissionFlags
12860    optional int32 permission_flags = 7;
12861
12862    enum Button {
12863        UNDEFINED = 0;
12864        // Allow button
12865        ALLOW = 1;
12866        // Deny button
12867        DENY = 2;
12868        // Ask every time button
12869        ASK_EVERY_TIME = 3;
12870        // Allow all the time button
12871        ALLOW_ALWAYS = 4;
12872        // Allow only while using the app button
12873        ALLOW_FOREGROUND = 5;
12874        // Same is Deny button but shown in while in use dialog
12875        DENY_FOREGROUND = 6;
12876        // Switch button set to ON for location accuracy
12877        GRANT_FINE_LOCATION = 7;
12878        // Switch button set to OFF for location accuracy
12879        REVOKE_FINE_LOCATION = 8;
12880        // The user has selected photos/videos from the photo picker
12881        PHOTOS_SELECTED = 9;
12882        // User selects Permission Rationale label
12883        PERMISSION_RATIONALE = 10;
12884    }
12885
12886    // Button pressed in the dialog
12887    optional Button button_pressed = 8;
12888}
12889
12890/**
12891* Information about a AppPermissionFragment viewed by user
12892*/
12893message AppPermissionFragmentViewed {
12894    // id which identifies single session of user interacting with permission controller
12895    optional int64 session_id = 1;
12896
12897    // UID of package for which permissions are viewed
12898    optional int32 uid = 2 [(is_uid) = true];
12899
12900    // Name of package for which permissions are viewed
12901    optional string package_name = 3;
12902
12903    // Permission group viewed
12904    optional string permission_group_name = 4;
12905
12906    // Whether Permission Rationale was shown on app permission fragment
12907    optional bool permission_rationale_shown = 5;
12908}
12909
12910/**
12911* Information about a AppPermissionGroupsFragment viewed by user. Fragment has been renamed, but
12912* the log retains the old fragment name.
12913*/
12914message AppPermissionsFragmentViewed {
12915    // id which identifies single session of user interacting with permission controller
12916    optional int64 session_id = 1;
12917
12918    // id which identifies single view as every view might have several logging records
12919    // with different package information attached
12920    optional int64 view_id = 2;
12921
12922    // Permission group viewed
12923    optional string permission_group_name = 3;
12924
12925    // UID of package for which permissions are viewed
12926    optional int32 uid = 4 [(is_uid) = true];
12927
12928    // Name of package for which permissions are viewed
12929    optional string package_name = 5;
12930
12931    // Category in which permission is included
12932    enum Category {
12933      UNDEFINED = 0;
12934      ALLOWED = 1;
12935      ALLOWED_FOREGROUND = 2;
12936      DENIED = 3;
12937    }
12938    optional Category category = 6;
12939}
12940/**
12941* Information about a PermissionAppsFragment viewed by user.
12942* Logged from ui/handheld/PermissionAppsFragment.java
12943*/
12944message PermissionAppsFragmentViewed {
12945    // id which identifies single session of user interacting with permission controller
12946    optional int64 session_id = 1;
12947
12948    // id which identifies single view as every view might have several logging records
12949    // with different package information attached
12950    optional int64 view_id = 2;
12951
12952    // Permission group viewed
12953    optional string permission_group_name = 3;
12954
12955    // UID of package for which permissions are viewed
12956    optional int32 uid = 4 [(is_uid) = true];
12957
12958    // Name of package for which permissions are viewed
12959    optional string package_name = 5;
12960
12961    // Category in which app is included
12962    enum Category {
12963        UNDEFINED = 0;
12964        ALLOWED = 1;
12965        ALLOWED_FOREGROUND = 2;
12966        DENIED = 3;
12967    }
12968    optional Category category = 6;
12969}
12970
12971/**
12972* Log that the Auto Revoke notification has been clicked
12973* Logged from ui/ManagePermissionsActivity
12974*/
12975message AutoRevokeNotificationClicked {
12976    // id which identifies single session of user interacting with permission controller
12977    optional int64 session_id = 1;
12978}
12979
12980/**
12981* Log that an app has been displayed on the auto revoke page, and lists one permission that was
12982* auto revoked for it.
12983* Logged from ui/handheld/AutoRevokeFragment
12984*/
12985message AutoRevokeFragmentAppViewed {
12986    // id which identifies single session of user interacting with permission controller
12987    optional int64 session_id = 1;
12988
12989    // UID of package for which permissions are viewed
12990    optional int32 uid = 2 [(is_uid) = true];
12991
12992    // Name of package for which permissions are viewed
12993    optional string package_name = 3;
12994
12995    // The name of a permission group that has been revoked
12996    optional string permission_group_name = 4;
12997
12998    // The age of the app- more than three months old, or more than six months
12999    enum Age {
13000        UNDEFINED = 0;
13001        NEWER_BUCKET = 1;
13002        OLDER_BUCKET = 2;
13003    }
13004
13005    // How long the app has been unused. Currently, newer bucket is 3 months, older is 6 months
13006    optional Age age = 5;
13007}
13008
13009/**
13010* Log that the user has interacted with an app on the auto revoke fragment
13011* Logged from ui/handheld/AutoRevokeFragment
13012*/
13013message AutoRevokedAppInteraction {
13014    // id which identifies single session of user interacting with permission controller
13015    optional int64 session_id = 1;
13016
13017    // UID of package for which permissions are viewed
13018    optional int32 uid = 2 [(is_uid) = true];
13019
13020    // Name of package for which permissions are viewed
13021    optional string package_name = 3;
13022
13023    enum Action {
13024        UNDEFINED = 0;
13025        REMOVE = 1;
13026        OPEN = 2;
13027        APP_INFO = 3;
13028        PERMISSIONS = 4;
13029        REMOVE_IN_SETTINGS = 5;
13030        OPEN_IN_SETTINGS = 6;
13031    }
13032
13033    // The action the user took to interact with the app
13034    optional Action action = 4;
13035}
13036
13037/**
13038* Log that the AppPermissionGroupsFragment has been interacted with for the possible purposes of
13039* auto revoke, or that the auto revoke switch has been changed
13040* Logged from ui/handheld/AppPermissionGroupsFragment
13041 */
13042message AppPermissionGroupsFragmentAutoRevokeAction {
13043    // id which identifies single session of user interacting with permission controller
13044    optional int64 session_id = 1;
13045
13046    // UID of package for which permissions are viewed
13047    optional int32 uid = 2 [(is_uid) = true];
13048
13049    // Name of package for which permissions are viewed
13050    optional string package_name = 3;
13051
13052    enum Action {
13053        UNDEFINED = 0;
13054        OPENED_FOR_AUTO_REVOKE = 1;
13055        OPENED_FROM_INTENT = 2;
13056        SWITCH_ENABLED = 3;
13057        SWITCH_DISABLED = 4;
13058    }
13059
13060    // The action the user took to interact with the fragment
13061    optional Action action = 4;
13062}
13063
13064/**
13065 * Logs when there is a smart selection related event.
13066 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
13067 * Logged from: TextClassifierEventLogger.java
13068 */
13069message TextSelectionEvent {
13070    // A session ID.
13071    optional string session_id = 1;
13072
13073    // Event type of this event.
13074    optional android.stats.textclassifier.EventType event_type = 2;
13075
13076    // Name of the annotator model that is involved in this event.
13077    optional string model_name = 3;
13078
13079    // Type of widget that was involved in triggering this event.
13080    optional android.stats.textclassifier.WidgetType widget_type = 4;
13081
13082    // Index of this event in a session.
13083    optional int32 event_index = 5;
13084
13085    // Entity type that is involved.
13086    optional string entity_type = 6;
13087
13088    // Relative word index of the start of the selection.
13089    optional int32 relative_word_start_index = 7;
13090
13091    // Relative word (exclusive) index of the end of the selection.
13092    optional int32 relative_word_end_index = 8;
13093
13094    // Relative word index of the start of the smart selection.
13095    optional int32 relative_suggested_word_start_index = 9;
13096
13097    // Relative word (exclusive) index of the end of the smart selection.
13098    optional int32 relative_suggested_word_end_index = 10;
13099
13100    // Name of source package.
13101    optional string package_name = 11;
13102
13103    // Name of the LangID model that is involved in this event.
13104    optional string langid_model_name = 12;
13105}
13106
13107/**
13108 * Logs when there is a smart linkify related event.
13109 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
13110 * Logged from: TextClassifierEventLogger.java
13111 */
13112message TextLinkifyEvent {
13113    // A session ID.
13114    optional string session_id = 1;
13115
13116    // Event type of this event.
13117    optional android.stats.textclassifier.EventType event_type = 2;
13118
13119    // Name of the annotator model that is involved in this event.
13120    optional string model_name = 3;
13121
13122    // Type of widget that was involved in triggering this event.
13123    optional android.stats.textclassifier.WidgetType widget_type = 4;
13124
13125    // Index of this event in a session.
13126    optional int32 event_index = 5;
13127
13128    // Entity type that is involved.
13129    optional string entity_type = 6;
13130
13131    // Number of links detected.
13132    optional int32 num_links = 7;
13133
13134    // The total length of all links.
13135    optional int32 linked_text_length = 8;
13136
13137    // Length of input text.
13138    optional int32 text_length = 9;
13139
13140    // Time spent on generating links in ms.
13141    optional int64 latency_millis = 10;
13142
13143    // Name of source package.
13144    optional string package_name = 11;
13145
13146    // Name of the LangID model that is involved in this event.
13147    optional string langid_model_name = 12;
13148}
13149
13150/**
13151 * Logs when there is a conversation actions related event.
13152 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
13153 * Logged from: TextClassifierEventLogger.java
13154 */
13155message ConversationActionsEvent {
13156    // A session ID.
13157    optional string session_id = 1;
13158
13159    // Event type of this event.
13160    optional android.stats.textclassifier.EventType event_type = 2;
13161
13162    // Name of the actions model that is involved in this event.
13163    optional string model_name = 3;
13164
13165    // Type of widget that was involved in triggering this event.
13166    optional android.stats.textclassifier.WidgetType widget_type = 4;
13167
13168    // The first entity type that is involved.
13169    optional string first_entity_type = 5;
13170
13171    // The second entity type that is involved.
13172    optional string second_entity_type = 6;
13173
13174    // The third entity type that is involved.
13175    optional string third_entity_type = 7;
13176
13177    // The score of the first entity type.
13178    optional float score = 8;
13179
13180    // Name of source package.
13181    optional string package_name = 9;
13182
13183    // Name of the annotator model that is involved in this event.
13184    optional string annotator_model_name = 10;
13185
13186    // Name of the LangID model that is involved in this event.
13187    optional string langid_model_name = 11;
13188}
13189
13190/**
13191 * Logs when there is a language detection related event.
13192 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
13193 * Logged from: TextClassifierEventLogger.java
13194 */
13195message LanguageDetectionEvent {
13196    // A session ID.
13197    optional string session_id = 1;
13198
13199    // Event type of this event.
13200    optional android.stats.textclassifier.EventType event_type = 2;
13201
13202    // Name of the language detection model that is involved in this event.
13203    optional string model_name = 3;
13204
13205    // Type of widget that was involved in triggering this event.
13206    optional android.stats.textclassifier.WidgetType widget_type = 4;
13207
13208    // Detected language.
13209    optional string language_tag = 5;
13210
13211    // Score of the detected language.
13212    optional float score = 6;
13213
13214    // Position of this action.
13215    optional int32 action_index = 7;
13216
13217    // Name of source package.
13218    optional string package_name = 8;
13219}
13220
13221/**
13222 * Information about an OTA update attempt by update_engine.
13223 * Logged from platform/system/update_engine/metrics_reporter_android.cc
13224 */
13225message UpdateEngineUpdateAttemptReported {
13226    // The number of attempts for the update engine to apply a given payload.
13227    optional int32 attempt_number = 1;
13228
13229    optional android.stats.otaupdate.PayloadType payload_type = 2;
13230
13231    // The total time in minutes for the update engine to apply a given payload.
13232    // The time is calculated by calling clock_gettime() / CLOCK_BOOTTIME; and
13233    // it's increased when the system is sleeping.
13234    optional int32 duration_boottime_in_minutes = 3;
13235
13236    // The total time in minutes for the update engine to apply a given payload.
13237    // The time is calculated by calling clock_gettime() / CLOCK_MONOTONIC_RAW;
13238    // and it's not increased when the system is sleeping.
13239    optional int32 duration_monotonic_in_minutes = 4;
13240
13241    // The size of the payload in MiBs.
13242    optional int32 payload_size_mib = 5;
13243
13244    // The attempt result reported by the update engine for an OTA update.
13245    optional android.stats.otaupdate.AttemptResult attempt_result = 6;
13246
13247    // The error code reported by the update engine after an OTA update attempt
13248    // on A/B devices.
13249    optional android.stats.otaupdate.ErrorCode error_code = 7;
13250
13251    // The build fingerprint of the source system. The value is read from a
13252    // system property when the device takes the update. e.g.
13253    // Android/aosp_sailfish/sailfish:10/QP1A.190425.004/5507117:userdebug/test-keys
13254    optional string source_fingerprint = 8;
13255
13256    // Size of super partition.
13257    optional int64 super_partition_size_bytes = 9;
13258
13259    // Size of current slot within the super partition.
13260    optional int64 slot_size_bytes = 10;
13261
13262    // Free space available in the super partition.
13263    optional int64 super_free_space_bytes = 11;
13264
13265    // Whether the device enables Virtual A/B compression.
13266    optional bool vab_compression_enabled = 12;
13267
13268    // Whether this update attempt uses Virtual A/B compression.
13269    optional bool vab_compression_used = 13;
13270}
13271
13272/**
13273 * Information about all the attempts the device make before finishing the
13274 * successful update.
13275 * Logged from platform/system/update_engine/metrics_reporter_android.cc
13276 */
13277message UpdateEngineSuccessfulUpdateReported {
13278    // The number of attempts for the update engine to apply the payload for a
13279    // successful update.
13280    optional int32 attempt_count = 1;
13281
13282    optional android.stats.otaupdate.PayloadType payload_type = 2;
13283
13284    optional int32 payload_size_mib = 3;
13285
13286    // The total number of bytes downloaded by update_engine since the last
13287    // successful update.
13288    optional int32 total_bytes_downloaded_mib = 4;
13289
13290    // The ratio in percentage of the over-downloaded bytes compared to the
13291    // total bytes needed to successfully install the update. e.g. 200 if we
13292    // download 200MiB in total for a 100MiB package.
13293    optional int32 download_overhead_percentage = 5;
13294
13295    // The total time in minutes for the update engine to apply the payload for a
13296    // successful update.
13297    optional int32 total_duration_minutes = 6;
13298
13299    // The number of reboot of the device during a successful update.
13300    optional int32 reboot_count = 7;
13301
13302    // Whether on device verity computation is enabled
13303    optional bool fec_enabled = 8;
13304
13305    // Whether on device hash tree computation is enabled
13306    optional bool hash_tree_enabled = 9;
13307
13308}
13309
13310/**
13311 * Reported when a client requests to prepare for resume on reboot.
13312 *
13313 * Logged from:
13314 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
13315 */
13316message RebootEscrowPreparationReported {
13317  enum Result {
13318    ROR_NEED_PREPARATION = 0;
13319    ROR_SKIP_PREPARATION_AND_NOTIFY = 1;
13320    ROR_SKIP_PREPARATION_NOT_NOTIFY = 2;
13321  }
13322
13323  // The uid of the client who requests ror.
13324  optional int32 requesting_uid = 1 [(is_uid) = true];
13325
13326  optional Result result = 2;
13327
13328  // The number of clients who has requested ror, including the current caller.
13329  optional int32 requested_client_count = 3;
13330}
13331
13332/**
13333 * Reported when the lock screen knowledge factor is captured, while there are clients of
13334 * resume on reboot to notify.
13335 *
13336 * Logged from:
13337 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
13338 */
13339message RebootEscrowLskfCaptureReported {
13340  // The uid of the client to notify about the Lskf capture.
13341  optional int32 uid_to_notify = 1 [(is_uid) = true];
13342
13343  // The total number of clients who have requested ror.
13344  optional int32 requested_client_count = 2;
13345
13346  // The duration between RoR request - current LSKF capture event.
13347  optional int32 duration_ror_requested_to_lskf_captured_seconds = 3;
13348}
13349
13350/* Reported when a client (e.g. gmscore) requests to reboot with Resume on Reboot.
13351 *
13352 * Logged from:
13353 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
13354 */
13355message RebootEscrowRebootReported {
13356  optional int32 error_code = 1;
13357
13358  // The uid of clients who requested the reboot
13359  optional int32 request_uid = 2 [(is_uid) = true];
13360
13361  // All clients that have prepared for RoR before this reboot
13362  optional int32 prepared_clients_count = 3;
13363
13364  // The RoR request count for the client who requests reboot.
13365  optional int32 request_count = 4;
13366
13367  // Whether the reboot request assumes a slot switch on a/b devices.
13368  optional bool slot_switch = 5;
13369
13370  // True if the DeviceConfig shows the device is using server based RoR.
13371  optional bool server_based = 6;
13372
13373  // The duration between last LSKF captured - reboot requests
13374  optional int32 duration_lskf_captured_to_reboot_seconds = 7;
13375
13376  // The count of LSKF captured since preparation
13377  optional int32 lskf_captured_counts = 8;
13378}
13379
13380/**
13381 * Logs stats for AppSearch function calls
13382 */
13383message AppSearchCallStatsReported {
13384    // The sampling interval for this specific type of stats
13385    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
13386    optional int32 sampling_interval = 1;
13387
13388    // # of previous skipped sample for this specific type of stats
13389    // We can't push atoms too closely, so some samples might be skipped
13390    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
13391    // For example, the true count of an event could be estimated as:
13392    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
13393    optional int32 num_skipped_sample = 2;
13394
13395    // Package UID of the application.
13396    optional int32 uid = 3 [(is_uid) = true];
13397
13398    // Hash of the database name within AppSearch
13399    optional int32 database = 4;
13400
13401    // The status code for the call or internal state.
13402    // Needs to be sync with AppSearchResult#ResultCode in
13403    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
13404    optional int32 status_code = 5;
13405
13406    // Overall time used for the end-to-end function call in AppSearch.
13407    // It doesn't include binder latency
13408    optional int32 total_latency_millis = 6;
13409
13410    // Type of the function call value is in sync with
13411    // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/CallStats.java
13412    optional int32 call_type = 7;
13413
13414    // Estimated binder latency (estimated as single-trip time * 2)
13415    optional int32 estimated_binder_latency_millis = 8;
13416
13417    // Number of operations succeeded for batch operations.
13418    optional int32 num_operations_succeeded = 9;
13419
13420    // Number of operations failed for batch operations.
13421    optional int32 num_operations_failed = 10;
13422
13423    // Number of actual API calls reported in this atom.
13424    optional int32 num_reported_calls = 11;
13425}
13426
13427/**
13428 * Logs detailed stats for putting a single document in AppSearch
13429 */
13430message AppSearchPutDocumentStatsReported {
13431    // The sampling interval for this specific type of stats
13432    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
13433    optional int32 sampling_interval = 1;
13434
13435    // # of previous skipped sample for this specific type of stats
13436    // We can't push atoms too closely, so some samples might be skipped
13437    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
13438    // For example, the true count of an event could be estimated as:
13439    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
13440    optional int32 num_skipped_sample = 2;
13441
13442    // Package UID of the application.
13443    optional int32 uid = 3 [(is_uid) = true];
13444
13445    // Hash of the database name within AppSearch
13446    optional int32 database = 4;
13447
13448    // Needs to be sync with AppSearchResult#ResultCode in
13449    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
13450    optional int32 status_code = 5;
13451
13452    // Overall time used for a put_document
13453    optional int32 total_latency_millis = 6;
13454
13455    // Time used to generate a document proto from a Bundle.
13456    optional int32 generate_document_proto_latency_millis = 7;
13457
13458    // Time used to rewrite types and namespaces in the document.
13459    optional int32 rewrite_document_types_latency_millis = 8;
13460
13461    // Overall time used for the native function call.
13462    optional int32 native_latency_millis = 9;
13463
13464    // Time used to store the document.
13465    optional int32 native_document_store_latency_millis = 10;
13466
13467    // Time used to index the document. It doesn't include the time to
13468    // merge indices.
13469    optional int32 native_index_latency_millis = 11;
13470
13471    // Time used to merge the indices.
13472    optional int32 native_index_merge_latency_millis = 12;
13473
13474    // Document size in bytes.
13475    optional int32 native_document_size_bytes = 13;
13476
13477    // Number of tokens added to the index.
13478    optional int32 native_num_tokens_indexed = 14;
13479
13480    // Whether the max number of tokens exceeded.
13481    optional bool native_exceeded_max_num_tokens = 15;
13482}
13483
13484/**
13485 * Logs detailed stats for AppSearch Initialize
13486 */
13487message AppSearchInitializeStatsReported {
13488    // The sampling interval for this specific type of stats
13489    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
13490    optional int32 sampling_interval = 1;
13491
13492    // # of previous skipped sample for this specific type of stats
13493    // We can't push atoms too closely, so some samples might be skipped
13494    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
13495    // For example, the true count of an event could be estimated as:
13496    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
13497    optional int32 num_skipped_sample = 2;
13498
13499    // Package UID of the application.
13500    optional int32 uid = 3 [(is_uid) = true];
13501
13502    // Initialize status code
13503    // Needs to be sync with AppSearchResult#ResultCode in
13504    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
13505    optional int32 status_code = 4;
13506
13507    // Overall time used for initialization, not including binder latency.
13508    optional int32 total_latency_millis = 5;
13509
13510    // Whether the initialize() detects desyncs.
13511    // Desync happens if we lose the visibility doc.
13512    optional bool has_desync = 6;
13513
13514    // Time used to read and process the schema and namespaces.
13515    optional int32 prepare_schema_and_namespaces_latency_millis = 7;
13516
13517    // Time used to read and process the visibility file.
13518    optional int32 prepare_visibility_file_latency_millis = 8;
13519
13520    // Overall time used for the native function call.
13521    optional int32 native_latency_millis = 9;
13522
13523    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
13524    optional int32 native_document_store_recovery_cause = 10;
13525
13526    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
13527    optional int32 native_index_restoration_cause = 11;
13528
13529    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
13530    optional int32 native_schema_store_recovery_cause = 12;
13531
13532    // Time used to recover the document store.
13533    optional int32 native_document_store_recovery_latency_millis = 13;
13534
13535    // Time used to restore the index.
13536    optional int32 native_index_restoration_latency_millis = 14;
13537
13538    // Time used to recover the schema store.
13539    optional int32 native_schema_store_recovery_latency_millis = 15;
13540
13541    // Needs to be sync with DocumentStoreDataStatus in google3/third_party/icing/proto/logging.proto
13542    optional int32 native_document_store_data_status = 16;
13543
13544    // Number of documents currently in document store. Those may
13545    // include alive, deleted, and expired documents.
13546    optional int32 native_num_documents = 17;
13547
13548    // Number of schema types currently in the schema store.
13549    optional int32 native_num_schema_types = 18;
13550
13551    // Whether we had to reset the index, losing all data, during initialization.
13552    optional bool has_reset = 19;
13553
13554    // The status code of the reset operation if has_reset is true.
13555    // Needs to be sync with AppSearchResult#ResultCode in
13556    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
13557    optional int32 reset_status_code = 20;
13558}
13559
13560/**
13561 * Logs detailed stats for querying in AppSearch
13562 *
13563 * Next tag: 34
13564 */
13565message AppSearchQueryStatsReported {
13566    // The sampling interval for this specific type of stats
13567    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
13568    optional int32 sampling_interval = 1;
13569
13570    // # of previous skipped sample for this specific type of stats
13571    // We can't push atoms too closely, so some samples might be skipped
13572    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
13573    // For example, the true count of an event could be estimated as:
13574    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
13575    optional int32 num_skipped_sample = 2;
13576
13577    // Package UID of the application.
13578    optional int32 uid = 3 [(is_uid) = true];
13579
13580    // Hash of the database name within AppSearch
13581    optional int32 database = 4;
13582
13583    // Needs to be sync with AppSearchResult#ResultCode in
13584    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
13585    optional int32 status_code = 5;
13586
13587    // Overall time used for query which doesn't include estimated binder latency
13588    optional int32 total_latency_millis = 6;
13589
13590    // Time used to rewrite the search spec.
13591    optional int32 rewrite_search_spec_latency_millis = 7;
13592
13593    // Time used to rewrite the search results.
13594    optional int32 rewrite_search_result_latency_millis = 8;
13595
13596    // Whether it is a global query.
13597    // Needs to be sync with QueryStats#VisibilityScope in
13598    // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/QueryStats.java
13599    optional int32 visibility_scope = 9;
13600
13601    // Overall time used for the native function call.
13602    optional int32 native_latency_millis = 10;
13603
13604    // Number of terms in the query string.
13605    optional int32 native_num_terms = 11;
13606
13607    // Length of the query string.
13608    optional int32 native_query_length = 12;
13609
13610    // Number of namespaces filtered.
13611    optional int32 native_num_namespaces_filtered = 13;
13612
13613    // Number of schema types filtered.
13614    optional int32 native_num_schema_types_filtered = 14;
13615
13616    // The requested number of results in one page.
13617    optional int32 native_requested_page_size = 15;
13618
13619    // The actual number of results returned in the current page.
13620    optional int32 native_num_results_returned_current_page = 16;
13621
13622    // Whether the function call is querying the first page. If it's
13623    // not, Icing will fetch the results from cache so that some steps
13624    // may be skipped.
13625    optional bool native_is_first_page = 17;
13626
13627    // Time used to parse the query, including 2 parts: tokenizing and
13628    // transforming tokens into an iterator tree.
13629    optional int32 native_parse_query_latency_millis = 18;
13630
13631    // Strategy of scoring and ranking.
13632    // Needs to be sync with RankingStrategy.Code in google3/third_party/icing/proto/scoring.proto
13633    optional int32 native_ranking_strategy = 19;
13634
13635    // Number of documents scored.
13636    optional int32 native_num_documents_scored = 20;
13637
13638    // Time used to score the raw results.
13639    optional int32 native_scoring_latency_millis = 21;
13640
13641    // Time used to rank the scored results.
13642    optional int32 native_ranking_latency_millis = 22;
13643
13644    // Time used to fetch the document protos. Note that it includes the
13645    // time to snippet if "native_num_results_with_snippets" is NOT zero.
13646    optional int32 native_document_retrieval_latency_millis = 23;
13647
13648    // How many snippets are calculated.
13649    optional int32 native_num_results_with_snippets = 24;
13650
13651    // Time passed while waiting to acquire the lock during Java function calls.
13652    optional int32 java_lock_acquisition_latency_millis = 25;
13653
13654    // Time spent on ACL checking. This is the time spent filtering namespaces
13655    // based on package permissions and Android permission access.
13656    optional int32 acl_check_latency_millis = 26;
13657
13658    // Time passed while waiting to acquire the lock during native function calls.
13659    optional int32 native_lock_acquisition_latency_millis = 27;
13660
13661    // Time used to send data across the JNI boundary from java to native side.
13662    optional int32 java_to_native_jni_latency_millis = 28;
13663
13664    // Time used to send data across the JNI boundary from native to java side.
13665    optional int32 native_to_java_jni_latency_millis = 29;
13666
13667    // The type of the join query.
13668    //
13669    // Needs to be sync with AppSearchSchema#JoinableValueType in
13670    // packages/modules/AppSearch/framework/java/external/android/app/appsearch/AppSearchSchema.java
13671    optional int32 join_type = 30;
13672
13673    // How many total documents were joined to the parent documents.
13674    optional int32 native_num_joined_results_current_page = 31;
13675
13676    // Time taken to join child documents to parent documents.
13677    optional int32 native_join_latency_millis = 32;
13678
13679    //  The Hash of the tag to indicate the query source of this search
13680    optional int32 query_source_log_tag = 33;
13681}
13682
13683/**
13684 * Logs detailed stats for remove in AppSearch
13685 */
13686message AppSearchRemoveStatsReported {
13687    // The sampling interval for this specific type of stats
13688    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
13689    optional int32 sampling_interval = 1;
13690
13691    // # of previous skipped sample for this specific type of stats
13692    // We can't push atoms too closely, so some samples might be skipped
13693    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
13694    // For example, the true count of an event could be estimated as:
13695    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
13696    optional int32 num_previous_skipped_sample = 2;
13697
13698    // Package UID of the application.
13699    optional int32 uid = 3 [(is_uid) = true];
13700
13701    // Hash of the database name within AppSearch
13702    optional int32 database = 4;
13703
13704    // Needs to be sync with AppSearchResult#ResultCode in
13705    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
13706    optional int32 status_code = 5;
13707
13708    // Overall time used for remove including the binder latency
13709    optional int32 total_latency_millis = 6;
13710
13711    // Overall time used for the native function call.
13712    optional int32 native_latency_millis = 7;
13713
13714    // Used to indicate what kind of delete(namespace, schemaType etc) calls deleteByQuery here.
13715    // Needs to be sync with external/icing/proto/icing/proto/logging.proto#DeleteStatsProto
13716    optional int32 native_delete_type = 8;
13717
13718    // Number of documents deleted by this call.
13719    optional int32 native_num_documents_deleted = 9;
13720}
13721
13722/**
13723 * Logs detailed stats for optimization in AppSearch.
13724 *
13725 * stats pushed from:
13726 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
13727 *
13728 * Next tag: 14
13729 */
13730message AppSearchOptimizeStatsReported {
13731    // The sampling interval for this specific type of stats
13732    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
13733    optional int32 sampling_interval = 1;
13734
13735    // # of previous skipped sample for this specific type of stats
13736    // We can't push atoms too closely, so some samples might be skipped
13737    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
13738    // For example, the true count of an event could be estimated as:
13739    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
13740    optional int32 num_previous_skipped_sample = 2;
13741
13742    // Needs to be sync with AppSearchResult#ResultCode in
13743    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
13744    optional int32 status_code = 3;
13745
13746    // Overall time used for remove including the binder latency
13747    optional int32 total_latency_millis = 4;
13748
13749    // Overall time used for the native function call.
13750    optional int32 native_latency_millis = 5;
13751
13752    // Time used to optimize the document store in millis.
13753    optional int32 native_document_store_optimize_latency_millis = 6;
13754
13755    // Time used to restore the index in millis.
13756    optional int32 native_index_restoration_latency_millis = 7;
13757
13758    // Number of documents before the optimization.
13759    optional int32 native_num_original_documents = 8;
13760
13761    // Number of documents deleted during the optimization.
13762    optional int32 native_num_deleted_documents = 9;
13763
13764    // Number of documents expired during the optimization.
13765    optional int32 native_num_expired_documents = 10;
13766
13767    // Size of storage in bytes before the optimization.
13768    optional int64 native_storage_size_before_bytes = 11;
13769
13770    // Size of storage in bytes after the optimization.
13771    optional int64 native_storage_size_after_bytes = 12;
13772
13773    // The amount of time in millis since the last optimization ran.
13774    optional int64 native_time_since_last_optimize_millis = 13;
13775}
13776
13777// Reports information in external/icing/proto/icing/proto/storage.proto#DocumentStorageInfoProto
13778// Next tag: 15
13779message AppSearchDocumentStorageInfo {
13780    // Total number of alive documents.
13781    optional int32 num_alive_documents = 1;
13782
13783    // Total number of deleted documents.
13784    optional int32 num_deleted_documents = 2;
13785
13786    // Total number of expired documents.
13787    optional int32 num_expired_documents = 3;
13788
13789    // Total size of the document store in bytes. Will be set to -1 if an IO error
13790    // is encountered while calculating this field.
13791    optional int64 document_store_size_bytes = 4;
13792
13793    // Total size of the ground truth in bytes. The ground truth may
13794    // include deleted or expired documents. Will be set to -1 if an IO error is
13795    // encountered while calculating this field.
13796    optional int64 document_log_size_bytes = 5;
13797
13798    // Size of the key mapper in bytes. Will be set to -1 if an IO error is
13799    // encountered while calculating this field.
13800    optional int64 key_mapper_size_bytes = 6;
13801
13802    // Size of the document id mapper in bytes. Will be set to -1 if an IO error
13803    // is encountered while calculating this field.
13804    optional int64 document_id_mapper_size_bytes = 7;
13805
13806    // Size of the score cache in bytes. Will be set to -1 if an IO error is
13807    // encountered while calculating this field.
13808    optional int64 score_cache_size_bytes = 8;
13809
13810    // Size of the filter cache in bytes. Will be set to -1 if an IO error is
13811    // encountered while calculating this field.
13812    optional int64 filter_cache_size_bytes = 9;
13813
13814    // Size of the corpus mapper in bytes. Will be set to -1 if an IO error is
13815    // encountered while calculating this field.
13816    optional int64 corpus_mapper_size_bytes = 10;
13817
13818    // Size of the corpus score cache in bytes. Will be set to -1 if an IO error
13819    // is encountered while calculating this field.
13820    optional int64 corpus_score_cache_size_bytes = 11;
13821
13822    // Size of the namespace id mapper in bytes. Will be set to -1 if an IO error
13823    // is encountered while calculating this field.
13824    optional int64 namespace_id_mapper_size_bytes = 12;
13825
13826    // Number of namespaces seen from the current documents.
13827    optional int32 num_namespaces = 13;
13828
13829    // Storage information of each namespace is not included due to that it has string field.
13830
13831    reserved 14;
13832}
13833
13834// Reports information in external/icing/proto/icing/proto/storage.proto#SchemaStoreStorageInfoProto
13835// Next tag: 5
13836message AppSearchSchemaStoreStorageInfo {
13837    // Size of the schema store in bytes. Will be set to -1 if an IO error is
13838    // encountered while calculating this field.
13839    optional int64 schema_store_size_bytes = 1;
13840
13841    // Total number of schema types.
13842    optional int32 num_schema_types = 2;
13843
13844    // Total number of all sections across all types
13845    optional int32 num_total_sections = 3;
13846
13847    // Total number of types at the current section limit.
13848    optional int32 num_schema_types_sections_exhausted = 4;
13849}
13850
13851// Reports information in external/icing/proto/icing/proto/storage.proto#IndexStorageInfoProto
13852// Next tag: 9
13853message AppSearchIndexStorageInfo {
13854    // Total size of the index in bytes. Will be set to -1 if an IO error is
13855    // encountered while calculating this field.
13856    optional int64 index_size_bytes = 1;
13857
13858    // Size of the lite index lexicon in bytes. Will be set to -1 if an IO error
13859    // is encountered while calculating this field.
13860    optional int64 lite_index_lexicon_size_bytes = 2;
13861
13862    // Size of the lite index hit buffer in bytes. Will be set to -1 if an IO
13863    // error is encountered while calculating this field.
13864    optional int64 lite_index_hit_buffer_size_bytes = 3;
13865
13866    // Size of the main index lexicon in bytes. Will be set to -1 if an IO error
13867    // is encountered while calculating this field.
13868    optional int64 main_index_lexicon_size_bytes = 4;
13869
13870    // Size of the main index storage in bytes. Will be set to -1 if an IO error
13871    // is encountered while calculating this field.
13872    optional int64 main_index_storage_size_bytes = 5;
13873
13874    // Size of one main index block in bytes.
13875    optional int64 main_index_block_size_bytes = 6;
13876
13877    // Number of main index blocks.
13878    optional int32 num_blocks = 7;
13879
13880    // Percentage of the main index blocks that are free, assuming
13881    // allocated blocks are fully used.
13882    optional float min_free_fraction = 8;
13883}
13884
13885/**
13886 * Pulls information about storage information per user from AppSearch
13887 *
13888 * Pulled from:
13889 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
13890 *
13891 * Next tag: 6
13892 */
13893message AppSearchStorageInfo {
13894    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
13895    // This is mainly used as a dimension for the metric, but it can also tell us if
13896    // the StorageInfo is for a primary user or secondary user.
13897    optional int32 user = 1;
13898
13899    // Total size of Icing’s storage in bytes. Will be set to -1 if an IO error is
13900    // encountered while calculating this field.
13901    optional int64 total_storage_size_bytes = 2;
13902
13903    // Storage information of the document store.
13904    optional AppSearchDocumentStorageInfo document_storage_info = 3
13905        [(android.os.statsd.log_mode) = MODE_BYTES];
13906
13907    // Storage information of the schema store.
13908    optional AppSearchSchemaStoreStorageInfo schema_store_storage_info = 4
13909        [(android.os.statsd.log_mode) = MODE_BYTES];
13910
13911    // Storage information of the index.
13912    optional AppSearchIndexStorageInfo index_storage_info = 5
13913        [(android.os.statsd.log_mode) = MODE_BYTES];
13914}
13915
13916
13917/**
13918 * Reported when AppSearch Contacts Indexer syncs the contacts data from CP2 to AppSearch
13919 *
13920 * Reported from:
13921 *   packages/modules/AppSearch/service/java/com/android/server/appsearch/contactsindexer/ContactsIndexerManagerService.java
13922 *
13923 * Next tag: 18
13924 */
13925message ContactsIndexerUpdateStatsReported {
13926    enum UpdateType {
13927      UNKNOWN = 0;
13928      DELTA = 1;
13929      FULL = 2;
13930    }
13931
13932    // Type of the update
13933    optional UpdateType update_type = 1;
13934
13935    // Latency for the update in millis
13936    optional int32 total_latency_millis = 2;
13937
13938    // Status code to indicate whether the insert new contacts, or update
13939    // existing contacts succeeds, or fails and why
13940    // In case of success, it only contains OK.
13941    // In case of failures, it contains all the possible errors we get.
13942    repeated int32 update_status_codes = 3;
13943
13944    // Status code to indicate whether the delete succeeds, or fails and why
13945    // In case of success, it only contains OK.
13946    // In case of failures, it contains all the possible errors we get.
13947    repeated int32 delete_status_codes = 4;
13948
13949    // Number of new contacts to be updated.
13950    optional int32 number_of_new_contacts_to_be_updated = 5;
13951
13952    // Number of old and new contacts has been successfully updated.
13953    optional int32 number_of_contacts_update_succeeded = 6;
13954
13955    // Number of old contacts has been successfully deleted.
13956    optional int32 number_of_contacts_delete_succeeded = 7;
13957
13958    // Number of old contacts skipped during this update due to no
13959    // significant change.
13960    optional int32 number_of_contacts_update_skipped = 8;
13961
13962    // Number of old and new contacts failed to be updated
13963    optional int32 number_of_contacts_update_failed = 9;
13964
13965    // Number of old contacts failed to be deleted
13966    optional int32 number_of_contacts_delete_failed = 10;
13967
13968    // Number of old contacts to be deleted that were not found
13969    optional int32 number_of_contacts_delete_not_found = 11;
13970
13971    // Start timestamp of the update in millis
13972    optional int64 update_start_timestamp_millis = 12;
13973
13974    // Timestamp of the last full update in millis (not including this update)
13975    optional int64 last_full_update_timestamp_millis = 13;
13976
13977    // Timestamp of the last delta update in millis (not including this update)
13978    optional int64 last_delta_update_timestamp_millis = 14;
13979
13980    // Timestamp of the last contact to be updated from CP2 in millis
13981    optional int64 last_contact_updated_timestamp_millis = 15;
13982
13983    // Timestamp of the last contact to be deleted from CP2 in millis
13984    optional int64 last_contact_deleted_timestamp_millis = 16;
13985
13986    // The previous update's last_contact_updated_timestamp_millis
13987    // This field is only set for a full update and expected to match
13988    // last_contacted_update_timestamp_millis. If the fields do not match, then we
13989    // were unexpectedly not synced up with CP2 at the time of the update.
13990    optional int64 previous_last_contact_updated_timestamp_millis = 17;
13991}
13992
13993/**
13994 * Reported when the RebootEscrow HAL has attempted to recover the escrowed
13995 * key to indicate whether it was successful or not.
13996 *
13997 * Logged from:
13998 *   frameworks/base/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
13999 */
14000message RebootEscrowRecoveryReported {
14001    // Type of the resume on reboot backend provider.
14002    enum ServiceType {
14003        UNKNOWN = 0;
14004        HAL = 1;
14005        SERVER_BASED = 2;
14006    }
14007
14008    // Whether the vbmeta digest of the current slot matches a precomputed value before reboot.
14009    enum VbmetaDigestStatus {
14010        MATCH_EXPECTED_SLOT = 0;
14011        MATCH_FALLBACK_SLOT = 1;
14012        MISMATCH = 2;
14013    }
14014
14015    optional bool successful = 1;
14016    // The error code for escrow data recovery failure
14017    optional int32 error_code = 2;
14018
14019    optional ServiceType type = 3;
14020
14021    // Number of retries to unwrap the escrow key asynchronously.
14022    optional int32 get_escrow_key_retry_count = 4;
14023
14024    // The duration between storing of reboot escrow key ->
14025    // use of reboot escrow key to unlock CE after reboot
14026    optional int32 duration_escrow_key_storage_to_unlock_seconds = 5;
14027
14028    optional VbmetaDigestStatus vbmeta_digest_status = 6;
14029
14030    // The duration between boot complete -> CE unlock
14031    optional int32 duration_boot_complete_to_unlock_seconds = 7;
14032}
14033
14034/**
14035 * Global display pipeline metrics reported by SurfaceFlinger.
14036 * Metrics exist beginning in Android 11.
14037 * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
14038 * That proto must be updated if this atom is updated.
14039 *
14040 * Pulled from:
14041 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
14042 */
14043message SurfaceflingerStatsGlobalInfo {
14044    // Aggregated refresh rate buckets that layers were presenting at. Buckets
14045    // are defined in SurfaceFlinger and are tracked per device.
14046    // Introduced in Android 12.
14047    // This is intended to be used as a dimenstion in collecting per-refresh rate
14048    // jank statistics.
14049    optional int32 display_refresh_rate_bucket = 18;
14050    // Aggregated render rate buckets that layers were overridden to run at.
14051    // Buckets are defined in SurfaceFlinger and are tracked per device.
14052    // Introduced in Android 12.
14053    // This is intended to be used as a dimension in collecting per-render rate
14054    // jank statistics.
14055    optional int32 render_rate_bucket = 21;
14056    // Total number of frames presented during the tracing period
14057    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14058    // using render_rate_bucket as a dimension.
14059    optional int64 total_frames = 1;
14060    // Total number of frames missed
14061    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14062    // using render_rate_bucket as a dimension.
14063    optional int64 missed_frames = 2;
14064    // Total number of frames that fell back to client composition
14065    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14066    // using render_rate_bucket as a dimension.
14067    optional int64 client_composition_frames = 3;
14068    // Total time the display was turned on
14069    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14070    // using render_rate_bucket as a dimension.
14071    optional int64 display_on_millis = 4;
14072    // Total time that was spent performing animations.
14073    // This is derived from the present-to-present layer histogram.
14074    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14075    // using render_rate_bucket as a dimension.
14076    optional int64 animation_millis = 5;
14077    // Total number of event connections tracked by SurfaceFlinger at the time
14078    // of this pull. If this number grows prohibitively large, then this can
14079    // cause jank due to resource contention.
14080    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14081    // using render_rate_bucket as a dimension.
14082    optional int32 event_connection_count = 6;
14083    // Set of timings measured from when SurfaceFlinger began compositing a
14084    // frame, until the frame was requested to be presented to the display. This
14085    // measures SurfaceFlinger's total CPU walltime on the critical path per
14086    // frame.
14087    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14088    // using render_rate_bucket as a dimension.
14089    optional FrameTimingHistogram frame_duration = 7
14090        [(android.os.statsd.log_mode) = MODE_BYTES];
14091    // Set of timings measured from when SurfaceFlinger first began using the
14092    // GPU to composite a frame, until the GPU has finished compositing that
14093    // frame. This measures the total additional time SurfaceFlinger needed to
14094    // perform due to falling back into GPU composition.
14095    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
14096    // using render_rate_bucket as a dimension.
14097    optional FrameTimingHistogram render_engine_timing = 8
14098        [(android.os.statsd.log_mode) = MODE_BYTES];
14099    // Number of frames where SF saw a frame, based on its frame timeline.
14100    // Frame timelines may include transactions without updating buffer contents.
14101    // Introduced in Android 12.
14102    optional int32 total_timeline_frames = 9;
14103    // Number of frames where SF saw a janky frame.
14104    // Introduced in Android 12.
14105    optional int32 total_janky_frames = 10;
14106    // Number of janky frames where SF spent a long time on the CPU.
14107    // Introduced in Android 12.
14108    optional int32 total_janky_frames_with_long_cpu = 11;
14109    // Number of janky frames where SF spent a long time on the GPU.
14110    // Introduced in Android 12.
14111    optional int32 total_janky_frames_with_long_gpu = 12;
14112    // Number of janky frames where SF missed the frame deadline, but there
14113    // was not an attributed reason (e.g., maybe HWC missed?)
14114    // Introduced in Android 12.
14115    optional int32 total_janky_frames_sf_unattributed = 13;
14116    // Number of janky frames where the app missed the frame deadline, but
14117    // there was not an attributed reason
14118    // Introduced in Android 12.
14119    optional int32 total_janky_frames_app_unattributed = 14;
14120    // Number of janky frames that were caused because of scheduling errors in
14121    // SF that resulted in early present (e.g., SF sending a buffer to the
14122    // composition engine earlier than expected, resulting in a present that is
14123    // one vsync early)
14124    // Introduced in Android 12.
14125    optional int32 total_janky_frames_sf_scheduling = 15;
14126    // Number of frames that were classified as jank because of possible drift in
14127    // vsync predictions.
14128    // Introduced in Android 12.
14129    optional int32 total_jank_frames_sf_prediction_error = 16;
14130    // Number of janky frames where the app was in a buffer stuffed state (more
14131    // than one buffer ready to be presented at the same vsync). Usually caused
14132    // when the first frame is unusually long, the following frames enter into a
14133    // stuffed state.
14134    // Introduced in Android 12.
14135    optional int32 total_jank_frames_app_buffer_stuffing = 17;
14136    // Buckets of timings in ms by which SurfaceFlinger's deadline was missed
14137    // while latching and presenting frames.
14138    // Introduced in Android 12.
14139    optional FrameTimingHistogram sf_deadline_misses = 19
14140        [(android.os.statsd.log_mode) = MODE_BYTES];
14141    // Buckets of timings in ms by which the Vsync prediction drifted, when
14142    // compared to the actual hardware vsync.
14143    // Introduced in Android 12.
14144    optional FrameTimingHistogram sf_prediction_errors = 20
14145        [(android.os.statsd.log_mode) = MODE_BYTES];
14146
14147    // Next ID: 22
14148}
14149
14150/**
14151 * Per-layer display pipeline metrics reported by SurfaceFlinger.
14152 * Metrics exist beginning in Android 11.
14153 * The number of layers uploaded may be restricted due to size limitations.
14154 * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
14155 * That proto must be updated if this atom is updated.
14156 *
14157 * Pulled from:
14158 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
14159 */
14160message SurfaceflingerStatsLayerInfo {
14161    // UID of the application who submitted this layer for presentation
14162    // This is intended to be used as a dimension for surfacing rendering
14163    // statistics to applications.
14164    // Introduced in Android 12.
14165    optional int32 uid = 12 [(is_uid) = true];
14166    // Refresh rate bucket that the layer was presenting at. Buckets are
14167    // defined in SurfaceFlinger and are tracked per device.
14168    // Introduced in Android 12.
14169    // This is intended to be used as a dimension in collecting per-refresh rate
14170    // jank statistics
14171    optional int32 display_refresh_rate_bucket = 22;
14172    // Render rate bucket that the layer was submitting frames at. Buckets are
14173    // defined in SurfaceFlinger and are tracked per device.
14174    // Introduced in Android 12.
14175    // This is intended to be used as a dimension in collecting per-render rate
14176    // jank statistics.
14177    optional int32 render_rate_bucket = 23;
14178
14179    // Game modes are used only for integrating with GameManager.
14180    enum GameMode {
14181         GAME_MODE_UNSPECIFIED = 0;
14182         GAME_MODE_UNSUPPORTED = 1;
14183         GAME_MODE_STANDARD = 2;
14184         GAME_MODE_PERFORMANCE = 3;
14185         GAME_MODE_BATTERY = 4;
14186         GAME_MODE_CUSTOM = 5;
14187    }
14188
14189    // Game mode that the layer was running at. Used to track user engagement
14190    // in different modes. The modes are defined in GameManager.java
14191    // All non-game layers will have this field set to UNSUPPORTED.
14192    // Introduced in Android 12
14193    // This is intended to be used as a dimension in collecting per-game mode
14194    // fps and frame related metrics.
14195    optional GameMode game_mode = 26;
14196    // The layer for this set of metrics
14197    // In many scenarios the package name is included in the layer name, e.g.,
14198    // layers created by Window Manager. But this is not a guarantee - in the
14199    // general case layer names are arbitrary debug names.
14200    optional string layer_name = 1;
14201    // Total number of frames presented
14202    optional int64 total_frames = 2;
14203    // Total number of dropped frames while latching a buffer for this layer.
14204    optional int64 dropped_frames = 3;
14205    // Set of timings measured between successive presentation timestamps.
14206    optional FrameTimingHistogram present_to_present = 4
14207        [(android.os.statsd.log_mode) = MODE_BYTES];
14208    // Variability histogram of present_to_present timings.
14209    optional FrameTimingHistogram present_to_present_delta = 27
14210        [(android.os.statsd.log_mode) = MODE_BYTES];
14211    // Set of timings measured from when an app queued a buffer for
14212    // presentation, until the buffer was actually presented to the
14213    // display.
14214    optional FrameTimingHistogram post_to_present = 5
14215        [(android.os.statsd.log_mode) = MODE_BYTES];
14216    // Set of timings measured from when a buffer is ready to be presented,
14217    // until the buffer was actually presented to the display.
14218    optional FrameTimingHistogram acquire_to_present = 6
14219        [(android.os.statsd.log_mode) = MODE_BYTES];
14220    // Set of timings measured from when a buffer was latched by
14221    // SurfaceFlinger, until the buffer was presented to the display
14222    optional FrameTimingHistogram latch_to_present = 7
14223        [(android.os.statsd.log_mode) = MODE_BYTES];
14224    // Set of timings measured from the desired presentation to the actual
14225    // presentation time
14226    optional FrameTimingHistogram desired_to_present = 8
14227        [(android.os.statsd.log_mode) = MODE_BYTES];
14228    // Set of timings measured from when an app queued a buffer for
14229    // presentation, until the buffer was ready to be presented.
14230    optional FrameTimingHistogram post_to_acquire = 9
14231        [(android.os.statsd.log_mode) = MODE_BYTES];
14232    // Frames missed latch because the acquire fence didn't fire
14233    optional int64 late_acquire_frames = 10;
14234    // Frames latched early because the desired present time was bad
14235    optional int64 bad_desired_present_frames = 11;
14236    // Number of frames where SF saw a frame, based on its frame timeline.
14237    // Frame timelines may include transactions without updating buffer contents.
14238    // Introduced in Android 12.
14239    optional int32 total_timeline_frames = 13;
14240    // Number of frames where SF saw a janky frame.
14241    // Introduced in Android 12.
14242    optional int32 total_janky_frames = 14;
14243    // Number of janky frames where SF spent a long time on the CPU.
14244    // Introduced in Android 12.
14245    optional int32 total_janky_frames_with_long_cpu = 15;
14246    // Number of janky frames where SF spent a long time on the GPU.
14247    // Introduced in Android 12.
14248    optional int32 total_janky_frames_with_long_gpu = 16;
14249    // Number of janky frames where SF missed the frame deadline, but there
14250    // was not an attributed reason (e.g., maybe HWC missed?)
14251    // Introduced in Android 12.
14252    optional int32 total_janky_frames_sf_unattributed = 17;
14253    // Number of janky frames where the app missed the frame deadline, but
14254    // there was not an attributed reason
14255    // Introduced in Android 12.
14256    optional int32 total_janky_frames_app_unattributed = 18;
14257    // Number of janky frames that were caused because of scheduling errors in
14258    // SF that resulted in early present (e.g., SF sending a buffer to the
14259    // composition engine earlier than expected, resulting in a present that is
14260    // one vsync early)
14261    // Introduced in Android 12.
14262    optional int32 total_janky_frames_sf_scheduling = 19;
14263    // Number of frames that were classified as jank because of possible drift in
14264    // vsync predictions.
14265    // Introduced in Android 12.
14266    optional int32 total_jank_frames_sf_prediction_error = 20;
14267    // Number of janky frames where the app was in a buffer stuffed state (more
14268    // than one buffer ready to be presented at the same vsync). Usually caused
14269    // when the first frame is unusually long, the following frames enter into a
14270    // stuffed state.
14271    // Introduced in Android 12.
14272    optional int32 total_jank_frames_app_buffer_stuffing = 21;
14273
14274    /**
14275     * Encapsulates the FrameRateVote information sent by the application while
14276     * calling setFrameRate.
14277     * Metrics exist beginning in Android 12.
14278     */
14279    message SetFrameRateVote {
14280        // The desired frame rate the application wishes to run on.
14281        optional float frame_rate = 1;
14282
14283        enum FrameRateCompatibility {
14284            FRAME_RATE_UNDEFINED = 0;
14285            FRAME_RATE_DEFAULT = 1;
14286            FRAME_RATE_EXACT_OR_MULTIPLE = 2;
14287        }
14288
14289        // Specifies how to interpret the frame rate associated with the layer.
14290        // Defined in Layer.h
14291        optional FrameRateCompatibility frame_rate_compatibility = 2;
14292
14293        enum Seamlessness {
14294            SEAMLESS_UNDEFINED = 0;
14295            SEAMLESS_SHOULD_BE_SEAMLESS = 1;
14296            SEAMLESS_NOT_REQUIRED = 2;
14297        }
14298        // Indicates whether seamless refresh rate switch is required or not.
14299        optional Seamlessness seamlessness = 3;
14300    }
14301
14302    // The last frame rate vote set by the application.
14303    // Introduced in Android 12.
14304    optional SetFrameRateVote set_frame_rate_vote = 24
14305        [(android.os.statsd.log_mode) = MODE_BYTES];
14306    // Buckets of timings in ms by which the app deadline was missed while
14307    // submitting work for a frame.
14308    // Introduced in Android 12.
14309    optional FrameTimingHistogram app_deadline_misses = 25
14310        [(android.os.statsd.log_mode) = MODE_BYTES];
14311
14312    // Next ID: 28
14313}
14314
14315/**
14316 * Histogram of frame counts bucketed by time in milliseconds.
14317 * Because of size limitations, we hard-cap the number of buckets, with
14318 * buckets for corresponding to larger milliseconds being less precise.
14319 */
14320message FrameTimingHistogram {
14321    // Timings in milliseconds that describes a set of histogram buckets
14322    repeated int32 time_millis_buckets = 1;
14323    // Number of frames that match to each time_millis, i.e. the bucket
14324    // contents
14325    // It's required that len(time_millis) == len(frame_count)
14326    repeated int64 frame_counts = 2;
14327}
14328
14329/**
14330 * Janky event as reported by SurfaceFlinger.
14331 * This event is intended to be consumed by a Perfetto subscriber for
14332 * automated trace collection.
14333 *
14334 * Logged from:
14335 *    frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
14336 */
14337message DisplayJankReported {
14338    // Informational field for how long the janky event lasted in milliseconds
14339    optional int64 event_duration_millis = 1;
14340    // Number of frame deadlines missed, where SurfaceFlinger failed to update
14341    // the display on time.
14342    optional int32 present_deadlines_missed = 2;
14343}
14344
14345message CameraStreamProto {
14346    // The stream width (in pixels)
14347    optional int32 width = 1;
14348    // The stream height (in pixels)
14349    optional int32 height = 2;
14350    // The format of the stream
14351    optional int32 format = 3;
14352    // The dataspace of the stream
14353    optional int32 data_space = 4;
14354    // The usage flag of the stream
14355    optional int64 usage = 5;
14356
14357    // The number of requests for this stream
14358    optional int64 request_count = 6;
14359    // The number of buffer error for this stream
14360    optional int64 error_count = 7;
14361    // The capture latency of first request for this stream
14362    optional int32 first_capture_latency_millis = 8;
14363
14364    // The maximum number of hal buffers
14365    optional int32 max_hal_buffers = 9;
14366    // The maximum number of app buffers
14367    optional int32 max_app_buffers = 10;
14368
14369    // Type of stream histogram
14370    // 1: Capture latency: bin size in milliseconds
14371    enum HistogramType {
14372        UNKNOWN = 0;
14373        CAPTURE_LATENCY = 1;
14374    }
14375    optional HistogramType histogram_type = 11;
14376    // The boundary values between histogram bins
14377    // Expected number of fields: 9
14378    repeated float histogram_bins = 12;
14379    // The frame counts for each histogram bins
14380    // Expected number of fields: 10
14381    repeated int64 histogram_counts = 13;
14382    // The dynamic range profile of the stream
14383    optional int64 dynamic_range_profile = 14;
14384    // The stream use case
14385    optional int64 stream_use_case = 15;
14386    // The color space
14387    optional int32 color_space = 16;
14388}
14389
14390/**
14391 * Information about camera facing and API level usage.
14392 * Logged from:
14393 *   frameworks/base/services/core/java/com/android/server/camera/CameraServiceProxy.java
14394 */
14395message CameraActionEvent {
14396    // Camera session duration in milliseconds if action is SESSION.
14397    // 0 if action is OPEN or CLOSE.
14398    optional int64 duration_millis = 1;
14399
14400    // Camera API level used.
14401    // 1 for camera1 API, and 2 for camera2 API.
14402    optional int32 api_level = 2;
14403
14404    // Name of client package
14405    optional string package_name = 3;
14406
14407    // Camera facing
14408    enum Facing {
14409        UNKNOWN = 0;
14410        BACK = 1;
14411        FRONT = 2;
14412        EXTERNAL = 3;
14413    }
14414    optional Facing facing = 4;
14415
14416    // Camera ID
14417    optional string camera_id = 5;
14418
14419    // Camera action type
14420    enum Action {
14421        UNKNOWN_ACTION = 0;
14422        OPEN = 1;
14423        CLOSE = 2;
14424        SESSION = 3;
14425    }
14426    optional Action action = 6;
14427
14428    // Whether the client is accessing camera using ndk
14429    optional bool is_ndk = 7;
14430
14431    // Action OPEN: Open latency
14432    // Action CLOSE: Close latency
14433    // Action SESSION: Camera session creation duration.
14434    //                 If this entry is reusing an existing session, the value is -1.
14435    optional int32 latency_millis = 8;
14436
14437    // session type: 0 for normal mode, 1 for constrained high speed mode
14438    optional int32 operating_mode = 9;
14439
14440    // If actioh is SESSION: number of internal reconfigurations
14441    // Else: 0
14442    optional int32 internal_reconfig = 10;
14443
14444    // Number of requests for this capture session. Only applicable to SESSION
14445    // action.
14446    optional int64 request_count = 11;
14447    // Number of result errors. Only applicable to SESSION action.
14448    optional int64 result_error_count = 12;
14449    // Whether the device runs into error state.
14450    optional bool device_error = 13;
14451
14452    // If action is SESSION: Stream states
14453    // Else: stream_count = 0
14454    optional int32 stream_count = 14;
14455    optional CameraStreamProto stream_1 = 15 [(log_mode) = MODE_BYTES];
14456    optional CameraStreamProto stream_2 = 16 [(log_mode) = MODE_BYTES];
14457    optional CameraStreamProto stream_3 = 17 [(log_mode) = MODE_BYTES];
14458    optional CameraStreamProto stream_4 = 18 [(log_mode) = MODE_BYTES];
14459    optional CameraStreamProto stream_5 = 19 [(log_mode) = MODE_BYTES];
14460
14461    // User tag string for this session
14462    optional string user_tag = 20;
14463
14464    // Video stabilization mode
14465    // Original type: uint8_t
14466    optional int32 video_stabilization_mode = 21 [default = -1];
14467
14468    // Identifier to correlate different Action events to each other
14469    // Not unique. Must be used with build fingerprint to generate a
14470    // good enough identifier.
14471    optional int64 log_id = 22;
14472
14473    // 0 for OPEN and CLOSE
14474    // ordinal of the SESSION between OPEN and CLOSE
14475    optional int32 session_idx = 23;
14476
14477    // Start: Extension metrics.
14478    // These will only be set for SESSION which use camera2 extensions
14479
14480    // Should match CameraExtensionCharacteristics#EXTENSION_*
14481    enum ExtensionSessionType {
14482        EXTENSION_NONE = -1;
14483        EXTENSION_AUTOMATIC = 0;
14484        EXTENSION_FACE_RETOUCH = 1;
14485        EXTENSION_BOKEH = 2;
14486        EXTENSION_HDR = 3;
14487        EXTENSION_NIGHT = 4;
14488
14489    }
14490
14491    // Type of camera extension being used
14492    optional ExtensionSessionType ext_type = 24 [default = EXTENSION_NONE];
14493
14494    // Whether advanced extensions session is being used
14495    optional bool ext_is_advanced = 25;
14496    // End: Extension Metrics
14497
14498    optional bool used_ultrawide = 26;
14499
14500    optional bool used_zoom_override = 27;
14501
14502    optional int32 most_requested_fps_range_min = 28;
14503    optional int32 most_requested_fps_range_max = 29;
14504
14505    // Extension metric
14506    optional int32 ext_capture_format = 30;
14507}
14508
14509/**
14510 * Logs when a compatibility change is affecting an app.
14511 *
14512 * Logged from:
14513 *   frameworks/base/core/java/android/app/AppCompatCallbacks.java and
14514 *   frameworks/base/services/core/java/com/android/server/compat/PlatformCompat.java
14515 */
14516message AppCompatibilityChangeReported {
14517    // The UID of the app being affected by the compatibilty change.
14518    optional int32 uid = 1 [(is_uid) = true];
14519
14520    // The ID of the change affecting the app.
14521    optional int64 change_id = 2;
14522
14523    enum State {
14524        UNKNOWN_STATE = 0;
14525        ENABLED = 1;
14526        DISABLED = 2;
14527        LOGGED = 3;
14528    }
14529
14530    // The state of the change - if logged from gating whether it was enabled or disabled, or just
14531    // logged otherwise.
14532    optional State state = 3;
14533
14534    enum Source {
14535        UNKNOWN_SOURCE = 0;
14536        APP_PROCESS = 1;
14537        SYSTEM_SERVER = 2;
14538    }
14539
14540    // Where it was logged from.
14541    optional Source source = 4;
14542
14543}
14544
14545/**
14546 * Logged from
14547 *     external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
14548 *     external/perfetto/src/tracing/service/tracing_service_impl.cc
14549 */
14550message PerfettoUploaded {
14551    // TODO(lalitm): many of the atoms below should be renamed to have a
14552    // "PERFETTO_CMD" prefix to make clear they are specific to perfetto_cmd.
14553    // This state exists because of legacy reasons (i.e. these values existed
14554    // before go/perfetto-monitoring was a thing).
14555    // Next id: 57.
14556    enum Event {
14557        PERFETTO_UNDEFINED = 0;
14558
14559        // Checkpoints inside perfetto_cmd before tracing is finished.
14560        PERFETTO_TRACE_BEGIN = 1;
14561        PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
14562        PERFETTO_CMD_CLONE_TRACE_BEGIN = 55;
14563        PERFETTO_CMD_CLONE_TRIGGER_TRACE_BEGIN = 56;
14564        PERFETTO_ON_CONNECT = 3;
14565
14566        // Guardrails inside perfetto_cmd before tracing is finished.
14567        PERFETTO_ON_TIMEOUT = 16;
14568        PERFETTO_CMD_USER_BUILD_TRACING_NOT_ALLOWED = 43;
14569
14570        // Checkpoints inside traced.
14571        PERFETTO_TRACED_ENABLE_TRACING = 37;
14572        PERFETTO_TRACED_START_TRACING = 38;
14573        PERFETTO_TRACED_DISABLE_TRACING = 39;
14574        PERFETTO_TRACED_NOTIFY_TRACING_DISABLED = 40;
14575
14576        // Trigger checkpoints inside traced.
14577        // These atoms are special because, along with the UUID,
14578        // they log the trigger name.
14579        PERFETTO_TRACED_TRIGGER_START_TRACING = 41;
14580        PERFETTO_TRACED_TRIGGER_STOP_TRACING = 42;
14581        PERFETTO_TRACED_TRIGGER_CLONE_SNAPSHOT = 53;
14582
14583        // Guardrails inside traced.
14584        PERFETTO_TRACED_ENABLE_TRACING_EXISTING_TRACE_SESSION = 18;
14585        PERFETTO_TRACED_ENABLE_TRACING_TOO_LONG_TRACE = 19;
14586        PERFETTO_TRACED_ENABLE_TRACING_INVALID_TRIGGER_TIMEOUT = 20;
14587        PERFETTO_TRACED_ENABLE_TRACING_DURATION_WITH_TRIGGER = 21;
14588        PERFETTO_TRACED_ENABLE_TRACING_STOP_TRACING_WRITE_INTO_FILE = 22;
14589        PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_TRIGGER_NAME = 23;
14590        PERFETTO_TRACED_ENABLE_TRACING_INVALID_DEFERRED_START = 24;
14591        PERFETTO_TRACED_ENABLE_TRACING_INVALID_BUFFER_SIZE = 25;
14592        PERFETTO_TRACED_ENABLE_TRACING_BUFFER_SIZE_TOO_LARGE = 26;
14593        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_BUFFERS = 27;
14594        PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_SESSION_NAME = 28;
14595        PERFETTO_TRACED_ENABLE_TRACING_SESSION_NAME_TOO_RECENT = 29;
14596        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_SESSIONS_FOR_UID = 30;
14597        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_CONCURRENT_SESSIONS = 31;
14598        PERFETTO_TRACED_ENABLE_TRACING_INVALID_FD_OUTPUT_FILE = 32;
14599        PERFETTO_TRACED_ENABLE_TRACING_FAILED_TO_CREATE_FILE = 33;
14600        PERFETTO_TRACED_ENABLE_TRACING_OOM = 34;
14601        PERFETTO_TRACED_ENABLE_TRACING_UNKNOWN_ERROR = 35;
14602        PERFETTO_TRACED_START_TRACING_INVALID_SESSION_STATE = 36;
14603        PERFETTO_TRACED_ENABLE_TRACING_INVALID_FILTER = 47;
14604        PERFETTO_TRACED_ENABLE_TRACING_OOB_TARGET_BUFFER = 48;
14605        PERFETTO_TRACED_ENABLE_TRACING_INVALID_TRIGGER_MODE = 52;
14606        PERFETTO_TRACED_ENABLE_TRACING_INVALID_BR_FILENAME = 54;
14607        PERFETTO_TRACED_ENABLE_TRACING_FAILED_SESSION_SEMAPHORE_CHECK = 57;
14608
14609        // Checkpoints inside perfetto_cmd after tracing has finished.
14610        PERFETTO_ON_TRACING_DISABLED = 4;
14611        PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
14612        PERFETTO_CMD_FW_REPORT_BEGIN = 49;
14613        // Will be removed once incidentd is no longer used.
14614        PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
14615
14616        // Guardrails inside perfetto_cmd after tracing has finished.
14617        PERFETTO_CMD_FW_REPORT_EMPTY_TRACE = 50;
14618        // Will be removed once incidentd is no longer used.
14619        PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
14620        PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
14621
14622        // "Successful" terminal states inside perfetto_cmd.
14623        PERFETTO_CMD_FW_REPORT_HANDOFF = 51;
14624
14625        // Deprecated as "success" is misleading; it simply means we were
14626        // able to communicate with incidentd. Will be removed once
14627        // incidentd is no longer used.
14628        PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9 [deprecated = true];
14629
14630        // Contained trigger begin/success/failure. Replaced by
14631        // |PerfettoTriggerAtom| to allow aggregation using a count metric
14632        // and reduce spam.
14633        reserved 12, 13, 14;
14634
14635        // Contained that a guardrail in perfetto_cmd was hit. Replaced with
14636        // kCmd* guardrails.
14637        reserved 15;
14638
14639        // Contained status of Dropbox uploads. Removed as Perfetto no
14640        // longer supports uploading traces using Dropbox.
14641        reserved 5, 6, 7;
14642
14643        // Contained status of guardrail state initialization and upload limit
14644        // in perfetto_cmd. Removed as perfetto no longer manages stateful
14645        // guardrails
14646        reserved 44, 45, 46;
14647    }
14648
14649    // Which stage of the pipeline we are reporting from.
14650    optional Event event = 1;
14651
14652    // UUID matching the one set inside the SystemInfo trace packet.
14653    optional int64 trace_uuid_lsb = 2;
14654    optional int64 trace_uuid_msb = 3;
14655
14656    // For trigger checkpoints inside traced, contains the trigger name
14657    // associated with this trace UUID.
14658    optional string trigger_name = 4;
14659}
14660
14661/**
14662 * Logged from
14663 *     external/perfetto/src/tracing/service/tracing_service_impl.cc
14664 */
14665message PerfettoTrigger {
14666    enum Event {
14667        PERFETTO_UNDEFINED = 0;
14668
14669        PERFETTO_CMD_TRIGGER = 1;
14670        PERFETTO_CMD_TRIGGER_FAIL = 2;
14671
14672        PERFETTO_TRIGGER_PERFETTO_TRIGGER = 3;
14673        PERFETTO_TRIGGER_PERFETTO_TRIGGER_FAIL = 4;
14674
14675        PERFETTO_TRACED_LIMIT_PROBABILITY = 5;
14676        PERFETTO_TRACED_LIMIT_MAX_PER_24_H = 6;
14677
14678        PERFETTO_PROBES_PRODUCER_TRIGGER = 7;
14679        PERFETTO_PROBES_PRODUCER_TRIGGER_FAIL = 8;
14680    }
14681
14682    // The event which fired.
14683    optional Event event = 1;
14684
14685    // The name of the trigger which fired.
14686    optional string trigger_name = 2;
14687}
14688
14689/**
14690 * Pulls client metrics on data transferred via Vehicle Maps Service.
14691 * Metrics are keyed by uid + layer.
14692 *
14693 * Pulled from:
14694 *   packages/services/Car/service/src/com/android/car/stats/CarStatsService.java
14695 */
14696message VmsClientStats {
14697    // UID of the VMS client app
14698    optional int32 uid = 1 [(is_uid) = true];
14699
14700    // VMS layer definition
14701    optional int32 layer_type = 2;
14702    optional int32 layer_channel = 3;
14703    optional int32 layer_version = 4;
14704
14705    // Bytes and packets sent by the client for the layer
14706    optional int64 tx_bytes = 5;
14707    optional int64 tx_packets = 6;
14708
14709    // Bytes and packets received by the client for the layer
14710    optional int64 rx_bytes = 7;
14711    optional int64 rx_packets = 8;
14712
14713    // Bytes and packets dropped due to client error
14714    optional int64 dropped_bytes = 9;
14715    optional int64 dropped_packets = 10;
14716}
14717
14718/**
14719 * State of a all permission requested by a package - sampled
14720 * Pulled from: StatsCompanionService.java with data obtained from PackageManager API
14721*/
14722message DangerousPermissionStateSampled {
14723    // Name of the permission
14724    optional string permission_name = 1;
14725
14726    // Uid of the package
14727    optional int32 uid = 2 [(is_uid) = true];
14728
14729    // If the permission is granted to the uid
14730    optional bool is_granted = 3;
14731
14732    // Permission flags as per android.content.pm.PermissionFlags
14733    optional int32 permission_flags = 4;
14734
14735    // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
14736    optional int32 protection_flags = 5;
14737}
14738
14739/**
14740 * HWUI stats for a given app.
14741 */
14742message GraphicsStats {
14743    // The package name of the app
14744    optional string package_name = 1;
14745
14746    // The version code of the app
14747    optional int64 version_code = 2;
14748
14749    // The start & end timestamps in UTC as
14750    // milliseconds since January 1, 1970
14751    // Compatible with java.util.Date#setTime()
14752    optional int64 start_millis = 3;
14753
14754    optional int64 end_millis = 4;
14755
14756    // HWUI renders pipeline type: GL (1) or Vulkan (2).
14757    enum PipelineType {
14758        UNKNOWN = 0;
14759        GL = 1;
14760        VULKAN = 2;
14761    }
14762
14763    // HWUI renders pipeline type: GL or Vulkan.
14764    optional PipelineType pipeline = 5;
14765
14766    // Distinct frame count.
14767    optional int32 total_frames = 6;
14768
14769    // Number of "missed vsync" events.
14770    optional int32 missed_vsync_count = 7;
14771
14772    // Number of frames in triple-buffering scenario (high input latency)
14773    optional int32 high_input_latency_count = 8;
14774
14775    // Number of "slow UI thread" events.
14776    optional int32 slow_ui_thread_count = 9;
14777
14778    // Number of "slow bitmap upload" events.
14779    optional int32 slow_bitmap_upload_count = 10;
14780
14781    // Number of "slow draw" events.
14782    optional int32 slow_draw_count = 11;
14783
14784    // Number of frames that missed their deadline (aka, visibly janked)
14785    optional int32 missed_deadline_count = 12;
14786
14787    // The frame time histogram for the package
14788    optional FrameTimingHistogram cpu_histogram = 13
14789    [(android.os.statsd.log_mode) = MODE_BYTES];
14790
14791    // The gpu frame time histogram for the package
14792    optional FrameTimingHistogram gpu_histogram = 14
14793    [(android.os.statsd.log_mode) = MODE_BYTES];
14794
14795    // UI mainline module version.
14796    optional int64 version_ui_module = 15;
14797
14798    // If true, these are HWUI stats for up to a 24h period for a given app from today.
14799    // If false, these are HWUI stats for a 24h period for a given app from the last complete
14800    // day (yesterday). Stats from yesterday stay constant, while stats from today may change as
14801    // more apps are running / rendering.
14802    optional bool is_today = 16;
14803}
14804
14805/**
14806 * Message related to dangerous (runtime) app ops access
14807 */
14808message RuntimeAppOpAccess {
14809    // Uid of the package accessing app op
14810    optional int32 uid = 1 [(is_uid) = true];
14811
14812    // Name of the package accessing app op
14813    optional string package_name = 2;
14814
14815    // deprecated - set to empty string
14816    optional string op_deprecated = 3 [deprecated = true];
14817
14818    // attribution_tag; provided by developer when accessing related API, limited at 50 chars by
14819    // API. Attributions must be provided through manifest using <attribution> tag available in R
14820    // and above.
14821    optional string attribution_tag = 4;
14822
14823    // message related to app op access, limited to 600 chars by API
14824    optional string message = 5;
14825
14826    enum SamplingStrategy {
14827        DEFAULT = 0;
14828        UNIFORM = 1;
14829        RARELY_USED = 2;
14830        BOOT_TIME_SAMPLING = 3;
14831        UNIFORM_OPS = 4;
14832    }
14833
14834    // sampling strategy used to collect this message
14835    optional SamplingStrategy sampling_strategy = 6;
14836
14837    // operation id
14838    optional android.app.AppOpEnum op = 7 [default = APP_OP_NONE];
14839}
14840
14841/*
14842 * Logs userspace reboot outcome and duration.
14843 *
14844 * Logged from:
14845 *   frameworks/base/core/java/com/android/server/BootReceiver.java
14846 */
14847message UserspaceRebootReported {
14848    // Possible outcomes of userspace reboot.
14849    enum Outcome {
14850        // Default value in case platform failed to determine the outcome.
14851        OUTCOME_UNKNOWN = 0;
14852        // Userspace reboot succeeded (i.e. boot completed without a fall back to hard reboot).
14853        SUCCESS = 1;
14854        // Userspace reboot shutdown sequence was aborted.
14855        FAILED_SHUTDOWN_SEQUENCE_ABORTED = 2;
14856        // Remounting userdata into checkpointing mode failed.
14857        FAILED_USERDATA_REMOUNT = 3;
14858        // Device didn't finish booting before timeout and userspace reboot watchdog issued a hard
14859        // reboot.
14860        FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED = 4;
14861    }
14862    // Outcome of userspace reboot. Always set.
14863    optional Outcome outcome = 1;
14864    // Duration of userspace reboot in case it has a successful outcome.
14865    // Duration is measured as time between userspace reboot was initiated and until boot completed
14866    // (e.g. sys.boot_completed=1).
14867    optional int64 duration_millis = 2;
14868    // State of primary user's (user0) credential encryption storage.
14869    enum UserEncryptionState {
14870        // Default value.
14871        USER_ENCRYPTION_STATE_UNKNOWN = 0;
14872        // Credential encrypted storage is unlocked.
14873        UNLOCKED = 1;
14874        // Credential encrypted storage is locked.
14875        LOCKED = 2;
14876    }
14877    // State of primary user's encryption storage at the moment boot completed. Always set.
14878    optional UserEncryptionState user_encryption_state = 3;
14879}
14880
14881/*
14882 * Logs integrity check information during each install.
14883 *
14884 * Logged from:
14885 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
14886 */
14887message IntegrityCheckResultReported {
14888    optional string package_name = 1;
14889    optional string app_certificate_hash = 2;
14890    optional int64 version_code = 3;
14891    optional string installer_package_name = 4;
14892    enum Response {
14893        UNKNOWN = 0;
14894        ALLOWED = 1;
14895        REJECTED = 2;
14896        FORCE_ALLOWED = 3;
14897    }
14898    optional Response response = 5;
14899    // An estimate on the cause of the response. This will only be populated for
14900    // REJECTED and FORCE_ALLOWED
14901    optional bool caused_by_app_cert_rule = 6;
14902    optional bool caused_by_installer_rule = 7;
14903}
14904
14905/**
14906 * Logs the information about the rules and the provider whenever rules are
14907 * pushed into AppIntegrityManager.
14908 *
14909 * Logged from:
14910 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
14911 */
14912message IntegrityRulesPushed {
14913    optional bool success = 1;
14914    // Package name of the app that pushed the rules.
14915    optional string rule_provider = 2;
14916    // Version string of arbitrary format provided by the rule provider to
14917    // identify the rules.
14918    optional string rule_version = 3;
14919}
14920
14921/**
14922 * Logs when a cell broadcast message is received on the device.
14923 *
14924 * Logged from Cell Broadcast module and platform:
14925 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
14926 *   packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/
14927 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/CellBroadcastServiceManager.java
14928 */
14929message CellBroadcastMessageReported {
14930    // The type of Cell Broadcast message
14931    enum CbType {
14932        UNKNOWN_TYPE = 0;
14933        GSM = 1;
14934        CDMA = 2;
14935        CDMA_SPC = 3;
14936    }
14937
14938    // The parts of the cell broadcast message pipeline
14939    enum ReportSource {
14940        UNKNOWN_SOURCE = 0;
14941        FRAMEWORK = 1;
14942        CB_SERVICE = 2;
14943        CB_RECEIVER_APP = 3;
14944    }
14945
14946    // GSM, CDMA, CDMA-SCP
14947    optional CbType type = 1;
14948    // The source of the report
14949    optional ReportSource source = 2;
14950    // The Message Identifier, as defined in 3GPP 23.041 clause 9.4.1.2.1
14951    optional int32 serial_number = 3;
14952    // The Message Identifier, as defined in 3GPP 23.041 clause 9.4.1.2.2
14953    optional int32 message_id = 4;
14954}
14955
14956/**
14957 * Logs when a cell broadcast message is filtered out,
14958 * or otherwise intentionally not sent to CBR, or not shown to users for reason
14959 *
14960 * Logged from Cell Broadcast module:
14961 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
14962 *   packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/
14963 */
14964message CellBroadcastMessageFiltered {
14965    enum FilterReason {
14966        // shown message to the user
14967        NOT_FILTERED = 0;
14968        // filtered message due to duplication (message body, service category, cross sim)
14969        DUPLICATE_MESSAGE = 1;
14970        // filtered message due to outside of coordinate range
14971        GEOFENCED_MESSAGE = 2;
14972        // filtered message due to not using for emergency alert but for update cell information on Setting Menu
14973        AREA_INFO_MESSAGE = 3;
14974        // filtered message due to OEM set config value ‘filtered message for duplication’ as ‘true’
14975        DISABLED_BY_OEM = 4;
14976        // when in ECBM(Emergency CallBack Mode) status
14977        NOTSHOW_ECBM = 5;
14978        // when user turn off preference of channel
14979        NOTSHOW_USER_PREF = 6;
14980        // when Empty content or Unsupported charset
14981        NOTSHOW_EMPTY_BODY = 7;
14982        // when language code in message is not same with preference of second language
14983        NOTSHOW_MISMATCH_PREF_SECOND_LANG = 8;
14984        // when user turn off preference of second language
14985        NOTSHOW_PREF_SECONDLANG_OFF = 9;
14986        // when language code in message is not same with device language setting
14987        NOTSHOW_MISMATCH_DEVICE_LANG_SETTING = 10;
14988        // when channel has feature ‘testing_mode = true’ and device is not in cb test_mode
14989        NOTSHOW_MESSAGE_FOR_TESTMODE = 11;
14990        // when the message contains ‘filter’ string from properties
14991        NOTSHOW_FILTER_STRING = 12;
14992    }
14993
14994    // GSM, CDMA, CDMA-SCP
14995    optional CellBroadcastMessageReported.CbType type = 1;
14996    // The source of the report
14997    optional FilterReason filter = 2;
14998    // The Message Identifier, as defined in 3GPP 23.041 clause 9.4.1.2.1
14999    optional int32 serial_number = 3;
15000    // The Message Identifier, as defined in 3GPP 23.041 clause 9.4.1.2.2
15001    optional int32 message_id = 4;
15002}
15003
15004/**
15005 * Logs when an error occurs while handling a cell broadcast message;
15006 *
15007 * Logged from CellBroadcastService module:
15008 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
15009 */
15010message CellBroadcastMessageError {
15011    // The type of error raised when trying to handle a cell broadcast message
15012    enum ErrorType {
15013        UNKNOWN_TYPE = 0;
15014        CDMA_DECODING_ERROR = 1;
15015        CDMA_SCP_EMPTY = 2;
15016        CDMA_SCP_HANDLING_ERROR = 3;
15017        GSM_INVALID_HEADER_LENGTH = 4;
15018        GSM_UNSUPPORTED_HEADER_MESSAGE_TYPE = 5;
15019        GSM_UNSUPPORTED_HEADER_DATA_CODING_SCHEME = 6;
15020        GSM_INVALID_PDU = 7;
15021        GSM_INVALID_GEO_FENCING_DATA = 8;
15022        GSM_UMTS_INVALID_WAC = 9;
15023        FAILED_TO_INSERT_TO_DB = 10;
15024        UNEXPECTED_GEOMETRY_FROM_FWK = 11;
15025        UNEXPECTED_GSM_MESSAGE_TYPE_FROM_FWK = 12;
15026        UNEXPECTED_CDMA_MESSAGE_TYPE_FROM_FWK = 13;
15027        UNEXPECTED_CDMA_SCP_MESSAGE_TYPE_FROM_FWK = 14;
15028        NO_CONNECTION_TO_CB_SERVICE = 15;
15029    }
15030
15031    // What kind of error occurred
15032    optional ErrorType type = 1;
15033    // Exception message (or log message) associated with the error (max 1000 chars)
15034    optional string exception_message = 2;
15035}
15036
15037/**
15038 * CellBroadcast channel range
15039 * Refer from CellBroadcastConfigUpdated, CellBroadcastReceiverFeature
15040 * Logged from Cell Broadcast module:
15041 *   packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/
15042 */
15043message CellBroadcastChannelRange {
15044    optional int32 start = 1;
15045    optional int32 end = 2;
15046}
15047/**
15048 * CellBroadcast channel ranges
15049 * Nested field for repeated
15050 * Logged from Cell Broadcast module:
15051 *   packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/
15052 */
15053message CellBroadcastChannelRanges {
15054    repeated CellBroadcastChannelRange channel_ranges = 1;
15055}
15056
15057/**
15058 * Logs when an channel configuration is updated with mcc-mnc
15059 *
15060 * Logged from Cell Broadcast module:
15061 *   packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/
15062 */
15063message CellBroadcastConfigUpdated  {
15064    // mcc_mnc value of Network operator for the roaming case
15065    optional string roaming_mcc_mnc = 1;
15066    // The channel ranges to be updated logged as bytes
15067    optional CellBroadcastChannelRanges channel_ranges = 2 [(log_mode) = MODE_BYTES];
15068}
15069
15070/**
15071 * Logs when a cell broadcast message is activated with the feature below
15072 * or when channel configuration is changed with the feature below
15073 *
15074 * Logged from Cell Broadcast module:
15075 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice
15076 */
15077message CellBroadcastServiceFeatureChanged {
15078    // Not for mainline devices, but for android-go devices, OEM can register package names.
15079    // if there is a data then true otherwise false
15080    optional bool overlay_additional_cbr_packages = 1;
15081    // package name which will get area info message
15082    // if there is a data except “com.android.settings” then true, or false
15083    optional bool overlay_area_info_packages = 2;
15084    // Reset Area Info when device goes out of service
15085    optional bool reset_area_info = 3;
15086}
15087
15088/**
15089 * Logs when a cell broadcast message is activated with the feature below
15090 * or when channel configuration is changed with the feature below
15091 *
15092 * Logged from Cell Broadcast module:
15093 *   packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/
15094 */
15095message CellBroadcastReceiverFeatureChanged {
15096    // Whether to enable alert handling during active voice call
15097    optional bool alert_during_call = 1;
15098    // Play alert sound in full volume regardless DND is on
15099    // [none:0][all:Integer.MAX_VALUE][partial:4370 4380 50]
15100    optional CellBroadcastChannelRanges override_dnd = 2 [(log_mode) = MODE_BYTES];
15101    // Whether to Support roaming for attached network operator
15102    optional bool roaming_support = 3;
15103    // Whether to save alerts to sms inbox database
15104    optional bool store_sms = 4;
15105    // whether the device is in test mode through *#*#CMAS#*#*
15106    optional bool testing_mode = 5;
15107    // whether Text To Speech is on/off
15108    optional bool tts_mode = 6;
15109    // whether the device is able to enter test mode even on user build
15110    optional bool testing_mode_on_user_build = 7;
15111}
15112
15113/**
15114 * Logs when exception is occurred in the device
15115 *
15116 * Logged from Cell Broadcast module:
15117 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
15118 *   packages/apps/CellBroadcastReceiver/
15119 */
15120message CellBroadcastModuleErrorReported {
15121    enum ErrorType {
15122        ERROR_UNKNOWN = 0;
15123        ERROR_BAD_CONFIG = 1;
15124        ERROR_DB_MIGRATION = 2;
15125        ERROR_DEFAULT_RES = 3;
15126        ERROR_ENABLE_CHANNEL = 4;
15127        ERROR_GET_LOCATION = 5;
15128        ERROR_MISSING_RES = 6;
15129        ERROR_PLAY_FLASH = 7;
15130        ERROR_PLAY_SOUND = 8;
15131        ERROR_PLAY_TTS = 9;
15132        ERROR_PREF_MIGRATION = 10;
15133        ERROR_PROVIDER_INIT = 11;
15134        ERROR_RESET_CHANNEL_R = 12;
15135        ERROR_STATUS_BAR = 13;
15136        ERROR_REMINDER_INTERVAL = 14;
15137        ERROR_ICON_RESOURCE = 15;
15138        ERROR_CHANNEL_RANGE_PARSE = 16;
15139        ERROR_DB_INIT = 17;
15140        ERROR_NOT_FOUND_DEFAULT_CBR_PKGS = 18;
15141        ERROR_FOUND_MULTIPLE_CBR_PKGS = 19;
15142    }
15143
15144    // The source of the report
15145    optional CellBroadcastMessageReported.ReportSource source = 1;
15146
15147    // The error type
15148    optional ErrorType type = 2;
15149}
15150
15151/**
15152 * Logs when a TV Input Service Session changes tune state
15153 * This is atom ID 327.
15154 *
15155 * Logged from:
15156 *   frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
15157 */
15158message TifTuneStateChanged {
15159
15160    // Tv Input Service uid, TV Player uid
15161    repeated AttributionNode attribution_node = 1 [
15162        (state_field_option).primary_field_first_uid = true
15163    ];
15164    optional android.stats.tv.TifTuneState state = 2 [
15165        (state_field_option).exclusive_state = true,
15166        (state_field_option).default_state_value = 0,
15167        (state_field_option).nested = false
15168    ];
15169    // This a globally unique 128 bit random number created by TvInputManagerService when
15170    // android.media.tv.TvInputManager#createSession is called.
15171    // It is has no device or user association.
15172    // See android.media.tv.TvInputService.onCreateSession(java.lang.String, java.lang.String)
15173    // WARNING: Any changes to this field should be carefully reviewed for privacy.
15174    //          Inspect the code at
15175    //          framework/base/cmds/statsd/src/atoms.proto
15176    //               TifTuneState
15177    //          frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
15178    //              logTuneStateChanged
15179    //              BinderService.createSession
15180    //              SessionState.sessionId
15181    optional string tif_session_id = 3 [(state_field_option).primary_field = true];
15182    optional android.stats.tv.TifInputType type = 4;
15183    // The id of this TV Input, only unique to a given TV Input Service.
15184    // This is specifically NOT android.media.tv.TvInputInfo.getId()
15185    // which is a string that contains the package name of its TvInputService.
15186    optional int32 input_id = 5  [(state_field_option).primary_field = true];
15187    // The HDMI port id
15188    // Only valid when type == HDMI
15189    optional int32 hdmi_port = 6  [(state_field_option).primary_field = true];
15190}
15191
15192/**
15193 * Logs when a tune occurs through device's Frontend.
15194 * This is atom ID 276.
15195 *
15196 * Logged from:
15197 *   frameworks/base/media/java/android/media/tv/tuner/Tuner.java
15198 */
15199message TvTunerStateChanged {
15200    enum State {
15201        UNKNOWN = 0;
15202        TUNING = 1; // Signal is tuned
15203        LOCKED = 2;    // the signal is locked
15204        NOT_LOCKED = 3; // the signal isn’t locked.
15205        SIGNAL_LOST = 4; // the signal was locked, but is lost now.
15206        SCANNING = 5; // the signal is scanned
15207        SCAN_STOPPED = 6; // the scan is stopped.
15208    }
15209    // The uid of the application that sent this custom atom.
15210    optional int32 uid = 1 [(is_uid) = true];
15211    //  new state
15212    optional State state = 2;
15213}
15214
15215/**
15216 * Logs the status of a dvr playback or record.
15217 * This is atom ID 279.
15218 *
15219 * Logged from:
15220 *   frameworks/base/media/java/android/media/tv/tuner/dvr
15221 */
15222message TvTunerDvrStatus {
15223    enum Type {
15224        UNKNOWN_TYPE = 0;
15225        PLAYBACK = 1; // is a playback
15226        RECORD = 2; // is a record
15227    }
15228    enum State {
15229        UNKNOWN_STATE = 0;
15230        STARTED = 1; // DVR is started
15231        STOPPED = 2; // DVR is stopped
15232    }
15233    // The uid of the application that sent this custom atom.
15234    optional int32 uid = 1 [(is_uid) = true];
15235    // DVR type
15236    optional Type type = 2;
15237    //  DVR state
15238    optional State state = 3;
15239    //  Identify the segment of a record or playback
15240    optional int32 segment_id = 4;
15241    // indicate how many overflow or underflow happened between started to stopped
15242    optional int32 overflow_underflow_count = 5;
15243}
15244
15245/**
15246 * Logs when a cas session opened through MediaCas.
15247 * This is atom ID 280.
15248 *
15249 * Logged from:
15250 *   frameworks/base/media/java/android/media/MediaCas.java
15251 */
15252message TvCasSessionOpenStatus {
15253    enum State {
15254        UNKNOWN = 0;
15255        SUCCEEDED = 1; // indicate that the session is opened successfully.
15256        FAILED = 2; // indicate that the session isn’t opened successfully.
15257    }
15258    // The uid of the application that sent this custom atom.
15259    optional int32 uid = 1 [(is_uid) = true];
15260    //  Cas system Id
15261    optional int32 cas_system_id = 2;
15262    // State of the session
15263    optional State state = 3;
15264}
15265
15266/**
15267 * Logs for ContactsProvider general usage.
15268 * This is atom ID 301.
15269 *
15270 * Logged from:
15271 *   packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
15272 */
15273message ContactsProviderStatusReported {
15274    enum ApiType {
15275        UNKNOWN_API = 0;
15276        QUERY = 1;
15277        // INSERT includes insert and bulkInsert, and inserts triggered by applyBatch.
15278        INSERT = 2;
15279        // UPDATE and DELETE includes update/delete and the ones triggered by applyBatch.
15280        UPDATE = 3;
15281        DELETE = 4;
15282        CALL = 5;
15283
15284        // Call from CP2 to a GAL provider.
15285        GAL_CALL = 6;
15286    }
15287
15288    // Method called for ApiType.CALL
15289    enum MethodCall {
15290        UNKNOWN_METHOD = 0;
15291        ADD_SIM_ACCOUNTS = 1;
15292        REMOVE_SIM_ACCOUNTS = 2;
15293        GET_SIM_ACCOUNTS = 3;
15294    }
15295
15296    enum ResultType {
15297        UNKNOWN_RESULT = 0;
15298        SUCCESS = 1;
15299        FAIL = 2;
15300        ILLEGAL_ARGUMENT = 3;
15301        UNSUPPORTED_OPERATION = 4;
15302    }
15303
15304    enum CallerType {
15305        UNSPECIFIED_CALLER_TYPE = 0;
15306        CALLER_IS_SYNC_ADAPTER = 1;
15307        CALLER_IS_NOT_SYNC_ADAPTER = 2;
15308    }
15309
15310    enum TaskType {
15311        UNKNOWN_TASK = 0;
15312        DANGLING_CONTACTS_CLEANUP_TASK = 1;
15313    }
15314
15315    optional ApiType api_type = 1;
15316    // Defined in
15317    // packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
15318    optional int32 uri_type = 2;
15319    optional CallerType caller_type = 3;
15320    optional ResultType result_type = 4;
15321    optional int32 result_count = 5;
15322    optional int64 latency_micros = 6;
15323    optional TaskType task_type = 7;
15324    // Set when api_type == CALL
15325    optional MethodCall method_called = 8;
15326
15327    // Normally, it's the binder calling UID. (this could be CP2, for work profile or cloned
15328    // profile cases.)
15329    // For GAL_CALL, it's the GAL provider UID.
15330    optional int32 uid = 9 [(is_uid) = true];
15331}
15332
15333/**
15334 * Logs when an app is frozen or unfrozen.
15335 *
15336 * Logged from:
15337 *   frameworks/base/services/core/java/com/android/server/am/CachedAppOptimizer.java
15338 */
15339message AppFreezeChanged {
15340    // The type of event.
15341    enum Action {
15342        UNKNOWN = 0;
15343        FREEZE_APP = 1;
15344        UNFREEZE_APP = 2;
15345    }
15346    optional Action action = 1;
15347
15348    // Pid of the process being frozen.
15349    optional int32 pid = 2;
15350
15351    // Name of the process being frozen.
15352    optional string process_name = 3;
15353
15354    // Time since last unfrozen.
15355    optional int64 time_unfrozen_millis = 4;
15356
15357    // The list of reason should be kept in sync with @OomAdjReason in OomAdjuster.java.
15358    enum OomAdjReason {
15359        NONE = 0;
15360        ACTIVITY = 1;
15361        FINISH_RECEIVER = 2;
15362        START_RECEIVER = 3;
15363        BIND_SERVICE = 4;
15364        UNBIND_SERVICE = 5;
15365        START_SERVICE = 6;
15366        GET_PROVIDER = 7;
15367        REMOVE_PROVIDER = 8;
15368        UI_VISIBILITY = 9;
15369        ALLOWLIST = 10;
15370        PROCESS_BEGIN = 11;
15371        PROCESS_END = 12;
15372    }
15373
15374    // Deprecated, use unfreeze_reason_v2.
15375    optional OomAdjReason unfreeze_reason = 5 [ deprecated = true ];
15376
15377    // The list of reason should be kept in sync with @UnfreezeReason in CachedAppOptimizer.java.
15378    enum UnfreezeReason {
15379        UFR_NONE = 0;
15380        UFR_ACTIVITY = 1;
15381        UFR_FINISH_RECEIVER = 2;
15382        UFR_START_RECEIVER = 3;
15383        UFR_BIND_SERVICE = 4;
15384        UFR_UNBIND_SERVICE = 5;
15385        UFR_START_SERVICE = 6;
15386        UFR_GET_PROVIDER = 7;
15387        UFR_REMOVE_PROVIDER = 8;
15388        UFR_UI_VISIBILITY = 9;
15389        UFR_ALLOWLIST = 10;
15390        UFR_PROCESS_BEGIN = 11;
15391        UFR_PROCESS_END = 12;
15392        UFR_TRIM_MEMORY = 13;
15393        UFR_PING = 15;
15394        UFR_FILE_LOCKS = 16;
15395        UFR_FILE_LOCK_CHECK_FAILURE = 17;
15396        UFR_BINDER_TXNS = 18;
15397        UFR_FEATURE_FLAGS = 19;
15398        UFR_SHORT_FGS_TIMEOUT = 20;
15399        UFR_SYSTEM_INIT = 21;
15400        UFR_BACKUP = 22;
15401        UFR_SHELL = 23;
15402        UFR_REMOVE_TASK = 24;
15403        UFR_UID_IDLE = 25;
15404        UFR_STOP_SERVICE = 26;
15405        UFR_EXECUTING_SERVICE = 27;
15406        UFR_RESTRICTION_CHANGE = 28;
15407        UFR_COMPONENT_DISABLED = 29;
15408    }
15409
15410    optional UnfreezeReason unfreeze_reason_v2 = 6;
15411}
15412
15413/**
15414 * Pulls information for a single voice call.
15415 *
15416 * Each pull creates multiple atoms, one for each call. The sequence is randomized when pulled.
15417 *
15418 * Pulled from:
15419 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15420 */
15421message VoiceCallSession {
15422    // Bearer (IMS or CS) when the call started.
15423    optional android.telephony.CallBearerEnum bearer_at_start = 1;
15424
15425    // Bearer (IMS or CS) when the call ended.
15426    // The bearer may change during the call, e.g. due to SRVCC.
15427    optional android.telephony.CallBearerEnum bearer_at_end = 2;
15428
15429    // Direction of the call (incoming or outgoing).
15430    optional android.telephony.CallDirectionEnum direction = 3;
15431
15432    // Deprecated by setup_duration_millis
15433    optional android.telephony.CallSetupDurationEnum setup_duration = 4 [ deprecated = true ];
15434
15435    // Whether the call ended before the setup was completed.
15436    optional bool setup_failed = 5;
15437
15438    // IMS reason code or CS disconnect cause.
15439    // For IMS, see: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
15440    // For CS, see: frameworks/base/telephony/java/android/telephony/DisconnectCause.java
15441    optional int32 disconnect_reason_code = 6;
15442
15443    // IMS extra code or CS precise disconnect cause.
15444    // For IMS, this code is vendor-specific
15445    // For CS, see: frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java
15446    optional int32 disconnect_extra_code = 7;
15447
15448    // IMS extra message or CS vendor cause.
15449    optional string disconnect_extra_message = 8;
15450
15451    // Radio access technology (RAT) used when call started.
15452    optional android.telephony.NetworkTypeEnum rat_at_start = 9;
15453
15454    // Radio access technology (RAT) used when call terminated.
15455    optional android.telephony.NetworkTypeEnum rat_at_end = 10;
15456
15457    // Number of times RAT changed during the call.
15458    optional int64 rat_switch_count = 11;
15459
15460    // A bitmask of all codecs used during the call.
15461    // See: frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java
15462    optional int64 codec_bitmask = 12;
15463
15464    // Number of other calls going on during call setup, for the same SIM slot.
15465    optional int32 concurrent_call_count_at_start = 13;
15466
15467    // Number of other calls going on during call termination, for the same SIM slot.
15468    optional int32 concurrent_call_count_at_end = 14;
15469
15470    // Index of the SIM used, 0 for single-SIM devices.
15471    optional int32 sim_slot_index = 15;
15472
15473    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
15474    optional bool is_multi_sim = 16;
15475
15476    // Whether the call was made with an eSIM profile.
15477    optional bool is_esim = 17;
15478
15479    // Carrier ID of the SIM card.
15480    // See https://source.android.com/devices/tech/config/carrierid.
15481    optional int32 carrier_id = 18;
15482
15483    // Whether an SRVCC has been completed successfully for this call.
15484    optional bool srvcc_completed = 19;
15485
15486    // Number of SRVCC failures.
15487    optional int64 srvcc_failure_count = 20;
15488
15489    // Number of SRVCC cancellations.
15490    optional int64 srvcc_cancellation_count = 21;
15491
15492    // Whether the Real-Time Text (RTT) was ever used in the call (rather than whether RTT was
15493    // enabled in the dialer's settings).
15494    optional bool rtt_enabled = 22;
15495
15496    // Whether this was an emergency call.
15497    optional bool is_emergency = 23;
15498
15499    // Whether the call was performed while roaming.
15500    optional bool is_roaming = 24;
15501
15502    // A random number used as the dimension field to pull multiple atoms.
15503    optional int32 dimension = 25;
15504
15505    // Signal strength at the end of the call. This value is applicable to both cellular and WiFi.
15506    optional android.telephony.SignalStrengthEnum signal_strength_at_end = 26;
15507
15508    // Band at the end of the call. Value 0 is used if the band is unknown.
15509    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending on the RAT at
15510    // the end of the call.
15511    optional int32 band_at_end = 27;
15512
15513    // Time spent setting up the call in milliseconds.
15514    // The time is measured from dial to ringing for outgoing calls, and from answer to connected
15515    // for incoming calls.
15516    optional int32 setup_duration_millis = 28;
15517
15518    // Main codec quality. The codec quality was equal to or greater than this value for at least
15519    // 70% of the call.
15520    optional android.telephony.CodecQuality main_codec_quality = 29;
15521
15522    // Whether video was enabled at any point during the call.
15523    optional bool video_enabled = 30;
15524
15525    // Radio access technology (RAT) used when call is connected.
15526    optional android.telephony.NetworkTypeEnum rat_at_connected = 31;
15527
15528    // Whether the call was a conference call (applicable only for calls over IMS).
15529    optional bool is_multiparty = 32;
15530
15531    // Duration after the call was connected.
15532    optional android.telephony.CallDuration call_duration = 33;
15533
15534    // Last known Radio access technology (RAT).
15535    optional android.telephony.NetworkTypeEnum last_known_rat = 34;
15536
15537    // Fold state of the device
15538    optional android.telephony.FoldState fold_state = 35;
15539
15540    // Number of times RAT changed after call connection
15541    optional int64 rat_switch_count_after_connected = 36;
15542
15543    // Handover state of the device
15544    optional bool handover_in_progress = 37;
15545
15546    // When the RAT is IWLAN, if it used cross-SIM calling when call started.
15547    optional bool is_iwlan_cross_sim_at_start = 38;
15548
15549    // When the RAT is IWLAN, if it used cross-SIM calling when call ended.
15550    optional bool is_iwlan_cross_sim_at_end = 39;
15551
15552    // When the RAT is IWLAN, if it used cross-SIM calling when call connected.
15553    optional bool is_iwlan_cross_sim_at_connected = 40;
15554
15555    // Whether Vonr is enabled
15556    optional bool vonr_enabled = 41;
15557
15558    // Whether the call is over non-terrestrial networks.
15559    optional bool is_ntn = 42;
15560
15561    // config supports_business_call_composer_bool which controls b2c feature
15562    optional bool supports_business_call_composer = 43;
15563
15564    // The user-set status for enriched calling with call composer
15565    optional android.telephony.CallComposerStatus call_composer_status = 44;
15566}
15567
15568/**
15569 * Pulls voice call radio access technology (RAT) usage.
15570 *
15571 * Each pull creates multiple atoms, one for each carrier/RAT, the order of which is irrelevant to
15572 * time. The atom will be skipped if not enough data is available.
15573 *
15574 * Pulled from:
15575 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15576 */
15577message VoiceCallRatUsage {
15578    // Carrier ID (https://source.android.com/devices/tech/config/carrierid).
15579    optional int32 carrier_id = 1;
15580
15581    // Radio access technology.
15582    optional android.telephony.NetworkTypeEnum rat = 2;
15583
15584    // Total duration that voice calls spent on this carrier and RAT, rounded to 5 minutes.
15585    optional int64 total_duration_seconds = 3;
15586
15587    // Total number of calls using this carrier and RAT.
15588    // A call is counted once even if it used the RAT multiple times.
15589    optional int64 call_count = 4;
15590}
15591
15592/**
15593 * Pulls amount of time spend in each cellular service state.
15594 *
15595 * Each pull creates multiple atoms, one for each SIM slot/carrier/RAT(including ENDC), the order of
15596 * which is irrelevant to time. If multi SIM settings changes during the period, durations will be
15597 * counted separately before and after the change. Airplane mode does not count towards durations.
15598 *
15599 * Pulled from:
15600 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15601 */
15602message CellularServiceState {
15603    // Radio access technology (RAT) for voice.
15604    // NETWORK_TYPE_UNKNOWN when the device is not in-service.
15605    // NETWORK_TYPE_IWLAN when the device is using VoWiFi.
15606    optional android.telephony.NetworkTypeEnum voice_rat = 1;
15607
15608    // Radio access technology (RAT) for data.
15609    // NETWORK_TYPE_UNKNOWN when the device is not in-service.
15610    // Only cellular RATs are valid and show where the device is camped.
15611    optional android.telephony.NetworkTypeEnum data_rat = 2;
15612
15613    // Whether the device was in roaming (domestic or international) for voice.
15614    optional android.telephony.RoamingTypeEnum voice_roaming_type = 3;
15615
15616    // Whether the device was in roaming (domestic or international) for data.
15617    optional android.telephony.RoamingTypeEnum data_roaming_type = 4;
15618
15619    // Whether the device is on LTE and has access to NR NSA, i.e. cell supports 5G (ENDC) and UE
15620    // registration (attach/TAU) indicates ENDC is not restricted.
15621    optional bool is_endc = 5;
15622
15623    // Index of the SIM used, 0 for single-SIM devices.
15624    optional int32 sim_slot_index = 6;
15625
15626    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
15627    optional bool is_multi_sim = 7;
15628
15629    // Carrier ID of the SIM card.
15630    // See https://source.android.com/devices/tech/config/carrierid.
15631    optional int32 carrier_id = 8;
15632
15633    // Total time spent in this service state, rounded to 5 minutes.
15634    optional int32 total_time_seconds = 9;
15635
15636    // Whether the device is in limited service (only emergency voice
15637    // call available). Voice and data RAT will be recorded as
15638    // NETWORK_TYPE_UNKNOWN in this case.
15639    optional bool is_emergency_only = 10;
15640
15641    // Whether internet pdn is up.
15642    optional bool is_internet_pdn_up = 11;
15643
15644    // Fold state of the device.
15645    optional android.telephony.FoldState fold_state = 12;
15646
15647    // Whether the voice service state is overridden by voice calling capability.
15648    optional bool override_voice_service = 13;
15649
15650    // Whether mobile data is enable.
15651    optional bool is_data_enabled = 14;
15652
15653    // When the voice RAT is NETWORK_TYPE_IWLAN, determines whether it is over
15654    // cross-SIM calling (WiFi calling over other SIM's cellular data).
15655    optional bool is_iwlan_cross_sim = 15;
15656
15657    // Whether the device is using non-terrestrial networks.
15658    optional bool is_ntn = 16;
15659}
15660
15661/**
15662 * Pulls the number of times cellular data service state switches.
15663 *
15664 * Each pull creates multiple atoms, one for each RAT combination, the order of which is irrelevant
15665 * to time. Switches for different SIM slots, carrier IDs, or multi-SIM settings are counted
15666 * separately.
15667 *
15668 * Pulled from:
15669 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15670 */
15671message CellularDataServiceSwitch {
15672    // Cellular RAT of the DATA domain from where the switch occurred.
15673    optional android.telephony.NetworkTypeEnum rat_from = 1;
15674
15675    // Cellular RAT of the DATA domain to where the switch occurred.
15676    optional android.telephony.NetworkTypeEnum rat_to = 2;
15677
15678    // Index of the SIM used, 0 for single-SIM devices.
15679    optional int32 sim_slot_index = 3;
15680
15681    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
15682    optional bool is_multi_sim = 4;
15683
15684    // Carrier ID of the SIM card.
15685    // See https://source.android.com/devices/tech/config/carrierid.
15686    optional int32 carrier_id = 5;
15687
15688    // Number of switches from rat_from to rat_to.
15689    optional int32 switch_count = 6;
15690}
15691
15692/**
15693 * Pulls the number of active SIM slots and SIMs/eSIM profiles.
15694 *
15695 * Pulled from:
15696 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15697 */
15698message SimSlotState {
15699    // Number of active SIM slots (both physical and eSIM profiles) in the device.
15700    optional int32 active_slot_count = 1;
15701
15702    // Number of SIM cards (both physical and active eSIM profiles).
15703    // This number may be greater than the number of active SIM slots, if multiple profiles are
15704    // enabled on the same eUICC.
15705    optional int32 sim_count = 2;
15706
15707    // Number of active eSIM profiles.
15708    // This number is always equal to or less than the number of SIMs.
15709    optional int32 esim_count = 3;
15710
15711    // Number of active eSIM slots in the device.
15712    optional int32 active_esim_slot_count = 4;
15713
15714    // Number of active slots using Multiple Enabled Profiles in the device.
15715    optional int32 active_mep_slot_count = 5;
15716}
15717
15718/**
15719 * Pulls supported cellular radio access technologies.
15720 *
15721 * This atom reports the capabilities of the device, rather than the network it has access to.
15722 *
15723 * Pulled from:
15724 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15725 */
15726message SupportedRadioAccessFamily {
15727    // A bitmask of supported radio technologies.
15728    // See android.telephony.TelephonyManager.NetworkTypeBitMask.
15729    optional int64 network_type_bitmask = 1;
15730}
15731
15732/**
15733 * Pulls the status of device-level telephony properties.
15734 *
15735 * Pulled from:
15736 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15737 */
15738message DeviceTelephonyProperties {
15739    // True if the device adopts the data stack came out in T
15740    // Deprecated since U, where legacy stack has been removed
15741    optional bool using_t_data_stack = 1 [deprecated = true];
15742    // True if auto data switch is enabled on the device
15743    optional bool auto_data_switch_enabled = 2;
15744    // Number of time the user toggled the data switch feature since the last collection
15745    optional int32 auto_data_switch_toggle_count = 3;
15746    // True if work profile is enabled on the device
15747    optional bool has_managed_profile_dedicated_sub = 4;
15748    // Number of SIM slots with support for Multiple Enabled Profiles on the device
15749    optional int32 mep_supported_slot_count = 5;
15750}
15751
15752/**
15753 * This atom is deprecated starting in T, use TelephonyNetworkRequestsV2 instead.
15754 *
15755 * Pulls information about network requests.
15756 *
15757 * Pulled from:
15758 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15759 */
15760message TelephonyNetworkRequests {
15761    // Carrier ID of the SIM card.
15762    // See https://source.android.com/devices/tech/config/carrierid.
15763    optional int32 carrier_id = 1;
15764    // Number of times the enterprise capability was requested.
15765    optional int32 enterprise_request_count = 2;
15766    // Number of times the enterprise capability was released.
15767    optional int32 enterprise_release_count = 3;
15768}
15769
15770/**
15771 * Pulls information about network requests.
15772 *
15773 * Pulled from:
15774 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15775 */
15776message TelephonyNetworkRequestsV2 {
15777    enum NetworkCapability {
15778        // Unknown capability was requested.
15779        UNKNOWN = 0;
15780        // Low latency capability (URLLC) was requested.
15781        PRIORITIZE_LATENCY = 1;
15782        // High bandwidth capability (EMBB) was requested.
15783        PRIORITIZE_BANDWIDTH = 2;
15784        // CBS (Carrier Branded Services) capability was requested.
15785        CBS = 3;
15786        // Enterprise capability was requested.
15787        ENTERPRISE = 4;
15788        //Satellite internet restricted capability was requested.
15789        SATELLITE_INTERNET_RESTRICTED = 5;
15790        //Satellite mms restricted capability was requested.
15791        SATELLITE_MMS_RESTRICTED = 6;
15792        //Satellite ims restricted capability was requested.
15793        SATELLITE_IMS_RESTRICTED = 7;
15794        //Satellite xcap restricted capability was requested.
15795        SATELLITE_XCAP_RESTRICTED = 8;
15796        //Satellite eims restricted capability was requested.
15797        SATELLITE_EIMS_RESTRICTED = 9;
15798        //Satellite supl restricted capability was requested.
15799        SATELLITE_SUPL_RESTRICTED =10;
15800    }
15801    // Carrier ID of the SIM card.
15802    // See https://source.android.com/devices/tech/config/carrierid.
15803    optional int32 carrier_id = 1;
15804    // The capability that was requested.
15805    optional NetworkCapability capability = 2;
15806    // Number of times the capability was requested.
15807    optional int32 request_count = 3;
15808}
15809
15810/**
15811 * Pulls information for a single incoming SMS.
15812 *
15813 * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
15814 *
15815 * Pulled from:
15816 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15817 */
15818message IncomingSms {
15819    // Format of the SMS (3GPP or 3GPP2).
15820    optional android.telephony.SmsFormatEnum sms_format = 1;
15821
15822    // Technology of the SMS (CS or IMS).
15823    optional android.telephony.SmsTechEnum sms_tech = 2;
15824
15825    // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
15826    optional android.telephony.NetworkTypeEnum rat = 3;
15827
15828    // Type the SMS.
15829    optional android.telephony.SmsTypeEnum sms_type = 4;
15830
15831    // Number of total parts.
15832    optional int32 total_parts = 5;
15833
15834    // Number of received parts (if smaller than total parts, the SMS was dropped).
15835    optional int32 received_parts = 6;
15836
15837    // Indicates if the incoming SMS was blocked.
15838    optional bool blocked = 7;
15839
15840    // Indicate a specific error handling the SMS
15841    optional android.telephony.SmsIncomingErrorEnum error = 8;
15842
15843    // Whether the SMS was received while roaming.
15844    optional bool is_roaming = 9;
15845
15846    // Index of the SIM used, 0 for single-SIM devices.
15847    optional int32 sim_slot_index = 10;
15848
15849    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
15850    optional bool is_multi_sim = 11;
15851
15852    // Whether the message was received with an eSIM profile.
15853    optional bool is_esim = 12;
15854
15855    // Carrier ID of the SIM card used for the SMS.
15856    // See https://source.android.com/devices/tech/config/carrierid.
15857    optional int32 carrier_id = 13;
15858
15859    // Random message ID.
15860    // If the value of count is greater than 1, the message_id represents only one of the messages.
15861    optional int64 message_id = 14;
15862
15863    // Number of messages with the same properties (see message_id for exception)
15864    optional int32 count = 15;
15865
15866    // Whether the message was received with an enterprise profile.
15867    optional bool is_managed_profile = 16;
15868
15869    // Whether the message was received over non-terrestrial networks.
15870    optional bool is_ntn = 17;
15871
15872    // Whether the message is an emergency or not.
15873    optional bool is_emergency = 18;
15874}
15875
15876/**
15877 * Pulls information for a single outgoing SMS.
15878 *
15879 * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
15880 *
15881 * Pulled from:
15882 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
15883 */
15884message OutgoingSms {
15885    // Format of the SMS (3GPP or 3GPP2).
15886    optional android.telephony.SmsFormatEnum sms_format = 1;
15887
15888    // Technology of the SMS (CS or IMS).
15889    optional android.telephony.SmsTechEnum sms_tech = 2;
15890
15891    // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
15892    optional android.telephony.NetworkTypeEnum rat = 3;
15893
15894    // Result of the SMS sending.
15895    optional android.telephony.SmsSendResultEnum send_result = 4;
15896
15897    // Error code
15898    // For IMS technology, see @SmsManager.Result in
15899    // http://cs/android/frameworks/base/telephony/java/android/telephony/SmsManager.java
15900    // For CS technology:
15901    //  - GSM format: see GsmSmsErrorCode (3GPP 27.005 clause 3.2.5)
15902    //  - CDMA format: see CdmaSmsErrorCode (3GPP2 N.S0005 (IS-41-C) Table 171)
15903    // The field error_code is used for up-to-Android-13 devices. From Android 14,
15904    // network_error_code will be used. The field error_code will be deprecated when most devices
15905    // use Android 14 or higher versions.
15906    optional int32 error_code = 5;
15907
15908    // Whether the SMS was sent while roaming.
15909    optional bool is_roaming = 6;
15910
15911    // Whether the default SMS application generated the SMS (regardless of which application).
15912    optional bool is_from_default_app = 7;
15913
15914    // Index of the SIM used, 0 for single-SIM devices.
15915    optional int32 sim_slot_index = 8;
15916
15917    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
15918    optional bool is_multi_sim = 9;
15919
15920    // Whether the message was sent with an eSIM profile.
15921    optional bool is_esim = 10;
15922
15923    // Carrier ID of the SIM card used for the SMS.
15924    // See https://source.android.com/devices/tech/config/carrierid.
15925    optional int32 carrier_id = 11;
15926
15927    // Random message ID.
15928    // If the value of count is greater than 1, the message_id represents only one of the messages.
15929    optional int64 message_id = 12;
15930
15931    // Retry count: 0 for the first attempt and then increasing for each attempt.
15932    // If the value of count is greater than 1, the retry_id represents the value associated with
15933    // the message defined by message_id.
15934    optional int32 retry_id = 13;
15935
15936    // Time in milliseconds to complete the SMS send to the network.
15937    // If the value of count is greater than 1, this field measures the average time interval.
15938    optional int64 interval_millis = 14;
15939
15940    // Number of messages with the same properties (see message_id, retry_id and latency_millis for
15941    // exceptions)
15942    optional int32 count = 15;
15943
15944    // Internal send error code
15945    optional android.telephony.SmsSendErrorEnum send_error_code = 16;
15946
15947    // Network error code
15948    // - SMS_FORMAT_3GPP format: see GsmSmsErrorCode (3GPP 27.005 clause 3.2.5)
15949    // - SMS_FORMAT_3GPP2 format: see CdmaSmsErrorCode (3GPP2 N.S0005 (IS-41-C) Table 171)
15950    optional int32 network_error_code = 17;
15951
15952    // Whether the message was sent with an enterprise profile.
15953    optional bool is_managed_profile = 18;
15954
15955    // Whether the message is an emergency or not.
15956    optional bool is_emergency = 19;
15957
15958    // Whether the message was sent over non-terrestrial networks.
15959    optional bool is_ntn = 20;
15960}
15961
15962/**
15963 * Logs information about usage of airplane mode.
15964 *
15965 * Logged from:
15966 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/AirplaneModeStats.java
15967 */
15968message AirplaneMode {
15969    // Status of airplane mode
15970    optional bool is_enabled = 1;
15971
15972    // When is_enabled is false, indicates if this was a very short airplane mode toggle
15973    // (i.e. airplane mode was disabled after less than 10 seconds from enablement).
15974    optional bool short_toggle = 2;
15975
15976    // Carrier ID of the SIM card.
15977    // See https://source.android.com/devices/tech/config/carrierid.
15978    optional int32 carrier_id = 3;
15979}
15980
15981/**
15982 * Logs information about modem restarts.
15983 *
15984 * Logged from:
15985 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/ModemRestartStats.java
15986 */
15987message ModemRestart {
15988    // Software version of the modem, as provided by android.os.Build.getRadioVersion().
15989    optional string baseband_version = 1;
15990
15991    // Reason of the modem restart, as provided in the modemReset indication of IRadio HAL.
15992    optional string reason = 2;
15993
15994    // Carrier ID of the first SIM card.
15995    // See https://source.android.com/devices/tech/config/carrierid.
15996    optional int32 carrier_id = 3;
15997}
15998
15999/**
16000 * Logs the SIM card details when the carrier ID match is not complete.
16001 *
16002 * The atom is pushed when a SIM card is initialized and the MCC/MNC is not present in the
16003 * carrier ID table, or the SIM card contains a GID1 value that is not present in the carrier ID
16004 * table. This atom is pushed only once for each type of SIM card.
16005 *
16006 * Logged from:
16007 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
16008 */
16009message CarrierIdMismatchReported {
16010    // Matched carrier ID. The value -1 is used if no match is found.
16011    optional int32 carrier_id = 1;
16012
16013    // MCC/MNC of the SIM card.
16014    optional string mcc_mnc = 2;
16015
16016    // Group identifier (level 1) of the SIM card.
16017    optional string gid1 = 3;
16018
16019    // SPN value of the SIM card.
16020    optional string spn = 4;
16021
16022    // First record of the PNN in the SIM card. This field is populated only if the SPN is missing
16023    // or empty.
16024    optional string pnn = 5;
16025}
16026
16027/**
16028 * Logs the version of the carrier ID matching table at first power up and when it is updated.
16029 *
16030 * Logged from:
16031 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
16032 */
16033message CarrierIdTableUpdated {
16034    // Version of the CarrierId matching table.
16035    optional int32 table_version = 1;
16036}
16037
16038/**
16039 * Pulls the version of the carrier ID matching table.
16040 *
16041 * Logged from:
16042 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
16043 */
16044message CarrierIdTableVersion {
16045    // Version of the CarrierId matching table.
16046    optional int32 table_version = 1;
16047}
16048
16049/**
16050 * Pulls information for a single data call session
16051 *
16052 * Each pull creates multiple atoms, one for each data call session.
16053 * The sequence is randomized when pulled.
16054 *
16055 * Pulled from:
16056 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
16057 */
16058message DataCallSession {
16059    // A random number to be used as dimension to capture multiple atoms
16060    optional int32 dimension = 1;
16061
16062    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
16063    optional bool is_multi_sim = 2;
16064
16065    // Whether the call was made with an eSIM profile.
16066    optional bool is_esim = 3;
16067
16068    // Data profile of this call (for what purpose this call was made)
16069    optional android.telephony.DataProfileEnum profile = 4 [deprecated = true];
16070
16071    // APN type bitmask of the APN used:
16072    // @ApnType in frameworks/base/telephony/java/android/telephony/Annotation.java.
16073    optional int32 apn_type_bitmask = 5;
16074
16075    // Carrier ID of the SIM
16076    // See https://source.android.com/devices/tech/config/carrierid.
16077    optional int32 carrier_id = 6;
16078
16079    // Whether the subscription is roaming
16080    optional bool is_roaming = 7;
16081
16082    // Data RAT when the call ended, can be IWLAN for IMS/MMS, otherwise should be WWAN PS RAT.
16083    // In the case that the connection hasn't ended yet, this field holds the current RAT.
16084    // In the case the call ended due to Out Of Service (OOS),
16085    // this field should be the last known RAT.
16086    optional android.telephony.NetworkTypeEnum rat_at_end = 8;
16087
16088    // Was the data call ended due to OOS
16089    optional bool oos_at_end = 9;
16090
16091    // Number of RAT switches during the data call
16092    optional int64 rat_switch_count = 10;
16093
16094    // Whether the call is on an opportunistic subscription
16095    optional bool is_opportunistic = 11;
16096
16097    // Packet data protocol used
16098    optional android.telephony.ApnProtocolEnum ip_type = 12;
16099
16100    // Whether the data call terminated before being established
16101    optional bool setup_failed = 13;
16102
16103    // Reason why the data call terminated, as in RIL_DataCallFailCause from ril.h
16104    optional int32 failure_cause = 14;
16105
16106    // Suggested retry back-off timer value from RIL
16107    optional int32 suggested_retry_millis = 15;
16108
16109    // Why the data call was deactivated
16110    // Set by telephony for MO deactivations (unrelated to failure_cause)
16111    optional android.telephony.DataDeactivateReasonEnum deactivate_reason = 16;
16112
16113    // Duration of the data call, rounded into the closest 5 minutes.
16114    optional int64 duration_minutes = 17;
16115
16116    // Whether the data call is still connected when the atom is collected.
16117    optional bool ongoing = 18;
16118
16119    // Band at the end of the data call. Value 0 is used if the band is unknown.
16120    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
16121    // on the RAT at the end of the data call.
16122    optional int32 band_at_end = 19;
16123
16124    // Reason why the data call handover failed, as in RIL_DataCallFailCause from ril.h
16125    repeated int32 handover_failure_causes = 20;
16126
16127    // For each int32, the lower 16 bits represent the source RAT while the upper 16 bits indicate
16128    // the target RAT of the failed handover.
16129    repeated int32 handover_failure_rat = 21;
16130
16131    // Whether the call is for internet on nonDDS due to auto data switch feature
16132    optional bool is_non_dds = 22;
16133
16134    // When the 'rat_at_end' field is IWLAN, determines if the data call setup was
16135    // over cross-SIM calling (Wifi calling over cellular data).
16136    optional bool is_iwlan_cross_sim = 23;
16137
16138    // Whether the call is over non-terrestrial networks.
16139    optional bool is_ntn = 24;
16140
16141    // Determines if current data call was over satellite transport
16142    optional bool is_satellite_transport = 25;
16143
16144    // Determines if current data call was over provisioning profile or not
16145    optional bool is_provisioning_profile = 26;
16146}
16147
16148/**
16149 * Logs data stall recovery event
16150 *
16151 * Logged from:
16152 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/data/
16153 *   DataStallRecoveryManager.java
16154 */
16155message DataStallRecoveryReported {
16156    // Carrier ID of the SIM
16157    // See https://source.android.com/devices/tech/config/carrierid.
16158    optional int32 carrier_id = 1;
16159
16160    // Data RAT when the stall happened
16161    optional android.telephony.NetworkTypeEnum rat = 2;
16162
16163    // Signal strength when stall happened
16164    optional android.telephony.SignalStrengthEnum signal_strength = 3;
16165
16166    // Action taken to recover
16167    optional android.telephony.DataStallRecoveryActionEnum action = 4;
16168
16169    // Whether the subscription is opportunistic
16170    optional bool is_opportunistic = 5;
16171
16172    // Whether the device is in multi-SIM mode
16173    optional bool is_multi_sim = 6;
16174
16175    // Band used when the stall/recovery took place.
16176    // Value 0 is used if the band is unknown.
16177    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
16178    // on the RAT used at the time.
16179    optional int32 band = 7;
16180
16181    // Whether the data stall is recovered.
16182    optional bool recovered = 8;
16183
16184    // The elapsed time between start of the data stall and result of current action.
16185    optional int32 duration_millis = 9;
16186
16187    // The data stall recovered reason. Available from Android T.
16188    optional android.telephony.DataStallRecoveredReason reason = 10;
16189
16190    // Signal strength of the other phone if DSDS when stall happened.
16191    // SIGNAL_STRENGTH_NONE_OR_UNKNOWN(0) if single SIM.
16192    optional android.telephony.SignalStrengthEnum other_phone_signal_strength = 11;
16193
16194    // PS WWAN Network Registration state of the other phone if DSDS when stall happened.
16195    // REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING(0) if single SIM.
16196    optional android.telephony.NetworkRegistrationState other_phone_reg_state = 12;
16197
16198    // PS WWAN Network Registration state of the default phone when data stall.
16199    optional android.telephony.NetworkRegistrationState phone_reg_state = 13;
16200
16201    // collect the first validation after recovery when data stall occurs.
16202    optional bool is_first_validation_after_recovery = 14;
16203
16204    // The phone id when doing the recovery action.
16205    optional int32 phone_id = 15;
16206
16207    // The elapsed time of current action.
16208    optional int32 duration_millis_of_current_action = 16;
16209
16210    // Link status of the data network.
16211    optional int32 link_status = 17;
16212
16213    // The link up bandwidth of the data network.
16214    optional int32 link_up_bandwidth = 18;
16215
16216    // The link down bandwidth of the data network.
16217    optional int32 link_down_bandwidth = 19;
16218}
16219
16220/**
16221 * Pulls IMS registration terminations.
16222 *
16223 * Each pull generates multiple atoms, one for each termination condition happened during the day.
16224 *
16225 * Pulled from:
16226 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
16227 */
16228message ImsRegistrationTermination {
16229    // Carrier ID of the SIM used for IMS registration.
16230    // See https://source.android.com/devices/tech/config/carrierid.
16231    optional int32 carrier_id = 1;
16232
16233    // Whether the device is in multi-SIM mode when the registration terminated.
16234    optional bool is_multi_sim = 2;
16235
16236    // Radio access technology (RAT) used by the registration when it terminated.
16237    // This can be IWLAN if IMS was registered over Wifi.
16238    optional android.telephony.NetworkTypeEnum rat_at_end = 3;
16239
16240    // Whether the IMS registration failed before it was established.
16241    optional bool setup_failed = 4;
16242
16243    // IMS reason code indicating the termination reason.
16244    // See: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
16245    optional int32 reason_code = 5;
16246
16247    // IMS extra code indicating the termination reason.
16248    optional int32 extra_code = 6;
16249
16250    // IMS extra message indicating the termination reason.
16251    // This string is truncated to 128 characters if its length exceeds the limit.
16252    optional string extra_message = 7;
16253
16254    // Total number of instances of registration termination that matches the above conditions.
16255    optional int32 count = 8;
16256
16257    // When the 'rat_at_end' field is IWLAN, indicates whether the ImsRegistrationTech is
16258    // REGISTRATION_TECH_CROSS_SIM.
16259    optional bool is_iwlan_cross_sim = 9;
16260}
16261
16262/**
16263 * Pulls IMS registration statistics.
16264 *
16265 * Each pull generates multiple atoms, one for each carrier, SIM slot, and radio access technology
16266 * (RAT) combination. Durations are aggregated from all registrations with matching criteria,
16267 * including ones that are currently active.
16268 *
16269 * Pulled from:
16270 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
16271 */
16272message ImsRegistrationStats {
16273    // Carrier ID of the SIM used for IMS registration.
16274    // See https://source.android.com/devices/tech/config/carrierid.
16275    optional int32 carrier_id = 1;
16276
16277    // Index of the SIM used, 0 for single-SIM devices.
16278    optional int32 sim_slot_index = 2;
16279
16280    // Radio access technology (RAT) used by the registration.
16281    // This can be IWLAN if IMS was registered over Wifi.
16282    optional android.telephony.NetworkTypeEnum rat = 3;
16283
16284    // Total time IMS was registered (connected time), rounded to 5 minutes.
16285    optional int32 registered_seconds = 4;
16286
16287    // Durations that each feature (Voice, Video, UT, SMS) is capable (supported/enabled by the
16288    // network/device) and available (registered and ready to use).
16289    // All durations are rounded to 5 minutes and should be equal to or shorter than
16290    // registered_seconds.
16291    optional int32 voice_capable_seconds = 5;
16292    optional int32 voice_available_seconds = 6;
16293    optional int32 sms_capable_seconds = 7;
16294    optional int32 sms_available_seconds = 8;
16295    optional int32 video_capable_seconds = 9;
16296    optional int32 video_available_seconds = 10;
16297    optional int32 ut_capable_seconds = 11;
16298    optional int32 ut_available_seconds = 12;
16299
16300    // Total time IMS was registering (connecting time), rounded to 5 minutes
16301    optional int32 registering_seconds = 13;
16302    // Total time IMS was unregistered (unconnected time), rounded to 5 minutes
16303    optional int32 unregistered_seconds = 14;
16304
16305    // When the 'rat' field is IWLAN, indicates whether the ImsRegistrationTech is
16306    // REGISTRATION_TECH_CROSS_SIM.
16307    optional bool is_iwlan_cross_sim = 15;
16308
16309    // How many times IMS is registered
16310    optional int32 registered_times = 16;
16311}
16312
16313/*
16314 * Logs information related to PIN storage and automatic PIN operations.
16315 *
16316 * Logged from:
16317 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/PinStorage.java
16318 */
16319message PinStorageEvent {
16320    // The type of event.
16321    enum Event {
16322        UNKNOWN = 0;
16323        // The PIN was verified automatically successfully.
16324        PIN_VERIFICATION_SUCCESS = 1;
16325        // The PIN was verified automatically unsuccessfully.
16326        PIN_VERIFICATION_FAILURE = 2;
16327        // The PIN(s) was cached, but discarded after reboot (e.g. SIM not present after reboot).
16328        CACHED_PIN_DISCARDED = 3;
16329        // The PIN(s) was stored to be used after unattended reboot.
16330        PIN_STORED_FOR_VERIFICATION = 4;
16331        // The PIN(s) is not available for storage and will be required after unattended reboot.
16332        PIN_REQUIRED_AFTER_REBOOT = 5;
16333        // The PIN was not verified automatically because the SIM card did not match.
16334        PIN_VERIFICATION_SKIPPED_SIM_CARD_MISMATCH = 6;
16335        // The available PINs after reboot does not match the number of stored PINs before reboot.
16336        PIN_COUNT_NOT_MATCHING_AFTER_REBOOT = 7;
16337        // Error while decrypting the PIN
16338        PIN_DECRYPTION_ERROR = 8;
16339        // Error while encrypting the PIN
16340        PIN_ENCRYPTION_ERROR = 9;
16341        // Attempted to decrypt the PIN with a null/missing encryption key.
16342        PIN_ENCRYPTION_KEY_MISSING = 10;
16343    }
16344    optional Event event = 1;
16345
16346    // Number of PINs stored or discarded.
16347    optional int32 number_of_pins = 2;
16348
16349    // The caller package name
16350    optional string package_name = 3;
16351}
16352
16353/**
16354 * Logs flip to screen off events.
16355 *
16356 * Logged from:
16357 *   frameworks/opt/telephony/src/java/com/android/server/power/FaceDownDetector.java
16358 */
16359message FaceDownReported {
16360    enum Response{
16361        UNKNOWN = 1;
16362        // The phone was flipped before the screen turns off.
16363        UNFLIP = 2;
16364        // User interacts with the screen after a face down is detected.
16365        USER_INTERACTION = 3;
16366        // A flip leads to screen turning off. This is the expected outcome.
16367        SCREEN_OFF = 4;
16368    }
16369
16370    // Logs the action that occurs from a flip event, whether by user or system
16371    // action.
16372    optional Response face_down_response = 1;
16373
16374    // After a flip is detected, how long until a system or user action occurs.
16375    optional int64 millis_since_flip = 2;
16376
16377    // Difference between the flip time and when the timeout would otherwise
16378    // occur.
16379    optional int64 millis_until_normal_timeout = 3;
16380
16381    // How quickly the user turns the screen back on after a flip event.
16382    // A low value may indicate a false negative. Logged only when Response is
16383    // SCREEN_OFF.
16384    optional int64 millis_until_next_screen_on = 4;
16385}
16386
16387/**
16388 * Logs timeout extended events which occur from consecutive undims.
16389 *
16390 * Logged from:
16391 *   frameworks/opt/telephony/src/java/com/android/server/power/ScreenUndimDetector.java
16392 */
16393message TimeoutAutoExtendedReported {
16394    enum Outcome {
16395        UNKNOWN = 0;
16396        POWER_BUTTON = 1;
16397        TIMEOUT = 2;
16398    }
16399
16400    // Logs the action that occurs after timeout is extended from undim.
16401    optional Outcome outcome = 1;
16402    // Time from timeout extension to the outcome.
16403    optional int64 time_to_outcome_millis = 2;
16404    // Time of first interaction after undim if an interaction occurs.
16405    // -1 if no interaction occurs before screen turns off.
16406    optional int64 time_to_first_interaction_millis = 3;
16407}
16408
16409/**
16410 * Logs gnss stats from location service provider
16411 *
16412 * Pulled from:
16413 *  frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
16414 */
16415message GnssStats {
16416    // Number of location reports since boot
16417    optional int64 location_reports = 1;
16418
16419    // Total pulled reports of Location failures since boot
16420    optional int64 location_failure_reports = 2;
16421
16422    // Number of time to first fix reports since boot
16423    optional int64 time_to_first_fix_reports = 3;
16424
16425    // Total pulled reported time to first fix (in milli-seconds) since boot
16426    optional int64 time_to_first_fix_millis = 4;
16427
16428    // Number of position accuracy reports since boot
16429    optional int64 position_accuracy_reports = 5;
16430
16431    // Total pulled reported position accuracy (in meters) since boot
16432    optional int64 position_accuracy_meters = 6;
16433
16434    // Number of top 4 average CN0 reports since boot
16435    optional int64 top_four_average_cn0_reports = 7;
16436
16437    // Total pulled reported of top 4 average CN0 (dB-mHz) since boot
16438    optional int64 top_four_average_cn0_db_mhz = 8;
16439
16440    // Number of l5 top 4 average CN0 reports since boot
16441    optional int64 l5_top_four_average_cn0_reports = 9;
16442
16443    // Total pulled reported of l5 top 4 average CN0 (dB-mHz) since boot
16444    optional int64 l5_top_four_average_cn0_db_mhz = 10;
16445
16446    // Total number of sv status messages reports since boot
16447    optional int64 sv_status_reports = 11;
16448
16449    // Total number of sv status messages reports, where sv is used in fix since boot
16450    optional int64 sv_status_reports_used_in_fix = 12;
16451
16452    // Total number of L5 sv status messages reports since boot
16453    optional int64 l5_sv_status_reports = 13;
16454
16455    // Total number of L5 sv status messages reports, where sv is used in fix since boot
16456    optional int64 l5_sv_status_reports_used_in_fix = 14;
16457}
16458
16459/**
16460 * Logs power usage data from GNSS subsystem.
16461 *
16462 * Logged from:
16463 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
16464 */
16465message GnssPowerStats {
16466    // Relative precision of the alignment of the reported power stats measurement.
16467    optional int64 elapsed_realtime_uncertainty_nanos = 1;
16468
16469    // Total GNSS energy consumption in micro-joules (or micro Watt-seconds).
16470    optional int64 total_energy_micro_joule = 2;
16471
16472    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
16473    // tracking signals of a single frequency band.
16474    optional int64 singleband_tracking_mode_energy_micro_joule = 3;
16475
16476    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
16477    // tracking signals of multiple frequency bands.
16478    optional int64 multiband_tracking_mode_energy_micro_joule = 4;
16479
16480    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
16481    // acquiring signals of a single frequency band.
16482    optional int64 singleband_acquisition_mode_energy_micro_joule = 5;
16483
16484    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
16485    // acquiring signals of multiple frequency bands.
16486    optional int64 multiband_acquisition_mode_energy_micro_joule = 6;
16487
16488    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16489    // operating in each of the vendor-specific power modes. (Index 0)
16490    optional int64 vendor_specific_power_modes_energy_micro_joule_0 = 7;
16491
16492    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16493    // operating in each of the vendor-specific power modes. (Index 1)
16494    optional int64 vendor_specific_power_modes_energy_micro_joule_1 = 8;
16495
16496    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16497    // operating in each of the vendor-specific power modes. (Index 2)
16498    optional int64 vendor_specific_power_modes_energy_micro_joule_2 = 9;
16499
16500    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16501    // operating in each of the vendor-specific power modes. (Index 3)
16502    optional int64 vendor_specific_power_modes_energy_micro_joule_3 = 10;
16503
16504    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16505    // operating in each of the vendor-specific power modes. (Index 4)
16506    optional int64 vendor_specific_power_modes_energy_micro_joule_4 = 11;
16507
16508    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16509    // operating in each of the vendor-specific power modes. (Index 5)
16510    optional int64 vendor_specific_power_modes_energy_micro_joule_5 = 12;
16511
16512    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16513    // operating in each of the vendor-specific power modes. (Index 6)
16514    optional int64 vendor_specific_power_modes_energy_micro_joule_6 = 13;
16515
16516    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16517    // operating in each of the vendor-specific power modes. (Index 7)
16518    optional int64 vendor_specific_power_modes_energy_micro_joule_7 = 14;
16519
16520    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16521    // operating in each of the vendor-specific power modes. (Index 8)
16522    optional int64 vendor_specific_power_modes_energy_micro_joule_8 = 15;
16523
16524    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
16525    // operating in each of the vendor-specific power modes. (Index 9)
16526    optional int64 vendor_specific_power_modes_energy_micro_joule_9 = 16;
16527}
16528
16529/**
16530 * Logs when an app is moved to a different standby bucket.
16531 *
16532 * Logged from:
16533 *   frameworks/base/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
16534 */
16535message AppStandbyBucketChanged {
16536    optional string package_name = 1;
16537
16538    // Should be 0, 10, 11, 12, etc. where 0 is the owner. See UserHandle for more documentation.
16539    optional int32 user_id = 2;
16540
16541    // These enum values match the constants defined in UsageStatsManager.java.
16542    enum Bucket {
16543        BUCKET_UNKNOWN = 0;
16544        BUCKET_EXEMPTED = 5;
16545        BUCKET_ACTIVE = 10;
16546        BUCKET_WORKING_SET = 20;
16547        BUCKET_FREQUENT = 30;
16548        BUCKET_RARE = 40;
16549        BUCKET_RESTRICTED = 45;
16550        BUCKET_NEVER = 50;
16551    }
16552    optional Bucket bucket = 3;
16553
16554    enum MainReason {
16555        MAIN_UNKNOWN = 0;
16556        MAIN_DEFAULT = 0x0100;
16557        MAIN_TIMEOUT = 0x0200;
16558        MAIN_USAGE = 0x0300;
16559        MAIN_FORCED_BY_USER = 0x0400;
16560        MAIN_PREDICTED = 0x0500;
16561        MAIN_FORCED_BY_SYSTEM = 0x0600;
16562    }
16563    optional MainReason main_reason = 4;
16564
16565    // A more detailed reason for the standby bucket change. The sub reason name is dependent on
16566    // the main reason. Values are one of the REASON_SUB_XXX constants defined in
16567    // UsageStatsManager.java.
16568    optional int32 sub_reason = 5;
16569}
16570
16571/**
16572* Reports a started sharesheet transaction.
16573*
16574* Logged from:
16575*   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java
16576*   packages/modules/IntentResolver/java/src/com/android/intentresolver/ChooserActivity.java
16577*/
16578message SharesheetStarted {
16579    // The event_id (as for UiEventReported).
16580    optional int32 event_id = 1;
16581    // The calling app's package name.
16582    optional string package_name = 2;
16583    // An identifier to tie together multiple logs relating to the same share event
16584    optional int32 instance_id = 3;
16585    // The mime type of the share
16586    optional string mime_type = 4;
16587    // The number of direct targets the calling app is providing that will be shown.
16588    optional int32 num_app_provided_direct_targets = 5;
16589    // The number of app targets the calling app is providing that will be shown.
16590    optional int32 num_app_provided_app_targets = 6;
16591    // True if the share originates from the workprofile
16592    optional bool is_workprofile = 7;
16593
16594    enum SharesheetPreviewType {  // Constants from ChooserActivity.java
16595        CONTENT_PREVIEW_TYPE_UNKNOWN = 0;  // Default for proto 2 / 3 compatibility.
16596        CONTENT_PREVIEW_IMAGE = 1;  // The preview shown in the sharesheet is an image.
16597        CONTENT_PREVIEW_FILE = 2;  // The preview shown in the sharesheet is a file.
16598        CONTENT_PREVIEW_TEXT = 3;  // The preview shown in the sharesheet is text.
16599        // Preview is toggleable media items (Shareousel):
16600        CONTENT_PREVIEW_TOGGLEABLE_MEDIA = 4;
16601    }
16602    // How the sharesheet preview is presented.
16603    optional SharesheetPreviewType preview_type = 8;
16604
16605    enum ResolverActivityIntent { // Intents handled by ResolverActivity.java
16606        INTENT_DEFAULT = 0;
16607        INTENT_ACTION_VIEW = 1;
16608        INTENT_ACTION_EDIT = 2;
16609        INTENT_ACTION_SEND = 3;
16610        INTENT_ACTION_SENDTO = 4;
16611        INTENT_ACTION_SEND_MULTIPLE = 5;
16612        INTENT_ACTION_IMAGE_CAPTURE = 6;
16613        INTENT_ACTION_MAIN = 7;
16614    }
16615    // The intent being processed (only SEND and SEND_MULTIPLE are system sharesheet)
16616    optional ResolverActivityIntent intent_type = 9;
16617    // The number of custom actions that the calling app has provided.
16618    optional int32 num_provided_custom_actions = 10;
16619    // True if the calling app has provided an action for share modification.
16620    optional bool modify_share_action_provided = 11;
16621}
16622
16623/**
16624 * Reports a ranking selection event.
16625 *
16626 * Logged from:
16627 *   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java (sharesheet)
16628 *   packages/modules/IntentResolver/java/src/com/android/intentresolver/ChooserActivity.java
16629 */
16630message RankingSelected {
16631    // The event_id (as for UiEventReported).
16632    optional int32 event_id = 1;
16633    // The relevant app's package name (can be source or picked package).
16634    optional string package_name = 2;
16635    // An identifier to tie together multiple logs relating to the same share event.
16636    optional int32 instance_id = 3;
16637    // Which of the ranked targets got picked, default starting position 0.
16638    optional int32 position_picked = 4;
16639    // Whether the selected target is pinned.
16640    optional bool is_pinned = 5;
16641}
16642
16643/**
16644 * Logs when TvSettings UI is interacted at.
16645 *
16646 * Logged from: packages/apps/TvSettings
16647 */
16648message TvSettingsUIInteracted {
16649
16650    /** The UI action category */
16651    optional android.app.tvsettings.Action action = 1;
16652
16653    /** The ID of the entry that the users actioned on */
16654    optional android.app.tvsettings.ItemId item_id = 2;
16655}
16656
16657/**
16658 * Logs information about a package installation using package installer V2 APIs.
16659 *
16660 * Logged from:
16661 *      frameworks/base/services/core/java/com/android/server/pm/PackageInstallerSession.java
16662 */
16663message PackageInstallerV2Reported {
16664    // Whether this installation uses Incremental File System
16665    optional bool is_incremental = 1;
16666    // Name of the package that is intended to be installed
16667    optional string package_name = 2;
16668    // The duration between when the install was requested to when the install has completed
16669    optional int64 duration_millis = 3;
16670    // Installation result in final integer, which are SystemApi's.
16671    // Return_code 1 indicates success.
16672    // For full list, see frameworks/base/core/java/android/content/pm/PackageManager.java
16673    optional int32 return_code  = 4;
16674    // Total size of the APKs installed for this package
16675    optional int64 apks_size_bytes = 5;
16676    // UID of the package. -1 if the installation failed.
16677    optional int32 uid = 6 [(is_uid) = true];
16678}
16679
16680/**
16681 * Logs settings provider values.
16682 *
16683 * Use DeviceConfig.getProperties to get a list Setting key, query the data from content provider,
16684 * then write the value to proto.
16685 *
16686 */
16687message SettingSnapshot {
16688
16689    // Setting key
16690    optional string name = 1;
16691
16692    enum SettingsValueType {
16693        NOTASSIGNED = 0;
16694        ASSIGNED_BOOL_TYPE = 1;
16695        ASSIGNED_INT_TYPE = 2;
16696        ASSIGNED_FLOAT_TYPE = 3;
16697        ASSIGNED_STRING_TYPE = 4;
16698    };
16699    // Setting value type
16700    optional SettingsValueType type = 2;
16701
16702    optional bool bool_value = 3;
16703
16704    optional int32 int_value = 4;
16705
16706    optional float float_value = 5;
16707
16708    optional string str_value = 6;
16709
16710    // Android user index. 0 for primary user, 10, 11 for secondary or profile user
16711    optional int32 user_id = 7;
16712}
16713
16714/**
16715 * An event logged to indicate that a user journey is about to be performed. This atom includes
16716 * relevant information about the users involved in the journey. A UserLifecycleEventOccurred event
16717 * will immediately follow this atom which will describe the event(s) and its state.
16718 *
16719 * Logged from:
16720 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
16721 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
16722 */
16723message UserLifecycleJourneyReported {
16724    // An identifier to track a chain of user lifecycle events occurring (referenced in the
16725    // UserLifecycleEventOccurred atom)
16726    optional int64 session_id = 1;
16727
16728    // Indicates what type of user journey this session is related to
16729    enum Journey {
16730        UNKNOWN = 0; // Undefined user lifecycle journey
16731        USER_SWITCH_UI = 1; // A user switch journey where a UI is shown
16732        USER_SWITCH_FG = 2; // A user switch journey without a UI shown
16733        USER_START = 3; // A user start journey
16734        USER_CREATE = 4; // A user creation journey
16735        USER_STOP = 5; // A user stop journey
16736        USER_REMOVE = 6; // A user removal journey
16737        GRANT_ADMIN = 7; // An admin grant journey
16738        REVOKE_ADMIN = 8; // An admin revocation journey
16739        USER_LIFECYCLE = 9; // User journey from creation to deletion
16740    }
16741    optional Journey journey = 2;
16742    // Which user the journey is originating from - could be -1 for certain phases (eg USER_CREATE)
16743    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
16744    optional int32 origin_user = 3;
16745    // Which user the journey is targeting
16746    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
16747    optional int32 target_user = 4;
16748
16749    // What is the user type of the target user
16750    // These should be in sync with USER_TYPE_* flags defined in UserManager.java
16751    enum UserType {
16752        TYPE_UNKNOWN = 0;
16753        FULL_SYSTEM = 1;
16754        FULL_SECONDARY = 2;
16755        FULL_GUEST = 3;
16756        FULL_DEMO = 4;
16757        FULL_RESTRICTED = 5;
16758        PROFILE_MANAGED = 6;
16759        SYSTEM_HEADLESS = 7;
16760        PROFILE_CLONE = 8;
16761        PROFILE_PRIVATE = 9;
16762    }
16763    optional UserType user_type = 5;
16764    // What are the flags attached to the target user
16765    optional int32 user_flags = 6;
16766    optional int32 error_code = 7;
16767    optional int64 elapsed_time = 8;
16768}
16769
16770/**
16771 * An event logged when a specific user lifecycle event is performed. These events should be
16772 * correlated with a UserLifecycleJourneyReported atom via the session_id.
16773 * Note: journeys can span over multiple events, hence some events may share a single session id.
16774 *
16775 * Logged from:
16776 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
16777 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
16778 */
16779message UserLifecycleEventOccurred {
16780    // An id which links back to user details (reported in the UserLifecycleJourneyReported atom)
16781    optional int64 session_id = 1;
16782    // The target user for this event (same as target_user in the UserLifecycleJourneyReported atom)
16783    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
16784    optional int32 user_id = 2;
16785
16786    enum Event {
16787        UNKNOWN = 0; // Indicates that the associated user journey timed-out or resulted in an error
16788        SWITCH_USER = 1; // Indicates that this is a user switch event
16789        START_USER = 2; // Indicates that this is a user start event
16790        CREATE_USER = 3; // Indicates that this is a user create event
16791        USER_RUNNING_LOCKED = 4; // Indicates that user is running in locked state
16792        UNLOCKING_USER = 5; // Indicates that this is a user unlocking event
16793        UNLOCKED_USER = 6; // Indicates that this is a user unlocked event
16794        STOP_USER = 7; // Indicates that this is a user stop event
16795        REMOVE_USER = 8; // Indicates that this is a user removal event
16796        GRANT_ADMIN = 9; // Indicates that this is an admin privileges grant event
16797        REVOKE_ADMIN = 10; // Indicates that this is an admin privileges revocation event
16798    }
16799    optional Event event = 3;
16800
16801    enum State {
16802        NONE = 0; // Indicates the associated event has no start/end defined
16803        BEGIN = 1;
16804        FINISH = 2;
16805        CANCEL = 3;
16806        ERROR = 4;
16807    }
16808    optional State state = 4; // Represents the state of an event (beginning/ending)
16809    optional int32 error_code = 5;
16810}
16811
16812/**
16813 * The UserInfo information about an Android user (as used in UserManager multiuser).
16814 *
16815 * Currently, we do not include information about user 0, since it is uninteresting.
16816 *
16817 * This will be pulled from
16818 *     frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
16819 */
16820message UserInfo {
16821    // The @UserIdInt userId of the user
16822    optional int32 user_id = 1;
16823
16824    // The type of user, if AOSP-defined, such as {@link UserManager#USER_TYPE_PROFILE_MANAGED}
16825    optional UserLifecycleJourneyReported.UserType user_type = 2;
16826
16827    // The type of user if not AOSP-defined. Will be empty if user_type is not TYPE_UNKNOWN.
16828    optional string user_type_custom = 3;
16829
16830    // The @UserInfoFlag UserInfo flags of user.
16831    optional int32 user_flags = 4;
16832
16833    // Wall-clock time in milliseconds when user was created, according to System.currentTimeMillis
16834    optional int64 creation_time_millis = 5;
16835
16836    // Wall-clock time in milliseconds when user last entered the state of STATE_RUNNING_UNLOCKED,
16837    // according to System.currentTimeMillis
16838    optional int64 last_logged_in_time_millis = 6;
16839
16840    // True if user is currently running and unlocked.
16841    // Note that this is NOT synonymous with being the 'current' user. Multiple users may be
16842    // running unlocked, with one in the foreground and others running in the background.
16843    optional bool is_user_running_unlocked = 7;
16844}
16845
16846
16847/**
16848 * The MultiUserInfo information about maximum supported users on the device.
16849 *
16850 * This will be pulled from
16851 *     frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
16852 */
16853message MultiUserInfo {
16854    // Maximum users supported on the device
16855    optional int32 max_supported_users = 1;
16856    // Whether multi user setting is on.
16857    optional bool multi_user_setting_on = 2;
16858    // Whether device supports multiuser and owner have no restriction in adding users.
16859    optional bool supports_adding_full_users = 3;
16860}
16861
16862/**
16863 * Logs when accessibility shortcut clicked.
16864 *
16865 * Logged from:
16866 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
16867 */
16868message AccessibilityShortcutReported {
16869    // The accessibility feature(including installed a11y service, framework a11y feature,
16870    // and installed a11y activity) package name that is assigned to the accessibility shortcut.
16871    optional string package_name = 1;
16872
16873    // The definition of the accessibility shortcut.
16874    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
16875    optional android.stats.accessibility.ShortcutType shortcut_type = 2;
16876
16877    // The definition of the service status.
16878    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
16879    optional android.stats.accessibility.ServiceStatus service_status = 3;
16880}
16881
16882/**
16883 * Logs when accessibility service status changed.
16884 *
16885 * Logged from:
16886 *   packages/apps/Settings/src/com/android/settings/accessibility
16887 */
16888message AccessibilityServiceReported {
16889    // The accessibility service package name.
16890    optional string package_name = 1;
16891
16892    // The definition of the service status.
16893    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
16894    optional android.stats.accessibility.ServiceStatus service_status = 2;
16895}
16896
16897/**
16898 * Pulls accessibility shortcuts status.
16899 *
16900 * Pulled from:
16901 *   StatsPullAtomService
16902 */
16903message AccessibilityShortcutStats {
16904    // The definition of the accessibility software shortcut.
16905    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
16906    optional android.stats.accessibility.ShortcutType software_shortcut_type = 1;
16907    // Number of accessibility services in accessibility software shortcut.
16908    optional int32 software_shortcut_service_num = 2;
16909
16910    // The definition of the accessibility hardware shortcut.
16911    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
16912    optional android.stats.accessibility.ShortcutType hardware_shortcut_type = 3;
16913    // Number of accessibility services in accessibility hardware shortcut.
16914    optional int32 hardware_shortcut_service_num = 4;
16915
16916    // The definition of the accessibility gesture shortcut.
16917    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
16918    optional android.stats.accessibility.ShortcutType gesture_shortcut_type = 5;
16919    // Number of accessibility services in accessibility gesture shortcut.
16920    optional int32 gesture_shortcut_service_num = 6;
16921
16922    // The definition of the accessibility quick settings shortcut.
16923    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
16924    optional android.stats.accessibility.ShortcutType qs_shortcut_type = 7;
16925    // Boolean indicating whether the user turns on qs shortcut for any
16926    // accessibility feature that support qs shortcut.
16927    optional bool use_qs_shortcut = 8;
16928}
16929
16930/**
16931 * Pulls accessibility floating menu status.
16932 *
16933 * Pulled from:
16934 *   StatsPullAtomService
16935 */
16936message AccessibilityFloatingMenuStats {
16937    // Size of the accessibility floating menu.
16938    optional int32 size = 1;
16939    // Icon shape of the accessibility floating menu.
16940    optional int32 icon_type = 2;
16941    // Whether the accessibility floating menu is enable auto fade ability.
16942    optional bool fade_enabled = 3;
16943    // Opacity of the accessibility floating menu. The range is between 0 and 1.
16944    optional float opacity = 4;
16945}
16946
16947/**
16948 * Logs when display wake up.
16949 *
16950 * Logged from:
16951 *   services/core/java/com/android/server/power/Notifier.java
16952 */
16953
16954message DisplayWakeReported {
16955    // Wake_up_reason code
16956    // If LOWORD(wake_up_reason) = 0
16957    //     reference to HIWORD(wake_up_reason) PowerManager.WAKE_REASON_XXX
16958    //     else reference wake_up_reason to
16959    //     services/core/java/com/android/server/power/Notifier.java#onWakeUp
16960    optional int32 wake_up_reason = 1;
16961    // UID that caused the display to wake
16962    optional int32 uid = 2 [(is_uid) = true];
16963}
16964
16965/**
16966 * Logs app usage events.
16967 *
16968 * Logged from:
16969 *  frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
16970 */
16971message AppUsageEventOccurred {
16972    optional int32 uid = 1 [(is_uid) = true];
16973    optional string package_name = 2;
16974    optional string class_name = 3;
16975
16976    // Usage event types please refer to below file:
16977    // frameworks/base/core/java/android/app/usage/UsageEvents.java
16978    enum EventType {
16979        NONE = 0;
16980        MOVE_TO_FOREGROUND       = 1;
16981        MOVE_TO_BACKGROUND       = 2;
16982        USER_INTERACTION         = 7;
16983        SHORTCUT_INVOCATION      = 8;
16984        CHOOSER_ACTION           = 9;
16985        STANDBY_BUCKET_CHANGED   = 11;
16986        FOREGROUND_SERVICE_START = 19;
16987        FOREGROUND_SERVICE_STOP  = 20;
16988    }
16989    optional EventType event_type = 4;
16990}
16991
16992/*
16993 * Quality metrics logged when EVS cameras are active.
16994 *
16995 * Logged from:
16996 *  packages/services/Car/evs/manager/1.1/Enumerator.cpp
16997 */
16998message EvsUsageStatsReported {
16999
17000    // Camera identifier to distinguish the source camera device.  This is not
17001    // globally unique and therefore cannot be used to identify the user and/or
17002    // the device.
17003    optional int32 device_id = 1;
17004
17005    // Peak number of clients during the service
17006    optional int32 peak_num_clients = 2;
17007
17008    // Number of erroneous events during the service
17009    optional int32 num_errors = 3;
17010
17011    // Round trip latency of the very first frame
17012    optional int64 first_latency_millis = 4;
17013
17014    // Average frame round trip latency
17015    optional float avg_latency_millis = 5;
17016
17017    // Peak frame round trip latency
17018    optional int64 peak_latency_millis = 6;
17019
17020    // Total number of frames received
17021    optional int64 total_frames = 7;
17022
17023    // Number of frames ignored
17024    optional int64 ignored_frames = 8;
17025
17026    // Number of dropped frames to synchronize camera devices
17027    optional int64 dropped_frames_to_sync = 9;
17028
17029    // The duration of the service
17030    optional int64 duration_millis = 10;
17031}
17032
17033/**
17034 * Logs audio power usage stats.
17035 *
17036 * Pushed from:
17037 *  frameworks/av/services/mediametrics/AudioPowerUsage.cpp
17038 */
17039message AudioPowerUsageDataReported {
17040    /**
17041     * Device used for input/output
17042     *
17043     * All audio devices please refer to below file:
17044     * system/media/audio/include/system/audio-base.h
17045     *
17046     * Define our own enum values because we don't report all audio devices.
17047     * Currently, we only report built-in audio devices such as handset, speaker,
17048     * built-in mics, common audio devices such as wired headset, usb headset
17049     * and bluetooth devices.
17050     */
17051    enum AudioDevice {
17052        OUTPUT_EARPIECE         = 0x1; // handset
17053        OUTPUT_SPEAKER          = 0x2; // dual speaker
17054        OUTPUT_WIRED_HEADSET    = 0x4; // 3.5mm headset
17055        OUTPUT_USB_HEADSET      = 0x8; // usb headset
17056        OUTPUT_BLUETOOTH_SCO    = 0x10; // bluetooth sco
17057        OUTPUT_BLUETOOTH_A2DP   = 0x20; // a2dp
17058        OUTPUT_SPEAKER_SAFE     = 0x40; // bottom speaker
17059        OUTPUT_BLUETOOTH_BLE    = 0x80; // ble
17060        OUTPUT_DOCK             = 0x100; // dock
17061        OUTPUT_HDMI             = 0x200; // hdmi
17062
17063        INPUT_DEVICE_BIT        = 0x40000000; // non-negative positive int32.
17064        INPUT_BUILTIN_MIC       = 0x40000001; // buildin mic
17065        INPUT_BUILTIN_BACK_MIC  = 0x40000002; // buildin back mic
17066        INPUT_WIRED_HEADSET_MIC = 0x40000004; // 3.5mm headset mic
17067        INPUT_USB_HEADSET_MIC   = 0x40000008; // usb headset mic
17068        INPUT_BLUETOOTH_SCO     = 0x40000010; // bluetooth sco mic
17069        INPUT_BLUETOOTH_BLE     = 0x40000020; // ble mic
17070    }
17071    optional AudioDevice audio_device = 1;
17072
17073    // Duration of the audio in seconds
17074    optional int32 duration_secs = 2;
17075
17076    // Average volume (0 ... 1.0)
17077    optional float average_volume = 3;
17078
17079    enum AudioType {
17080        UNKNOWN_TYPE = 0;
17081        VOICE_CALL_TYPE = 1; // voice call
17082        VOIP_CALL_TYPE = 2; // voip call, including uplink and downlink
17083        MEDIA_TYPE = 3; // music and system sound
17084        RINGTONE_NOTIFICATION_TYPE = 4; // ringtone and notification
17085        ALARM_TYPE = 5; // alarm type
17086        // record type
17087        CAMCORDER_TYPE = 6; // camcorder
17088        RECORD_TYPE = 7;  // other recording
17089    }
17090    optional AudioType type = 4;
17091
17092    // Minimum volume duration of the audio in seconds
17093    optional int32 minimum_volume_duration_secs = 5;
17094
17095    // Minimum volume (0 ... 1.0)
17096    optional float minimum_volume = 6;
17097
17098    // Maximum volume duration of the audio in seconds
17099    optional int32 maximum_volume_duration_secs = 7;
17100
17101    // Maximum volume (0 ... 1.0)
17102    optional float maximum_volume = 8;
17103}
17104
17105/**
17106 * Logs the Spatializer capability when the Spatializer is created.
17107 *
17108 * We expect this to occur only once on a healthy system,
17109 * when audioserver is initialized.
17110 *
17111 * On devices that do not support spatialization,
17112 * SpatializerLevel returns SPATIALIZER_LEVEL_NONE only.
17113 *
17114 * Logged from:
17115 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17116 */
17117message MediametricsSpatializerCapabilitiesReported {
17118    // Available head tracking modes
17119    repeated android.media.audio.HeadTrackingMode head_tracking_modes = 1;
17120
17121    // Available spatializer levels
17122    repeated android.media.audio.SpatializerLevel spatializer_levels = 2;
17123
17124    // Available spatializer modes
17125    repeated android.media.audio.SpatializerMode spatializer_modes = 3;
17126
17127    // Available channel masks, with each channel position bitwise ORed.
17128    // One or more bits from
17129    // system/media/audio/include/system/audio-hal-enums.h
17130    // audio_channel_mask_t, representing the channel configuration
17131    // of AudioTrack data.
17132    //
17133    // Generally the most populated channel_mask is selected for use.
17134    repeated int64 channel_masks = 4;
17135}
17136
17137/**
17138 * Logs when Spatializer is enabled or disabled for a device.
17139 *
17140 * The event field indicates the reason for enabling or disabling:
17141 * through the Settings UI, startup/boot, or new device detection.
17142 *
17143 * The presence of this message indicates that the audio device type
17144 * supports Spatialization; this is generally a fixed
17145 * property of the platform and depends if the device type is considered
17146 * BINAURAL or TRANSAURAL, and the Spatializer support for it.
17147 *
17148 * This logs existing saved state on BOOT and changes afterwards.
17149 * Due to rpc to the MediaMetrics service which generates the atom,
17150 * the timestamp of the atom may have a slight delay.
17151 *
17152 * Logged from:
17153 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17154 */
17155message MediametricsSpatializerDeviceEnabledReported {
17156    // Device type enumeration, e.g. BUILTIN_SPEAKER, BT_A2DP, etc.
17157    optional android.media.audio.AudioDeviceInfoType type = 1;
17158
17159    // The event field indicates the reason for enabling or disabling:
17160    // NORMAL: from Settings UI.
17161    // BOOT: on startup/boot.
17162    // FIRST: on new device detection.
17163    optional android.media.audio.SpatializerSettingEvent event = 2;
17164
17165    // Whether the spatializer is enabled on that device.
17166    // This triggers only on a change of state.
17167    // If multiple devices share the same type (e.g. bluetooth headsets),
17168    // they will register separate messages.
17169    optional bool enabled = 3;
17170}
17171
17172/**
17173 * Logs whether the HeadTracker is enabled for a device.
17174 *
17175 * This only changes if there is a HeadTracker associated with the device.
17176 *
17177 * This logs existing saved state on BOOT and changes afterwards.
17178 * Due to rpc to the MediaMetrics service which generates the atom,
17179 * the timestamp of the atom may have a slight delay.
17180 *
17181 * Logged from:
17182 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17183 */
17184message MediametricsHeadTrackerDeviceEnabledReported {
17185    // Device type enumeration, e.g. BUILTIN_SPEAKER, BT_A2DP, etc.
17186    optional android.media.audio.AudioDeviceInfoType type = 1;
17187
17188    // The event field indicates the reason for enabling or disabling:
17189    // NORMAL: from Settings UI.
17190    // BOOT: on startup/boot.
17191    // FIRST: on new device detection.
17192    optional android.media.audio.SpatializerSettingEvent event = 2;
17193
17194    // Whether the head tracker was enabled or disabled on that device.
17195    // This triggers only on a change of state.
17196    // If multiple devices share the same type (e.g. bluetooth headsets),
17197    // they will register separate messages.
17198    optional bool enabled = 3;
17199}
17200
17201/**
17202 * Logs whether the HeadTracker is supported for a device.
17203 *
17204 * Generally a fixed property of the device, but it is possible
17205 * that the HeadTracker sensor might be turned off
17206 * or be temporarily unavailable.
17207 *
17208 * This logs existing saved state on BOOT and changes afterwards.
17209 * Due to rpc to the MediaMetrics service which generates the atom,
17210 * the timestamp of the atom may have a slight delay.
17211 *
17212 * Logged from:
17213 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17214 */
17215message MediametricsHeadTrackerDeviceSupportedReported {
17216    // Device type enumeration, e.g. BUILTIN_SPEAKER, BT_A2DP, etc.
17217    optional android.media.audio.AudioDeviceInfoType type = 1;
17218
17219    // The event field indicates the reason for enabling or disabling:
17220    // NORMAL: on sensor change.
17221    // BOOT: on startup/boot.
17222    // FIRST: on new device detection.
17223    optional android.media.audio.SpatializerSettingEvent event = 2;
17224
17225    // Whether the head tracker is supported on that device.
17226    // This triggers only on a change of state.
17227    // If multiple devices share the same type (e.g. bluetooth headsets),
17228    // they will register separate messages.
17229    optional bool supported = 3;
17230}
17231
17232/**
17233  * Pulls bytes transferred over WiFi and mobile networks sliced by uid, is_metered, and tag.
17234  *
17235  * Pulled from:
17236  *   StatsPullAtomService, which uses NetworkStatsService to query NetworkStats.
17237  */
17238message BytesTransferByTagAndMetered {
17239    optional int32 uid = 1 [(is_uid) = true];
17240
17241    optional bool is_metered = 2;
17242
17243    optional int32 tag = 3;
17244
17245    optional int64 rx_bytes = 4;
17246
17247    optional int64 rx_packets = 5;
17248
17249    optional int64 tx_bytes = 6;
17250
17251    optional int64 tx_packets = 7;
17252
17253    // Radio Access Technology (RAT) type of this record, should be one of
17254    // TelephonyManager#NETWORK_TYPE_* constants, or
17255    // NetworkTemplate#NETWORK_TYPE_ALL to indicate the record is for all rat
17256    // types combined.
17257    optional int32 rat_type = 8;
17258}
17259
17260/**
17261 * Logs when the Assistant is invoked.
17262 *
17263 * Logged from:
17264 *   frameworks/base/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
17265 */
17266message AssistantInvocationReported {
17267
17268    // The event_id (as for UiEventReported).
17269    optional int32 event_id = 1;
17270
17271    // The registered Assistant's uid and package (as for UiEventReported).
17272    optional int32 uid = 2 [(is_uid) = true];
17273    optional string package_name = 3;
17274
17275    // An identifier used to disambiguate which logs refer to a particular invocation of the
17276    // Assistant  (as for UiEventReported).
17277    optional int32 instance_id = 4;
17278
17279    // The state of the device at the time of invocation.
17280    enum DeviceState {
17281        UNKNOWN_DEVICE_STATE = 0;
17282        AOD1 = 1;
17283        AOD2 = 2;
17284        BOUNCER = 3;
17285        UNLOCKED_LOCKSCREEN = 4;
17286        LAUNCHER_HOME = 5;
17287        LAUNCHER_OVERVIEW = 6;
17288        LAUNCHER_ALL_APPS = 7;
17289        APP_DEFAULT = 8;
17290        APP_IMMERSIVE = 9;
17291        APP_FULLSCREEN = 10;
17292    }
17293    optional DeviceState device_state = 5;
17294
17295    // Whether the Assistant handles were showing at the time of invocation.
17296    optional bool assistant_handles_showing = 6;
17297}
17298
17299/**
17300 * Logs when an AudioRecord finishes running on an audio device
17301 *
17302 * Logged from:
17303 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17304 */
17305message MediametricsAudioRecordDeviceUsageReported {
17306    // The devices connected to this AudioRecord.
17307    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
17308    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17309    // See audio_device_t in system/media/audio/include/system/audio-base.h
17310    optional string devices = 1;
17311
17312    // The name of the remote device attached to the device, typically available for USB or BT.
17313    // This may be empty for a fixed device, or separated by "|" if more than one.
17314    optional string device_names = 2;
17315
17316    // The amount of time spent in the device as measured by the active track in AudioFlinger.
17317    optional int64 device_time_nanos = 3;
17318
17319    // The audio data format used for encoding.
17320    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
17321    optional string encoding = 4;
17322
17323    // The client-server buffer framecount.
17324    // The framecount is generally between 960 - 48000 for PCM encoding.
17325    // The framecount represents raw buffer size in bytes for non-PCM encoding.
17326    optional int32 frame_count = 5;
17327
17328    // The number of audio intervals (contiguous, continuous playbacks).
17329    optional int32 interval_count = 6;
17330
17331    // The sample rate of the AudioRecord.
17332    // A number generally between 8000-96000 (frames per second).
17333    optional int32 sample_rate = 7;
17334
17335    // The audio input flags used to construct the AudioRecord.
17336    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
17337    optional string flags = 8;
17338
17339    // The santized package name of the audio client associated with the AudioRecord.
17340    // See getSanitizedPackageNameAndVersionCode() in
17341    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
17342    optional string package_name = 9;
17343
17344    // The selected device id (nonzero if a non-default device is selected)
17345    optional int32 selected_device_id = 10;
17346
17347    // The caller of the AudioRecord.
17348    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17349    optional string caller = 11;
17350
17351    // The audio source for AudioRecord.
17352    // An enumeration from system/media/audio/include/system/audio-base.h audio_source_t
17353    optional string source = 12;
17354
17355    // Android S
17356    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
17357    // An empty string means no session id is set.
17358    optional string log_session_id = 13;
17359}
17360
17361/**
17362 * Logs when an AudioThread finishes running on an audio device
17363 *
17364 * Logged from:
17365 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17366 */
17367message MediametricsAudioThreadDeviceUsageReported {
17368    // The devices connected to this audio thread.
17369    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
17370    // (for record threads):
17371    // See lookup<INPUT_DEVICE> in frameworks/av/services/mediametrics/AudioTypes.cpp
17372    // (for playback threads):
17373    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17374    // See audio_device_t in system/media/audio/include/system/audio-base.h
17375    optional string devices = 1;
17376
17377    // The name of the remote device attached to the device, typically available for USB or BT.
17378    // This may be empty for a fixed device, or separated by "|" if more than one.
17379    optional string device_names = 2;
17380
17381    // The amount of time spent in the device as measured by the active track in AudioFlinger.
17382    optional int64 device_time_nanos = 3;
17383
17384    // The audio data format used for encoding.
17385    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
17386    optional string encoding = 4;
17387
17388    // The framecount of the buffer delivered to (or from) the HAL.
17389    // The framecount is generally ~960 for PCM encoding.
17390    // The framecount represents raw buffer size in bytes for non-PCM encoding.
17391    optional int32 frame_count = 5;
17392
17393    // The number of audio intervals (contiguous, continuous playbacks).
17394    optional int32 interval_count = 6;
17395
17396    // The sample rate of the audio thread.
17397    // A number generally between 8000-96000 (frames per second).
17398    optional int32 sample_rate = 7;
17399
17400    // The audio flags used to construct the thread
17401    // (for record threads):
17402    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
17403    // (for playback threads):
17404    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
17405    optional string flags = 8;
17406
17407    // The number of underruns encountered for a playback thread or the
17408    // number of overruns encountered for a capture thread.
17409    optional int32 xruns = 9;
17410
17411    // The type of thread
17412    // A thread type enumeration from
17413    // frameworks/av/mediametrics/services/Translate.h
17414    optional string type = 10;
17415}
17416
17417/**
17418 * Logs when an AudioTrack finishes running on an audio device
17419 *
17420 * Logged from:
17421 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17422 */
17423message MediametricsAudioTrackDeviceUsageReported {
17424    // The output devices connected to this AudioTrack.
17425    // A string OR of various output device categories, e.g. "DEVICE1|DEVICE2".
17426    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17427    // See audio_device_t in system/media/audio/include/system/audio-base.h
17428    optional string devices = 1;
17429
17430    // The name of the remote device attached to the device, typically available for USB or BT.
17431    // This may be empty for a fixed device, or separated by "|" if more than one.
17432    optional string device_names = 2;
17433
17434    // The amount of time spent in the device as measured by the active track in AudioFlinger.
17435    optional int64 device_time_nanos = 3;
17436
17437    // The audio data format used for encoding.
17438    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
17439    optional string encoding = 4;
17440
17441    // The client-server buffer framecount.
17442    // The framecount is generally between 960 - 48000 for PCM encoding.
17443    // The framecount represents raw buffer size in bytes for non-PCM encoding.
17444    // A static track (see traits) may have a very large framecount.
17445    optional int32 frame_count = 5;
17446
17447    // The number of audio intervals (contiguous, continuous playbacks).
17448    optional int32 interval_count = 6;
17449
17450    // The sample rate of the AudioTrack.
17451    // A number generally between 8000-96000 (frames per second).
17452    optional int32 sample_rate = 7;
17453
17454    // The audio flags used to construct the AudioTrack.
17455    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
17456    optional string flags = 8;
17457
17458    // The number of underruns encountered.
17459    optional int32 xruns = 9;
17460
17461    // The santized package name of the audio client associated with the AudioTrack.
17462    // See getSanitizedPackageNameAndVersionCode() in
17463    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
17464    optional string package_name = 10;
17465
17466    // The latency of the last sample in the buffer in milliseconds.
17467    optional float device_latency_millis = 11;
17468
17469    // The startup time in milliseconds from start() to sample played.
17470    optional float device_startup_millis = 12;
17471
17472    // The average volume of the track on the device [ 0.f - 1.f ]
17473    optional float device_volume = 13;
17474
17475    // The selected device id (nonzero if a non-default device is selected)
17476    optional int32 selected_device_id = 14;
17477
17478    // The stream_type category for the AudioTrack.
17479    // An enumeration from system/media/audio/include/system/audio-base.h audio_stream_type_t
17480    optional string stream_type = 15;
17481
17482    // The usage for the AudioTrack.
17483    // An enumeration from system/media/audio/include/system/audio-base.h audio_usage_t
17484    optional string usage = 16;
17485
17486    // The content type of the AudioTrack.
17487    // An enumeration from system/media/audio/include/system/audio-base.h audio_content_type_t
17488    optional string content_type = 17;
17489
17490    // The caller of the AudioTrack.
17491    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17492    optional string caller = 18;
17493
17494    // The traits of the AudioTrack.
17495    // A string OR of different traits, may be empty string.
17496    // Only "static" is supported for R.
17497    // See lookup<TRACK_TRAITS>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17498    optional string traits = 19;
17499
17500    // Android S
17501    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
17502    // An empty string means no session id is set.
17503    optional string log_session_id = 20;
17504}
17505
17506/**
17507 * Logs the status of an audio device connection attempt.
17508 *
17509 * Logged from:
17510 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17511 */
17512message MediametricsAudioDeviceConnectionReported {
17513    // The input devices represented by this report.
17514    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
17515    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17516    // See audio_device_t in system/media/audio/include/system/audio-base.h
17517    optional string input_devices = 1;
17518
17519    // The output devices represented by this report.
17520    // A string OR of various output device categories.
17521    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
17522    // See audio_device_t in system/media/audio/include/system/audio-base.h
17523    optional string output_devices = 2;
17524
17525    // The name of the remote device attached to the device, typically available for USB or BT.
17526    // This may be empty for a fixed device, or separated by "|" if more than one.
17527    optional string device_names = 3;
17528
17529    // The result of the audio device connection.
17530    // 0 indicates success: connection verified.
17531    // 1 indicates unknown: connection not verified or not known if diverted properly.
17532    // Other values indicate specific status.
17533    // See DeviceConnectionResult in frameworks/av/services/mediametrics/AudioTypes.h
17534    optional int32 result = 4;
17535
17536    // Average milliseconds of time to connect
17537    optional float time_to_connect_millis = 5;
17538
17539    // Number of connections if aggregated statistics, otherwise 1.
17540    optional int32 connection_count = 6;
17541}
17542
17543/**
17544 * Logs the status of an AudioRecord operation.
17545 *
17546 * Logged from:
17547 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17548 */
17549message MediametricsAudioRecordStatusReported {
17550    // General status code for categorization of status.
17551    optional android.media.Status status = 1;
17552
17553    // Status or error message, e.g. logcat.
17554    optional string debug_message = 2;
17555
17556    // Supplemental status subcode for AudioRecord.
17557    optional int32 status_subcode = 3;
17558
17559    // Uid associated with the AudioRecord.
17560    optional int32 uid = 4 [(is_uid) = true];
17561
17562    // The AudioRecord event.
17563    optional android.media.audio.AudioRecordEvent event = 5;
17564
17565    // Requested AudioRecord flags, with each flag bitwise ORed.
17566    // One or more bits from system/media/audio/include/system/audio-hal-enums.h
17567    // audio_input_flags_t
17568    optional int32 input_flags = 6;
17569
17570    // An enumeration from system/media/audio/include/system/audio-hal-enums.h
17571    // audio_source_t, representing the input source for the AudioRecord.
17572    optional android.media.audio.Source source = 7;
17573
17574    // An enumeration from system/media/audio/include/system/audio-hal-enums.h
17575    // audio_format_t, representing the encoding of the AudioRecord data.
17576    optional android.media.audio.Encoding encoding = 8;
17577
17578    // Channel mask, with each channel position bitwise ORed.
17579    // One or more bits from system/media/audio/include/system/audio-hal-enums.h
17580    // audio_channel_mask_t, representing the input channel configuration
17581    // of AudioRecord data.
17582    optional int64 channel_mask = 9;
17583
17584    // The size of the AudioRecord buffer in frames.
17585    // If an error occurs during creation, this may be a small integer requested size
17586    // as AudioFlinger is entitled to increase this as required.
17587    optional int32 buffer_frame_count = 10;
17588
17589    // Sample rate in Hz.
17590    optional int32 sample_rate = 11;
17591}
17592
17593/**
17594 * Logs the status of an AudioTrack operation.
17595 *
17596 * Logged from:
17597 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
17598 */
17599message MediametricsAudioTrackStatusReported {
17600    // General status code for categorization of status.
17601    optional android.media.Status status = 1;
17602
17603    // Status or error message, e.g. logcat.
17604    optional string debug_message = 2;
17605
17606    // Supplemental status subcode for AudioTrack.
17607    optional int32 status_subcode = 3;
17608
17609    // Uid associated with track
17610    optional int32 uid = 4 [(is_uid) = true];
17611
17612    // The AudioTrack event.
17613    optional android.media.audio.AudioTrackEvent event = 5;
17614
17615    // Requested AudioTrack flags, with each flag bitwise ORed.
17616    // One or more bits from system/media/audio/include/system/audio-hal-enums.h
17617    // audio_output_flags_t
17618    optional int32 output_flags = 6;
17619
17620    // An enumeration from system/media/audio/include/system/audio-hal-enums.h
17621    // audio_content_type_t, representing the content type of the AudioTrack.
17622    optional android.media.audio.ContentType content_type = 7;
17623
17624    // An enumeration from system/media/audio/include/system/audio-hal-enums.h
17625    // audio_usage_t, representing the use case for the AudioTrack.
17626    optional android.media.audio.Usage usage = 8;
17627
17628    // An enumeration from system/media/audio/include/system/audio-hal-enums.h
17629    // audio_format_t, representing the encoding of the AudioTrack data.
17630    optional android.media.audio.Encoding encoding = 9;
17631
17632    // Channel mask, with each channel position bitwise ORed.
17633    // One or more bits from system/media/audio/include/system/audio-hal-enums.h
17634    // audio_channel_mask_t, representing the channel configuration of AudioTrack data.
17635    optional int64 channel_mask = 10;
17636
17637    // The size of the AudioTrack buffer in frames.
17638    // If an error occurs during creation, this may be a small integer requested size
17639    // as AudioFlinger is entitled to increase this as required.
17640    optional int32 buffer_frame_count = 11;
17641
17642    // Sample rate in Hz.
17643    optional int32 sample_rate = 12;
17644
17645    // Playback speed, nominal 1.f representing 1x.
17646    optional float speed = 13;
17647
17648    // Playback pitch, nominal 1.f representing 1x.
17649    optional float pitch = 14;
17650}
17651
17652/**
17653 * Logs: i) creation of different types of cryptographic keys in the keystore,
17654 * ii) operations performed using the keys,
17655 * iii) attestation of the keys
17656 * Logged from: system/security/keystore/key_event_log_handler.cpp
17657 */
17658message KeystoreKeyEventReported {
17659
17660    enum Algorithm {
17661        /** Asymmetric algorithms. */
17662        RSA = 1;
17663        // 2 removed, do not reuse.
17664        EC = 3;
17665        /** Block cipher algorithms */
17666        AES = 32;
17667        TRIPLE_DES = 33;
17668        /** MAC algorithms */
17669        HMAC = 128;
17670    };
17671    /** Algorithm associated with the key */
17672    optional Algorithm algorithm = 1;
17673
17674    /** Size of the key */
17675    optional int32 key_size = 2;
17676
17677    enum KeyOrigin {
17678        /** Generated in keymaster.  Should not exist outside the TEE. */
17679        GENERATED = 0;
17680        /** Derived inside keymaster.  Likely exists off-device. */
17681        DERIVED = 1;
17682        /** Imported into keymaster.  Existed as cleartext in Android. */
17683        IMPORTED = 2;
17684        /** Keymaster did not record origin. */
17685        UNKNOWN = 3;
17686        /** Securely imported into Keymaster. */
17687        SECURELY_IMPORTED = 4;
17688    };
17689    /* Logs whether the key was generated, imported, securely imported, or derived.*/
17690    optional KeyOrigin key_origin = 3;
17691
17692    enum HardwareAuthenticatorType {
17693        NONE = 0;
17694        PASSWORD = 1;
17695        FINGERPRINT = 2;
17696        // Additional entries must be powers of 2.
17697    };
17698    /**
17699     * What auth types does this key require? If none,
17700     * then no auth required.
17701     */
17702    optional HardwareAuthenticatorType user_auth_type = 4;
17703
17704    /**
17705     * If user authentication is required, is the requirement time based? If it
17706     * is not time based then this field will not be used and the key is per
17707     * operation. Per operation keys must be user authenticated on each usage.
17708     */
17709    optional int32 user_auth_key_timeout_secs = 5;
17710
17711    /**
17712     * padding mode, digest, block_mode and purpose should ideally be repeated
17713     * fields. However, since statsd does not support repeated fields in
17714     * pushed atoms, they are represented using bitmaps.
17715     */
17716
17717    /** Track which padding mode is being used.*/
17718    optional int32 padding_mode_bitmap = 6;
17719
17720    /** Track which digest is being used. */
17721    optional int32 digest_bitmap = 7;
17722
17723    /** Track what block mode is being used (for encryption). */
17724    optional int32 block_mode_bitmap = 8;
17725
17726    /** Track what purpose is this key serving. */
17727    optional int32 purpose_bitmap = 9;
17728
17729    enum EcCurve {
17730        P_224 = 0;
17731        P_256 = 1;
17732        P_384 = 2;
17733        P_521 = 3;
17734    };
17735    /** Which ec curve was selected if elliptic curve cryptography is in use **/
17736    optional EcCurve ec_curve = 10;
17737
17738    enum KeyBlobUsageRequirements {
17739        STANDALONE = 0;
17740        REQUIRES_FILE_SYSTEM = 1;
17741    };
17742    /** Standalone or is a file system required */
17743    optional KeyBlobUsageRequirements key_blob_usage_reqs = 11;
17744
17745    enum Type {
17746        key_operation = 0;
17747        key_creation = 1;
17748        key_attestation = 2;
17749    }
17750    /** Key creation event, operation event or attestation event? */
17751    optional Type type = 12;
17752
17753    /** Was the key creation, operation, or attestation successful? */
17754    optional bool was_successful = 13;
17755
17756    /** Response code or error code */
17757    optional int32 error_code = 14;
17758}
17759
17760/**
17761 * Logs: key creation events with Algorithm, Origin, Error and Attestation info.
17762 * Logged from: system/security/keystore2/metrics.rs
17763 */
17764message Keystore2KeyCreationWithGeneralInfo {
17765
17766    // Algorithm associated with the key
17767    optional android.system.security.keystore2.Algorithm algorithm = 1;
17768
17769    // Size of the key, based on the algorithm used.
17770    optional int32 key_size = 2;
17771
17772    enum EcCurve {
17773        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
17774        EC_CURVE_UNSPECIFIED = 0;
17775        P_224 = 1;
17776        P_256 = 2;
17777        P_384 = 3;
17778        P_521 = 4;
17779        CURVE_25519 = 5;
17780    };
17781    // Which ec curve was selected if elliptic curve cryptography is in use
17782    optional EcCurve ec_curve = 3;
17783
17784    enum KeyOrigin {
17785        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
17786        ORIGIN_UNSPECIFIED = 0;
17787        // Generated in keymaster.  Should not exist outside the TEE.
17788        GENERATED = 1;
17789        // Derived inside keymaster.  Likely exists off-device.
17790        DERIVED = 2;
17791        // Imported into keymaster.  Existed as cleartext in Android.
17792        IMPORTED = 3;
17793        // Previously used for another purpose that is now obsolete.
17794        RESERVED = 4;
17795        // Securely imported into Keymaster.
17796        SECURELY_IMPORTED = 5;
17797    };
17798    // Logs whether the key was generated, imported, securely imported, or derived.
17799    optional KeyOrigin key_origin = 4;
17800
17801    /**
17802     * Response code (system/hardware/interfaces/keystore2/aidl/../ResponseCode.aidl)
17803     * or
17804     * error code (hardware/interfaces/security/keymint/aidl/../ErrorCode.aidl)
17805     */
17806    optional int32 error_code = 5;
17807
17808    // Indicates whether key attestation is requested in creation
17809    optional bool attestation_requested = 6;
17810
17811    // Count of a particular combination of field values of this atom
17812    optional int32 count = 7;
17813}
17814
17815/**
17816 * Logs: key creation events with authentication info.
17817 * Logged from: system/security/keystore2/metrics.rs
17818 */
17819message Keystore2KeyCreationWithAuthInfo {
17820
17821    enum HardwareAuthenticatorType {
17822        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
17823        AUTH_TYPE_UNSPECIFIED = 0;
17824        NONE = 1;
17825        PASSWORD = 2;
17826        FINGERPRINT = 3;
17827        ANY = 5;
17828    };
17829    /**
17830     * What auth types does this key require? If none,
17831     * then no auth required.
17832     */
17833    optional HardwareAuthenticatorType user_auth_type = 1;
17834
17835    /**
17836     * If user authentication is required, is the requirement time based? If it
17837     * is time based then this field indicates the base 10 logarithm of time out in seconds.
17838     * Logarithm is taken in order to reduce the cardinaltiy.
17839     */
17840    optional int32 log_auth_timeout_seconds = 2;
17841
17842    // Security level of the Keymint instance which creates the key.
17843    optional android.system.security.keystore2.SecurityLevelEnum security_level = 3;
17844
17845    // Count of a particular combination of field values of this atom
17846    optional int32 count = 4;
17847}
17848
17849/**
17850 * Logs: key creation events with purpose and modes info.
17851 * Logged from: system/security/keystore2/metrics.rs
17852 */
17853message Keystore2KeyCreationWithPurposeAndModesInfo {
17854    // Algorithm associated with the key
17855    optional android.system.security.keystore2.Algorithm algorithm = 1;
17856
17857	/**
17858     * Track which purpose is being used.
17859     * Bitmap composition is given by KeyPurposeBitPosition enum
17860     * defined in system/security/keystore2/metrics.rs.
17861     */
17862    optional int32 purpose_bitmap = 2;
17863
17864    /**
17865     * Track which padding mode is being used.
17866     * Bitmap composition is given by PaddingModeBitPosition enum
17867     * defined in system/security/keystore2/metrics.rs.
17868     */
17869    optional int32 padding_mode_bitmap = 3;
17870
17871    /**
17872     * Track which digest is being used.
17873     * Bitmap composition is given by DigestBitPosition enum
17874     * defined in system/security/keystore2/metrics.rs.
17875     */
17876    optional int32 digest_bitmap = 4;
17877
17878    /**
17879     * Track which block mode is being used.
17880     * Bitmap composition is given by BlockModeBitPosition enum
17881     * defined in system/security/keystore2/metrics.rs.
17882     */
17883    optional int32 block_mode_bitmap = 5;
17884
17885    // Count of a particular combination of field values of this atom
17886    optional int32 count = 6;
17887}
17888
17889/**
17890 * Logs the atom id of the atoms associated with key creation/operation events, that have reached
17891 * the maximum storage limit allocated for different atom objects of that atom,
17892 * in keystore in-memory store.
17893 *
17894 * Size of the storage bucket for each atom is limited considering their expected cardinaltity.
17895 * This limit may exceed if the dimensions of the atoms take a large number of unexpected
17896 * combinations. This atom is used to track such cases.
17897 */
17898message Keystore2AtomWithOverflow {
17899
17900    // Atom id as defined in atoms.proto
17901    optional int32 atom_id = 1;
17902
17903    // Count of the objects of this atom type that have overflowed.
17904    optional int32 count = 2;
17905}
17906
17907/**
17908 * Logs: key operations events with purpose and modes info.
17909 * Logged from: system/security/keystore2/metrics.rs
17910 */
17911message Keystore2KeyOperationWithPurposeAndModesInfo {
17912
17913    enum KeyPurpose {
17914        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
17915        KEY_PURPOSE_UNSPECIFIED = 0;
17916
17917        // Usable with RSA, 3DES and AES keys.
17918        ENCRYPT = 1;
17919
17920        // Usable with RSA, 3DES and AES keys.
17921        DECRYPT = 2;
17922
17923        // Usable with RSA, EC and HMAC keys.
17924        SIGN = 3;
17925
17926        // Usable with RSA, EC and HMAC keys.
17927        VERIFY = 4;
17928
17929        // 5 is reserved
17930        // Usable with RSA keys.
17931        WRAP_KEY = 6;
17932
17933        // Key Agreement, usable with EC keys.
17934        AGREE_KEY = 7;
17935
17936        // Usable as an attestation signing key.
17937        ATTEST_KEY = 8;
17938    }
17939    // Purpose of the key operation
17940    optional KeyPurpose purpose = 1;
17941
17942    /**
17943     * Track which padding mode is being used.
17944     * Bitmap composition is given by PaddingModeBitPosition enum
17945     * defined in system/security/keystore2/metrics.rs.
17946     */
17947    optional int32 padding_mode_bitmap = 2;
17948
17949    /**
17950     * Track which digest is being used.
17951     * Bitmap composition is given by DigestBitPosition enum
17952     * defined in system/security/keystore2/metrics.rs.
17953     */
17954    optional int32 digest_bitmap = 3;
17955
17956    /**
17957     * Track which block mode is being used.
17958     * Bitmap composition is given by BlockModeBitPosition enum
17959     * defined in system/security/keystore2/metrics.rs.
17960     */
17961    optional int32 block_mode_bitmap = 4;
17962
17963    // Count of a particular combination of field values of this atom
17964    optional int32 count = 5;
17965}
17966
17967/**
17968 * Logs key operations events with outcome, error_code, security level and whether the key is
17969 * upgraded during the operation.
17970 * Logged from: system/security/keystore2/metrics.rs
17971 */
17972message Keystore2KeyOperationWithGeneralInfo {
17973
17974    enum Outcome {
17975        OUTCOME_UNSPECIFIED = 0;
17976        DROPPED = 1;
17977        SUCCESS = 2;
17978        ABORT = 3;
17979        PRUNED = 4;
17980        ERROR = 5;
17981    }
17982    // Outcome of the operation
17983    optional Outcome outcome = 1;
17984
17985    // Response code or error code in case of error outcome
17986    optional int32 error_code = 2;
17987
17988    // Indicates whether the key was upgraded during the operation
17989    optional bool key_upgraded = 3;
17990
17991    // Security level of the Keymint instance which performs the operation.
17992    optional android.system.security.keystore2.SecurityLevelEnum security_level = 4;
17993
17994    // Count of a particular combination of field values of this atom
17995    optional int32 count = 5;
17996}
17997
17998/**
17999 * Logs: Keystore 2 storage statistics.
18000 * Logged from: system/security/keystore2
18001 */
18002message Keystore2StorageStats {
18003    enum Storage {
18004       STORAGE_UNSPECIFIED = 0;
18005       KEY_ENTRY = 1;
18006       KEY_ENTRY_ID_INDEX = 2;
18007       KEY_ENTRY_DOMAIN_NAMESPACE_INDEX = 3;
18008       BLOB_ENTRY = 4;
18009       BLOB_ENTRY_KEY_ENTRY_ID_INDEX = 5;
18010       KEY_PARAMETER = 6;
18011       KEY_PARAMETER_KEY_ENTRY_ID_INDEX = 7;
18012       KEY_METADATA = 8;
18013       KEY_METADATA_KEY_ENTRY_ID_INDEX = 9;
18014       GRANT = 10;
18015       AUTH_TOKEN = 11;
18016       BLOB_METADATA = 12;
18017       BLOB_METADATA_BLOB_ENTRY_ID_INDEX =13;
18018       METADATA = 14;
18019       DATABASE = 15;
18020       LEGACY_STORAGE = 16;
18021    }
18022    // Type of the storage (database table or legacy storage) of which the size is reported.
18023    optional Storage storage_type = 1;
18024    // Storage size in bytes
18025    optional int64 size = 2;
18026    // Unused space, in bytes. The total storage size may be larger, indicating
18027    // inefficiencies in the packing of data in the database.
18028    optional int64 unused_size = 3;
18029}
18030
18031/**
18032 * Logs Remote Key Provisioning (RKP) related error events.
18033 * Logged from: system/security/keystore2
18034 */
18035message RkpErrorStats {
18036
18037    enum RkpError {
18038        RKP_ERROR_UNSPECIFIED = 0;
18039        // The key pool is out of keys.
18040        OUT_OF_KEYS = 1;
18041        // Falling back to factory provisioned keys during hybrid mode.
18042        FALL_BACK_DURING_HYBRID = 2;
18043    }
18044    // Type of the error event
18045    optional RkpError rkp_error = 1;
18046
18047    // Count of a particular error occurred.
18048    optional int32 count = 2;
18049
18050    /**
18051     * Security level of the IRemotelyProvisionedComponent.
18052     */
18053    optional android.system.security.keystore2.SecurityLevelEnum security_level = 3;
18054}
18055
18056
18057/**
18058 * Deprecated in U. Use RkpdPoolStats instead.
18059 *
18060 * Logs: Status of the attestation key pool related to
18061 * Remote Key Provisioning (RKP).
18062 * Logged from: system/security/keystore2
18063 */
18064message RkpPoolStats {
18065    /**
18066     * Security level of the Keymint instance associated with the
18067     * attestation pool status.
18068     */
18069    optional android.system.security.keystore2.SecurityLevelEnum security_level = 1;
18070
18071    /**
18072     * The number of signed attestation certificate chains which are
18073     * expired.
18074     */
18075    optional int32 expiring = 2;
18076
18077    /**
18078     * The number of signed attestation certificate chains which have
18079     * not yet been assigned to an app.
18080     */
18081    optional int32 unassigned = 3;
18082
18083    /**
18084     * The number of signed attestation keys.
18085     */
18086    optional int32 attested = 4;
18087
18088    /**
18089     * The total number of attestation keys.
18090     */
18091    optional int32 total = 5;
18092}
18093
18094/**
18095 * Logs: Number of keystore2 crashes per-boot cycle.
18096 * Logged from: system/security/keystore2
18097 */
18098message Keystore2CrashStats {
18099    optional int32 count_of_crash_events = 1;
18100}
18101
18102// Blob Committer stats
18103// Keep in sync between:
18104//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
18105//     frameworks/base/cmds/statsd/src/atoms.proto
18106message BlobCommitterProto {
18107    // Committer app's uid
18108    optional int32 uid = 1 [(is_uid) = true];
18109
18110    // Unix epoch timestamp of the commit in milliseconds
18111    optional int64 commit_timestamp_millis = 2;
18112
18113    // Flags of what access types the committer has set for the Blob
18114    optional int32 access_mode = 3;
18115
18116    // Number of packages that have been whitelisted for ACCESS_TYPE_WHITELIST
18117    optional int32 num_whitelisted_package = 4;
18118}
18119
18120// Blob Leasee stats
18121// Keep in sync between:
18122//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
18123//     frameworks/base/cmds/statsd/src/atoms.proto
18124message BlobLeaseeProto {
18125    // Leasee app's uid
18126    optional int32 uid = 1 [(is_uid) = true];
18127
18128    // Unix epoch timestamp for lease expiration in milliseconds
18129    optional int64 lease_expiry_timestamp_millis = 2;
18130}
18131
18132// List of Blob Committers
18133// Keep in sync between:
18134//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
18135//     frameworks/base/cmds/statsd/src/atoms.proto
18136message BlobCommitterListProto {
18137    repeated BlobCommitterProto committer = 1;
18138}
18139
18140// List of Blob Leasees
18141// Keep in sync between:
18142//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
18143//     frameworks/base/cmds/statsd/src/atoms.proto
18144message BlobLeaseeListProto {
18145    repeated BlobLeaseeProto leasee = 1;
18146}
18147
18148/**
18149 * Logs the current state of a Blob committed with BlobStoreManager
18150 *
18151 * Pulled from:
18152 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
18153 */
18154message BlobInfo {
18155    // Id of the Blob
18156    optional int64 blob_id = 1;
18157
18158    // Size of the Blob data
18159    optional int64 size = 2;
18160
18161    // Unix epoch timestamp of the Blob's expiration in milliseconds
18162    optional int64 expiry_timestamp_millis = 3;
18163
18164    // List of committers of this Blob
18165    optional BlobCommitterListProto committers = 4 [(log_mode) = MODE_BYTES];
18166
18167    // List of leasees of this Blob
18168    optional BlobLeaseeListProto leasees = 5 [(log_mode) = MODE_BYTES];
18169}
18170
18171/**
18172 * Logs when the HDMI CEC active source changes.
18173 *
18174 * Logged from:
18175 *   frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
18176 */
18177message HdmiCecActiveSourceChanged {
18178    // The logical address of the active source.
18179    optional android.stats.hdmi.LogicalAddress active_source_logical_address = 1;
18180
18181    // The physical address of the active source. Consists of four hexadecimal nibbles.
18182    // Examples: 0x1234, 0x0000 (root device). 0xFFFF represents an unknown or invalid address.
18183    // See section 8.7 in the HDMI 1.4b spec for details.
18184    optional int32 active_source_physical_address = 2;
18185
18186    // The relationship between this device and the active source.
18187    optional android.stats.hdmi.PathRelationship local_relationship = 3;
18188}
18189
18190/**
18191 * Logs when an HDMI CEC message is sent or received.
18192 *
18193 * Logged from:
18194 *   frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
18195 */
18196message HdmiCecMessageReported {
18197    // The calling uid of the application that caused this atom to be written.
18198    optional int32 uid = 1 [(is_uid) = true];
18199
18200    // Whether a HDMI CEC message is sent from this device, to this device, or neither.
18201    optional android.stats.hdmi.MessageDirection direction = 2;
18202
18203    // The HDMI CEC logical address of the initiator.
18204    optional android.stats.hdmi.LogicalAddress initiator_logical_address = 3;
18205
18206    // The HDMI CEC logical address of the destination.
18207    optional android.stats.hdmi.LogicalAddress destination_logical_address = 4;
18208
18209    // The opcode of the message. Ranges from 0x00 to 0xFF.
18210    // For all values, see section "CEC 15 Message Descriptions" in the HDMI CEC 1.4b spec.
18211    optional int32 opcode = 5;
18212
18213    // The result of attempting to send the message on its final retransmission attempt.
18214    // Only applicable to outgoing messages; set to SEND_MESSAGE_RESULT_UNKNOWN otherwise.
18215    optional android.stats.hdmi.SendMessageResult send_message_result = 6;
18216
18217    // Fields specific to <User Control Pressed> messages
18218
18219    // The user control command that was received.
18220    optional android.stats.hdmi.UserControlPressedCommand user_control_pressed_command = 7;
18221
18222    // Fields specific to <Feature Abort> messages
18223
18224    // The opcode of the message that was feature aborted.
18225    // Set to 0x100 when unknown or not applicable.
18226    optional int32 feature_abort_opcode = 8;
18227
18228    // The reason for the feature abort.
18229    optional android.stats.hdmi.FeatureAbortReason feature_abort_reason = 9;
18230}
18231
18232/**
18233 * Logs when an auto rotate event occurs while smart auto rotate is enabled.
18234 */
18235message AutoRotateReported {
18236    enum Orientation {
18237        UNKNOWN = 0;
18238        DEPRECATED = 1;
18239        ROTATION_0 = 2;
18240        ROTATION_90 = 3;
18241        ROTATION_180 = 4;
18242        ROTATION_270 = 5;
18243        DISABLED = 6;
18244        UNAVAILABLE = 7;
18245        FAILURE = 8;
18246    }
18247
18248    // Orientation of the device when a rotation was detected.
18249    optional Orientation current_orientation = 1;
18250    // The orientation of the phone after rotation before going through the recommendation service.
18251    optional Orientation proposed_orientation = 2;
18252    // Orientation recommended by the smart autorotate service component outside of the platform. It
18253    // may or may not match the proposed_orientation. Can be disabled or unavailable if the
18254    // recommendation service is disabled or unavailable. Will be unknown if the service failed.
18255    optional Orientation recommended_orientation = 3;
18256    // Time taken to calculate the rotation recommendation.
18257    optional int64 recommendation_process_duration_millis = 4;
18258}
18259
18260/**
18261 * Logs when sensors only autorotate is triggered. Associated event can be a rotation preindication,
18262 * actual event or a "data ready to be pulled" indication. More info: go/autorotate-logging.
18263 *
18264 * Logged from:
18265 *    platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
18266 */
18267
18268message DeviceRotated {
18269  // Timestamp of the event in millis. We log the timestamp explicitly since
18270  // data logging will follow the event logging and all these
18271  // will be joined with other logs such as rotation button clicked.
18272  optional int64 timestamp_millis = 1;
18273  // Device orientation
18274  optional android.stats.wm.Orientation proposed_orientation = 2;
18275
18276  enum RotationEventType{
18277    UNKNOWN = 0;
18278    // An early indication of device might be rotated.
18279    PREINDICATION = 1;
18280    // Device rotation is detected.
18281    ACTUAL_EVENT = 2;
18282    // Device rotated and the data associated with it is ready to be pulled.
18283    // This happens after the ACTUAL_EVENT since some data after the event is
18284    // also useful.
18285    DATA_READY = 3;
18286  }
18287  optional RotationEventType rotation_event_type = 3;
18288}
18289
18290/**
18291 * Records the raw sensor data published by the device orientation debug sensor. The pull will be
18292 * configured to be conditioned on the {@code DeviceRotated} atom.
18293 *
18294 * Logged from:
18295 *     platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
18296 */
18297message DeviceRotatedData {
18298  // All the sensor data and timestamps used to calculate the orientation
18299  optional DeviceRotatedSensorData snapshot = 1 [(log_mode) = MODE_BYTES];
18300  // Resulting orientation
18301  optional android.stats.wm.Orientation proposed_orientation = 2;
18302}
18303
18304message DeviceRotatedSensorData {
18305  optional DeviceRotatedSensorHeader header = 1 [(log_mode) = MODE_BYTES];
18306  repeated DeviceRotatedSensorSample sample = 2 [(log_mode) = MODE_BYTES];
18307}
18308
18309message DeviceRotatedSensorHeader {
18310  optional int64 timestamp_base_millis = 1;
18311}
18312
18313message DeviceRotatedSensorSample{
18314  optional int32 timestamp_offset_millis = 1;
18315  enum SensorType {
18316    UNKNOWN = 0;
18317    ACCEL = 1;
18318    GYRO = 2;
18319  }
18320  optional SensorType sensor_type = 2;
18321  optional float x_value = 3;
18322  optional float y_value = 4;
18323  optional float z_value = 5;
18324}
18325
18326/**
18327  * Pushes TLS handshake counters from Conscrypt.
18328  * Pulled from:
18329  *   external/conscrypt/common/src/main/java/org/conscrypt/ConscryptEngineSocket.java
18330  *   external/conscrypt/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java
18331  */
18332message TlsHandshakeReported {
18333    optional bool success = 1;
18334
18335    optional android.stats.tls.Protocol protocol = 2;
18336
18337    optional android.stats.tls.CipherSuite cipher_suite = 3;
18338
18339    optional int32 handshake_duration_millis = 4;
18340
18341    optional android.stats.tls.Source source = 5;
18342
18343    repeated int32 uid = 6 [(is_uid) = true];
18344}
18345
18346/**
18347 * Logs when a TextClassifier API is invoked.
18348 *
18349 * See frameworks/base/core/java/android/view/textclassifier/TextClassifier.java
18350 * Logged from: external/libtextclassifier/java/
18351 */
18352message TextClassifierApiUsageReported {
18353    enum ApiType {
18354        UNKNOWN_API = 0;
18355        SUGGEST_SELECTION = 1;
18356        CLASSIFY_TEXT = 2;
18357        GENERATE_LINKS = 3;
18358        DETECT_LANGUAGES = 4;
18359        SUGGEST_CONVERSATION_ACTIONS = 5;
18360    }
18361    optional ApiType api_type = 1;
18362
18363    enum ResultType {
18364        UNKNOWN_RESULT = 0;
18365        SUCCESS = 1;
18366        FAIL = 2;
18367    }
18368    optional ResultType result_type = 2;
18369    optional int64 latency_millis = 3;
18370    optional string session_id = 4;
18371}
18372
18373/**
18374 * Logs when TextClassifier Model Downloader finishes a download task.
18375 *
18376 * Currently we create a downlaod task for each new manifest to download.
18377 *
18378 * Logged from: external/libtextclassifier/java/
18379 */
18380message TextClassifierDownloadReported {
18381    // The model type to download
18382    enum ModelType {
18383        UNKNOWN_MODEL_TYPE = 0;
18384        ANNOTATOR = 1;
18385        LANG_ID = 2;
18386        ACTIONS_SUGGESTIONS = 3;
18387    }
18388    optional ModelType model_type = 1;
18389    // The file type to download
18390    enum FileType {
18391        UNKNOWN_FILE_TYPE = 0;
18392        MANIFEST = 1;
18393        MODEL = 2;
18394    }
18395    // Deprecated: now manifest and model files are downloaded together.
18396    optional FileType file_type = 2;
18397    // The status of the download
18398    enum DownloadStatus {
18399        UNKNOWN_STATUS = 0;
18400        SCHEDULED = 1;
18401        SUCCEEDED = 2;
18402        FAILED_AND_RETRY = 3;
18403        FAILED_AND_ABORT = 4;
18404    }
18405    optional DownloadStatus download_status = 3;
18406    // The public GStatic url we used to download the model. Contains locale info.
18407    optional string url_suffix = 4;
18408    // Failure reason, only set if this is for a failure status
18409    enum FailureReason {
18410        reserved 1, 8, 9;
18411
18412        UNKNOWN_FAILURE_REASON = 0;
18413        FAILED_TO_DOWNLOAD_SERVICE_CONN_BROKEN = 2;
18414        FAILED_TO_DOWNLOAD_404_ERROR = 3;
18415        FAILED_TO_DOWNLOAD_OTHER = 4;
18416        DOWNLOADED_FILE_MISSING = 5;
18417        FAILED_TO_PARSE_MANIFEST = 6;
18418        FAILED_TO_VALIDATE_MODEL = 7;
18419    }
18420    optional FailureReason failure_reason = 5;
18421    // How many attempts we have tried for the same task at a terminal status (i.e. SUCCEEDED or
18422    // FAILED_AND_ABORT).
18423    optional int32 run_attempt_count = 6;
18424
18425    // Custom failure code for downloader lib internal failures (E.g. 404 error).
18426    optional int32 downloader_lib_failure_code = 7;
18427
18428    // Time elapsed for the whole download task
18429    optional int64 download_duration_millis = 8;
18430
18431    // The id of the WorkManager work that launched this download.
18432    optional int64 work_id = 9;
18433}
18434
18435/**
18436 * Logs when TextClassifier Model Downloader schedules a WorkManager work.
18437 *
18438 * Logged from: external/libtextclassifier/java/
18439 */
18440message TextClassifierDownloadWorkScheduled {
18441    optional int64 work_id = 1;
18442
18443    enum ReasonToSchedule {
18444        UNKNOWN_REASON_TO_SCHEDULE = 0;
18445        TCS_STARTED = 1;
18446        LOCALE_SETTINGS_CHANGED = 2;
18447        DEVICE_CONFIG_UPDATED = 3;
18448    }
18449    optional ReasonToSchedule reason_to_schedule = 2;
18450
18451    optional bool failed_to_schedule = 3;
18452}
18453
18454/**
18455 * Logs when TextClassifier Model Downloader finishes a WorkManager work.
18456 *
18457 * A WorkManager work includes one or more downlad tasks. We log this atom when
18458 * all tasks finished. The work_id can be used to join work log and task logs.
18459 *
18460 * Logged from: external/libtextclassifier/java/
18461 */
18462message TextClassifierDownloadWorkCompleted {
18463    optional int64 work_id = 1;
18464
18465    enum WorkResult {
18466        UNKNOWN_WORK_RESULT = 0;
18467        SUCCESS_MODEL_DOWNLOADED = 1;
18468        SUCCESS_NO_UPDATE_AVAILABLE = 2;
18469        FAILURE_MODEL_DOWNLOADER_DISABLED = 3;
18470        FAILURE_MAX_RUN_ATTEMPT_REACHED = 4;
18471        RETRY_MODEL_DOWNLOAD_FAILED = 5;
18472        RETRY_RUNTIME_EXCEPTION = 6;
18473        RETRY_STOPPED_BY_OS = 7;
18474    }
18475    optional WorkResult work_result = 2;
18476
18477    // How many attempts we have tried for this work.
18478    optional int32 run_attempt_count = 3;
18479
18480    optional int64 work_scheduled_to_started_duration_millis = 4;
18481    optional int64 work_started_to_ended_duration_millis = 5;
18482}
18483
18484/**
18485 * Logs telemetry for Android Virtualization framework
18486 *
18487 * On CreateVM requests, an atom is pushed that records what hypervisor is being used.
18488 * the protected status of the new VM, and if the VM creation succeeded
18489 * Logged from: packages/modules/Virtualization/
18490 */
18491message VmCreationRequested {
18492    enum Hypervisor {
18493        UNKNOWN = 0;
18494        PKVM = 1;
18495        OTHER = 2;
18496    }
18497
18498    enum ConfigType {
18499        UNKNOWN_CONFIG = 0;
18500        VIRTUAL_MACHINE_APP_CONFIG = 1;
18501        VIRTUAL_MACHINE_RAW_CONFIG = 2;
18502    }
18503
18504    optional Hypervisor hypervisor = 1;
18505    // Is the VM started in protected mode?
18506    optional bool is_protected = 2;
18507    // Did the VM creation succeed
18508    optional bool creation_succeeded = 3;
18509    // Binder exception Code thrown by createVm request
18510    optional int32 binder_exception_code = 4;
18511
18512    optional int32 uid = 5 [(is_uid) = true];
18513    optional string vm_identifier = 6;
18514
18515    optional ConfigType config_type = 7;
18516    optional int32 num_cpus = 8;
18517    optional string cpu_affinity = 9 [deprecated = true];
18518    optional int32 memory_mib = 10;
18519    optional string apexes = 11;
18520
18521    // TODO(seungjaeyoo) Fill information about task_profile
18522    // TODO(seungjaeyoo) Fill information about disk_image for raw config
18523
18524}
18525
18526/**
18527 * Logs telemetry for Android Virtualization framework
18528 *
18529 * When VM is booted successfully, an atom is pushed that records information about VM.
18530 * Logged from: packages/modules/Virtualization/
18531 */
18532message VmBooted {
18533    optional int32 uid = 1 [(is_uid) = true];
18534    optional string vm_identifier = 2;
18535    // Elapsed time between start and boot completion of a VM
18536    optional int64 elapsed_time_millis = 3;
18537}
18538
18539/**
18540 * Logs telemetry for Android Virtualization framework
18541 *
18542 * When VM is exited, an atom is pushed that records information about VM.
18543 * Logged from: packages/modules/Virtualization/
18544 */
18545message VmExited {
18546    enum DeathReason {
18547        UNKNOWN = 0;
18548        INFRASTRUCTURE_ERROR = 1;
18549        KILLED = 2;
18550        SHUTDOWN = 3;
18551        ERROR = 4;
18552        REBOOT = 5;
18553        CRASH = 6;
18554        PVM_FIRMWARE_PUBLIC_KEY_MISMATCH = 7;
18555        PVM_FIRMWARE_INSTANCE_IMAGE_CHANGED = 8;
18556        BOOTLOADER_PUBLIC_KEY_MISMATCH = 9;
18557        BOOTLOADER_INSTANCE_IMAGE_CHANGED = 10;
18558        MICRODROID_FAILED_TO_CONNECT_TO_VIRTUALIZATION_SERVICE = 11;
18559        MICRODROID_PAYLOAD_HAS_CHANGED = 12;
18560        MICRODROID_PAYLOAD_VERIFICATION_FAILED = 13;
18561        MICRODROID_INVALID_PAYLOAD_CONFIG = 14;
18562        MICRODROID_UNKNOWN_RUNTIME_ERROR = 15;
18563        HANGUP = 16;
18564    }
18565    optional int32 uid = 1 [(is_uid) = true];
18566    optional string vm_identifier = 2;
18567
18568    optional DeathReason death_reason = 3;
18569    // Exit signal when VM was KILLED
18570    optional int32 exit_signal = 8;
18571
18572    // Elapsed time between start and termination of a VM
18573    optional int64 elapsed_time_millis = 4;
18574
18575    // Guest time for CPU usage
18576    optional int64 guest_time_millis = 5;
18577
18578    // RSS for memory usage
18579    optional int64 rss_vm_kb = 6;
18580    optional int64 rss_crosvm_kb = 7;
18581}
18582
18583/**
18584 * (Deprecated)
18585 * Logs telemetry for Android Virtualization framework
18586 *
18587 * For every second while VM is running, an atom is pushed that records CPU time information of VM.
18588 * Logged from: packages/modules/Virtualization/
18589 */
18590message VmCpuStatusReported {
18591    option deprecated = true;
18592
18593    optional int32 uid = 1 [(is_uid) = true];
18594    optional string vm_identifier = 2;
18595
18596    optional int64 cpu_time_user_millis = 3;
18597    optional int64 cpu_time_nice_millis = 4;
18598    optional int64 cpu_time_sys_millis = 5;
18599    optional int64 cpu_time_idle_millis = 6;
18600}
18601
18602/**
18603 * (Deprecated)
18604 * Logs telemetry for Android Virtualization framework
18605 *
18606 * For every second while VM is running, an atom is pushed that records memory information of VM.
18607 * Logged from: packages/modules/Virtualization/
18608 */
18609message VmMemStatusReported {
18610    option deprecated = true;
18611
18612    optional int32 uid = 1 [(is_uid) = true];
18613    optional string vm_identifier = 2;
18614
18615    optional int64 mem_total_kb = 3;
18616    optional int64 mem_free_kb = 4;
18617    optional int64 mem_available_kb = 5;
18618    optional int64 mem_buffer_kb = 6;
18619    optional int64 mem_cached_kb = 7;
18620}
18621
18622/**
18623 * Logs telemetry for Early boot CompOsArtifacts checks (done by odsign)
18624 *
18625 * odsign is a binary that runs during early boot. One of its responsibility is
18626 * to check if the device can use compOS and check if so, validate the compos
18627 * generated artifacts. An atom is pushed on each such check. Note: We only
18628 * push an atom from devices/configurations that can use compOs.
18629 */
18630message EarlyBootCompOsArtifactsCheckReported {
18631  // Are the current Artifacts okay (This check is done by odrefresh).
18632  // (current_artifacts_ok == true) => compilationRequired is false
18633  optional bool current_artifacts_ok = 1;
18634  // Has CompOs generated any Artifacts
18635  optional bool comp_os_pending_artifacts_exists = 2;
18636  // The device will be using CompOs generated artifacts. Note: the value of
18637  // this is meaningless if current_artifacts_ok = true
18638  optional bool use_comp_os_generated_artifacts = 3;
18639}
18640
18641/**
18642 * Logs telemetry when Isolation compilation job is scheduled.
18643 *
18644 * The atoms are sent by IsolatedCompilationService (fragment of system_server)
18645 * when apex are staged and need compilation.
18646 */
18647message IsolatedCompilationScheduled {
18648    enum Result {
18649        SCHEDULING_RESULT_UNKNOWN = 0;
18650        SCHEDULING_FAILURE = 1;
18651        SCHEDULING_SUCCESS = 2;
18652    }
18653    optional Result scheduling_result = 1;
18654}
18655
18656/**
18657 * Logs telemetry Isolation compilation completion.
18658 *
18659 * The atoms is sent by IsolatedCompilationService by compilation ends
18660 * and contain results/timings of compilation
18661 */
18662message IsolatedCompilationEnded {
18663    enum Result {
18664        RESULT_UNKNOWN = 0;
18665        RESULT_SUCCESS = 1;
18666        RESULT_UNKNOWN_FAILURE = 2;
18667        RESULT_FAILED_TO_START = 3;
18668        RESULT_JOB_CANCELED = 4;
18669        RESULT_COMPILATION_FAILED = 5;
18670        RESULT_UNEXPECTED_COMPILATION_RESULT = 6;
18671        RESULT_COMPOSD_DIED = 7;
18672        RESULT_FAILED_TO_ENABLE_FSVERITY = 8;
18673    }
18674    // Time between compilation job starts to when it ends.
18675    // Note: this does not include the time between compilation job being scheduled (or when apex is staged)
18676    // and it actually starting
18677    optional int64 compilation_time_millis = 1;
18678    // Result of compilation
18679    optional Result compilation_result = 2;
18680    // In case the job scheduler cancels the job, this will be the reason code
18681    // Codes are used from https://source.corp.google.com/android/frameworks/base/apex/jobscheduler/framework/java/android/app/job/JobParameters.java
18682    // Note: this field only makes sense when compilation_result = RESULT_JOB_CANCELED
18683    optional int32 compilation_job_stop_reason = 3;
18684}
18685
18686/**
18687 * Logs the current state of an application/process before it is killed.
18688 *
18689 * Keep in sync with proto file at
18690 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18691 *
18692 * Pushed from:
18693 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18694 */
18695message CarWatchdogKillStatsReported {
18696    // Linux process uid for the package.
18697    optional int32 uid = 1 [(is_uid) = true];
18698
18699    // State of the uid when it was killed.
18700    enum UidState {
18701        UNKNOWN_UID_STATE = 0;
18702        BACKGROUND_MODE = 1;
18703        FOREGROUND_MODE = 2;
18704    }
18705    optional UidState uid_state = 2;
18706
18707    // System state indicating whether the system was in normal mode or garage mode.
18708    enum SystemState {
18709        UNKNOWN_SYSTEM_STATE = 0;
18710        USER_INTERACTION_MODE = 1;
18711        USER_NO_INTERACTION_MODE = 2;
18712        GARAGE_MODE = 3;
18713    }
18714    optional SystemState system_state = 3;
18715
18716    // Reason for killing the application.
18717    // Keep in sync with proto file at packages/services/Car/cpp/watchdog/proto
18718    enum KillReason {
18719        UNKNOWN_KILL_REASON = 0;
18720        KILLED_ON_ANR = 1;
18721        KILLED_ON_IO_OVERUSE = 2;
18722        KILLED_ON_MEMORY_OVERUSE = 3;
18723    }
18724    optional KillReason kill_reason = 4;
18725
18726    // Stats of the processes owned by the application when the application was killed.
18727    // The process stack traces are not collected when the application was killed due to IO_OVERUSE.
18728    optional CarWatchdogProcessStats process_stats = 5 [(log_mode) = MODE_BYTES];
18729
18730    // The application's I/O overuse stats logged only when the kill reason is KILLED_ON_IO_OVERUSE.
18731    optional CarWatchdogIoOveruseStats io_overuse_stats = 6 [(log_mode) = MODE_BYTES];
18732}
18733
18734/**
18735 * Logs the I/O overuse stats for an application on detecting I/O overuse.
18736 *
18737 * Keep in sync with proto file at
18738 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18739 *
18740 * Pushed from:
18741 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18742 */
18743message CarWatchdogIoOveruseStatsReported {
18744    // Linux process uid for the package.
18745    optional int32 uid = 1 [(is_uid) = true];
18746
18747    // The application's I/O overuse stats.
18748    optional CarWatchdogIoOveruseStats io_overuse_stats = 2 [(log_mode) = MODE_BYTES];
18749}
18750
18751/**
18752 * Logs I/O overuse stats for a package.
18753 *
18754 * Keep in sync with proto file at
18755 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18756 *
18757 * Logged from:
18758 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18759 */
18760message CarWatchdogIoOveruseStats {
18761    enum Period {
18762        UNKNOWN_PERIOD = 0;
18763        DAILY = 1;
18764        WEEKLY = 2;
18765    }
18766
18767    // Threshold and usage stats period.
18768    optional Period period = 1;
18769
18770    // Threshold in-terms of write bytes defined for the package.
18771    optional CarWatchdogPerStateBytes threshold = 2;
18772
18773    // Number of write bytes in each state for the specified period.
18774    optional CarWatchdogPerStateBytes written_bytes = 3;
18775
18776    // Application or service uptime during the aforementioned period.
18777    optional uint64 uptime_millis = 4;
18778};
18779
18780/**
18781 * Logs bytes attributed to each application and system states.
18782 *
18783 * Keep in sync with proto file at
18784 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18785 *
18786 * Logged from:
18787 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18788 */
18789message CarWatchdogPerStateBytes {
18790    // Number of bytes attributed to the application foreground.
18791    optional int64 foreground_bytes = 1;
18792
18793    // Number of bytes attributed to the application background.
18794    optional int64 background_bytes = 2;
18795
18796    // Number of bytes attributed to the garage mode.
18797    optional int64 garage_mode_bytes = 3;
18798}
18799
18800/**
18801 * Logs each CarWatchdogProcessStat in CarWatchdogProcessStats.
18802 *
18803 * Keep in sync with proto file at
18804 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18805 *
18806 * Logged from:
18807 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18808 */
18809message CarWatchdogProcessStats {
18810    // Records the stats of the processes owned by an application.
18811    repeated CarWatchdogProcessStat process_stat = 1;
18812}
18813
18814/**
18815 * Logs a process's stats.
18816 *
18817 * Keep in sync with proto file at
18818 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18819 *
18820 * Logged from:
18821 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18822 */
18823message CarWatchdogProcessStat {
18824    // Command name of the process.
18825    optional string process_name = 1;
18826
18827    // Process uptime.
18828    optional uint64 uptime_millis = 2;
18829
18830    // Number of major page faults caused by the process and its children.
18831    optional uint64 major_page_faults = 3;
18832
18833    // Peak virtual memory size in kb.
18834    optional uint64 vm_peak_kb = 4;
18835
18836    // Virtual memory size in kb.
18837    optional uint64 vm_size_kb = 5;
18838
18839    // Peak resident set size (high water mark) in kb.
18840    optional uint64 vm_hwm_kb = 6;
18841
18842    // Resident set size in kb.
18843    optional uint64 vm_rss_kb = 7;
18844}
18845
18846/**
18847 * Logs total I/O usage summary for all applications and services running in the system.
18848 *
18849 * Keep in sync with proto file at
18850 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18851 *
18852 * Pulled from:
18853 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18854 */
18855message CarWatchdogSystemIoUsageSummary {
18856    // I/O usage summary for the system.
18857    optional CarWatchdogIoUsageSummary io_usage_summary = 1 [(log_mode) = MODE_BYTES];
18858
18859    // Start time of the event in milliseconds since epoch.
18860    // Note: This field must be a top-level field as it is used to slice the metrics.
18861    optional int64 start_time_millis = 2;
18862}
18863
18864/**
18865 * Logs I/O usage summary for an UID.
18866 *
18867 * Keep in sync with proto file at
18868 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18869 *
18870 * Pulled from:
18871 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18872 */
18873message CarWatchdogUidIoUsageSummary {
18874    // UID of the application/service whose usage summary are recorded.
18875    optional int32 uid = 1 [(is_uid) = true];
18876
18877    // I/O usage summary for the UID.
18878    optional CarWatchdogIoUsageSummary io_usage_summary = 2 [(log_mode) = MODE_BYTES];
18879
18880    // Start time of the event in milliseconds since epoch.
18881    // Note: This field must be a top-level field as it is used to slice the metrics.
18882    optional int64 start_time_millis = 3;
18883}
18884
18885/**
18886 * Logs I/O usage summary for a time period.
18887 *
18888 * Keep in sync with proto file at
18889 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18890 *
18891 * Pulled from:
18892 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18893 */
18894message CarWatchdogIoUsageSummary {
18895    // Summary event time period.
18896    optional CarWatchdogEventTimePeriod event_time_period = 1;
18897
18898    // Daily I/O usage summary for the period. Logs summary entries only for days with I/O usage.
18899    // The entries are ordered beginning from the event_time_period.start_time_millis.
18900    repeated CarWatchdogDailyIoUsageSummary daily_io_usage_summary = 2;
18901}
18902
18903/**
18904 * Logs a car watchdog event's time period.
18905 *
18906 * Keep in sync with proto file at
18907 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18908 *
18909 * Pulled from:
18910 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18911 */
18912message CarWatchdogEventTimePeriod {
18913    enum Period {
18914        UNKNOWN_PERIOD = 0;
18915        WEEKLY = 1;
18916        BIWEEKLY = 2;
18917        MONTHLY = 3;
18918    }
18919
18920    // Deprecated field - Start time of the event in milliseconds since epoch.
18921    optional uint64 start_time_millis = 1 [deprecated = true];
18922
18923    // Period for the event.
18924    optional Period period = 2;
18925}
18926
18927/**
18928 * Logs daily I/O usage summary.
18929 *
18930 * Keep in sync with proto file at
18931 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
18932 *
18933 * Pulled from:
18934 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
18935 */
18936message CarWatchdogDailyIoUsageSummary {
18937    // Total bytes written to disk during a day.
18938    optional CarWatchdogPerStateBytes written_bytes = 1;
18939
18940    // Total uptime for the system or service or application during a day.
18941    optional uint64 uptime_millis = 2;
18942
18943    // Total disk I/O overuses during a day.
18944    optional int32 overuse_count = 3;
18945}
18946
18947/*
18948 * pushes Media playback information.
18949 * Logged from
18950 *  frameworks/base/services/core/java/com/android/server/media/metrics/
18951 *      MediaMetricsManagerService.java
18952 */
18953message MediametricsPlaybackReported {
18954    optional int32 uid = 1 [(is_uid) = true];
18955
18956    // Randomly generated log session ID. A Base64 encoded hex string representing a
18957    // 128-bit integer.
18958    optional string log_session_id = 2;
18959    // The total length of the media in milliseconds. 0 for live contents.
18960    optional int64 media_duration_millis = 3;
18961    // Network, device, or mixed.
18962    optional android.stats.mediametrics.StreamSourceType stream_source = 4;
18963    // Stream type. DASH, HLS, etc
18964    optional android.stats.mediametrics.StreamType stream_type = 5;
18965    // Live, VOD, others
18966    optional android.stats.mediametrics.PlaybackType playback_type = 6;
18967    // DRM type
18968    optional android.stats.mediametrics.DrmType drm_type = 7;
18969    // Main, AD, others
18970    optional android.stats.mediametrics.ContentType content_type = 8;
18971    // Player name. E.g. ExoPlayer
18972    optional string player_name = 9;
18973    // Player version. E.g. 1.10.3e
18974    optional string player_version = 10;
18975    // Player related experiment IDs
18976    optional Experiments experiment_ids = 11 [(log_mode) = MODE_BYTES];
18977    // Number of frames played. Dropped frames are not included.  -1 means unknown.
18978    optional int32 video_frames_played = 12;
18979    // Number of frames dropped. -1 means unknown.
18980    optional int32 video_frames_dropped = 13;
18981    // Number of audio underruns. -1 means unknown.
18982    optional int32 audio_underrun_count = 14;
18983    // Total number of bytes read from the network
18984    optional int64 network_bytes_read = 15;
18985    // Total number of bytes read from on-device sources
18986    optional int64 local_bytes_read = 16;
18987    // Total transfer spent reading from the network in ms.
18988    // For parallel requests, the overlapping time intervals are counted only once.
18989    optional int64 network_transfer_duration_millis = 17;
18990    // A session ID generated from DRM to distinguish different DRM sessions.
18991    optional string drm_session_id = 18;
18992}
18993
18994message MediaNetworkInfoChanged {
18995    // Randomly generated log session ID. A Base64 encoded hex string representing a
18996    // 128-bit integer.
18997    optional string log_session_id = 1;
18998    //  New network type
18999    optional android.stats.mediametrics.NetworkType type = 2;
19000    // When the network info change occurred relative to playback creation
19001    // time in milliseconds.
19002    // It is in absolute time (e.g. always ticks even if the playback is paused).
19003    optional int64 time_since_playback_created_millis = 3;
19004}
19005
19006message MediaPlaybackStateChanged {
19007    // Randomly generated log session ID. A Base64 encoded hex string representing a
19008    // 128-bit integer.
19009    optional string log_session_id = 1;
19010    //  New playback state
19011    optional android.stats.mediametrics.PlaybackState playback_state = 2;
19012    // When the state change occurred relative to playback creation time in
19013    // milliseconds.
19014    // It is in absolute time (e.g. always ticks even if the playback is paused).
19015    optional int64 time_since_playback_created_millis = 3;
19016}
19017
19018message MediaPlaybackErrorReported {
19019    // Randomly generated log session ID. A Base64 encoded hex string representing a
19020    // 128-bit integer.
19021    optional string log_session_id = 1;
19022    //  A shortened call stack of the error
19023    optional string exception_stack = 2;
19024    //  Error code
19025    optional android.stats.mediametrics.PlaybackErrorCode error_code = 3;
19026    //  Sub-code of error type specified by the error code.
19027    optional int32 sub_error_code = 4;
19028    // When the error occurred relative to playback creation time in millisecond.
19029    // It is in absolute time (e.g. always ticks even if the playback is paused).
19030    optional int64 time_since_playback_created_millis = 5;
19031}
19032
19033message MediaPlaybackTrackChanged {
19034    // Randomly generated log session ID. A Base64 encoded hex string representing a
19035    // 128-bit integer.
19036    optional string log_session_id = 1;
19037    //  The track is on or off after the change
19038    optional android.stats.mediametrics.TrackState state = 2;
19039    //  The reason of the track change
19040    optional android.stats.mediametrics.TrackChangeReason reason = 3;
19041    //  The MIME type of the container. E.g. video/mp4
19042    optional string container_mime_type = 4;
19043    //  The sample MIME type of the track. E.g. video/avc
19044    optional string sample_mime_type = 5;
19045
19046    //  Codec name
19047    optional string codec_name = 6;
19048    //  Bits per second. 0 means unknown.
19049    optional int32 bitrate = 7;
19050
19051   // When the track change occurred, relative to playback creation time in
19052   // millisecond.
19053   // It is in absolute time (e.g. always ticks even if the playback is paused).
19054   optional int64 time_since_playback_created_millis = 8;
19055
19056    //  Track type. Audio, Video, Text
19057    optional android.stats.mediametrics.TrackType type = 9;
19058    //  2-letter ISO 639-1 language code.
19059    optional string language = 10;
19060    //  IETF BCP 47 optional language region subtag based on a two-letter country code
19061    optional string language_region = 11;
19062    //  Number of channels
19063    optional int32 channel_count = 12;
19064    //  Samples per second
19065    optional int32 sample_rate = 13;
19066    //  The width of the video in pixels.
19067    optional int32 width = 14;
19068    //  The height of the video in pixels.
19069    optional int32 height = 15;
19070    //  Video frame rate in frames per second.
19071    optional float video_frame_rate = 16;
19072}
19073
19074message Experiments {
19075    // Experiment IDs sent by the player.
19076    repeated int64 experiments = 1;
19077}
19078
19079/**
19080 * Logs when a Wifi network scan happens.
19081 *
19082 * Logged from:
19083 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
19084 */
19085message WifiScanReported {
19086    enum Type {
19087        TYPE_UNKNOWN = 0;
19088
19089        // Single scan.
19090        TYPE_SINGLE = 1;
19091
19092        // Background scan (deprecated, should not happen).
19093        TYPE_BACKGROUND = 2;
19094    }
19095
19096    enum Result {
19097        RESULT_UNKNOWN = 0;
19098
19099        // Failed to start scan.
19100        RESULT_FAILED_TO_START = 1;
19101
19102        // The HAL reported a scan failure after the scan was started.
19103        RESULT_FAILED_TO_SCAN = 2;
19104
19105        // Scan succeeded.
19106        RESULT_SUCCESS = 3;
19107    }
19108
19109    enum Source {
19110        SOURCE_UNKNOWN = 0;
19111
19112        // No work source set - not possible to determine the origin.
19113        SOURCE_NO_WORK_SOURCE = 1;
19114
19115        // The Wifi stack.
19116        SOURCE_WIFI_STACK = 2;
19117
19118        // GMS on behalf of some other app.
19119        SOURCE_GMS = 3;
19120
19121        // Settings app.
19122        SOURCE_SETTINGS_APP = 4;
19123
19124        // Other app directly.
19125        SOURCE_OTHER_APP = 5;
19126    }
19127
19128    enum Importance {
19129        IMPORTANCE_UNKNOWN = 0;
19130
19131        // Foreground app. Corresponds to the value of
19132        // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND or less.
19133        IMPORTANCE_FOREGROUND = 1;
19134
19135        // Foreground service. Corresponds to the value of
19136        // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE
19137        IMPORTANCE_FOREGROUND_SERVICE = 2;
19138
19139        // Everything else.
19140        IMPORTANCE_BACKGROUND = 3;
19141    }
19142
19143    // Scan type
19144    optional Type type = 1;
19145
19146    // Outcome: success/failure
19147    optional Result result = 2;
19148
19149    // What initiated a scan.
19150    optional Source source = 3;
19151
19152    // Process importance of the initiator.
19153    // This is only available for non-system calls.
19154    optional Importance importance = 4;
19155
19156    // Time taken for the scan.
19157    optional int32 scan_duration_millis = 5;
19158
19159    // Count of found networks.
19160    optional int32 count_networks_found = 6;
19161}
19162
19163/**
19164 * Logs when a Wifi PNO (Preferred Network Offload) scan happens.
19165 *
19166 * Logged from:
19167 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
19168 */
19169message WifiPnoScanReported {
19170    enum State {
19171        UNKNOWN = 0;
19172
19173        // Scan started.
19174        STARTED = 1;
19175
19176        // Scan failed to start (e.g. bad request, unsupported by hardware, etc).
19177        FAILED_TO_START = 2;
19178
19179        // Scan completed and a network was found.
19180        // Note - due to implementation constraints, nothing is reported when a scan completes but
19181        // doesn't find any networks.
19182        FINISHED_NETWORKS_FOUND = 3;
19183
19184        // Scan failed.
19185        FAILED = 4;
19186    }
19187
19188    optional State state = 1;
19189}
19190
19191/**
19192 * Logs when an airplane mode session happens.
19193 *
19194 * Logged from:
19195 *   packages/modules/Wifi/service/java/com/android/server/wifi/WifiMetrics.java
19196 *   packages/modules/Bluetooth/service/java/com/android/server/bluetooth/BluetoothAirplaneModeListener.java
19197 */
19198message AirplaneModeSessionReported {
19199    enum PackageName {
19200        WIFI = 0;
19201        BLUETOOTH = 1;
19202    }
19203    // Module recording the airplane mode session
19204    optional PackageName package_name = 1;
19205    // State of the module before entering airplane mode
19206    // False - module off
19207    // True - module on
19208    optional bool previous_state = 2;
19209    // State of the module at the beginning of airplane mode
19210    optional bool entering_state = 3;
19211    // State of the module at the end of airplane mode
19212    optional bool exiting_state = 4;
19213    // Whether the user has activated the feature by
19214    // toggling the module in airplane mode
19215    optional bool feature_active = 5;
19216    // Whether the user toggled the module during current airplane mode
19217    optional bool user_toggled = 6;
19218    // Whether the user toggled the module within one minute
19219    optional bool user_toggled_within_minute = 7;
19220    // Whether media profile was connected before entering airplane mode
19221    // Only applicable to the Bluetooth module
19222    optional bool media_profile_connected = 8;
19223}
19224
19225/**
19226 * Logs when a package installation session happens.
19227 *
19228 * Logged from:
19229 *   frameworks/base/services/core/java/com/android/server/pm/InstallPackageHelper.java
19230 */
19231message PackageInstallationSessionReported {
19232    // Used to correlate with Play logging metrics
19233    optional int32 session_id = 1;
19234    // Only logged for failed installations
19235    optional string package_name = 2;
19236
19237    // UID of the app that is successfully installed
19238    optional int32 uid = 3 [(is_uid) = true];
19239    // Users that will have this package installed
19240    repeated int32 user_ids = 4;
19241    // User types for the users listed above
19242    repeated int32 user_types = 5;
19243    // Users that originally had this package installed if it already exists
19244    repeated int32 original_user_ids = 6;
19245    // User types for original users
19246    repeated int32 original_user_types = 7;
19247    // PackageManager.INSTALL_FAILED_* error codes
19248    optional int32 public_return_code = 8;
19249    // Internal error codes that indicate detailed installation failures
19250    optional int32 internal_error_code = 9;
19251    // Total size of the new APKs in the current session
19252    optional int64 apks_size_bytes = 10;
19253    // Version code of the app
19254    optional int64 version_code = 11;
19255
19256    // List of install steps defined in
19257    // frameworks/base/services/core/java/com/android/server/pm/PackageMetrics.java
19258    repeated int32 install_steps = 12;
19259    // Duration of each step in the installation; order must match install_steps
19260    repeated int64 step_duration_millis = 13;
19261    // Total duration can be greater than zero even if install failed
19262    optional int64 total_duration_millis = 14;
19263    // Installation flags including DONT_KILL
19264    optional int32 install_flags = 15;
19265    // UID of the package that initiates the installation
19266    optional int32 installer_package_uid = 16 [(is_uid) = true];
19267    // UID of the package that previously installed the app
19268    optional int32 original_installer_package_uid = 17 [(is_uid) = true];
19269    // {@see android.content.pm.DataLoaderType}
19270    optional int32 data_loader_type = 18;
19271    // {@see android.content.pm.UserActionRequirement}
19272    optional int32 user_action_required_type = 19;
19273
19274    // Install types might overlap, therefore using booleans for each type
19275    // A regular new app install has every field as false.
19276    optional bool is_instant = 20;
19277    optional bool is_replace = 21;
19278    optional bool is_system = 22;
19279    optional bool is_inherit = 23;
19280    optional bool is_installing_existing_as_user = 24;
19281    optional bool is_move_install = 25;
19282    // Whether this is a staged installation
19283    optional bool is_staged = 26;
19284}
19285
19286message PackageUninstallationReported {
19287    // UID of the package being uninstalled
19288    optional int32 uid = 1 [(is_uid) = true];
19289    // Users on which the package (or system app update) is uninstalled from
19290    // If uninstall for all users, list all the user ids
19291    repeated int32 user_ids = 2;
19292    // Types of the users listed above. Order must match above.
19293    repeated int32 user_types = 3;
19294    // Users that originally had this package (or system app update) installed
19295    repeated int32 original_user_ids = 4;
19296    repeated int32 original_user_types = 5;
19297    // Flags of uninstallation, including KEEP_DATA
19298    optional int32 uninstall_flags = 6;
19299    // PackageManager.DELETE_SUCCEEDED or PackageManager.DELETE_FAILED_*
19300    optional int32 return_code = 7;
19301    // Special uninstall types might overlap, therefore booleans
19302    // An uninstall of a non-system app on all users should have all fields false
19303    optional bool is_system = 8;
19304    // When this is true, user_ids != original_user_ids
19305    optional bool is_uninstall_for_users = 9;
19306}
19307
19308/**
19309 * Logs when the entitlement configuration of an IMS service is queried/updated.
19310 *
19311 * Logged from: ImsServiceEntitlement app
19312 */
19313message ImsServiceEntitlementUpdated {
19314    // The purpose of entitlement query/update
19315    enum Purpose {
19316        UNKNOWN_PURPOSE = 0;
19317
19318        // Initial service activation in foreground
19319        ACTIVATION = 1;
19320
19321        // Updating service configuration in foreground
19322        UPDATE = 2;
19323
19324        // Background polling for querying service entitlement
19325        POLLING = 3;
19326    }
19327
19328    // The IMS services
19329    enum ServiceType {
19330        UNKNOWN_SERVICE = 0;
19331        VOWIFI = 1;
19332        VOLTE = 2;
19333        SMSOIP = 3;
19334    }
19335
19336    // The result of activation
19337    enum AppResult {
19338        UNKNOWN_RESULT = 0;
19339        ENABLED = 1;
19340        DISABLED = 2;
19341        INCOMPATIBLE = 3;
19342        PROVISIONING = 4;
19343        SUCCESSFUL = 5;
19344        FAILED = 6;
19345        CANCELED = 7;
19346        TIMEOUT = 8;
19347        UNEXPECTED_RESULT = 9;
19348    }
19349
19350    // The Android carrier ID for the carrier providing the IMS service.
19351    // This may not be the actual carrier of the device, e.g. a MVNO
19352    // may use the IMS service of its MNO.
19353    optional int64 carrier_id = 1;
19354
19355    // The Android carrier ID of the actual carrier.
19356    // E.g. a MVNO may use its MNO's IMS service. In this case,
19357    // actual_carrier_id is the MVNO and carrier_id is the MNO.
19358    optional int64 actual_carrier_id = 2;
19359
19360    // The purpose of this query/update.
19361    optional Purpose purpose = 3;
19362
19363    // Which IMS service's entitlement status were queried/updated.
19364    optional ServiceType service_type = 4;
19365
19366    // Result of this query/update.
19367    optional AppResult app_result = 5;
19368
19369    // How long (in milliseconds) this query/update took.
19370    optional int64 duration_millis = 6;
19371}
19372
19373/**
19374 * Logged when a SIM-specific settings restore was attempted.
19375 *
19376 * Logged from:
19377 *    packages/providers/TelephonyProvider/src/com/android/providers/telephony/TelephonyProvider.java
19378 */
19379message SimSpecificSettingsRestored {
19380    optional android.telephony.SimSpecfifcSettingsRestoreResult result = 1;
19381
19382    // Indicates which restore flow was followed.
19383    optional android.telephony.SimSpecificSettingsRestoreCase restored_from_suw = 2;
19384
19385    // Indicates which criteria was used to match the inserted SIM to backed up
19386    // SIM. Only relevant when result is SUCCESS
19387    optional android.telephony.SimSpecificSettingsRestoreMatchingCriteria matching_criteria = 3;
19388}
19389
19390/**
19391 * The latency of Binder calls broken down by calling API and method name.
19392 * This is different from BinderCalls as it collects a histogram of the
19393 * latencies (to get more detailed data) not just the count, sum, and maximum.
19394 *
19395 * Logged from:
19396 * frameworks/base/core/java/com/android/internal/os/BinderLatencyObserver.java
19397 */
19398message BinderLatencyReported {
19399    message Dims {
19400        enum ProcessSource {
19401            UNKNOWN_PROCESS_SOURCE = 0;
19402            SYSTEM_SERVER = 1;
19403            TELEPHONY = 2;
19404            BLUETOOTH = 3;
19405            WIFI = 4;
19406        }
19407        enum ServiceClassName {
19408            UNKNOWN_CLASS = 0;
19409        }
19410        enum ServiceMethodName {
19411            UNKNOWN_METHOD = 0;
19412        }
19413
19414        // Required.
19415        optional ProcessSource process_source = 1;
19416
19417        // The class name of the API making the call to Binder. Enum value
19418        // is preferred as uses much less data to store.
19419        // This field does not contain PII.
19420        oneof service_class {
19421            ServiceClassName service_class_name_as_enum = 2;
19422            string service_class_name = 3;
19423        }
19424
19425        // Method name of the API call. It can also be a transaction code if we
19426        // cannot resolve it to a name. See Binder#getTransactionName. Enum value
19427        // is preferred as uses much less data to store.
19428        // This field does not contain PII.
19429        oneof service_method {
19430            ServiceMethodName service_method_name_as_enum = 4;
19431            string service_method_name = 5;
19432        }
19433    }
19434
19435    message ApiStats {
19436        // required.
19437        optional Dims dims = 1;
19438
19439        // Indicates the first bucket that had any data. Allows omitting any empty
19440        // buckets at the start of the bucket list and thus save on data size.
19441        optional int32 first_bucket_index = 2;
19442        // Stores the count of samples for each bucket. The number of buckets and
19443        // their sizes are controlled server side with a flag.
19444        repeated int32 buckets = 3;
19445    }
19446
19447    message RepeatedApiStats {
19448        repeated ApiStats api_stats = 1;
19449    }
19450
19451    // The binder latency data broken down by the dimensions specified above.
19452    // The message wrapper is used for the repeated field as top level repeated
19453    // fields are not allowed.
19454    // MODE_BYTES is used as nested messages are not allowed otherwise.
19455    // Required.
19456    optional RepeatedApiStats repeated_api_stats = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
19457
19458    // The fraction of samples that are recorded in the histogram.
19459    // Required.
19460    optional float sampling_rate = 2;
19461
19462    // Indicates how many shards the APIs are divided in - e.g. for 3 every
19463    // 3rd API will be included in the data for this shard.
19464    // Required.
19465    optional int32 sharding_modulo = 3;
19466
19467    // Params for histogram buckets.
19468    // The number of buckets the histogram should have.
19469    optional int32 bucket_count = 4;
19470
19471    // The size (upper bound) of the first bucket (used to avoid creating an
19472    // excessive amount of small buckets). E.g. for first_bucket_size of 5, the
19473    // first bucket will be [0, 5) and the second will be [5, 5 * scaleFactor).
19474    optional int32 first_bucket_size = 5;
19475
19476    // The rate in which each consecutive bucket increases (before rounding).
19477    // Implemented in: com.android.internal.os.BinderLatencyBuckets.
19478    optional float scale_factor = 6;
19479}
19480
19481/**
19482 * Log audio device types that are used for input/output.
19483 * Next Tag: 2
19484 */
19485message AudioDevice {
19486    // See audio_devices_t in system/media/audio/include/system/audio-hal-enums.h
19487    repeated int32 type = 1;
19488}
19489
19490/**
19491 * Track information about AAudio Stream
19492 * Logged from
19493 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
19494 */
19495message MediametricsAAudioStreamReported {
19496    // The implementation of aaudio.
19497    optional android.media.audio.CallerPath path = 1;
19498
19499    // The direction of the stream.
19500    optional android.media.audio.Direction direction = 2;
19501
19502    // The amount read or written in one shot by the Mixer or DSP.
19503    optional int32 frames_per_burst = 3;
19504    // The number of frames that the buffer is used.
19505    optional int32 buffer_size = 4;
19506    // The allocated number of frames for the buffer.
19507    optional int32 buffer_capacity = 5;
19508    // The channel count of the aaudio stream.
19509    optional int32 channel_count = 6;
19510    // Total frames transferred (written or read)
19511    optional int64 total_frames_transferred = 7;
19512
19513    // The performance mode requested by the applications.
19514    optional android.media.audio.PerformanceMode perf_mode_requested = 8;
19515    // The actual performance mode used by aaudio.
19516    optional android.media.audio.PerformanceMode perf_mode_actual = 9;
19517
19518    // The mode requested for sharing the device
19519    optional android.media.audio.SharingMode sharing = 10;
19520
19521    // Approximate number of glitches.
19522    // Underrun on output stream. Overrun on input stream.
19523    optional int32 xrun_count = 11;
19524    // Devices that are used by the aaudio stream.
19525    optional AudioDevice types = 12 [(log_mode) = MODE_BYTES];
19526
19527    // Format request by the applications
19528    optional int32 format_app = 13;
19529    // Format processed by the framework
19530    optional int32 format_device = 14;
19531
19532    // Android S metric log session id, a Base64Url encoded string representing a 128-bit integer.
19533    optional string log_session_id = 15;
19534
19535    // The sample rate of the aaudio stream.
19536    optional int32 sample_rate = 16;
19537
19538    // The content type of the aaudio stream.
19539    optional android.media.audio.ContentType content_type = 17;
19540
19541    // The mode of sharing the device requested by the client.
19542    optional android.media.audio.SharingMode sharing_requested = 18;
19543
19544    // Android U
19545    // The format used by the audio hardware.
19546    optional int32 format_hardware = 19;
19547
19548    // Android U
19549    // The channel count used by the audio hardware.
19550    optional int32 channel_count_hardware = 20;
19551
19552    // Android U
19553    // The sample rate used by the audio hardware.
19554    optional int32 sample_rate_hardware = 21;
19555
19556    // Android U
19557    // The UID of the client.
19558    optional int32 uid = 22 [(is_uid) = true];
19559
19560    // Android U
19561    // The sample rate used by the client.
19562    optional int32 sample_rate_client = 23;
19563}
19564
19565/**
19566 * Logs media transcoding session ended events.
19567 *
19568 * Logged from:
19569 *   frameworks/av/media/libmediatranscoding/TranscoderWrapper.cpp
19570 */
19571message MediaTranscodingSessionEnded {
19572
19573    enum Reason {
19574        UNKNOWN = 0;       // Unused.
19575        FINISHED = 1;      // Transcoding session finished successfully.
19576        ERROR = 2;         // Transcoding session returned error while running.
19577        PAUSED = 3;        // Transcoding session was paused, potentially failed.
19578        CANCELLED = 4;     // Transcoding session was cancelled.
19579        START_FAILED = 5;  // Transcoding session failed to start.
19580        RESUME_FAILED = 6; // Transcoding session failed to resume.
19581        CREATE_FAILED = 7; // Transcoder instance failed to crate.
19582        CONFIG_SRC_FAILED = 8;    // Configure source failed.
19583        CONFIG_DST_FAILED = 9;    // Configure destination failed.
19584        CONFIG_TRACK_FAILED = 10; // Configure track failed.
19585        OPEN_SRC_FD_FAILED = 11;  // Open source fd failed.
19586        OPEN_DST_FD_FAILED = 12;  // Open destination fd failed.
19587        NO_TRACKS = 13;  // No tracks in source file.
19588    }
19589
19590    // Reason for logging the atom.
19591    optional Reason reason = 1;
19592
19593    // UID of client connecting to media transcoding service.
19594    optional int32 calling_uid = 2 [(is_uid) = true];
19595
19596    // Transcode session status flag (media_status_t).
19597    optional int32 transcode_status = 3;
19598
19599    // Transcode speed as framerate, if status is success.
19600    optional int32 transcode_fps = 4;
19601
19602    // Source video dimensions.
19603    optional int32 src_width = 5;
19604    optional int32 src_height = 6;
19605
19606    // Source video codec information.
19607    optional string src_codec_type = 7;
19608    optional int32 src_profile = 8;
19609    optional int32 src_level = 9;
19610
19611    // Source video framerate.
19612    optional int32 src_fps = 10;
19613
19614    // Source video duration.
19615    optional int32 src_duration_millis = 11;
19616
19617    // Whether source video is HDR.
19618    optional bool src_is_hdr = 12;
19619
19620    // Destination video dimensions.
19621    optional int32 dst_width = 13;
19622    optional int32 dst_height = 14;
19623
19624    // Destination video codec information.
19625    optional string dst_codec_type = 15;
19626
19627    // Whether destination video is HDR.
19628    optional bool dst_is_hdr = 16;
19629}
19630
19631/** Logs information about an unattended reboot that took place. This is logged
19632 *  after the next boot, when the device is first unlocked.
19633 *
19634 * Logged from:
19635 *   packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
19636 */
19637message UnattendedRebootOccurred {
19638
19639    // Time between the reboot readiness state checks starting, and the device
19640    // becoming reboot-ready.
19641    optional int64 time_until_reboot_ready_millis= 1;
19642
19643    // Time taken for the device to be unlocked (i.e. for the keyguard to be
19644    // gone) after an unattended reboot took place.
19645    optional int64 time_until_first_unlock_millis = 2;
19646
19647    // Number of times the reboot was blocked by the device being interactive.
19648    optional int32 times_blocked_by_interactivity = 3;
19649
19650    // Number of times the reboot was blocked by a callback registered by a
19651    // subsystem or a privileged app.
19652    optional int32 times_blocked_by_subsystems = 4;
19653
19654    // Number of times the reboot was blocked by background app activity.
19655    optional int32 times_blocked_by_app_activity = 5;
19656
19657    // Time until next user interaction with the device.
19658    optional int64 time_until_next_interaction_ms = 6;
19659}
19660
19661
19662/**
19663 * Logs information about an app uid or registered system component that has
19664 * been blocking the device from being reboot-ready for a long time.
19665 *
19666 * Logged from:
19667 *   packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
19668 */
19669message LongRebootBlockingReported {
19670
19671    enum RebootBlockReason {
19672        SYSTEM_COMPONENT = 1;
19673        APP_UID = 2;
19674    }
19675
19676    // The reason why the reboot has been blocked. This is either a system
19677    // component that has registered a callback, or an app UID running in the
19678    // background.
19679    optional RebootBlockReason reboot_block_reason = 1;
19680
19681    // Only one of the following two fields should be set, depending on the
19682    // RebootBlockReason.
19683
19684    // The name supplied by a system component when it registered a callback
19685    // to block the reboot.
19686    optional string component_name = 2;
19687
19688    // The uid of an app that is running in the background.
19689    optional int32 uid = 3;
19690}
19691
19692/**
19693 * Logs the magnification activated mode and its duration of the usage
19694 * when the magnification is disabled.
19695 *
19696 * Logged from:
19697 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
19698 */
19699message MagnificationUsageReported {
19700    // The definition of the magnification mode.
19701    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
19702    optional android.stats.accessibility.MagnificationMode activated_mode = 1;
19703
19704    // The duration of this magnification mode activation in milliseconds
19705    optional int64 duration_millis = 2;
19706
19707    // The last magnification scale for the activation in percentage
19708    optional int64 scale_percentage = 3;
19709}
19710
19711/**
19712 * Logs the magnification activated mode when IME dialog shows on the screen.
19713 *
19714 * Logged from:
19715 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
19716 */
19717message MagnificationModeWithImeOnReported {
19718    // The definition of the magnification mode.
19719    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
19720    optional android.stats.accessibility.MagnificationMode activated_mode = 1;
19721}
19722
19723/**
19724 * Logs the duration for the magnification session which is activated by the triple tap and
19725 * hold gesture.
19726 *
19727 * Logged from:
19728 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
19729 */
19730message MagnificationTripleTapAndHoldActivatedSessionReported {
19731    // The duration of the triple tap and hold activated session in milliseconds
19732    optional int64 duration_millis = 1;
19733}
19734
19735/**
19736 * Logs the duration for the following typing focus activated session.
19737 *
19738 * Logged from:
19739 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
19740 */
19741message MagnificationFollowTypingFocusActivatedSessionReported {
19742    // The duration of the following typing focus activated session in milliseconds
19743    optional int64 duration_millis = 1;
19744}
19745
19746/*
19747 * Logged when hardware based user-configurable device state changes.
19748 *
19749 * Logged from:
19750 *     frameworks/base/services/core/java/com/android/server/devicestate/DeviceStateManagerService.java
19751 */
19752message DeviceStateChanged {
19753    optional int32 new_device_state = 1
19754            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
19755    optional bool boot_state = 2;
19756}
19757
19758/*
19759 * Logged when device folded state changes.
19760 *
19761 * Logged from:
19762 *     frameworks/base/packages/SystemUI/src/com/android/systemui/unfold/FoldStateLogger.kt
19763 */
19764message FoldStateDurationReported {
19765    enum State {
19766      UNKNOWN = 0;
19767      OPEN = 1;
19768      CLOSED = 2;
19769      HALF_OPEN = 3;
19770    }
19771
19772    optional State start_state = 1;
19773    optional State end_state = 2;
19774    optional int64 duration_millis = 3;
19775}
19776
19777/**
19778 * This metric is collected at the end of playback
19779 * as a pulled atom.
19780 *
19781 *   DrmHal::cleanup() {
19782 *     // ...
19783 *     reportFrameworkMetrics(reportPluginMetrics());
19784 *     // ...
19785 *   }
19786 * This proto should be kept in-sync with
19787 * frameworks/av/drm/libmediadrm/protos/metrics.proto.
19788 */
19789message DrmFrameworkMetrics {
19790
19791    // Attributes are associated with a recorded value. E.g. A counter may
19792    // represent a count of an operation returning a specific error code. The
19793    // error code will be an attribute.
19794    message Attributes {
19795        // Reserved for compatibility with logging proto.
19796        reserved 2 to 13;
19797
19798        // A general purpose error code where 0 means OK.
19799        optional int32 error_code = 1;
19800
19801        // Defined at ::android::hardware::drm::V1_0::KeyStatusType;
19802        optional uint32 key_status_type = 14;
19803
19804        // Defined at ::android::hardware::drm::V1_0::EventType;
19805        optional uint32 event_type = 15;
19806    }
19807
19808    // The Counter message is used to store a count value with an associated
19809    // Attribute.
19810    message Counter {
19811        optional uint64 count = 1;
19812        // Represents the attributes associated with this counter instance.
19813        optional Attributes attributes = 2;
19814    }
19815
19816    // The DistributionMetric is meant to capture the moments of a normally
19817    // distributed (or approximately normal) value.
19818    message DistributionMetric {
19819        optional float min = 1;
19820        optional float max = 2;
19821        optional float mean = 3;
19822        optional double variance = 4;
19823        optional uint64 operation_count = 5;
19824
19825        // Represents the attributes associated with this distribution metric
19826        // instance.
19827        optional Attributes attributes = 6;
19828    }
19829
19830    message SessionLifetime {
19831        // Start time of the session in milliseconds since epoch.
19832        optional uint64 start_time_millis = 1;
19833        // End time of the session in milliseconds since epoch.
19834        optional uint64 end_time_millis = 2;
19835    }
19836
19837    // The count of open session operations. Each instance has a specific error
19838    // code associated with it.
19839    repeated Counter open_session_counter = 1;
19840
19841    // The count of close session operations. Each instance has a specific error
19842    // code associated with it.
19843    repeated Counter close_session_counter = 2;
19844
19845    // Count and execution time of getKeyRequest calls.
19846    repeated DistributionMetric get_key_request_time_us = 3;
19847
19848    // Count and execution time of provideKeyResponse calls.
19849    repeated DistributionMetric provide_key_response_time_us = 4;
19850
19851    // Count of getProvisionRequest calls.
19852    repeated Counter get_provisioning_request_counter = 5;
19853
19854    // Count of provideProvisionResponse calls.
19855    repeated Counter provide_provisioning_response_counter = 6;
19856
19857    // Count of key status events broken out by status type.
19858    repeated Counter key_status_change_counter = 7;
19859
19860    // Count of events broken out by event type
19861    repeated Counter event_callback_counter = 8;
19862
19863    // Count getPropertyByteArray calls to retrieve the device unique id.
19864    repeated Counter get_device_unique_id_counter = 9;
19865
19866    message SessionLifetimeEntry {
19867        optional string session_id = 1;
19868        optional SessionLifetime session_lifetime = 2;
19869    }
19870    // Session ids to lifetime (start and end time) map.
19871    // Session ids are strings of hex-encoded byte arrays.
19872    // This field is equivalent to the map<string, SessionLifetime>
19873    // field in frameworks/av/drm/libmediadrm/protos/metrics.proto.
19874    repeated SessionLifetimeEntry session_lifetimes = 10;
19875}
19876
19877/**
19878 * The metric is collected at the end of playback
19879 * as a pulled atom MediaDrmActivityInfo.
19880 *
19881 * The framework_metrics is defined in
19882 * frameworks/av/drm/libmediadrm/protos/metrics.proto.
19883 *
19884 * The format of vendor_metrics is  MediaDrm plugin dependent.
19885 *
19886 *   DrmHal::cleanup() {
19887 *     // ...
19888 *     reportFrameworkMetrics(reportPluginMetrics());
19889 *     // ...
19890 *   }
19891 *
19892 * This pulled atom is then collected in
19893 * frameworks/av/services/mediametrics/MediaMetricsService.cpp.
19894 */
19895message MediaDrmActivityInfo {
19896    optional string package_name = 1;
19897    optional int64 package_version_code = 2;
19898
19899    // vendor+description tell about which DRM plugin is in use on this device
19900    optional string vendor = 3;
19901    optional string description = 4;
19902
19903    optional DrmFrameworkMetrics framework_metrics = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
19904    optional bytes vendor_metrics = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
19905}
19906
19907/*
19908 * A canonical form time zone suggestion for metrics use.
19909 */
19910message MetricsTimeZoneSuggestion {
19911    enum Type {
19912        UNKNOWN = 0;
19913        CERTAIN = 1;
19914        UNCERTAIN = 2;
19915    }
19916    optional Type type = 1;
19917
19918    // The ordinals for time zone(s) in the suggestion. Always empty for
19919    // UNCERTAIN, and can be empty for CERTAIN, for example when the device is in
19920    // a disputed area / on an ocean.
19921    //
19922    // The suggestion's time zone IDs (which relate to location) are obfuscated by
19923    // mapping them to an ordinal. When the ordinal is assigned consistently across
19924    // several objects (i.e. so the same time zone ID is always mapped to the same
19925    // ordinal), this allows comparisons between those objects. For example, we can
19926    // answer "did these two suggestions agree?", "does the suggestion match the
19927    // device's current time zone?", without leaking knowledge of location. Ordinals
19928    // are also significantly more compact than full IANA TZDB IDs, albeit unstable
19929    // and of limited use.
19930    repeated int32 time_zone_ordinals = 2;
19931
19932    // The actual time zone ID(s) in the suggestion. Similar to time_zone_ordinals
19933    // but contains the actual string IDs.
19934    //
19935    // This information is only captured / reported for some devices based on the
19936    // value of a server side flag, i.e. it could be enabled for internal testers.
19937    // Therefore the list can be empty even when time_zone_ordinals is populated.
19938    //
19939    // When enabled, see time_zone_ordinals for the expected number of values.
19940    repeated string time_zone_ids = 3;
19941}
19942
19943/*
19944 * Logs a snapshot of time zone detector state.
19945 *
19946 * Logged from:
19947 * frameworks/base/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
19948 */
19949message TimeZoneDetectorState {
19950
19951    // True if telephony-based time zone detection is supported on the device.
19952    optional bool telephony_supported = 1;
19953
19954    // True if geo-based time zone detection is supported on the device.
19955    optional bool geo_supported = 2;
19956
19957    // The current user's master location setting value.
19958    optional bool location_enabled = 3;
19959
19960    // The current user's auto time zone detection enabled setting value.
19961    optional bool auto_detection_setting = 4;
19962
19963    // The current user's geo detection enabled setting.
19964    optional bool geo_detection_setting = 5;
19965
19966    enum DetectionMode {
19967        UNKNOWN = 0;
19968        MANUAL = 1;
19969        TELEPHONY = 2;
19970        GEO = 3;
19971    }
19972
19973    // The functional / behavioral state for how time zones are currently determined on the device.
19974    // Avoids needing to duplicate the logic used.
19975    optional DetectionMode detection_mode = 6;
19976
19977    // The device's current time zone ordinal (see MetricsTimeZoneSuggestion).
19978    optional int32 device_time_zone_ordinal = 7;
19979
19980    // The latest suggestion received from the user, e.g. via SettingsUI (non-persistent).
19981    optional MetricsTimeZoneSuggestion latest_manual_suggestion = 8
19982            [(log_mode) = MODE_BYTES];
19983
19984    // The latest telephony-derived suggestion (non-persistent).
19985    optional MetricsTimeZoneSuggestion latest_telephony_suggestion = 9
19986            [(log_mode) = MODE_BYTES];
19987
19988    // The latest geo-derived suggestion (non-persistent).
19989    optional MetricsTimeZoneSuggestion latest_geo_suggestion = 10
19990            [(log_mode) = MODE_BYTES];
19991
19992    // True if fallback to telephony time zone detection is supported on the device.
19993    optional bool telephony_time_zone_fallback_supported = 11;
19994
19995    // The device's current time zone ID (see MetricsTimeZoneSuggestion).
19996    optional string device_time_zone_id = 12;
19997
19998    // True if enhanced metrics collection is enabled.
19999    optional bool enhanced_metrics_collection_enabled = 13;
20000
20001    // True if the device may run geolocation time zone detection in the
20002    // background. This is the raw server flag value, not the value after
20003    // considering other state like the user's "use location" setting that also
20004    // affects runtime behavior. See LocationTimeZoneProviderController for
20005    // details.
20006    optional bool geo_detection_run_in_background_enabled = 14;
20007}
20008
20009/*
20010 * Logs information about an individual location time zone provider's state.
20011 *
20012 * Logged from:
20013 * frameworks/base/services/core/java/com/android/server/timezonedetector/location/RealProviderMetricsLogger.java
20014 */
20015message LocationTimeZoneProviderStateChanged {
20016    // The index of the provider (primary = 0, secondary = 1)
20017    optional int32 provider_index = 1 [(state_field_option).primary_field = true];
20018
20019    enum State {
20020        // A placeholder for unknown values.
20021        UNKNOWN = 0;
20022
20023        // The provider is initializing.
20024        INITIALIZING = 1;
20025
20026        // The provider is certain of the time zone.
20027        CERTAIN = 2;
20028
20029        // The provider is uncertain of the time zone.
20030        UNCERTAIN = 3;
20031
20032        // The provider has been stopped.
20033        STOPPED = 4;
20034
20035        // The provider has failed.
20036        PERM_FAILED = 5;
20037
20038        // The provider has been destroyed.
20039        DESTROYED = 6;
20040    }
20041
20042    // The state of the provider.
20043    optional State state = 2 [
20044        (state_field_option).exclusive_state = true,
20045        (state_field_option).nested = false
20046    ];
20047}
20048
20049/*
20050 * Logs information about the location time zone provider controller's state.
20051 *
20052 * Logged from:
20053 * frameworks/base/services/core/java/com/android/server/timezonedetector/location/RealControllerMetricsLogger.java
20054 */
20055message LocationTimeZoneProviderControllerStateChanged {
20056
20057    enum State {
20058        // A placeholder for unknown values.
20059        UNKNOWN = 0;
20060
20061        // The providers are initializing.
20062        PROVIDERS_INITIALIZING = 1;
20063
20064        // The controller is / has been stopped.
20065        STOPPED = 2;
20066
20067        // The controller is started and is initializing.
20068        INITIALIZING = 3;
20069
20070        // The controller is started and is certain of the time zone.
20071        CERTAIN = 4;
20072
20073        // The controller is started and is uncertain of the time zone.
20074        UNCERTAIN = 5;
20075
20076        // The controller has been destroyed.
20077        DESTROYED = 6;
20078
20079        // The controller has failed.
20080        FAILED = 7;
20081    }
20082
20083    // The state of the provider.
20084    optional State state = 1;
20085}
20086
20087/*
20088 * Reports fdtrack state change.
20089 *
20090 * Logged from:
20091 *   frameworks/base/services/java/com/android/server/SystemServer.java
20092 */
20093message FdtrackEventOccurred {
20094    enum FdtrackEventType {
20095      DISABLED = 1;
20096      ENABLED = 2;
20097
20098      // Aborting because we're above the abort threshold.
20099      ABORTING = 3;
20100    }
20101
20102    optional FdtrackEventType event = 1;
20103    optional int32 fd_count = 2;
20104}
20105
20106/**
20107 * Pushed when delivering a batch of alarms.
20108 *
20109 * Logged from:
20110 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
20111 */
20112message AlarmBatchDelivered {
20113    // The total number of alarms delivered in the batch.
20114    optional int32 num_alarms = 1;
20115
20116    // The number of wakeup alarms delivered in the batch.
20117    optional int32 wakeups = 2;
20118
20119    // A list of uids receiving the alarm delivery.
20120    repeated int32 uids = 3 [(is_uid) = true];
20121
20122    // The number of alarms delivered to each of the {@link uids} above.
20123    repeated int32 num_alarms_per_uid = 4;
20124
20125    // The number of wakeup alarms delivered to each of the {@link uids} above.
20126    repeated int32 num_wakeups_per_uid = 5;
20127}
20128
20129/**
20130 * Pushed when an app schedules an alarm.
20131 *
20132 * Logged from:
20133 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
20134 */
20135message AlarmScheduled {
20136    optional int32 calling_uid = 1 [(is_uid) = true];
20137
20138    optional bool is_exact = 2;
20139    optional bool is_wakeup = 3;
20140    optional bool is_allow_while_idle = 4;
20141    optional bool is_alarm_clock = 5;
20142    optional bool is_repeating = 6;
20143
20144    enum ReasonCode {
20145        NOT_APPLICABLE = 0;
20146        PERMISSION = 1;
20147        ALLOW_LIST = 2;
20148        CHANGE_DISABLED = 3;
20149        POLICY_PERMISSION = 4;
20150        LISTENER = 5;
20151        PRIORITIZED = 6;
20152    }
20153    optional ReasonCode exact_alarm_allowed_reason = 7;
20154    optional bool is_rtc = 8;
20155    // The state of the callingUid, from frameworks/proto_logging/stats/enums/app/app_enums.proto.
20156    optional android.app.ProcessStateEnum calling_process_state = 9;
20157}
20158
20159/**
20160 * Logs statistics about pending alarms.
20161 *
20162 * Pulled from:
20163 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
20164 */
20165message PendingAlarmInfo {
20166    optional int32 num_total = 1;
20167    optional int32 num_exact = 2;
20168    optional int32 num_wakeup = 3;
20169    optional int32 num_allow_while_idle = 4;
20170    optional int32 num_prioritized = 5;
20171    optional int32 num_foreground_service = 6;
20172    optional int32 num_activity = 7;
20173    optional int32 num_service = 8;
20174    optional int32 num_listener = 9;
20175    optional int32 num_indefinite_future = 10;
20176    optional int32 num_repeating = 11;
20177    optional int32 num_alarm_clock = 12;
20178    optional int32 num_rtc = 13;
20179}
20180
20181/*
20182 * Logged when a package's user-level hibernation state changes.
20183 * Logged from:
20184 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
20185 */
20186 message UserLevelHibernationStateChanged {
20187    // Name of the package that had its hibernation state change.
20188    optional string package_name = 1;
20189
20190    // Android user id to which this event belongs. This can only be 0, 10, 11 and so on.
20191    optional int32 user_id = 2;
20192
20193    // New hibernation state. True if hibernating, false otherwise
20194    optional bool is_hibernating = 3;
20195}
20196
20197/*
20198 * Pull atom for the number of hibernated packages on the device for the given user.
20199 * Logged from:
20200 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
20201 */
20202message UserLevelHibernatedApps {
20203    // Total number of apps hibernated for the user
20204    optional int32 hibernated_app_count = 1;
20205
20206    // Android user id of the queried user which can only be 0, 10, 11 and so on.
20207    optional int32 user_id = 2;
20208}
20209
20210/**
20211 * Pull atom for total number of globally hibernated packages on the device and the storage savings
20212 * from these apps being hibernated.
20213 * Logged from:
20214 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
20215 */
20216message GlobalHibernatedApps {
20217    // Total number of apps in global hibernation
20218    optional int32 hibernated_app_count = 1;
20219
20220    // Cumulative storage savings from apps being hibernated
20221    optional int64 storage_saved_mb = 2;
20222}
20223
20224/*
20225 * Report the event of app process kills.
20226 * Logged from:
20227 *   frameworks/base/services/core/java/com/android/server/am/AppExitInfoTracker.java
20228 */
20229message AppProcessDied {
20230    // Uid of the package of the dying process
20231    optional int32 uid = 1 [(is_uid) = true];
20232
20233    // Name of the dying process, it'll be omitted if the process name and package name are the same
20234    optional string process_name = 2;
20235
20236    // The reason code of why the process dies
20237    optional android.app.AppExitReasonCode reason = 3;
20238
20239    // The supplemental reason code of why the process dies
20240    optional android.app.AppExitSubReasonCode sub_reason = 4;
20241
20242    // The importance of the process when it dies
20243    optional android.app.Importance importance = 5;
20244
20245    // The last known PSS (in kB) of the process before it dies, could be 0.
20246    optional int32 pss = 6;
20247
20248    // The last known RSS (in kB) of the process before it dies, could be 0.
20249    optional int32 rss = 7;
20250
20251    // Whether or not this process is hosting one or more foregound services.
20252    optional bool has_foreground_services = 8;
20253}
20254
20255// Each pull creates multiple atoms. One for each incremental package.
20256message InstalledIncrementalPackage {
20257    optional int32 uid = 1 [(is_uid) = true];
20258    optional bool is_loading = 2;
20259    optional int64 loading_completed_timestamp = 3;
20260}
20261
20262/**
20263 * Memory management statistics pulled atom based on /proc/vmstat.
20264 * Logged from StatsPullAtomService.
20265 */
20266message VmStat {
20267    optional int32 oom_kill_count = 1;
20268}
20269
20270/**
20271* Log that the user has interacted with an app on the permission usage
20272* fragment.
20273* Logged from permission/debug/PermissionUsageV2Frament.kt
20274*/
20275message PermissionUsageFragmentInteraction {
20276    // id which identifies single session of user interacting with permission hub
20277    optional int64 session_id = 1;
20278
20279    enum Action {
20280        UNDEFINED = 0;
20281        OPEN = 1;
20282        LOCATION_ACCESS_TIMELINE_VIEWED = 2;
20283        CAMERA_ACCESS_TIMELINE_VIEWED = 3;
20284        MICROPHONE_ACCESS_TIMELINE_VIEWED = 4;
20285        SHOW_SYSTEM_CLICKED = 5;
20286        SEE_OTHER_PERMISSIONS_CLICKED = 6;
20287    }
20288
20289    // The action the user took to interact with the fragment
20290    optional Action action = 2;
20291}
20292
20293/**
20294* Log that the user has clicked on .
20295* Logged from permission/debug/PermissionDetailsFragment.kt
20296*/
20297message PermissionDetailsInteraction {
20298    // id which identifies single session of user interacting with permission details fragment.
20299    optional int64 session_id = 1;
20300
20301    // The name of a permission group whose details are viewed.
20302    optional string permission_group_name = 2;
20303
20304    enum Action {
20305        UNDEFINED = 0;
20306        SHOW_SYSTEM_CLICKED = 1;
20307        INFO_ICON_CLICKED = 2;
20308    }
20309
20310    // Package name for which the info icon was clicked.
20311    optional string package_name = 3;
20312
20313    // The action the user took to interact with the fragment
20314    optional Action action = 4;
20315}
20316
20317/**
20318* Log that the user has toggled the sensor privacy.
20319*/
20320message PrivacySensorToggleInteraction {
20321
20322    enum Sensor {
20323        SENSOR_UNKNOWN = 0;
20324        MICROPHONE = 1;
20325        CAMERA = 2;
20326    }
20327
20328    // Sensor for which sensor privacy was toggled.
20329    optional Sensor sensor = 1;
20330
20331    enum Action {
20332        ACTION_UNKNOWN = 0;
20333        TOGGLE_ON = 1;
20334        TOGGLE_OFF = 2;
20335        TOGGLE_ON_EXCEPT_ALLOWLISTED_APPS = 3;
20336    }
20337
20338    // Action taken on sensor.
20339    optional Action action = 2;
20340
20341    enum Source {
20342        SOURCE_UNKNOWN = 0;
20343        DIALOG = 1;
20344        SETTINGS = 2;
20345        QS_TILE = 3;
20346    }
20347
20348    // Source for the toggling.
20349    optional Source source = 3;
20350
20351    // Amount of time a user spent in the previous sensor privacy state in minutes.
20352    optional int64 time_in_previous_state_in_mins = 4;
20353}
20354
20355message PrivacyToggleDialogInteraction {
20356
20357    enum Action {
20358        ACTION_UNKNOWN = 0;
20359        ENABLE = 1;
20360        CANCEL = 2;
20361    }
20362
20363    // Action taken on the toggle dialog.
20364    optional Action action = 1;
20365
20366    // Name of the package for which the dialog was shown.
20367    optional string package_name = 2;
20368}
20369
20370message VendorApexInfo {
20371  optional string package_name = 1;
20372  optional string version_code = 2;
20373  optional string version_name = 3;
20374  optional string source_dir = 4;
20375  optional string signing_certs_hash = 5;
20376  optional string file_hash = 6;
20377}
20378
20379/**
20380 * Logs the non-a11yTool service warning status and its duration of the usage.
20381 *
20382 * Logged from:
20383 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
20384 *   packages/apps/Settings
20385 */
20386message NonA11yToolServiceWarningReported {
20387    // Package name of the non-a11yTool service.
20388    optional string package_name = 1;
20389
20390    // Warning status of the non-a11yTool service.
20391    optional android.stats.accessibility.WarningStatus status = 2;
20392
20393    // Duration between status in milliseconds.
20394    optional int64 duration_millis = 3;
20395}
20396
20397message MediaCapabilities {
20398    message AudioEncodings {
20399        repeated android.stats.mediametrics.AudioEncoding audio_encodings = 1;
20400    }
20401
20402    message HdrFormats {
20403        repeated android.stats.mediametrics.HdrFormat hdr_formats = 1;
20404    }
20405
20406
20407    message DisplayMode {
20408        optional int32 height = 1;
20409        optional int32 width = 2;
20410        optional float refresh_rate = 3;
20411        optional int32 seamless_refresh_rates_group_id = 4;
20412    }
20413
20414    message DisplayModes {
20415        repeated DisplayMode display_modes = 1;
20416    }
20417
20418    // Surround sound capabilities
20419
20420    // List of surround sound encodings supported by this device
20421    optional AudioEncodings surround_encodings = 1 [(log_mode) = MODE_BYTES];
20422    // List of surround sound encodings supported by the sink device
20423    optional AudioEncodings sink_surround_encodings = 2 [(log_mode) = MODE_BYTES];
20424    // List of supported surround sound encodings disabled by user
20425    optional AudioEncodings user_disabled_surround_encodings = 3 [(log_mode) = MODE_BYTES];
20426    // List of unsupported surround sound encodings enabled by user
20427    optional AudioEncodings user_enabled_surround_encodings = 4 [(log_mode) = MODE_BYTES];
20428     // The surround sound output mode chosen by user
20429    optional android.stats.mediametrics.EncodedSurroundOutputMode surround_output_mode = 5;
20430
20431
20432    // Display capabilities
20433
20434    // List of HDR display formats supported by the sink device
20435    optional HdrFormats sink_hdr_formats = 6 [(log_mode) = MODE_BYTES];
20436    // List of modes supported by the sink device. Each mode has height, width, refresh rate and a list
20437    // of refresh-rates between which a seamless switch is possible.
20438    optional DisplayModes sink_display_modes = 7 [(log_mode) = MODE_BYTES];
20439    // The HDCP level with which the display is connected
20440    optional int32 hdcp_level = 8;
20441
20442    // Display settings
20443
20444    // The Match content refresh rate user preference
20445    optional android.stats.mediametrics.MatchContentFrameRatePreference
20446                match_content_refresh_rate_preference = 9;
20447    // List of HDR formats disabled by the user
20448    optional HdrFormats user_disabled_hdr_formats = 10 [(log_mode) = MODE_BYTES];
20449    // The resolution height selected by the user
20450    optional int32 user_preferred_resolution_height = 11;
20451    // The resolution width selected by the user
20452    optional int32 user_preferred_resolution_width = 12;
20453    // The refresh rate selected by the user
20454    optional float user_preferred_refresh_rate = 13;
20455    // Whether the user has disabled auto low latency mode
20456    optional bool has_user_disabled_allm = 14;
20457}
20458
20459/**
20460 * Logs when NNAPI model is compiled successfully
20461 * Logged from
20462 *   modules/NeuralNetworks/runtime/TelemetryStatsd.cpp
20463 */
20464message NeuralNetworksCompilationCompleted {
20465    // Linux process uid for the package.
20466    optional int32 uid = 1 [(is_uid) = true];
20467
20468    // id which identifies single session of client interacting with NNAPI runtime
20469    optional int32 session_id = 2;
20470
20471    // NNAPI mainline module version.
20472    optional int64 version_nnapi_module = 3;
20473
20474    // An identifier that can be used to match events for ML model architecture.
20475    // Hash is generated from model operations and operands definition, but not weights.
20476    // Hash algorithm: HMAC-SHA256
20477    // Size: 32 byte
20478    optional bytes model_arch_hash = 4 [(log_mode) = MODE_BYTES];
20479
20480    // Device driver identifier used by this compilation.
20481    // NeuralNetworks models are compiled/prepared for one or more device drivers (e.g., DSP, GPU,
20482    // TPU, CPU). The device driver identifier is a concatenation of [device driver name, =, and
20483    // device driver version]. If multiple device drivers are used, all device driver identifiers
20484    // are sorted and concatenated with comma as a separator.
20485    optional string device_id = 5;
20486
20487    // Type of tensors used for inputs
20488    optional android.neuralnetworks.DataClass input_data_class = 6;
20489
20490    // Type of tensors used for outputs
20491    optional android.neuralnetworks.DataClass output_data_class = 7;
20492
20493    // Did the compilation had to fallback to cpu due to an error?
20494    optional bool fallback_to_cpu_from_error = 8;
20495
20496    // Did client name target devices explicitly?
20497    optional bool introspection_enabled = 9;
20498
20499    // Was cache enabled?
20500    optional bool cache_enabled = 10;
20501
20502    // Was control flow used in the model?
20503    optional bool has_control_flow = 11;
20504
20505    // Whether there exists a partition boundary in the compilation that has dynamic size
20506    optional bool has_dynamic_temporaries = 12;
20507
20508    // Time taken to compile a model
20509    optional int64 compilation_time_sum_millis = 13;
20510    optional int64 compilation_time_min_millis = 14;
20511    optional int64 compilation_time_max_millis = 15;
20512    optional int64 compilation_time_sum_squared_millis = 16;
20513    optional int32 compilation_time_count = 17;
20514
20515    // How many times this atom occurred locally before being pushed.
20516    optional int32 count = 18;
20517
20518    // model_arch_hash compressed to 64 bits by bitwise-xor each 64 chunk of model_arch_hash.
20519    optional int64 model_arch_hash_64 = 19;
20520}
20521
20522/**
20523 * Logs when NNAPI model fails compilation
20524 * Logged from
20525 *   modules/NeuralNetworks/runtime/TelemetryStatsd.cpp
20526 */
20527message NeuralNetworksCompilationFailed {
20528    // Linux process uid for the package.
20529    optional int32 uid = 1 [(is_uid) = true];
20530
20531    // id which identifies single session of client interacting with NNAPI runtime
20532    optional int32 session_id = 2;
20533
20534    // NNAPI mainline module version.
20535    optional int64 version_nnapi_module = 3;
20536
20537    // An identifier that can be used to match events for ML model architecture.
20538    // Hash is generated from model operations and operands definition, but not weights.
20539    // Hash algorithm: HMAC-SHA256
20540    // Size: 32 byte
20541    optional bytes model_arch_hash = 4 [(log_mode) = MODE_BYTES];
20542
20543    // Device driver identifier used by this compilation.
20544    // NeuralNetworks models are compiled/prepared for one or more device drivers (e.g., DSP, GPU,
20545    // TPU, CPU). The device driver identifier is a concatenation of [device driver name, =, and
20546    // device driver version]. If multiple device drivers are used, all device driver identifiers
20547    // are sorted and concatenated with comma as a separator.
20548    optional string device_id = 5;
20549
20550    // Type of tensors used for inputs
20551    optional android.neuralnetworks.DataClass input_data_class = 6;
20552
20553    // Type of tensors used for outputs
20554    optional android.neuralnetworks.DataClass output_data_class = 7;
20555
20556    // Error code returned by compilation call
20557    optional android.neuralnetworks.ResultCode error_code = 8;
20558
20559    // Did client name target devices explicitly?
20560    optional bool introspection_enabled = 9;
20561
20562    // Was cache enabled?
20563    optional bool cache_enabled = 10;
20564
20565    // Was control flow used in the model?
20566    optional bool has_control_flow = 11;
20567
20568    // Whether there exists a partition boundary in the compilation that has dynamic size
20569    optional bool has_dynamic_temporaries = 12;
20570
20571    // How many times this atom occurred locally before being pushed.
20572    optional int32 count = 13;
20573
20574    // model_arch_hash compressed to 64 bits by bitwise-xor each 64 chunk of model_arch_hash.
20575    optional int64 model_arch_hash_64 = 14;
20576}
20577
20578/**
20579 * Logs when NNAPI model is executed successfully
20580 *
20581 * Logged from
20582 *   modules/NeuralNetworks/runtime/TelemetryStatsd.cpp
20583 */
20584message NeuralNetworksExecutionCompleted {
20585    // Linux process uid for the package.
20586    optional int32 uid = 1 [(is_uid) = true];
20587
20588    // id which identifies single session of client interacting with NNAPI runtime
20589    optional int32 session_id = 2;
20590
20591    // NNAPI mainline module version.
20592    optional int64 version_nnapi_module = 3;
20593
20594    // An identifier that can be used to match events for ML model architecture.
20595    // Hash is generated from model operations and operands definition, but not weights.
20596    // Hash algorithm: HMAC-SHA256
20597    // Size: 32 byte
20598    optional bytes model_arch_hash = 4 [(log_mode) = MODE_BYTES];
20599
20600    // Device driver identifier used by this execution.
20601    // NeuralNetworks models are executed on one or more device drivers (e.g., DSP, GPU, TPU, CPU).
20602    // The device driver identifier is a concatenation of [device driver name, =, and device driver
20603    // version]. If multiple device drivers are used, all device driver identifiers are sorted and
20604    // concatenated with comma as a separator.
20605    optional string device_id = 5;
20606
20607    // Execution mode
20608    optional android.neuralnetworks.Mode mode = 6;
20609
20610    // Type of tensors used for inputs
20611    optional android.neuralnetworks.DataClass input_data_class = 7;
20612
20613    // Type of tensors used for outputs
20614    optional android.neuralnetworks.DataClass output_data_class = 8;
20615
20616    // Did client name target devices explicitly?
20617    optional bool introspection_enabled = 9;
20618
20619    // Was cache enabled?
20620    optional bool cache_enabled = 10;
20621
20622    // Was control flow used in the model?
20623    optional bool has_control_flow = 11;
20624
20625    // Whether there exists a partition boundary in the compilation that has dynamic size
20626    optional bool has_dynamic_temporaries = 12;
20627
20628    // Time taken to execute from runtime, including runtime/ipc overhead
20629    optional int64 duration_runtime_sum_micros = 13;
20630    optional int64 duration_runtime_min_micros = 14;
20631    optional int64 duration_runtime_max_micros = 15;
20632    optional int64 duration_runtime_sum_squared_micros = 16;
20633    optional int32 duration_runtime_count = 17;
20634
20635    // Time taken to execute in the driver, excluding runtime/ipc overhead
20636    optional int64 duration_driver_sum_micros = 18;
20637    optional int64 duration_driver_min_micros = 19;
20638    optional int64 duration_driver_max_micros = 20;
20639    optional int64 duration_driver_sum_squared_micros = 21;
20640    optional int32 duration_driver_count = 22;
20641
20642    // Time taken to execute on the hardware, excluding driver overhead
20643    optional int64 duration_hardware_sum_micros = 23;
20644    optional int64 duration_hardware_min_micros = 24;
20645    optional int64 duration_hardware_max_micros = 25;
20646    optional int64 duration_hardware_sum_squared_micros = 26;
20647    optional int32 duration_hardware_count = 27;
20648
20649    // How many times this atom occurred locally before being pushed.
20650    optional int32 count = 28;
20651
20652    // model_arch_hash compressed to 64 bits by bitwise-xor each 64 chunk of model_arch_hash.
20653    optional int64 model_arch_hash_64 = 29;
20654}
20655
20656/**
20657 * Logs when NNAPI model fails execution
20658 * Logged from
20659 *   modules/NeuralNetworks/runtime/TelemetryStatsd.cpp
20660 */
20661message NeuralNetworksExecutionFailed {
20662    // Linux process uid for the package.
20663    optional int32 uid = 1 [(is_uid) = true];
20664
20665    // id which identifies single session of client interacting with NNAPI runtime
20666    optional int32 session_id = 2;
20667
20668    // NNAPI mainline module version.
20669    optional int64 version_nnapi_module = 3;
20670
20671    // An identifier that can be used to match events for ML model architecture.
20672    // Hash is generated from model operations and operands definition, but not weights.
20673    // Hash algorithm: HMAC-SHA256
20674    // Size: 32 byte
20675    optional bytes model_arch_hash = 4 [(log_mode) = MODE_BYTES];
20676
20677    // Device driver identifier used by this execution.
20678    // NeuralNetworks models are executed on one or more device drivers (e.g., DSP, GPU, TPU, CPU).
20679    // The device driver identifier is a concatenation of [device driver name, =, and device driver
20680    // version]. If multiple device drivers are used, all device driver identifiers are sorted and
20681    // concatenated with comma as a separator.
20682    optional string device_id = 5;
20683
20684    // Execution mode
20685    optional android.neuralnetworks.Mode mode = 6;
20686
20687    // Type of tensors used for inputs
20688    optional android.neuralnetworks.DataClass input_data_class = 7;
20689
20690    // Type of tensors used for outputs
20691    optional android.neuralnetworks.DataClass output_data_class = 8;
20692
20693    // Error code returned by execution call
20694    optional android.neuralnetworks.ResultCode error_code = 9;
20695
20696    // Did client name target devices explicitly?
20697    optional bool introspection_enabled = 10;
20698
20699    // Was cache enabled?
20700    optional bool cache_enabled = 11;
20701
20702    // Was control flow used in the model?
20703    optional bool has_control_flow = 12;
20704
20705    // Whether there exists a partition boundary in the compilation that has dynamic size
20706    optional bool has_dynamic_temporaries = 13;
20707
20708    // How many times this atom occurred locally before being pushed.
20709    optional int32 count = 14;
20710
20711    // model_arch_hash compressed to 64 bits by bitwise-xor each 64 chunk of model_arch_hash.
20712    optional int64 model_arch_hash_64 = 15;
20713}
20714
20715/**
20716 * Logs boot-time info for a Context Hub.
20717 */
20718message ContextHubBooted {
20719  // The amount of time it took the framework to connect to CHRE/Context Hub HAL
20720  // since the framework has booted.
20721  optional int64 boot_time_nanos = 1;
20722
20723  // The number of Context Hub instances found on this system.
20724  optional int32 num_context_hubs = 2;
20725}
20726
20727/**
20728 * Logs Context Hub restart events (e.g. crashes).
20729 */
20730message ContextHubRestarted {
20731  // The duration of time between the last time Context Hub restart and this event.
20732  // This should use the SystemClock.elapsedRealTime() API.
20733  optional int64 elapsed_time_millis_since_boot = 1;
20734
20735  // The ID of the Context Hub that has restarted (zero-indexed).
20736  optional int32 context_hub_id = 2;
20737}
20738
20739/**
20740 * Logs a snapshot of all the nanoapps loaded on this Context Hub.
20741 */
20742message ContextHubLoadedNanoappSnapshotReported {
20743  // The ID of the Context Hub the snapshot is for (zero-indexed).
20744  optional int32 context_hub_id = 1;
20745
20746  // The nanoapp this snapshot is for. The nanoapp ID is the 64-bit unique identifier
20747  // for the application, and the version is the semantic versioning (https://semver.org)
20748  // used to determine the software version.
20749  optional int64 nanoapp_id = 2;
20750  optional int32 nanoapp_version = 3;
20751}
20752
20753/**
20754 * Logs details of a dynamic CHRE nanoapp code download transaction.
20755 */
20756message ChreCodeDownloadTransacted {
20757  enum Type {
20758    TYPE_UNKNOWN = 0;
20759    TYPE_LOAD = 1;
20760    TYPE_UNLOAD = 2;
20761  }
20762  // The ID/version of the nanoapp this code download was for.
20763  optional int64 nanoapp_id = 1;
20764  optional int32 nanoapp_version = 2;
20765
20766  // The type of code download transaction.
20767  optional Type transaction_type = 3;
20768
20769  // The result of this transaction.
20770  optional android.contexthub.ContextHubTransactionResult transaction_result = 4;
20771}
20772
20773/**
20774 * Stats about each feature tag that was included in the registration.
20775 *
20776 * Logged from:
20777 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
20778 */
20779message ImsRegistrationFeatureTagStats {
20780    // the carrier id associated with this SIP delegate
20781    // Used as a dimension
20782    optional int32 carrier_id = 1;
20783
20784    // The slot id associated with this SIP delegate
20785    // Used as a dimension
20786    optional int32 slot_id = 2;
20787
20788    // The name of the feature tag
20789    // used as a dimension
20790    optional android.telephony.ImsFeatureTag feature_tag_name = 3;
20791
20792    // The underlying radio technology type associated with the feature tag
20793    // used as a dimension
20794    // See the ImsRegistrationImplBase#REGISTRATION_TECH*
20795    optional int32 registration_tech = 4;
20796
20797    // The time this feature tag was registered, rounded to 5 minutes
20798    optional int32 registered_seconds = 5;
20799}
20800
20801/**
20802 * Stats about the messaging client interacting with telephony
20803 *
20804 * Logged from:
20805 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
20806 */
20807message RcsClientProvisioningStats {
20808    enum EventType {
20809        EVENT_TYPE_UNSPECIFIED = 0;
20810        // The client sent its client params to the ACS service.
20811        CLIENT_PARAMS_SENT = 1;
20812        // The client has manually triggered reconfiguration
20813        TRIGGER_RCS_RECONFIGURATION = 2;
20814        // Default messaging application changed.
20815        DMA_CHANGED = 3;
20816    }
20817    // Carrier ID of the SIM used for IMS registration.
20818    // See https://source.android.com/devices/tech/config/carrierid.
20819    // Used as a dimension
20820    optional int32 carrier_id = 1;
20821
20822    // Index of the SIM used, 0 for single-SIM devices.
20823    // Used as a dimension
20824    optional int32 slot_id = 2;
20825
20826    // Used as a dimension
20827    optional EventType event = 3;
20828
20829    // The number of times this event has occurred.
20830    optional int32 count = 4;
20831}
20832
20833/**
20834 * Stats about the RCS provisioning via ACS
20835 *
20836 * Logged from:
20837 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
20838 */
20839message RcsAcsProvisioningStats {
20840    enum ResponseType {
20841        RESPONSE_TYPE_UNSPECIFIED = 0;
20842        // a provisioning request resulted in an error.
20843        ERROR = 1;
20844        // a provisioning request succeeded and provided an xml
20845        PROVISIONING_XML = 2;
20846        // a provisioning request has resulted in a "pre-provisioning" xml, which
20847        // means RCS is not provisioned and requires the user to intervene.
20848        PRE_PROVISIONING_XML = 3;
20849    }
20850
20851    // Carrier ID of the SIM used for IMS registration.
20852    // See https://source.android.com/devices/tech/config/carrierid.
20853    // Used as a dimension
20854    optional int32 carrier_id = 1;
20855
20856    // Index of the SIM used, 0 for single-SIM devices.
20857    // Used as a dimension
20858    optional int32 slot_id = 2;
20859
20860    // The response code of provisioning if the provisioning resulted in
20861    // ResponseType.ERROR
20862    // Used as a dimension
20863    optional int32 response_code = 3;
20864
20865    // used as a dimension.
20866    optional ResponseType response_type = 4;
20867
20868    // Does the provisioning XML have single registration provisioned.
20869    // Populated if response_type is ResponseType.PROVISIONING_XML
20870    // used as a dimension
20871    optional bool is_single_registration_enabled = 5;
20872
20873    // The number of times this event has occurred.
20874    optional int32 count = 6;
20875
20876    // The amount of time in seconds that the device was in this state in total, rounded 5 minutes
20877    optional int32 state_timer_sec = 7;
20878}
20879
20880/**
20881 * Metrics surrounding the lifetime of a SIP delegate created by applications.
20882 *
20883 * Logged from:
20884 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
20885 */
20886message SipDelegateStats {
20887    // The random number identifier with this SIP delegate
20888    optional int32 dimension = 1;
20889
20890    // The carrier id associated with this SIP delegate
20891    optional int32 carrier_id = 2;
20892
20893    // The slot id associated with this SIP delegate
20894    optional int32 slot_id = 3;
20895
20896    // The total uptime of this delegate, rounded 5 minutes
20897    optional int32 uptime_seconds = 4;
20898
20899    // The reason why this SIP delegate was destroyed.
20900    // See the SipDelegateManager#SIP_DELEGATE_DESTROY_REASON*
20901    optional int32 destroy_reason = 5;
20902}
20903
20904/**
20905 * Tracks each feature tag associated with the SipDelegates that are currently active.
20906 *
20907 * Logged from:
20908 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
20909 */
20910message SipTransportFeatureTagStats {
20911    // the carrier id associated with this SIP delegate
20912    // Used as a dimension
20913    optional int32 carrier_id = 1;
20914
20915    // The slot id associated with this SIP delegate
20916    // Used as a dimension
20917    optional int32 slot_id = 2;
20918
20919    // The name of the feature tag
20920    // used as a dimension
20921    optional android.telephony.ImsFeatureTag feature_tag_name = 3;
20922
20923    // The reason why this feature tag was denied on the SIP Transport
20924    // used as a dimension
20925    // Use SIP transport denied reason.
20926    // See the SipDelegateManager#DENIED_REASON*
20927    optional int32 sip_transport_denied_reason = 4;
20928
20929    // The reason why this feature tag was associated with the SIP Transport but not
20930    // marked as deregistered.
20931    // used as a dimension
20932    // Use SIP transport deregistered reason.
20933    // See the DelegateRegistrationState#DEREGISTERING_REASON*
20934    optional int32 sip_transport_deregistered_reason = 5;
20935
20936    // the time this feature tag was in this state, rounded 5 minutes
20937    optional int32 associated_seconds = 6;
20938}
20939
20940/**
20941 * Tracks each SIP message and the response from either the app or network.
20942 *
20943 * Logged from:
20944 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
20945 */
20946message SipMessageResponse {
20947    enum Direction {
20948        UNKNOWN = 0;
20949        INCOMING = 1;
20950        OUTGOING = 2;
20951    }
20952    // the carrier id associated with this SIP delegate
20953    // Used as a dimension
20954    optional int32 carrier_id = 1;
20955
20956    // The slot id associated with this SIP delegate
20957    // Used as a dimension
20958    optional int32 slot_id = 2;
20959
20960    // The SIP message method type (INVITE, MESSAGE, etc...)
20961    // used as a dimension
20962    optional android.telephony.SipRequestMethodType sip_message_method = 3;
20963
20964    // The SIP message response code, used if this is a response to a request.
20965    // used as a dimension.
20966    optional int32 sip_message_response = 4;
20967
20968    // The SIP message direction
20969    // used as a dimension
20970    optional Direction sip_message_direction = 5;
20971
20972    // The response from the SIP stack to sending/receiving the message
20973    // used as a dimension
20974    // See the SipDelegateManager#MESSAGE_FAILURE_REASON*
20975    optional int32 message_error = 6;
20976
20977    // The number of messages that fit this criteria.
20978    optional int32 count = 7;
20979}
20980
20981/**
20982 * Tracks SIP sessions managed by the SIP transport.
20983 *
20984 * Logged from:
20985 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
20986 */
20987message SipTransportSession {
20988    enum Direction {
20989        UNKNOWN = 0;
20990        INCOMING = 1;
20991        OUTGOING = 2;
20992    }
20993    // the carrier id associated with this SIP delegate
20994    // Used as a dimension
20995    optional int32 carrier_id = 1;
20996
20997    // The slot id associated with this SIP delegate
20998    // Used as a dimension
20999    optional int32 slot_id = 2;
21000
21001    // The SIP message method that started the session (INVITE, SUBSCRIBE, etc...)
21002    // used as a dimension
21003    optional android.telephony.SipRequestMethodType session_method = 3;
21004
21005    // The SIP message direction
21006    // used as a dimension
21007    optional Direction sip_message_direction = 4;
21008
21009    // The response from the SIP stack or network.
21010    // used as a dimension.
21011    optional int32 sip_response = 5;
21012
21013    // The number of these sessions counted
21014    optional int32 session_count = 6;
21015
21016    // The number of sessions that were started properly and did not require
21017    // the SIP transport to forcefully close them.
21018    optional int32 ended_gracefully_count = 7;
21019}
21020
21021/**
21022 * Used to determine if there were dedicated bearers set up for a specific listener.
21023 * If not, this indicates that there may have been a network issue in the dedicated bearer setup.
21024 *
21025 * Logged from:
21026 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
21027 */
21028message ImsDedicatedBearerListenerEvent {
21029    // Carrier ID of the SIM used for IMS registration.
21030    // See https://source.android.com/devices/tech/config/carrierid.
21031    // Used as a dimension
21032    optional int32 carrier_id = 1;
21033
21034    // Index of the SIM used, 0 for single-SIM devices.
21035    // Used as a dimension
21036    optional int32 slot_id = 2;
21037
21038    // Radio access technology (RAT) used by the registration when it terminated.
21039    // The value is either 4G or 5G.
21040    // Used as a dimension
21041    optional android.telephony.NetworkTypeEnum rat_at_end = 3;
21042
21043    // QoS class identifier.
21044    // dimension
21045    optional int32 qci = 4;
21046
21047    // True if there was a dedicated bearer established for this listener.
21048    // dimension
21049    optional bool dedicated_bearer_established = 5;
21050
21051    // The count of listeners with this result.
21052    optional int32 event_count = 6;
21053}
21054
21055/**
21056 * Logs information related to ims dedicated bearer which fulfills required qos and provides guaranteed service.
21057 *
21058 * Logged from:
21059 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
21060 */
21061message ImsDedicatedBearerEvent {
21062    enum State {
21063        STATE_UNSPECIFIED = 0;
21064        STATE_ADDED = 1;
21065        STATE_MODIFIED = 2;
21066        STATE_DELETED = 3;
21067    }
21068    // Carrier ID of the SIM used for IMS registration.
21069    // See https://source.android.com/devices/tech/config/carrierid.
21070    // Used as a dimension
21071    optional int32 carrier_id = 1;
21072
21073    // Index of the SIM used, 0 for single-SIM devices.
21074    // Used as a dimension
21075    optional int32 slot_id = 2;
21076
21077    // Radio access technology (RAT) used by the registration when it terminated.
21078    // The value is either 4G or 5G.
21079    // Used as a dimension
21080    optional android.telephony.NetworkTypeEnum rat_at_end = 3;
21081
21082    // Qos class identifier.
21083    // Used as a dimension
21084    optional int32 qci = 4;
21085
21086    // Dedicated bearer state from the network.
21087    // Used as a dimension
21088    optional State bearer_state = 5;
21089
21090    // Whether location connection information is received.
21091    // Used as a dimension
21092    optional bool local_connection_info_received = 6;
21093
21094    // Whether remote connection information is received.
21095    // Used as a dimension
21096    optional bool remote_connection_info_received = 7;
21097
21098    // Whether or not the QoS indication had listeners.
21099    // Used as a dimension
21100    optional bool has_listeners = 8;
21101
21102    // The count that matches the above conditions.
21103    optional int32 count = 9;
21104}
21105
21106/**
21107 * Stats about each ServiceDescription that was included in the PIDF XML sent to the network during publish.
21108 *
21109 * Logged from:
21110 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
21111 */
21112message ImsRegistrationServiceDescStats {
21113    // Describe Service IDs will be included PUBLISH
21114    // See RcsContactPresenceTuple.java
21115    enum ServiceId {
21116        SERVICE_ID_UNSPECIFIED = 0;
21117        SERVICE_ID_CUSTOM = 1;
21118        SERVICE_ID_MMTEL = 2;
21119        SERVICE_ID_CHAT_V1 = 3;
21120        SERVICE_ID_CHAT_V2 = 4;
21121        SERVICE_ID_FT = 5;
21122        SERVICE_ID_FT_OVER_SMS = 6;
21123        SERVICE_ID_GEO_PUSH = 7;
21124        SERVICE_ID_GEO_PUSH_VIA_SMS = 8;
21125        SERVICE_ID_CALL_COMPOSER = 9;
21126        SERVICE_ID_POST_CALL = 10;
21127        SERVICE_ID_SHARED_MAP = 11;
21128        SERVICE_ID_SHARED_SKETCH = 12;
21129        SERVICE_ID_CHATBOT = 13;
21130        SERVICE_ID_CHATBOT_STANDALONE = 14;
21131        SERVICE_ID_CHATBOT_ROLE = 15;
21132    }
21133
21134    // the carrier id associated with this SIP delegate
21135    // Used as a dimension
21136    optional int32 carrier_id = 1;
21137
21138    // The slot id associated with this SIP delegate
21139    // Used as a dimension
21140    optional int32 slot_id = 2;
21141
21142    // The service id portion of the ServiceDescription
21143    // used as a dimension
21144    optional ServiceId service_id_name = 3;
21145
21146    // The version portion of the ServiceDescription
21147    // used as a dimension
21148    optional float service_id_version = 4;
21149
21150    // The underlying radio technology type associated with the feature tag
21151    // used as a dimension
21152    // See the ImsRegistrationImplBase#REGISTRATION_TECH*
21153    optional int32 registration_tech = 5;
21154
21155    // the time this feature tag was registered, rounded 5 minutes
21156    optional int32 published_seconds = 6;
21157}
21158
21159/**
21160 * Stats related to UCE queries to the network
21161 *
21162 * Logged from:
21163 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
21164 */
21165message UceEventStats {
21166    enum MessageType {
21167        MESSAGE_TYPE_UNSPECIFIED = 0;
21168        PUBLISH = 1;
21169        SUBSCRIBE = 2;
21170        INCOMING_OPTION = 3;
21171        OUTGOING_OPTION = 4;
21172    }
21173    enum CommandCode {
21174        SERVICE_UNKNOWN = 0;
21175        GENERIC_FAILURE = 1;
21176        INVALID_PARAM = 2;
21177        FETCH_ERROR = 3;
21178        REQUEST_TIMEOUT = 4;
21179        INSUFFICIENT_MEMORY = 5;
21180        LOST_NETWORK_CONNECTION = 6;
21181        NOT_SUPPORTED = 7;
21182        NOT_FOUND = 8;
21183        SERVICE_UNAVAILABLE = 9;
21184        NO_CHANGE = 10;
21185    }
21186    // Carrier ID of the SIM used for IMS registration.
21187    // See https://source.android.com/devices/tech/config/carrierid.
21188    // Used as a dimension
21189    optional int32 carrier_id = 1;
21190
21191    // Index of the SIM used, 0 for single-SIM devices.
21192    // Used as a dimension
21193    optional int32 slot_id = 2;
21194
21195    // Used to identify the message type.
21196    // Used as a dimension
21197    optional MessageType type = 3;
21198
21199    // Whether the UCE event is successfully finished. If false, the request to the
21200    // modem timed out and we sent a timeout error back to the requesting app.
21201    // Used as a dimension
21202    optional bool successful = 4;
21203
21204    // The command error code for the Uce event. Not populated if the modem
21205    // accepted the request and delivered a network_response.
21206    // Used as a dimension
21207    optional CommandCode command_code = 5;
21208
21209    // The network response code for the Uce event. Will not be populated if
21210    // command_code is present.
21211    // Used as a dimension
21212    optional int32 network_response = 6;
21213
21214    // The count that matches the above conditions;
21215    optional int32 count = 7;
21216}
21217
21218/**
21219 * Information related to a SIP NOTIFY event from modem.
21220 *
21221 * Logged from:
21222 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
21223 */
21224message PresenceNotifyEvent {
21225    // See RFC3265 Section 3.2.4 for more information about these subscription states.
21226    enum TerminatedReason {
21227        REASON_UNSPECIFIED = 0;
21228        // Not spec defined, the network returned a custom code that is not spec defined.
21229        REASON_CUSTOM = 1;
21230        REASON_DEACTIVATED = 2;
21231        REASON_PROBATION = 3;
21232        REASON_REJECTED = 4;
21233        REASON_TIMEOUT = 5;
21234        REASON_GIVEUP = 6;
21235        REASON_NORESOURCE = 7;
21236    }
21237
21238    // Carrier ID of the SIM used for IMS registration.
21239    // See https://source.android.com/devices/tech/config/carrierid.
21240    // Used as a dimension
21241    optional int32 carrier_id = 1;
21242
21243    // Index of the SIM used, 0 for single-SIM devices.
21244    // Used as a dimension
21245    optional int32 slot_id = 2;
21246
21247    // The terminated reason associated with the subscription state.
21248    // Used as a dimension
21249    optional TerminatedReason reason = 3;
21250
21251    // Whether or not the NOTIFY received contained at least one body with PIDF
21252    // content before moving to the terminated state.
21253    // Used as a dimension
21254    optional bool content_body_received = 4;
21255
21256    // The count of PIDF info received that contained RCS caps.
21257    optional int32 rcs_caps_count = 5;
21258
21259    // The count of PIDF info received that contained MMTEL caps.
21260    optional int32 mmtel_caps_count = 6;
21261
21262    // The count of PIDF info received that contained no mmtel or RCS caps.
21263    optional int32 no_caps_count = 7;
21264
21265    // The count that matches the above conditions;
21266    optional int32 count = 8;
21267}
21268
21269/**
21270 * Tracks GBA requests from applications
21271 *
21272 * Logged from:
21273 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
21274 */
21275message GbaEvent {
21276    enum FailedReason {
21277        UNKNOWN = 0;
21278        FEATURE_NOT_SUPPORTED = 1;
21279        FEATURE_NOT_READY = 2;
21280        NETWORK_FAILURE = 3;
21281        INCORRECT_NAF_ID = 4;
21282        SECURITY_PROTOCOL_NOT_SUPPORTED = 5;
21283    }
21284    // Carrier ID of the SIM used for IMS registration.
21285    // See https://source.android.com/devices/tech/config/carrierid.
21286    // Used as a dimension
21287    optional int32 carrier_id = 1;
21288
21289    // Index of the SIM used, 0 for single-SIM devices.
21290    // Used as a dimension
21291    optional int32 slot_id = 2;
21292
21293    // Whether the GBA event is successful.
21294    // Used as a dimension
21295    optional bool successful = 3;
21296
21297    // Gba authentication failed reason.
21298    // Used as a dimension
21299    optional FailedReason failed_reason = 4;
21300
21301    // The count that matches the above conditions.
21302    optional int32 count = 5;
21303}
21304
21305/*
21306 * Logs details of initiated UWB ranging session
21307 * Logged from packages/modules/Uwb/service/java/com/android/server/uwb/UwbMetrics.java
21308 */
21309message UwbSessionInitiated {
21310    // UWB profiles
21311    optional android.uwb.Profile profile = 1;
21312    // Scrambled timestamp sequence (STS) Type
21313    optional android.uwb.Sts sts = 2;
21314    // Was it an initiator as opposed to responder?
21315    optional bool is_initiator = 3;
21316    // Was it a controller as opposed to controlee?
21317    optional bool is_controller = 4;
21318    // Was the discovery done by the framework?
21319    optional bool is_discovered_by_framework = 5;
21320    // Was it out-of-band connection as opposed to in-band connection?
21321    // Note that this field is ignored if is_discovered_by_framework is false.
21322    optional bool is_out_of_band = 6;
21323    // UWB channel 5, 6, 9, etc.
21324    optional int32 channel = 7;
21325    // The status code of session initialization.
21326    optional android.uwb.Status status = 8;
21327    // Initialization latency in ms if is_discovered_by_framework is true.
21328    optional int32 latency_ms = 9;
21329    // Initialization latency in step size of 200 ms if is_discovered_by_framework is true.
21330    optional int32 latency_200ms = 10;
21331    // The uid of the app that initiates the connection.
21332    optional int32 uid = 11 [(is_uid) = true];
21333    // Ranging interval of the session in ms.
21334    optional int32 ranging_interval_ms = 12;
21335    // How many ongoing session when current session is initiated?
21336    optional int32 parallel_session_count = 13;
21337    // Composed value for UWB filter configurations.
21338    // This value combines the boolean value of multiple feature flags for
21339    // UWB filter configuration into one integer, where the bits of its binary value
21340    // are for the flags
21341    // Below are the flags from LSB to MSB, 1 for enabled and 0 for disabled
21342    // bit 0: filter_enabled
21343    // bit 1: enable_azimuth_mirroring
21344    // bit 2: enable_primer_aoa
21345    // bit 3: enable_primer_est_elevation
21346    // bit 4: enable_primer_fov
21347    // bit 5: predict_rear_azimuths
21348    // For example, when all flags are enabled this value is 63 (0b111111)
21349    // Refer to packages/modules/Uwb/service/ServiceUwbResources/res/values/config.xml
21350    // for more information about the flags
21351    optional int32 filter_config_value = 14;
21352}
21353
21354/*
21355 * Logs details of closed UWB ranging session
21356 * Logged from packages/modules/Uwb/service/java/com/android/server/uwb/UwbMetrics.java
21357 */
21358message UwbSessionClosed {
21359    // UWB profiles
21360    optional android.uwb.Profile profile = 1;
21361    // Scrambled timestamp sequence (STS) Type
21362    optional android.uwb.Sts sts = 2;
21363    // Was it an initiator as opposed to responder?
21364    optional bool is_initiator = 3;
21365    // Was it a controller as opposed to controlee?
21366    optional bool is_controller = 4;
21367    // Was the connection done by the app as opposed to by the framework?
21368    optional bool is_framework_initiated = 5;
21369    // Was it out-of-band connection as opposed to in-band connection?
21370    // Note that this field is ignored if is_framework_initiated is false.
21371    optional bool is_out_of_band = 6;
21372    // Session active duration in seconds
21373    optional int32 duration_sec = 7;
21374    // Session active duration bucket
21375    optional android.uwb.DurationBucket duration_bucket = 8;
21376    // Total ranging measurement count
21377    optional int32 ranging_count = 9;
21378    // Valid ranging measurement count
21379    optional int32 valid_ranging_count = 10;
21380    // Ranging measurement count bucket.
21381    optional android.uwb.CountBucket ranging_count_bucket = 11;
21382    // Valid ranging measurement count bucket.
21383    optional android.uwb.CountBucket valid_ranging_count_bucket = 12;
21384    // Ranging start count
21385    optional int32 start_count = 13;
21386    // Ranging start failure count
21387    optional int32 start_failure_count = 14;
21388    // Ranging start without valid ranging result count
21389    optional int32 start_no_valid_report_count = 15;
21390    // Total Rx data packet count
21391    optional int32 rx_packet_count = 16;
21392    // Total Tx data packet count
21393    optional int32 tx_packet_count = 17;
21394    // Count of Rx data packet with error
21395    optional int32 rx_error_count = 18;
21396    // Count of Tx data packet with error
21397    optional int32 tx_error_count = 19;
21398    // Count of Rx data packets sent to upper layer
21399    optional int32 rx_to_upper_layer_count = 20;
21400    // Ranging Measurement Type
21401    optional android.uwb.RangingType ranging_type = 21;
21402}
21403
21404/*
21405 * Logs details of start UWB ranging
21406 * Logged from packages/modules/Uwb/service/java/com/android/server/uwb/UwbMetrics.java
21407 */
21408message UwbStartRanging {
21409    // UWB profiles
21410    optional android.uwb.Profile profile = 1;
21411    // Scrambled timestamp sequence (STS) Type
21412    optional android.uwb.Sts sts = 2;
21413    // Was it an initiator as opposed to responder?
21414    optional bool is_initiator = 3;
21415    // Was it a controller as opposed to controlee?
21416    optional bool is_controller = 4;
21417    // Was the connection done by the app as opposed to by the framework?
21418    optional bool is_framework_initiated = 5;
21419    // Was it out-of-band connection as opposed to in-band connection?
21420    // Note that this field is ignored if is_framework_initiated is false.
21421    optional bool is_out_of_band = 6;
21422    // The status code of ranging start.
21423    optional android.uwb.RangingStatus status = 7;
21424}
21425
21426/*
21427 * Log that the ranging measurement is received
21428 * Logged from packages/modules/Uwb/service/java/com/android/server/uwb/UwbMetrics.java
21429 */
21430message UwbRangingMeasurementReceived {
21431    // UWB profiles
21432    optional android.uwb.Profile profile = 1;
21433    // None-Line-of-sight (LOS) indication
21434    optional android.uwb.Nlos nlos = 2;
21435    // Was the distance valid?
21436    optional bool is_distance_valid = 3;
21437    // The distance measurement in centimeters.
21438    optional int32 distance_cm = 4;
21439    // The distance measurement in step size of 50 cm
21440    optional int32 distance_50cm = 5;
21441    // RSSI of ranging report, in dBm
21442    optional int32 rssi = 6;
21443    // Was azimuth angle valid?
21444    optional bool is_azimuth_valid = 7;
21445    // The azimuth angle measurement in degrees.
21446    optional int32 azimuth_degree = 8;
21447    // The azimuth angle measurement in step size of 10 degree.
21448    optional int32 azimuth_10degree = 9;
21449    // The figure of merit of azimuth angle measurement.
21450    optional int32 azimuth_fom = 10;
21451    // Was elevation angle valid?
21452    optional bool is_elevation_valid = 11;
21453    // The elevation angle measurement in degrees.
21454    optional int32 elevation_degree = 12;
21455    // The elevation angle measurement in step size of 10 degree.
21456    optional int32 elevation_10degree = 13;
21457    // The figure of merit of elevation angle measurement.
21458    optional int32 elevation_fom = 14;
21459    // Ranging Measurement Type
21460    optional android.uwb.RangingType ranging_type = 15;
21461    // The filtered distance measurement in centimeters.
21462    optional int32 filtered_distance_cm = 16;
21463    // The filtered azimuth angle measurement in degrees.
21464    optional int32 filtered_azimuth_degree = 17;
21465    // The filtered figure of merit of azimuth angle measurement.
21466    optional int32 filtered_azimuth_fom = 18;
21467    // The filtered elevation angle measurement in degrees.
21468    optional int32 filtered_elevation_degree = 19;
21469    // The filtered figure of merit of elevation angle measurement.
21470    optional int32 filtered_elevation_fom = 20;
21471}
21472
21473/*
21474 * Log that the first ranging measurement is received
21475 * Logged from packages/modules/Uwb/service/java/com/android/server/uwb/UwbMetrics.java
21476 */
21477message UwbFirstRangingReceived {
21478    // UWB profiles
21479    optional android.uwb.Profile profile = 1;
21480    // The latency between the ranging start/resume and 1st ranging measurement, in ms.
21481    optional int32 latency_ms = 2;
21482    // The ranging latency in 200ms.
21483    optional int32 latency_200ms = 3;
21484}
21485
21486/*
21487 * Log that UWB device error is detected
21488 * Logged from packages/modules/Uwb/service/java/com/android/server/uwb/UwbMetrics.java
21489 */
21490message UwbDeviceErrorReported {
21491    enum Type {
21492        UNKNOWN = 0;
21493        // Initialization error
21494        INIT_ERROR = 1;
21495        // Device status error
21496        DEVICE_STATUS_ERROR = 2;
21497        // UCI generic error
21498        UCI_GENERIC_ERROR = 3;
21499    }
21500    // Error type
21501    optional Type type= 1;
21502}
21503
21504/**
21505 * Log that the clipboard has been cleared
21506 * Logged from frameworks/base/services/core/java/android/content/ClipboardAutoWipeService.java
21507 */
21508message ClipboardCleared {
21509    enum Source {
21510        SOURCE_UNKNOWN = 0;
21511        AUTO_CLEAR = 1;
21512    }
21513
21514    // Source of the wipe
21515    optional Source source = 1;
21516}
21517
21518/**
21519 * Pulls status for a SIM.
21520 *
21521 * Each pull creates multiple atoms, one for each SIM. The atom holds the status for a SIM that's
21522 * sensitive per carrier. The atom would be aggregated per carrier for analysis.
21523 *
21524 * Pulled from:
21525 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
21526 */
21527message PerSimStatus {
21528    enum WfcMode {
21529        UNKNOWN = 0;
21530        WIFI_ONLY = 1;
21531        CELLULAR_PREFERRED = 2;
21532        WIFI_PREFERRED = 3;
21533    }
21534    enum SimVoltageClass {
21535        VOLTAGE_CLASS_UNKNOWN = 0;
21536        VOLTAGE_CLASS_A = 1;
21537        VOLTAGE_CLASS_B = 2;
21538        VOLTAGE_CLASS_C = 3;
21539    }
21540
21541    // Index of the SIM, 0 for single-SIM devices.
21542    optional int32 sim_slot_index = 1;
21543
21544    // Carrier ID of the SIM.
21545    // See https://source.android.com/devices/tech/config/carrierid.
21546    optional int32 carrier_id = 2;
21547
21548    // Indicates whether phone number source UICC provides a phone number
21549    // and whether it agrees with other sources:
21550    //  - 0: no number provided
21551    //  - a positive integer (> 0): sources providing the same phone number
21552    //    shall use the same integer. The integer shall start from 1, and
21553    //    for each new unique source the next integer (2, 3, …) is used.
21554    // This way, the raw phone number cannot be derived from the value of
21555    // this field.
21556    // This also allows a quick check of conflicts: any field > 1 means conflict,
21557    // and the max means the count of unique phone numbers.
21558    optional int32 phone_number_source_uicc = 3;
21559
21560    // Indicates whether phone number source CARRIER provides a phone number
21561    // and whether it agrees with other sources.
21562    // See field phone_number_source_uicc.
21563    optional int32 phone_number_source_carrier = 4;
21564
21565    // Indicates whether phone number source IMS provides a phone number
21566    // and whether it agrees with other sources.
21567    // See field phone_number_source_uicc.
21568    optional int32 phone_number_source_ims = 5;
21569
21570    // Indicates whether VoLTE is enabled
21571    optional bool volte_enabled = 6;
21572
21573    // Indicates whether WFC is enabled
21574    optional bool wfc_enabled = 7;
21575
21576    // Indicates the user's WFC mode
21577    optional WfcMode wfc_mode = 8;
21578
21579    // Indicates the user's WFC mode when roaming
21580    optional WfcMode wfc_roaming_mode = 9;
21581
21582    // Indicates the user's setting for video calling.
21583    optional bool video_calling_enabled = 10;
21584
21585    // Indicates if data roaming is enabled
21586    optional bool data_roaming_enabled = 11;
21587
21588    // Indicates the list of networks allowed by the user. Bitmask is encoded as
21589    // TelephonyManager#NetworkTypeBitMask.
21590    optional int64 allowed_networks_by_user = 12;
21591
21592    // Indicates if 2G is disabled by the user using the "Allow 2G" toggle
21593    optional bool is_2g_disabled = 13;
21594
21595    // Indicates if PIN1 of the SIM card is enabled
21596    optional bool is_pin1_enabled = 14;
21597
21598    // Indicates the lowest voltage class supported by the SIM
21599    optional SimVoltageClass sim_voltage_class = 15;
21600
21601    // APN type bitmask of the APNs added or modified by user:
21602    // @ApnType in frameworks/base/telephony/java/android/telephony/Annotation.java.
21603    optional int32 user_modified_apn_type_bitmask = 16;
21604
21605    // Indicates the unmetered networks
21606    // Bitmask is encoded as TelephonyManager#NetworkTypeBitMask.
21607    optional int64 unmetered_networks = 17;
21608
21609    // Indicates whether VoNR is enabled
21610    optional bool vonr_enabled = 18;
21611
21612    // Indicates whether cross-SIM calling (WiFi calling over cellular data) is
21613    // enabled.
21614    optional bool cross_sim_calling_enabled = 19;
21615}
21616
21617/*
21618 * Logs Device Scan State events generated by Nearby Scan API.
21619 */
21620message NearbyDeviceScanStateChanged {
21621  // Uid of the client that triggers the Nearby scan.
21622  optional int32 uid = 1 [(is_uid) = true];
21623
21624  // Scan start timestamp as session id.
21625  optional int64 scan_session_id = 2;
21626
21627  // Scan state.
21628  optional android.nearby.NearbyScanState scan_state = 3;
21629
21630  // Scan type.
21631  optional android.nearby.NearbyScanType scan_type = 4;
21632
21633  // Medium that this device was discovered/lost.
21634  optional android.nearby.NearbyNetworkMedium network_medium = 5;
21635
21636  // Received Signal Strength Indication (RSSI) value of the device discovered/lost.
21637  optional int32 rssi = 6;
21638
21639  // Model of the device discovered/lost.
21640  optional string scanned_device_model = 7;
21641
21642  // Manufacturer of the device discovered/lost.
21643  optional string scanned_device_manufacturer = 8;
21644}
21645
21646/**
21647 * Logs when locales of an application are changed.
21648 * Logged from
21649 *   frameworks/base/services/core/java/com/android/server/locales/LocaleManagerService.java
21650 */
21651message ApplicationLocalesChanged {
21652    // The uid which invoked this update. The locales for an application
21653    // could be changed from the in-app picker OR from the settings UI.
21654    optional int32 calling_uid = 1 [(is_uid) = true];
21655
21656    // The uid for which the locale change is being done.
21657    optional int32 target_uid = 2 [(is_uid) = true];
21658
21659    // The new locales for the target package. A comma separated list of BCP 47
21660    // locale identifiers, compatible with LocaleList#forLanguageTags.
21661    optional string new_locales = 3;
21662
21663    // The previous locales for the target package. A comma separated list of
21664    // BCP 47 locale identifiers, compatible with LocaleList#forLanguageTags.
21665    optional string prev_locales = 4;
21666
21667    // Application locales changed status.
21668    enum Status {
21669        // A placeholder for unspecified values.
21670        STATUS_UNSPECIFIED = 0;
21671
21672        // New locales were committed.
21673        CONFIG_COMMITTED = 1;
21674
21675        // Likely because no change is required.
21676        CONFIG_UNCOMMITTED = 2;
21677
21678        // Failed because the target package is invalid.
21679        FAILURE_INVALID_TARGET_PACKAGE = 3;
21680
21681        // Failed because the calling package does not have the required permission.
21682        FAILURE_PERMISSION_ABSENT = 4;
21683    }
21684
21685    optional Status status = 5;
21686
21687    // The caller where changes application locales.
21688    enum Caller {
21689        // A placeholder for unknown value.
21690        CALLER_UNKNOWN = 0;
21691
21692        // The change was called from the delegate.
21693        CALLER_DELEGATE = 1;
21694
21695        // The change was called from Apps.
21696        CALLER_APPS = 2;
21697
21698        // The change was called from the system due to backup and restore.
21699        CALLER_BACKUP_RESTORE = 3;
21700
21701        // The change was called from the system when the app languages
21702        // feature or the set per-app locales was changed from opt-in to
21703        // opt-out.
21704        CALLER_APP_UPDATE_LOCALES_CHANGE = 4;
21705
21706        // The change was called from the system due to the dynamic locales
21707        // change.
21708        CALLER_DYNAMIC_LOCALES_CHANGE = 5;
21709    }
21710
21711    optional Caller caller = 6;
21712}
21713
21714/* Logs when the display HBM state changes.
21715 *
21716 * Logged from:
21717 *   frameworks/base/services/core/java/com/android/server/display/HighBrightnessModeController.java
21718 */
21719message DisplayHbmStateChanged {
21720    optional int32 display_id = 1;
21721
21722    // New HBM state
21723    optional android.server.display.HbmState state = 2;
21724
21725    // The reason the state changes.
21726    optional android.server.display.HbmStateTransitionReason reason = 3;
21727}
21728
21729/*
21730 * Logs when the display HBM brightness changes.
21731 * Logged from:
21732 *   frameworks/base/services/core/java/com/android/server/display/AutomaticBrightnessControllerjava
21733 */
21734message DisplayHbmBrightnessChanged {
21735    optional int32 display_id = 1;
21736
21737    // display brightness
21738    optional float brightness = 2;
21739}
21740
21741/**
21742 * Per-UID time spent running work on the GPU.
21743 *
21744 * Each pull creates multiple atoms, one per (GPU ID, UID) pair, for at most 10
21745 * randomly selected UIDs.
21746 *
21747 * Pulled from:
21748 *    frameworks/native/services/gpuservice/gpuwork/GpuWork.cpp
21749 */
21750message GpuWorkPerUid {
21751  // The UID (i.e. app id) that scheduled work on the GPU.
21752  optional int32 uid = 1 [(is_uid) = true];
21753
21754  // The GPU ID for which we have work information.
21755  optional int32 gpu_id = 2;
21756
21757  // The time duration (in seconds) over which this data was collected (most
21758  // likely 24 hours).
21759  optional int32 time_duration_seconds = 3;
21760
21761  // The total amount of time (in milliseconds) the GPU spent running work for
21762  // |uid|.
21763  optional int32 total_active_duration_millis = 4;
21764
21765  // The total amount of time (in milliseconds) the GPU was inactive while
21766  // running "continuous" work for |uid|. This is estimated by adding up the
21767  // duration of the small gaps between GPU work for |uid|.
21768  optional int32 total_inactive_duration_millis = 5;
21769}
21770
21771/**
21772 * Logs when entries are dropped in DropBox and the reason for the drop.
21773 *
21774 * Logged from: frameworks/base/services/
21775 */
21776message DropboxEntryDropped {
21777    // Explains at which stage of the DropBox workflow the entry was dropped.
21778    enum DropReason {
21779        UNKNOWN = 0;
21780        CLEARING_DATA = 3;
21781        AGED = 4;
21782        WRITE_FAILURE = 5;
21783        ENTRY_TOO_LARGE = 6;
21784
21785        reserved 1, 2;
21786    }
21787
21788    optional DropReason drop_reason = 1;
21789
21790    // Tag describing the type of dropbox entry.
21791    optional string tag = 2;
21792
21793    // The age (millis) of the dropped dropbox entry.
21794    optional int64 age_millis = 3;
21795}
21796
21797message PersistentUriPermissionsFlushed {
21798    // Current amount of persistent uri permissions overall
21799    optional int32 permissions_flushed_amount = 1;
21800}
21801
21802message PersistentUriPermissionsAmountPerPackage {
21803    // The uid persistent uri permissions amount reported for
21804    optional int32 uid = 1 [(is_uid) = true];
21805    // Current amount of persistent uri permissions for this package
21806    optional int32 amount = 2;
21807}
21808
21809/**
21810 * VBMeta Digest cryptographically encapsulates the composition of signed images or partitions of
21811 * a particular build.
21812 *
21813 * Logs when boot is complete.
21814 * Pushed from:
21815 *    frameworks/base/services/core/java/com/android/server/BinaryTransparencyService.java
21816 */
21817message VBMetaDigestReported {
21818    // the hex encoded string of VBMeta Digest value
21819    optional string vbmeta_digest = 1;
21820}
21821
21822/**
21823 * APEXs can either be signed by Google or OEMs. This atom captures basic metadata of APEXs
21824 * pre-installed on a build or a device.
21825 *
21826 * Logs when boot is complete.
21827 * Pushed from:
21828 *    frameworks/base/services/core/java/com/android/server/BinaryTransparencyService.java
21829 */
21830message ApexInfoGathered {
21831    // APEX package names are determined by OEMs
21832    optional string package_name = 1;
21833    // the version code of the APEX
21834    optional int64 version_code = 2;
21835
21836    // the hex encoded value of digest of the content of this APEX
21837    // we are deprecating the use of this going forward
21838    optional string content_digest = 3;
21839
21840    // the algorithm that the content digest is computed
21841    optional com.android.os.transparency.DigestAlgorithmType algo_type = 4;
21842
21843    // the SHA256 digest(s) of the APEX's signer certificate(s)
21844    repeated string signer_sha256_digest = 5;
21845}
21846
21847/**
21848 * MobileBundledApps (MBAs) include preloaded apps and apps that are installed in the background
21849 * without user knowledge/consent.
21850 *
21851 * However, note that we will only be recording *updated* preloaded apps + dynamic MBAs.
21852 *
21853 * Pushed from:
21854 *    frameworks/base/services/core/java/com/android/server/BinaryTransparencyService.java
21855 *
21856 * Next ID: 12
21857 */
21858message MobileBundledAppInfoGathered {
21859    // MBA package names are determined by developers (which can include OEMs)
21860    optional string package_name = 1;
21861    // the package version code of the MBA
21862    optional int64 version_code = 2;
21863    // the split name (empty if it's the base)
21864    optional string split_name = 11;
21865
21866    // the hex encoded value of digest of the content of the MBA
21867    optional string content_digest = 3;
21868    // the algorithm that the content_digest is computed
21869    optional com.android.os.transparency.DigestAlgorithmType algo_type = 4;
21870    // the SHA256 digest(s) of the APEX's signer certificate(s)
21871    repeated string signer_sha256_digest = 5;
21872
21873    enum MBAStatus {
21874        ERROR = 0;
21875        PRELOADED = 1;
21876        UPDATED_PRELOAD = 2;
21877        NEW_MBA = 3;
21878        UPDATED_NEW_MBA = 4;
21879    }
21880    // whether or not the MBA is preloaded or dynamically installed
21881    optional MBAStatus mba_status = 6;
21882    // the package that initiated the installation of this MBA
21883    optional string initiator = 7;
21884    // the SHA256 digest(s) of the initiator's signer certificate(s)
21885    repeated string initiator_signer_sha256_digest = 8;
21886    // the package that installs this MBA
21887    optional string installer = 9;
21888    // the package on behalf of which initiator requested the installation of this MBA
21889    optional string originator = 10;
21890}
21891
21892/**
21893 * PVM is protected virtual machine. This atom captures the notion of a container
21894 * that describes a virtual machine.
21895 *
21896 * Will be pushed from:
21897 *      frameworks/base/services/core/java/com/android/server/BinaryTransparencyService.java
21898 */
21899message PvmInfoGathered {
21900    // PVM names are determined by OEMs
21901    optional string name = 1;
21902    // an int describing the version of the VM
21903    optional int64 version = 2;
21904    // the hex encoded SHA256 digest of the pvm descriptor file
21905    optional string sha256_digest = 3;
21906}
21907
21908/**
21909 * This will be pulled from
21910 *     frameworks/base/services/core/java/com/android/server/BinaryTransparencyService.java
21911 */
21912message SignedPartitionInfo {
21913    // partition name (e.g. vendor, product) is determined by OEM
21914    optional string partition_name = 1;
21915    // the hex encoded SHA256 digest of the partition image file
21916    optional string sha256_digest = 2;
21917}
21918
21919/**
21920 * Logs when Wear Settings UI is interacted with
21921 */
21922message WearSettingsUIInteracted {
21923    /** The UI action category */
21924    optional android.app.wearsettings.Action action = 1;
21925
21926    /** The ID of the entry that the users actioned on. */
21927    optional android.app.wearsettings.ItemId item_id = 2;
21928}
21929
21930message TracingServiceReportEvent {
21931    enum Event {
21932      TRACING_SERVICE_REPORT_UNDEFINED = 0;
21933
21934      // Checkpoints inside TracingServiceProxy.
21935      TRACING_SERVICE_REPORT_BEGIN = 1;
21936      TRACING_SERVICE_REPORT_SVC_HANDOFF = 2;
21937
21938      // Guardrails inside TracingServiceProxy.
21939      TRACING_SERVICE_REPORT_BIND_PERM_INCORRECT = 3;
21940      TRACING_SERVICE_REPORT_SVC_PERM_MISSING = 4;
21941      TRACING_SERVICE_REPORT_SVC_COMM_ERROR = 5;
21942  }
21943
21944  // Which stage of the pipeline we are reporting from.
21945  optional Event event = 1;
21946
21947  // UUID of the trace.
21948  optional int64 trace_uuid_lsb = 2;
21949  optional int64 trace_uuid_msb = 3;
21950}
21951
21952/** Pulled from PinnerService. */
21953message PinnedFileSizesPerPackage {
21954    // If the file is pinned but not as part of a specific pinned app,
21955    // this will be set to 1000 - the value of system_server.
21956    optional int32 uid = 1 [(is_uid) = true];
21957
21958    // Consists of only the pinned file's filename, not its full path; for example
21959    // Given a pinned file at ‘/vendor/lib64/libCB.so’, then this field will be
21960    // Determined to have have the value ‘libCB.so’.
21961    optional string filename = 2;
21962
21963    // The size of the pinned file, in kilobytes.
21964    optional int32 size_kb = 3;
21965}
21966
21967/** Pulled from PendingIntentController. */
21968message PendingIntentsPerPackage {
21969    // The UID of the app that sent the PendingIntent.
21970    optional int32 uid = 1 [(is_uid) = true];
21971    // The total number of currently active PendingIntents belonging to this uid.
21972    optional int32 pending_intent_count = 2;
21973    // The total size of all currently active PendingIntents belonging to this uid, in kilobytes.
21974    optional int32 pending_intent_total_bundle_size_kb = 3;
21975}
21976
21977/*
21978 * Logs changes to game state set by game applications via GameService.
21979 */
21980message GameStateChanged {
21981    enum State {
21982        // Game mode is unknown.
21983        MODE_UNKNOWN = 0;
21984
21985        // The game is not in active play, e.g.e the user is using a game menu.
21986        MODE_NONE = 1;
21987
21988        // The game is in active, but interruptible, game play.
21989        MODE_GAMEPLAY_INTERRUPTIBLE = 2;
21990
21991        // The game is in active user play mode, which cannot be interrupted.
21992        MODE_GAMEPLAY_UNINTERRUPTIBLE = 3;
21993
21994        // The current content shown is not gameplay related (e.g. an ad).
21995        MODE_CONTENT = 4;
21996    }
21997
21998    // Provided to ensure package is available even with UID sharing.
21999    optional string package_name = 1;
22000
22001    // The UID (i.e. app id).
22002    optional int32 uid = 2 [(is_uid) = true];
22003
22004    // Whether the device enabled performance boost when the state was changed.
22005    optional bool boost_enabled = 3;
22006
22007    // This includes a top-level state for the game.
22008    optional State state = 4;
22009
22010    // Indicates if the game is loading assets/resources/compiling/etc.
22011    optional bool is_loading = 5;
22012
22013    // A developer-selected enum, for example to indicate level or scene.
22014    optional int32 label = 6;
22015
22016    // A developer-supplied enum, e.g. to indicate the current quality level.
22017    optional int32 quality = 7;
22018}
22019
22020/**
22021 * Log the duration of executing all receivers of LOCKED_BOOT_COMPLETED or BOOT_COMPLETED broadcast.
22022 * The dispatch latency is the dispatchTime - enqueueTime.
22023 * The completion latency is the completeTime - enqueueTime.
22024 * Logged from:
22025 *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
22026 */
22027message BootCompletedBroadcastCompletionLatencyReported {
22028    enum Event {
22029        UNKNOWN = 0;
22030        LOCKED_BOOT_COMPLETED = 1;
22031        BOOT_COMPLETED = 2;
22032    }
22033
22034    optional Event event = 1;
22035    // from enqueueTime to dispatchTime.
22036    optional int32 dispatch_latency_uptime_millis = 2;
22037    // from enqueueTime to completeTime.
22038    optional int32 complete_latency_uptime_millis = 3;
22039    // from enqueueRealTime to dispatchRealTime.
22040    optional int32 dispatch_latency_realtime_millis = 4;
22041    // from enqueueRealTime to completeRealTime.
22042    optional int32 complete_latency_realtime_millis = 5;
22043
22044    optional int32 user_id = 6;
22045    optional UserLifecycleJourneyReported.UserType user_type = 7;
22046}
22047
22048/**
22049 * Log that the permission reminder notification has been displayed or clicked.
22050 */
22051message PermissionReminderNotificationInteracted {
22052    // id which identifies single session of user interacting with permission
22053    // controller
22054    optional int64 session_id = 1;
22055
22056    enum Result {
22057        UNDEFINED = 0;
22058        // notification was presented to the user
22059        NOTIFICATION_PRESENTED = 1;
22060        // notification was clicked by the user
22061        NOTIFICATION_CLICKED = 2;
22062    }
22063
22064    // View / interaction recorded
22065    optional Result result = 2;
22066}
22067
22068/**
22069 * Log that the user has interacted with the permission decision screen.
22070 */
22071message RecentPermissionDecisionsInteracted {
22072    // id which identifies single session of user interacting with permission
22073    // controller
22074    optional int64 session_id = 1;
22075
22076    enum Action {
22077        ACTION_UNKNOWN = 0;
22078        SCREEN_VIEWED = 1;
22079        REVIEW_DECISION = 2;
22080        VIEW_ALL_CLICKED = 3;
22081    }
22082
22083    // Action taken on the recent permission decisions page.
22084    optional Action action = 2;
22085
22086    // Uid of the package for the permission decision being reviewed
22087    optional int32 uid = 3 [(is_uid) = true];
22088
22089    // Name of the permission for the permission decision being reviewed.
22090    optional string permission_group_name = 4;
22091}
22092
22093/**
22094 * Logs information about app background restrictions.
22095 *
22096 * Logged from:
22097 *      frameworks/base/services/core/java/com/android/server/am/AppRestrictionController.java
22098 */
22099message AppBackgroundRestrictionsInfo {
22100    // the uid of the app.
22101    optional int32 uid = 1 [(is_uid) = true];
22102
22103    enum RestrictionLevel {
22104        LEVEL_UNKNOWN = 0;
22105        LEVEL_UNRESTRICTED = 1;
22106        LEVEL_EXEMPTED = 2;
22107        LEVEL_ADAPTIVE_BUCKET = 3;
22108        LEVEL_RESTRICTED_BUCKET = 4;
22109        LEVEL_BACKGROUND_RESTRICTED = 5;
22110        LEVEL_HIBERNATION = 6;
22111    }
22112    // indicates the app background restriction level.
22113    optional RestrictionLevel restriction_level = 2;
22114
22115    enum Threshold {
22116        THRESHOLD_UNKNOWN = 0;
22117        THRESHOLD_RESTRICTED = 1; // app was background restricted by the system.
22118        THRESHOLD_USER = 2; // app was background restricted by user action.
22119    }
22120    // indicates which threshold caused the app to be put into bg restriction.
22121    optional Threshold threshold = 3;
22122
22123    enum StateTracker {
22124        UNKNOWN_TRACKER = 0;
22125        BATTERY_TRACKER = 1;
22126        BATTERY_EXEMPTION_TRACKER = 2;
22127        FGS_TRACKER = 3;
22128        MEDIA_SESSION_TRACKER = 4;
22129        PERMISSION_TRACKER = 5;
22130        BROADCAST_EVENTS_TRACKER = 6;
22131        BIND_SERVICE_EVENTS_TRACKER = 7;
22132    }
22133    // indicates the reason/tracker which caused the app to hit the threshold.
22134    optional StateTracker tracker = 4;
22135
22136    message FgsTrackerInfo {
22137        // indicates whether an fgs notification was visible for this app or not.
22138        optional bool fgs_notification_visible = 1;
22139        // total FGS duration for this app.
22140        optional int64 fgs_duration = 2;
22141    }
22142    optional FgsTrackerInfo fgs_tracker_info = 5 [(log_mode) = MODE_BYTES];
22143
22144    message BatteryTrackerInfo {
22145        // total battery usage within last 24h (1/10000th)
22146        optional int32 battery_24h = 1;
22147        // background battery usage (1/10000th)
22148        optional int32 battery_usage_background = 2;
22149        // FGS battery usage (1/10000th)
22150        optional int32 battery_usage_fgs = 3;
22151        // Foreground battery usage (1/10000th)
22152        optional int32 battery_usage_foreground = 4;
22153        // Cached battery usage (1/10000th)
22154        optional int32 battery_usage_cached = 5;
22155    }
22156    optional BatteryTrackerInfo battery_tracker_info = 6 [(log_mode) = MODE_BYTES];
22157
22158    message BroadcastEventsTrackerInfo {
22159        // the number of broadcasts sent by this app.
22160        optional int32 broadcasts_sent = 1;
22161    }
22162    optional BroadcastEventsTrackerInfo broadcast_events_tracker_info = 7 [(log_mode) = MODE_BYTES];
22163
22164    message BindServiceEventsTrackerInfo {
22165        // the number of bind service requests by this app.
22166        optional int32 bind_service_requests = 1;
22167    }
22168    optional BindServiceEventsTrackerInfo bind_service_events_tracker_info =
22169        8 [(log_mode) = MODE_BYTES];
22170
22171    // The reasons listed below are defined in PowerExemptionManager.java
22172    enum ExemptionReason {
22173        // range 0-9 is reserved for default reasons
22174        REASON_UNKNOWN = 0;
22175        REASON_DENIED = 1;
22176        REASON_OTHER = 2;
22177        // range 10-49 is reserved for BG-FGS-launch allowed proc states
22178        REASON_PROC_STATE_PERSISTENT = 10;
22179        REASON_PROC_STATE_PERSISTENT_UI = 11;
22180        REASON_PROC_STATE_TOP = 12;
22181        REASON_PROC_STATE_BTOP = 13;
22182        REASON_PROC_STATE_FGS = 14;
22183        REASON_PROC_STATE_BFGS = 15;
22184        // range 50-99 is reserved for BG-FGS-launch allowed reasons
22185        REASON_UID_VISIBLE = 50;
22186        REASON_SYSTEM_UID = 51;
22187        REASON_ACTIVITY_STARTER = 52;
22188        REASON_START_ACTIVITY_FLAG = 53;
22189        REASON_FGS_BINDING = 54;
22190        REASON_DEVICE_OWNER = 55;
22191        REASON_PROFILE_OWNER = 56;
22192        REASON_COMPANION_DEVICE_MANAGER = 57;
22193        REASON_BACKGROUND_ACTIVITY_PERMISSION = 58;
22194        REASON_BACKGROUND_FGS_PERMISSION = 59;
22195        REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION = 60;
22196        REASON_INSTR_BACKGROUND_FGS_PERMISSION = 61;
22197        REASON_SYSTEM_ALERT_WINDOW_PERMISSION = 62;
22198        REASON_DEVICE_DEMO_MODE = 63;
22199        REASON_ALLOWLISTED_PACKAGE = 65;
22200        REASON_APPOP = 66;
22201        REASON_ACTIVITY_VISIBILITY_GRACE_PERIOD = 67;
22202        REASON_OP_ACTIVATE_VPN = 68;
22203        REASON_OP_ACTIVATE_PLATFORM_VPN = 69;
22204        REASON_TEMP_ALLOWED_WHILE_IN_USE = 70;
22205        REASON_CURRENT_INPUT_METHOD = 71;
22206        // range 100-199 is reserved for public reasons
22207        REASON_GEOFENCING = 100;
22208        REASON_PUSH_MESSAGING = 101;
22209        REASON_PUSH_MESSAGING_OVER_QUOTA = 102;
22210        REASON_ACTIVITY_RECOGNITION = 103;
22211        REASON_ACCOUNT_TRANSFER = 104;
22212        // range 200-299 is reserved for broadcast actions
22213        REASON_BOOT_COMPLETED = 200;
22214        REASON_PRE_BOOT_COMPLETED = 201;
22215        REASON_LOCKED_BOOT_COMPLETED = 202;
22216        REASON_BLUETOOTH_BROADCAST = 203;
22217        REASON_TIMEZONE_CHANGED = 204;
22218        REASON_TIME_CHANGED = 205;
22219        REASON_LOCALE_CHANGED = 206;
22220        REASON_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED = 207;
22221        REASON_REFRESH_SAFETY_SOURCES = 208;
22222        // range 300-399 is reserved for other internal reasons
22223        REASON_SYSTEM_ALLOW_LISTED = 300;
22224        REASON_ALARM_MANAGER_ALARM_CLOCK = 301;
22225        REASON_ALARM_MANAGER_WHILE_IDLE = 302;
22226        REASON_SERVICE_LAUNCH = 303;
22227        REASON_KEY_CHAIN = 304;
22228        REASON_PACKAGE_VERIFIER = 305;
22229        REASON_SYNC_MANAGER = 306;
22230        REASON_DOMAIN_VERIFICATION_V1 = 307;
22231        REASON_DOMAIN_VERIFICATION_V2 = 308;
22232        REASON_VPN = 309;
22233        REASON_NOTIFICATION_SERVICE = 310;
22234        REASON_PACKAGE_REPLACED = 311;
22235        REASON_LOCATION_PROVIDER = 312;
22236        REASON_MEDIA_BUTTON = 313;
22237        REASON_EVENT_SMS = 314;
22238        REASON_EVENT_MMS = 315;
22239        REASON_SHELL = 316;
22240        REASON_MEDIA_SESSION_CALLBACK = 317;
22241        REASON_ROLE_DIALER = 318;
22242        REASON_ROLE_EMERGENCY = 319;
22243        REASON_SYSTEM_MODULE = 320;
22244        REASON_CARRIER_PRIVILEGED_APP = 321;
22245        REASON_DPO_PROTECTED_APP = 322;
22246        REASON_DISALLOW_APPS_CONTROL = 323;
22247        REASON_ACTIVE_DEVICE_ADMIN = 324;
22248        REASON_MEDIA_NOTIFICATION_TRANSFER = 325;
22249        REASON_PACKAGE_INSTALLER = 326;
22250        REASON_SYSTEM_EXEMPT_APP_OP = 327;
22251        REASON_PACKAGE_UNARCHIVE = 328;
22252        REASON_TILE_ONCLICK = 329;
22253        // app requested to be exempt
22254        REASON_OPT_OUT_REQUESTED = 1000;
22255    }
22256    // indicates if the app is exempt from background restrictions and the reason if applicable.
22257    optional ExemptionReason exemption_reason = 9;
22258
22259    enum OptimizationLevel {
22260        UNKNOWN = 0;
22261        OPTIMIZED = 1;
22262        BACKGROUND_RESTRICTED = 2;
22263        NOT_OPTIMIZED = 3;
22264    }
22265    // the user choice for the optimization level of the app.
22266    optional OptimizationLevel opt_level = 10;
22267
22268    enum TargetSdk {
22269        SDK_UNKNOWN = 0;
22270        SDK_PRE_S = 1;
22271        SDK_S = 2;
22272        SDK_T = 3;
22273    }
22274    // indicates the target sdk level for this app.
22275    optional TargetSdk target_sdk = 11;
22276
22277    // indicates if the current device is a low ram device.
22278    optional bool low_mem_device = 12;
22279
22280    // indicates previous background restriction level.
22281    optional RestrictionLevel previous_restriction_level = 13;
22282}
22283
22284/**
22285 * Logs failure reason when MmsSmsProvider#getThreadId fails to return a threadId
22286 */
22287message MmsSmsProviderGetThreadIdFailed {
22288    enum FailureCode {
22289        FAILURE_UNKNOWN = 0;
22290        // Did not return a threadId due to recipients being passed in
22291        FAILURE_NO_RECIPIENTS = 1;
22292        FAILURE_FIND_OR_CREATE_THREAD_ID_SQL = 2;
22293        // Found more than one threadId for the given of recipients
22294        FAILURE_MULTIPLE_THREAD_IDS_FOUND = 3;
22295    }
22296
22297    optional FailureCode failure_code = 1;
22298}
22299
22300/**
22301 * Logs failure reason when MmsSmsDatabaseHelperOnUpgradeFailed fails on an upgrade step
22302 */
22303message MmsSmsDatabaseHelperOnUpgradeFailed {
22304    enum FailureCode {
22305        FAILURE_UNKNOWN = 0;
22306        FAILURE_IO_EXCEPTION = 1;
22307        FAILURE_SECURITY_EXCEPTION = 2;
22308        FAILURE_SQL_EXCEPTION = 3;
22309    }
22310
22311    // Database version being upgraded from
22312    optional int32 old_version = 1;
22313    // Database version being upgraded to
22314    optional int32 current_version = 2;
22315    // Version number of the database upgrade step that failed
22316    optional int32 upgrade_failed_to_version = 3;
22317    optional FailureCode failure_code = 4;
22318}
22319
22320/** Log for autofill events. This captures events till the view goes out of
22321 * focus. For each auttofilled view going out of focus, and coming back, a
22322 * separate event would be generated.
22323 *
22324 * Logged from:
22325 * frameworks/base/services/autofill/java/com/android/server/autofill/
22326 */
22327message AutofillPresentationEventReported {
22328  enum PresentationEventResult {
22329    NONE_SHOWN_UNKNOWN_REASON =
22330        0;  // Includes reasons where losses can be partial: eg: IME not showing
22331            // certain datasets, while others are filtered out because user
22332            // started typing. So, it can either refer to a set of mixed of
22333            // known or unknown reasons.
22334    ANY_SHOWN =
22335        1;  // This is counter to the event name, but we need it in order to get
22336            // overall success rate.
22337    // Below ones corresponds to no presentation getting shown
22338    NONE_SHOWN_VIEW_FOCUS_CHANGED =
22339        2;  // User action leads to focus getting shifted to another field
22340    NONE_SHOWN_VIEW_CHANGED =
22341        3;  // This would also include if view becomes invisible.
22342    NONE_SHOWN_ACTIVITY_FINISHED = 4;  // Eg: User pressed back
22343    NONE_SHOWN_REQUEST_TIMEOUT =
22344        5;  // Autofill provider didn't respond in the given time.
22345    NONE_SHOWN_SESSION_COMMITTED_PREMATURELY =
22346        6;  // Session was prematurely committed. This can happen due to various
22347            // reasons, eg: app developers calling commit() earlier than when
22348            // they should.
22349    NONE_SHOWN_FILL_REQUEST_FAILED =
22350        7; // Autofill provider request failed. Different from timeout.
22351    NONE_SHOWN_NO_FOCUS =
22352        8; // Autofill provider request was triggered pre-focus. User never
22353           // focussed on autofillable fields. This can happen for FillDialog
22354           // where we trigger fill request at layout time.
22355    NONE_SHOWN_VIEW_FOCUSED_BEFORE_FILL_DIALOG_RESPONSE =
22356        9; // Users focus a field before the fill dialogs response is returned.
22357    NONE_SHOWN_SUGGESTION_FILTER_OUT =
22358        10; // Suggestions were filtered out due to pre-existing text
22359  }
22360
22361  // Id number which increases for each subsequent request.
22362  optional int32 request_id = 1;
22363
22364  // SessionId to aggregate requests within a session, and see overall
22365  // performance.
22366  optional int32 session_id = 2;
22367
22368  // Result of autofill event.
22369  optional PresentationEventResult presentation_event_result = 3;
22370
22371  // Count of datasets that should've been available for display. If the request
22372  // times out, this won't be populated.
22373  optional int32 available_count = 4;
22374
22375  // Count of datasets that are shown to the user.
22376  optional int32 count_shown = 5;
22377
22378  // Count of datasets that are eligible to be shown to the user, but aren't
22379  // shown because user started typing already, and the results were filtered.
22380  // If the user starts typing, dataset isn't shown at the moment, but then the
22381  // user deletes text, and the dataset becomes visible, it would count as
22382  // shown, and not as filtered out.
22383  optional int32 count_filtered_user_typing = 6;
22384
22385  // Count of datasets that aren't shown because IME didn't use datasets at all.
22386  optional int32 count_not_shown_unused_by_ime = 7;
22387
22388  // Count of datasets that are eligible to be shown to the user, but aren't
22389  // shown because display didn't show them (probably user didn't scroll to see
22390  // the view). The dataset was requested by display, but not shown.
22391  optional int32 count_not_shown_never_visible = 8;
22392
22393  // How the dataset is supposed to be shown to the user
22394  optional AutofillDisplayPresentationType display_presentation_type = 9;
22395
22396  // Autofill Service Provider's uid
22397  optional int32 autofill_service_uid = 10 [(is_uid) = true];
22398
22399  // Inline suggestion host's uid. Populated only when
22400  // AutofillDisplayPresentationType = INLINE
22401  optional int32 inline_suggestion_host_uid = 11 [(is_uid) = true];
22402
22403  // Whether a new request was triggered or alternatively served from cached
22404  // response.
22405  optional bool is_request_triggered = 12;
22406
22407  // Timestamps are in milliseconds, relative to when the Session was created
22408  // For example, if timestamp has a value = 100, the event was triggered
22409  // 100ms after the session was created.
22410  // Since these are relative to Session creation, you can subtract events to
22411  // get the latency duration between events.
22412  // t1 = 100
22413  // t2 = 300
22414  // duration = t2 - t1 = 200ms
22415  // ------------------------------------------------------------------------
22416  // Timestamp of when FillRequest is sent to Autofill provider
22417  // This is also the latency of when a field is focused to Framework sending a FillRequest
22418  optional int32 fill_request_sent_timestamp_ms = 13;
22419
22420  // Timestamp of when Autofill provider returns a FillResponse
22421  // The latency of the Autofill provider IPC can be calculated
22422  // by fillResponseReceivedTimestampMs - fillRequestSentTimestampMs
22423  optional int32 fill_response_received_timestamp_ms = 14;
22424
22425  // Timestamp of when FillResponse is sent to the IME/Dropdown handler/Fill Dialog UI
22426  // The latency of processing provider FillResponse to when suggestions are sent to be rendered
22427  // can be calculated by suggestionSentTimestampMs - fillResponseReceivedTimestampMs
22428  optional int32 suggestion_sent_timestamp_ms = 15;
22429
22430  // Timestamp of when the suggestion is first shown
22431  // The latency of showing suggestions can be calculated by
22432  // suggestionPresentedTimestampMs - suggestionSentTimestampMs
22433  optional int32 suggestion_presented_timestamp_ms = 16;
22434
22435  // The index of the dataset that a user selected. -1 if not selected.
22436  optional int32 selected_dataset_id = 17;
22437
22438  // True if the user dismissed the fill UI.
22439  optional bool dialog_dismissed = 18;
22440
22441  // True if the user clicked the negative CTA button.
22442  optional bool negative_cta_button_clicked = 19;
22443
22444  // True if the user clicked the positive CTA button.
22445  optional bool positive_cta_button_clicked = 20;
22446
22447  optional autofill.AuthenticationType authentication_type = 21;
22448
22449  optional autofill.AuthenticationResult authentication_result = 22;
22450
22451  // From response received to authentication UI displayed to the user.
22452  optional int64 latency_authentication_ui_display_millis = 23;
22453
22454  // From the user finishing authentication to the dataset is displayed to the user.
22455  optional int64 latency_dataset_display_millis = 24;
22456
22457  // Count of datasets that are available due to PCC Detection. These can include datasets
22458  // available via provider response, and would be eligible because of pcc too.
22459  // If PCC detection is preferred over Autofill provider, and Autofill provider had same detection
22460  // as PCC did, the following invariants would hold.
22461  // available_pcc_count = available_count
22462  // available_pcc_only_count = 0
22463  optional int32 available_pcc_count = 25;
22464
22465  // Count of datasets that are available only due to PCC Detection.
22466  optional int32 available_pcc_only_count = 26;
22467
22468  // The selection process of this dataset.
22469  optional autofill.DatasetPickedReason selected_dataset_picked_reason = 27;
22470
22471  // Which detection was preferred
22472  optional autofill.DetectionPreference detection_preference = 28;
22473
22474  // field_classification request id that was used for this event.
22475  optional int32 field_classification_request_id = 29;
22476
22477  // App package Uid
22478  optional int32 app_package_uid = 30 [(is_uid) = true];
22479
22480  // True if the request is directed to the credential autofill service.
22481  optional bool is_credential_request = 31;
22482
22483  // True if the response is from webview requesting credential autofill service.
22484  optional bool webview_requested_credential = 32;
22485
22486  // Count of views that can be filled as per the provider service.
22487  // views_fillable_total_count = views_filled_failure_count +
22488  //     views_filled_success_count + views_with_no_callback
22489  // views_with_no_callback aren't logged explicitly, as it can be computed.
22490  // There may be no callback due to views overriding default behavior, and
22491  // not adhering to javadoc guidelines. They may correspond to autofill
22492  // failing or being successful. There is no way for autofill framework to
22493  // know such status.
22494  optional int64 views_fillable_total_count = 33;
22495
22496  // Count of views that failed to receive autofill values. These are minimum counts.
22497  // It's possible that additional views themselves didn't fill correctly.
22498  optional int64 views_filled_failure_count = 34;
22499
22500  // ViewID of the AutofillID that triggered the presentation
22501  optional int32 focused_autofill_id = 35;
22502
22503  // Count of views that successfully received autofill values. These are guaranteed counts.
22504  // They are confirmed by getting views autofill value, and comparing against what was attempted
22505  // to be set.
22506  optional int64 views_filled_success_count = 36;
22507
22508  // Count of views that successfully received autofill values, but don't belong to this event.
22509  // This value is for confirmation that nothing is wrong. It's expected value is 0.
22510  // If non-zero, there's likely some bug in our logging (or in autofill).
22511  optional int64 views_filled_but_unexpected_count = 37;
22512
22513  // Timestamp (relative to session start) of when user tapped a selection
22514  optional int32 presentation_selected_timestamp_ms = 38;
22515
22516  // Timestamp (relative to session start) of filling into a field
22517  optional int32 field_autofilled_timestamp_ms = 39;
22518
22519  // Timestamp (relative to session start) of when the field is first modified
22520  // This is used to check if a field was modified before an Autofill suggestion
22521  // was presented
22522  optional int32 field_first_modified_timestamp_ms = 40;
22523
22524  // Timestamp (relative to session start) of when the field is last modified
22525  // This is value is updated when the view value was changed manually
22526  // (by app/user - not autofill)
22527  // This will be the same as field_first_modified_timestamp_ms
22528  // if field was only modified once
22529  optional int32 field_last_modified_timestamp_ms = 41;
22530
22531  // Supplement to suggestion_presented_timestamp_ms. This is the timestamp
22532  // of the last suggestion that was presented to the user. It is used to
22533  // distinguish multiple presentations in the same field.
22534  optional int32 suggestion_presented_last_timestamp_ms = 42;
22535
22536  // The virtual component (if any) of the autofill id
22537  optional int32 focused_virtual_autofill_id = 43;
22538
22539  // Length of text already in the field when the event is initialized
22540  optional int32 field_first_length = 44;
22541
22542  // Length of text already in the field when the event is logged
22543  optional int32 field_last_length = 45;
22544}
22545
22546// Tells how Autofill dataset was/will-be displayed.
22547enum AutofillDisplayPresentationType {
22548  UNKNOWN_AUTOFILL_DISPLAY_PRESENTATION_TYPE = 0;
22549  MENU = 1;    // aka drop-down
22550  INLINE = 2;  // shown via IME
22551  DIALOG = 3;  // aka Bottom-sheet dialog
22552}
22553
22554/**
22555 * Log the CompanionDeviceManager associations are created by various device
22556 * profiles
22557 *
22558 * Logged from:
22559 * frameworks/base/services/companion/java/com/android/server/companion/
22560 * CompanionDeviceManagerService.java
22561 */
22562message CdmAssociationAction {
22563    enum Action {
22564        UNKNOWN = 0;
22565        CREATED = 1;
22566        REMOVED = 2;
22567    }
22568
22569    enum DeviceProfile{
22570        DEVICE_PROFILE_NULL = 0;
22571        DEVICE_PROFILE_WATCH = 1;
22572        DEVICE_PROFILE_APP_STREAMING = 2;
22573        DEVICE_PROFILE_AUTO_PROJECTION = 3;
22574        DEVICE_PROFILE_COMPUTER = 4;
22575        DEVICE_PROFILE_GLASSES = 5;
22576        DEVICE_PROFILE_NEARBY_DEVICE_STREAMING = 6;
22577    }
22578
22579    // Action taken on the CDM association been created by companion apps.
22580    optional Action action = 1;
22581
22582    // Name of the CDM Association Request profiles.
22583    optional DeviceProfile device_profile = 2;
22584}
22585
22586/**
22587 * Logs when text and reading options changed.
22588 *
22589 * Logged from:
22590 *   packages/apps/Settings/src/com/android/settings/accessibility
22591 */
22592message AccessibilityTextReadingOptionsChanged {
22593    // The item name of the accessibility feature "Text and Reading Options".
22594    optional android.stats.accessibility.TextReadingOption name = 1;
22595
22596    // The status value of the item of the accessibility feature "Text and Reading Options".
22597    optional int32 value = 2;
22598
22599    // The entry point from which page.
22600    optional android.stats.accessibility.TextReadingEntry entry_point = 3;
22601}
22602
22603/*
22604 * Pushed atom logged by ONS service.
22605 */
22606message OnsOpportunisticEsimProvisioningComplete {
22607    enum ResultCode {
22608      // Unknown
22609      RESULT_UNKNOWN = 0;
22610
22611      // Operation was successful.
22612      RESULT_SUCCESS = 1;
22613
22614      // Device capabilities not met such as eSIM and MultiSIM not supported.
22615      RESULT_DEVICE_NOT_CAPABLE = 2;
22616
22617      // Internet connection is not available while trying to download opportunistic eSIM.
22618      RESULT_INTERNET_NOT_AVAILABLE = 3;
22619
22620      // Error occurred while switching device from Single to MultiSIM mode.
22621      RESULT_SWITCH_TO_MULTISIM_FAILED = 4;
22622
22623      // Connection error occurred while downloading opportunistic eSIM from SMDP server.
22624      RESULT_CONNECTION_ERROR = 5;
22625
22626      // Download failed because there is no sufficient storage available in eUICC memory.
22627      RESULT_MEMORY_FULL = 6;
22628
22629      // Installation of downloaded eSIM failed.
22630      RESULT_INSTALL_ESIM_PROFILE_FAILED = 7;
22631
22632      // Unresolvable errors such as Invalid SMDP address or activation code.
22633      RESULT_UNRESOLVABLE_ERROR = 8;
22634
22635      // Auto provisioning disabled
22636      RESULT_AUTO_PROVISIONING_DISABLED = 9;
22637
22638      // eSIM provisioning failed
22639      RESULT_ESIM_PROVISIONING_FAILED = 10;
22640    }
22641
22642    // CBRS carrier id. Filled only while reporting failure cases.
22643    optional int32 carrier_id = 1;
22644
22645    // carrier id of the opportunistic eSIM downloaded from the SMDP server.
22646    //Filled only while reporting failure cases.
22647    optional int32 opportunistic_esim_carrier_id = 2;
22648
22649    // Flag to indicate that the data connection was used for downloading.
22650    optional bool is_mobile_data_used = 3;
22651
22652    // Error code occurred during the above operation.
22653    optional ResultCode error_code = 4;
22654
22655    // Retry count of the above operation.
22656    optional int32 retry_count = 5;
22657
22658    // Detailed error code.
22659    optional int32 detailed_error_code = 6;
22660}
22661
22662/**
22663 * Logs when a telephony anomaly is reported.
22664 *
22665 * Logged from:
22666 *   frameworks/base/telephony/java/android/telephony/AnomalyReporter.java
22667 */
22668message TelephonyAnomalyDetected {
22669    // Carrier ID of the SIM card.
22670    // See https://source.android.com/devices/tech/config/carrierid.
22671    optional int32 carrier_id = 1;
22672    // UUID of the anomaly, as generated by android.telephony.AnomalyReporter
22673    optional int64 event_id_lsb = 2;
22674    optional int64 event_id_msb = 3;
22675}
22676
22677// Logs when the remote key provisioner application is invoked, either
22678// due to a periodically scheduled job, due to an attestation key being
22679// consumed from the pool, or when the system has detected that it's
22680// completely out of attestation keys.
22681//
22682// Logged from:
22683//   packages/modules/RemoteKeyProvisioning
22684message RemoteKeyProvisioningAttempt {
22685    // The reason for the provisioning attempt.
22686    enum Cause {
22687        CAUSE_UNKNOWN = 0;
22688        SCHEDULED = 1;          // A scheduled job issued the request
22689        KEY_CONSUMED = 2;       // A provisioned key was consumed from the pool
22690        OUT_OF_KEYS = 3;        // The system is out of keys
22691    }
22692    optional Cause cause = 1;
22693
22694    // The name of the remotely provisioned component for whom keys are being
22695    // generated and certified. The string value is determined by the vendor,
22696    // and is fixed for the lifetime of the device. The number of unique string
22697    // values on a given device is determined by how many remotely provisioned
22698    // component HALs are on a given device. Typically, this is 2-3 HALs.
22699    optional string remotely_provisioned_component = 2;
22700
22701    // The uptime of the device, organized into time ranges of interest.
22702    enum UpTime {
22703        UPTIME_UNKNOWN = 0;
22704        LESS_THAN_5_MINUTES = 1;
22705        BETWEEN_5_AND_60_MINUTES = 2;
22706        MORE_THAN_60_MINUTES = 3;
22707    }
22708    optional UpTime uptime = 3;
22709
22710    // The state of remote provisioning enablement
22711    enum Enablement {
22712        ENABLEMENT_UNKNOWN = 0;
22713        ENABLED_WITH_FALLBACK = 1;
22714        ENABLED_RKP_ONLY = 2;
22715        DISABLED = 3;
22716    }
22717    optional Enablement enablement = 4;
22718
22719    // If the key pool is completely exhausted, this is set to true. Typically,
22720    // we do not expect to see a pool with no spare keys available.
22721    optional bool is_key_pool_empty = 5;
22722
22723    // Indicates success or failure of the provisioning attempt.
22724    optional com.android.remoteprovisioner.RemoteKeyProvisioningStatus status = 6;
22725
22726    // A digest of the root key that certified the provisioned certificates
22727    optional string root_cert_fingerprint = 7;
22728
22729    // The depth of the cert chains issued to the device
22730    optional int32 cert_chain_length = 8;
22731}
22732
22733// Logs that correlate remote key provisioning status with the active
22734// network for the given provisioning attempt.
22735//
22736// Logged from:
22737//   packages/modules/RemoteKeyProvisioning
22738message RemoteKeyProvisioningNetworkInfo {
22739    // The network transport, according ConnectivityManager::getActiveNetwork().
22740    optional android.stats.connectivity.TransportType transport_type = 1;
22741
22742    // Indicates success or failure of the provisioning attempt.
22743    optional com.android.remoteprovisioner.RemoteKeyProvisioningStatus status = 2;
22744
22745    // If an HTTP error was received, this contains the code. Else, contains 200.
22746    optional int32 http_status_error = 3;
22747}
22748
22749// Logs indicating timing data to understand how long the remote provisioner is
22750// taking to perform various sub-tasks. This is intended to be used with KLL metrics.
22751//
22752// Logged from:
22753//   packages/modules/RemoteKeyProvisioning
22754message RemoteKeyProvisioningTiming {
22755    // Time spent waiting on the RKP service to reply.
22756    optional int32 server_wait_millis = 1;
22757
22758    // Time spent waiting on internal binder calls to the provisioning service.
22759    optional int32 binder_wait_millis = 2;
22760
22761    // Time spent waiting on the serialization lock.
22762    optional int32 lock_wait_millis = 3;
22763
22764    // Total time spent processing the attempt.
22765    optional int32 total_processing_time = 4;
22766
22767    // The network transport, according ConnectivityManager::getActiveNetwork().
22768    optional android.stats.connectivity.TransportType transport_type = 5;
22769
22770    // The name of the remotely provisioned component for whom keys are being
22771    // generated and certified. The string value is determined by the vendor,
22772    // and is fixed for the lifetime of the device. The number of unique string
22773    // values on a given device is determined by how many remotely provisioned
22774    // component HALs are on a given device. Typically, this is 2-3 HALs.
22775    optional string remotely_provisioned_component = 6;
22776
22777    // Cause of the attempt which resulted in these timings.
22778    optional RemoteKeyProvisioningAttempt.Cause cause = 7;
22779
22780    // Indicates success or failure of the provisioning attempt.
22781    optional com.android.remoteprovisioner.RemoteKeyProvisioningStatus status = 8;
22782}
22783
22784// Deprecated in U.
22785//
22786// Counters that track how many errors we're seeing on the device for the
22787// given boot.
22788//
22789// Logged from:
22790//   packages/modules/RemoteKeyProvisioning
22791message RemoteKeyProvisioningErrorCounts {
22792    // The total number of RKP attempts there have been this boot.
22793    optional int32 total_count = 1;
22794
22795    // How many errors this device has encountered this boot.
22796    optional int32 error_count = 2;
22797
22798    // How many bytes of data have been sent that resulted in errors. These
22799    // bytes count against an error budget, so it's important to track.
22800    optional int32 error_bytes = 3;
22801}
22802
22803/**
22804 * Logs information about sync exemptions when they occur.
22805 *
22806 * Logged from:
22807 *      frameworks/base/services/core/java/com/android/server/content/ContentService.java
22808 */
22809message SyncExemptionOccurred {
22810    optional int32 uid = 1 [(is_uid) = true]; // the uid of the app.
22811
22812    enum ProcState {
22813        UNKNOWN = 0;
22814        PERSISTENT = 1;
22815        PERSISTENT_UI = 2;
22816        TOP = 3;
22817        BOUND_TOP = 4;
22818        FOREGROUND_SERVICE = 5;
22819        BOUND_FOREGROUND_SERVICE = 6;
22820        IMPORTANT_FOREGROUND = 7;
22821        IMPORTANT_BACKGROUND = 8;
22822        TRANSIENT_BACKGROUND = 9;
22823        BACKUP = 10;
22824        SERVICE = 11;
22825        RECEIVER = 12;
22826        TOP_SLEEPING = 13;
22827        HEAVY_WEIGHT = 14;
22828        HOME = 15;
22829        LAST_ACTIVITY = 16;
22830        CACHED_ACTIVITY = 17;
22831        CACHED_ACTIVITY_CLIENT = 18;
22832        CACHED_RECENT = 19;
22833        CACHED_EMPTY = 20;
22834    }
22835    optional ProcState proc_state = 2; // the proc state of the app when the exemption occurred.
22836
22837    optional bool is_uid_active = 3; // was the uid active when the exemption occurred.
22838
22839    optional AppBackgroundRestrictionsInfo.RestrictionLevel restriction_level = 4;
22840}
22841
22842// Logs the overall Safety State of the device (as cached by the Safety Center)
22843message SafetyState {
22844    // The overall severity level of the Safety Center.
22845    optional android.stats.safetycenter.SafetySeverityLevel overall_severity_level = 1;
22846
22847    // The number of open issues in the Safety Center.
22848    optional int64 open_issues_count = 2;
22849
22850    // The number of dismissed issues in the Safety Center.
22851    optional int64 dismissed_issues_count = 3;
22852}
22853
22854// Logs the state of an individual Safety Source when overall SafetyState is
22855// collected.
22856message SafetySourceStateCollected {
22857    optional int64 encoded_safety_source_id = 1;
22858
22859    optional android.stats.safetycenter.SafetySourceProfileType safety_source_profile_type = 2;
22860
22861    // The severity level of this source.
22862    optional android.stats.safetycenter.SafetySeverityLevel severity_level = 3;
22863
22864    // The number of open issues belonging to this Safety Source.
22865    optional int64 open_issues_count = 4;
22866
22867    // The number of dismissed issues belonging to this Safety Source.
22868    optional int64 dismissed_issues_count = 5;
22869
22870    optional int64 duplicate_filtered_out_issues_count = 6;
22871
22872    enum SourceState {
22873        SOURCE_STATE_UNKNOWN = 0;
22874        DATA_PROVIDED = 1;
22875        NO_DATA_PROVIDED = 2;
22876        REFRESH_TIMEOUT = 3;
22877        REFRESH_ERROR = 4;
22878        SOURCE_ERROR = 5;
22879        SOURCE_CLEARED = 6;
22880    }
22881    optional SourceState source_state = 7;
22882
22883    // Indicates the reason for which this event was collected.
22884    enum CollectionType {
22885        COLLECTION_TYPE_UNKNOWN = 0;
22886        AUTOMATIC = 1;
22887        SOURCE_UPDATED = 2;
22888    }
22889    optional CollectionType collection_type = 8;
22890
22891    enum UpdateType {
22892        UPDATE_TYPE_UNKNOWN = 0;
22893        SELF_INITIATED = 1;
22894        REFRESH_RESPONSE = 2;
22895    }
22896    optional UpdateType update_type = 9;
22897
22898    optional int64 refresh_reason = 10;
22899
22900    optional bool data_changed = 11;
22901
22902    optional int64 last_updated_elapsed_time_millis = 12;
22903}
22904
22905// Logs system-health and performance related events from the Safety Center
22906message SafetyCenterSystemEventReported {
22907    enum EventType {
22908        EVENT_TYPE_UNKNOWN = 0;
22909        SINGLE_SOURCE_GET_NEW_DATA = 1;
22910        SINGLE_SOURCE_RESCAN = 2;
22911        COMPLETE_GET_NEW_DATA = 3;
22912        COMPLETE_RESCAN = 4;
22913        INLINE_ACTION = 5;
22914    }
22915    optional EventType event_type = 1;
22916
22917    // Unset if this event isn't source-specific.
22918    optional int64 encoded_safety_source_id = 2;
22919
22920    // Unset if this event isn't source-specific.
22921    optional android.stats.safetycenter.SafetySourceProfileType safety_source_profile_type = 3;
22922
22923    // Unset if this event isn't specific to an issue.
22924    optional int64 encoded_issue_type_id = 4;
22925
22926    optional int64 duration_millis = 5;
22927
22928    enum Result {
22929        RESULT_UNKNOWN = 0;
22930        SUCCESS = 1;
22931        TIMEOUT = 2;
22932        ERROR = 3;
22933    }
22934    optional Result result = 6;
22935
22936    optional int64 refresh_reason = 7;
22937
22938    optional bool data_changed = 8;
22939}
22940
22941// Logs a user interaction with the Safety Center. Various fields may or may not be
22942// set depending on the Action reported.
22943message SafetyCenterInteractionReported {
22944    // ID which identifies single session of user interacting with Safety Center.
22945    optional int64 session_id = 1;
22946
22947    enum Action {
22948        ACTION_UNKNOWN = 0;
22949
22950        SAFETY_CENTER_VIEWED = 1;
22951        SAFETY_ISSUE_VIEWED = 2;
22952
22953        SCAN_INITIATED = 3;
22954
22955        ISSUE_PRIMARY_ACTION_CLICKED = 4;
22956        ISSUE_SECONDARY_ACTION_CLICKED = 5;
22957        ISSUE_DISMISS_CLICKED = 6;
22958
22959        MORE_ISSUES_CLICKED = 7;
22960        ENTRY_CLICKED = 8;
22961        ENTRY_ICON_ACTION_CLICKED = 9;
22962        STATIC_ENTRY_CLICKED = 10;
22963
22964        PRIVACY_CONTROL_TOGGLE_CLICKED = 11;
22965        SENSOR_PERMISSION_REVOKE_CLICKED = 12;
22966        SENSOR_PERMISSION_SEE_USAGES_CLICKED = 13;
22967        REVIEW_SETTINGS_CLICKED = 14;
22968
22969        NOTIFICATION_POSTED = 15;
22970        NOTIFICATION_DISMISSED = 16;
22971
22972        STATUS_VIEWED = 17;
22973        ENTRY_VIEWED = 18;
22974
22975        ISSUE_RESOLVED = 19;
22976    }
22977
22978    // Action taken in the Safety Center.
22979    optional Action action = 2;
22980
22981    enum ViewType {
22982        VIEW_TYPE_UNKNOWN = 0;
22983        FULL = 1;
22984        QUICK_SETTINGS = 2;
22985        SUBPAGE = 3;
22986
22987        // Prefix required to distinguish from NavigationSource.NOTIFICATION (since
22988        // proto enums use C++ scoping rules, enum value names must be unique within
22989        // the enum's enclosing type, not just the enum itself).
22990        VIEW_TYPE_NOTIFICATION = 4;
22991    }
22992
22993    // Which view of the Safety Center this interaction occurred in.
22994    optional ViewType view_type = 3;
22995
22996    enum NavigationSource {
22997        SOURCE_UNKNOWN = 0;
22998        NOTIFICATION = 1;
22999        QUICK_SETTINGS_TILE = 2;
23000        SETTINGS = 3;
23001        SENSOR_INDICATOR = 4;
23002
23003        // Set for navigations that start from within Safety Center. e.g. when a subpage
23004        // is opened from the main Safety Center page instead of from a notification.
23005        SAFETY_CENTER = 5;
23006    }
23007
23008    // Where the session was initiated from.
23009    optional NavigationSource navigation_source = 4;
23010
23011    // Severity level of the particular issue or entry, or the overall Safety
23012    // Center this interaction is associated with.
23013    optional android.stats.safetycenter.SafetySeverityLevel severity_level = 5;
23014
23015    // The hashed ID of the Safety Source that this interaction was with performed with,
23016    // or nothing if this event isn't source-specific.
23017    optional int64 encoded_safety_source_id = 6;
23018
23019    // The kind of profile that this safety source originated from (sources from
23020    // personal and work profiles may have the same source ID)
23021    optional android.stats.safetycenter.SafetySourceProfileType safety_source_profile_type = 7;
23022
23023    // A hash of the loggable issue type ID that this interaction was performed with.
23024    optional int64 encoded_issue_type_id = 8;
23025
23026    enum Sensor {
23027        SENSOR_UNKNOWN = 0;
23028        MICROPHONE = 1;
23029        CAMERA = 2;
23030        LOCATION = 3;
23031    }
23032
23033    // Which sensor was associated with this interaction (if any).
23034    optional Sensor sensor = 9;
23035
23036    optional int64 encoded_safety_sources_group_id = 10;
23037
23038    enum IssueState {
23039        ISSUE_STATE_UNKNOWN = 0;
23040        ACTIVE = 1;
23041        DISMISSED = 2;
23042    }
23043    optional IssueState issue_state = 11;
23044}
23045
23046/**
23047 * Logs information about SettingsProvider setting changes when they occur.
23048 *
23049 * Logged from:
23050 *      frameworks/base/packages/src/com/android/providers/settings/SettingsProvider.java
23051 */
23052message SettingsProviderSettingChanged {
23053    optional int32 user_id = 1; // user for whom the setting has changed
23054    optional string name = 2; // name of the setting
23055    optional int32 type = 3; // the setting type, e.g., global, system or secure
23056    optional int32 change_type = 4; // the change type, e.g., insert, delete or update
23057}
23058
23059/**
23060 * Pulls information for a single incoming MMS.
23061 *
23062 * Each pull creates multiple atoms, one for each MMS.
23063 * The sequence is randomized when pulled.
23064 *
23065 * Pulled from:
23066 *   packages/services/Mms/src/com/android/mms/service/metrics/MmsMetricsCollector.java
23067 */
23068message IncomingMms {
23069    // Radio access technology (RAT) used for downloading the MMS.
23070    // It can be IWLAN in case of IMS.
23071    // RAT is logged at the end of the download.
23072    optional android.telephony.NetworkTypeEnum rat = 1;
23073
23074    // Indicate a specific result handling the MMS.
23075    optional android.mms.MmsResultEnum result = 2;
23076
23077    // Roaming type when MMS was received.
23078    optional android.telephony.RoamingTypeEnum roaming = 3;
23079
23080    // Index of the SIM used, 0 for single-SIM devices.
23081    optional int32 sim_slot_index = 4;
23082
23083    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
23084    optional bool is_multi_sim = 5;
23085
23086    // Whether the MMS was received with an eSIM profile.
23087    optional bool is_esim = 6;
23088
23089    // Carrier ID of the SIM card used for the MMS.
23090    // See https://source.android.com/devices/tech/config/carrierid.
23091    optional int32 carrier_id = 7;
23092
23093    // Average time in milliseconds to download MMS from the network.
23094    optional int64 avg_interval_millis = 8;
23095
23096    // Total number of MMS having same configuration.
23097    optional int64 mms_count = 9;
23098
23099    // Retry count: 0 for the first attempt and then increasing for each attempt.
23100    optional int32 retry_id = 10;
23101
23102    // Whether MmsService or carrier app downloaded the MMS from the network.
23103    optional bool handled_by_carrier_app = 11;
23104
23105    // Whether the MMS was received with an enterprise profile.
23106    optional bool is_managed_profile = 12;
23107
23108    // Whether the MMS was received over non-terrestrial networks.
23109    optional bool is_ntn = 13;
23110}
23111
23112/**
23113 * Pulls information for a single outgoing MMS.
23114 *
23115 * Each pull creates multiple atoms, one for each MMS.
23116 * The sequence is randomized when pulled.
23117 *
23118 * Pulled from:
23119 *   packages/services/Mms/src/com/android/mms/service/metrics/MmsMetricsCollector.java
23120 */
23121message OutgoingMms {
23122    // Radio access technology (RAT) used for uploading the MMS.
23123    // It can be IWLAN in case of IMS.
23124    // RAT is logged at the end of the upload.
23125    optional android.telephony.NetworkTypeEnum rat = 1;
23126
23127    // Indicate a specific result handling the MMS.
23128    optional android.mms.MmsResultEnum result = 2;
23129
23130    // Roaming type when MMS was received.
23131    optional android.telephony.RoamingTypeEnum roaming = 3;
23132
23133    // Index of the SIM used, 0 for single-SIM devices.
23134    optional int32 sim_slot_index = 4;
23135
23136    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
23137    optional bool is_multi_sim = 5;
23138
23139    // Whether the MMS was sent with an eSIM profile.
23140    optional bool is_esim = 6;
23141
23142    // Carrier ID of the SIM card used for the MMS.
23143    // See https://source.android.com/devices/tech/config/carrierid.
23144    optional int32 carrier_id = 7;
23145
23146    // Average time in milliseconds to download MMS from the network.
23147    optional int64 avg_interval_millis = 8;
23148
23149    // Total number of MMS having same configuration.
23150    optional int64 mms_count = 9;
23151
23152    // Whether the default MMS application sent the MMS (regardless of which application).
23153    optional bool is_from_default_app = 10;
23154
23155    // Retry count: 0 for the first attempt and then increasing for each attempt.
23156    optional int32 retry_id = 11;
23157
23158    // Whether MmsService or carrier app uploaded the MMS to the network.
23159    optional bool handled_by_carrier_app = 12;
23160
23161    // Whether the MMS was sent with an enterprise profile.
23162    optional bool is_managed_profile = 13;
23163
23164    // Whether the MMS was sent over non-terrestrial networks.
23165    optional bool is_ntn = 14;
23166}
23167
23168message PrivacySignalNotificationInteraction {
23169
23170    enum Action {
23171        UNKNOWN = 0;
23172        NOTIFICATION_SHOWN = 1;
23173        NOTIFICATION_CLICKED = 2;
23174        DISMISSED = 3;
23175    }
23176
23177    // Privacy source that triggered the notification
23178    optional android.stats.privacysignals.PrivacySource privacy_source = 1;
23179
23180    // Optional Uid of the package for which the notification was sent.
23181    optional int32 uid = 2 [(is_uid) = true];
23182
23183    // Action taken on the notification.
23184    optional Action action = 3;
23185
23186    // Session Id to link the notification with the issue card.
23187    optional int64 session_id = 4; // to map the notification and issue card interaction
23188}
23189
23190message PrivacySignalIssueCardInteraction {
23191
23192    enum Action {
23193        ACTION_UNKNOWN = 0;
23194        CARD_SHOWN = 1;
23195        CARD_CLICKED = 2;
23196        CARD_DISMISSED = 3;
23197        CLICKED_CTA1 = 4;
23198        CLICKED_CTA2 = 5;
23199    }
23200
23201    // Privacy source  that pushed the issue card.
23202    optional android.stats.privacysignals.PrivacySource privacy_source = 1;
23203
23204    // Optional Uid of the package for which the issue card was sent.
23205    optional int32 uid = 2 [(is_uid) = true];
23206
23207    // Action taken on the issue card.
23208    optional Action action = 3;
23209
23210    // Session Id to link the notification with the issue card.
23211    optional int64 session_id = 4;
23212}
23213
23214message PrivacySignalsJobFailure {
23215
23216    // Which privacy source for which the daily job failed.
23217    optional android.stats.privacysignals.PrivacySource privacy_source = 1;
23218
23219    enum JobFailureReason {
23220        REASON_UNKNOWN = 0;
23221        TIMEOUT = 1;
23222        COROUTINE_CANCELLED = 2;
23223    }
23224    optional JobFailureReason reason =2;
23225}
23226
23227/**
23228 * Contains information about different method and code contention durations in
23229 * the ANR code path
23230 */
23231message ANRLatencyReported {
23232    /* Important durations */
23233    // Total duration of the ANR (in ms)
23234    optional int64 total_duration = 1;
23235    // The duration between when the ANR is triggered and when the stacks are dumped
23236    // (in ms)
23237    optional int64 triggering_to_stack_dump_duration = 2;
23238
23239    /* Disjoint durations, each duration representing the time spent in the
23240    method before calling the next one on the ANR chain */
23241    // The duration between when the ANR is triggered and when appNotResponding starts.
23242    optional int64 triggering_to_app_not_responding_duration = 3;
23243    // The time taken by appNotResponding before the record is placed on the
23244    // queue.
23245    optional int64 app_not_responding_duration = 4;
23246    // The time spent by the ANR record on the ANR queue.
23247    optional int64 anr_record_placed_on_queue_duration = 5;
23248    // The time from the start of the ANR processing by the ANR thread until the
23249    // stacks are dumped.
23250    optional int64 anr_processing_duration = 6;
23251    // The time taken to dump the stacks.
23252    optional int64 dump_stack_traces_duration = 7;
23253
23254    /* Helper methods */
23255    // The time spent waiting on updateCpuStatsNow to return.
23256    optional int64 update_cpu_stats_now_total_duration = 8;
23257    // The time spent waiting on currentPsiStateReturned to return.
23258    optional int64 current_psi_state_total_duration = 9;
23259    // The time spent waiting on ProcessCpuTracker methods to return
23260    optional int64 process_cpu_tracker_methods_total_duration = 10;
23261    // The time spent waiting on CriticalEventLog#logLinesForTraceFile to return.
23262    optional int64 critical_event_log_duration = 11;
23263
23264    /* Lock contention */
23265    // The time spent waiting on the Global Lock.
23266    optional int64 global_lock_total_contention = 12;
23267    // The time spent waiting on the PID lock.
23268    optional int64 pid_lock_total_contention = 13;
23269    // The time spent waiting on the AMS lock.
23270    optional int64 ams_lock_total_contention = 14;
23271    // The time spent waiting on proc lock.
23272    optional int64 proc_lock_total_contention = 15;
23273    // The time spent waiting on the ANR record queue lock.
23274    optional int64 anr_record_lock_total_contention = 16;
23275
23276    /* Misc */
23277    // The size of the ANR queue before pushing the ANR.
23278    optional int32 anr_queue_size_when_pushed = 17;
23279    // The type of the ANR.
23280    optional android.anr.AnrType anr_type = 18;
23281    // The number of dumped processes.
23282    optional int32 dumped_processes_count = 19;
23283    // Next ID: 20
23284}
23285
23286// Logs Display Brightness change events.
23287message DisplayBrightnessChanged {
23288
23289    enum Reason {
23290        REASON_UNKNOWN = 0;
23291        REASON_MANUAL = 1;
23292    }
23293
23294    // Display brightness before the brightness event, in nits.
23295    optional float initial_nits = 1;
23296
23297    // Display brightness after the brightness event, in nits.
23298    optional float end_nits = 2;
23299
23300    // Estimated ambient light, in lux.
23301    optional float lux = 3;
23302
23303    // Physical display id, with format $ADAPTER_PREFIX:$ID, in this case
23304    // "local:$PHYSICAL_ID".
23305    optional string physical_display_id = 4 [(state_field_option).primary_field = true];
23306
23307    // Whether the short term model was active at the time of the event.
23308    optional bool short_term_model_active = 5;
23309
23310    // The factor to adjust the screen brightness in low power mode in the range
23311    // 0 (screen off) to 1 (no change).
23312    // If not applied, this is set to -1.
23313    optional float power_brightness_factor = 6;
23314
23315    // The level of Reduce Bright Colors (RBC) intensity, the range is [0, 100].
23316    // If RBC is not enabled, this is set to -1;
23317    optional int32 reduce_bright_colors_strength = 7;
23318
23319    // Max nits value when High Brightness Mode (HBM) is enabled.
23320    // If HBM is not enabled, this is set to -1;
23321    optional float hbm_current_max = 8;
23322
23323    // Thermal throttling cap.
23324    // If thermal throttling not enabled, this is -1.
23325    optional float thermal_throttling_cap = 9;
23326
23327    // Whether adaptive brightness is enabled.
23328    optional bool adaptive_brightness_enabled = 10;
23329
23330    // Historical: replaced by entire_reason after 2023-04-10
23331    optional Reason reason = 11 [deprecated = true];
23332
23333    // Reason that triggered the brightness event to occur.
23334    optional android.display.DisplayBrightnessChangeReasonEnum entire_reason = 12;
23335
23336    // New brightness bucket index, from frameworks/proto_logging/stats/enums/display/display_enums.proto.
23337    optional android.display.DisplayBrightnessRangeEnum bucket_index = 13
23338            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
23339
23340    // Brightness is at maximum allowable value regarding the current context.
23341    optional bool brightness_at_max = 14;
23342
23343    // Whether HBM mode is enabled due to sunlight
23344    optional bool hbm_mode_sunlight = 15;
23345
23346    // Whether HBM mode is enabled due to HDR
23347    optional bool hbm_mode_hdr = 16;
23348
23349    // Whether modified by low power mode.
23350    optional bool modified_by_low_power_mode = 17;
23351
23352    // Value defined in frameworks/base/core/java/android/hardware/display/BrightnessInfo.java
23353    // BRIGHTNESS_MAX_REASON_NONE = 0
23354    // BRIGHTNESS_MAX_REASON_THERMAL = 1
23355    // BRIGHTNESS_MAX_REASON_* defined in the future
23356    optional int32 throttling_reason = 18;
23357
23358    // Whether modified by dimming.
23359    optional bool modified_by_dimming = 19;
23360
23361    // Whether Reduce Bright Colors (RBC) is enabled.
23362    optional bool rbc_enabled = 20;
23363
23364    // Whether ambient lux is invalid.
23365    optional bool ambient_lux_invalid = 21;
23366
23367    // Whether doze scale applied for auto brightness.
23368    optional bool doze_scale_applied = 22;
23369
23370    // Whether the value is set by the user.
23371    optional bool set_by_user = 23;
23372
23373    // Whether idle mode is active.
23374    optional bool idle_mode_active= 24;
23375
23376    // Whether low power mode is enabled.
23377    optional bool low_power_mode_enabled= 25;
23378}
23379
23380// Logs daily ambient brightness stats.
23381message AmbientBrightnessStatsReported {
23382
23383    // How much time was spent in each of the buckets, in seconds.
23384    repeated float bucket_size_seconds = 1;
23385
23386    // Ambient brightness values for creating bucket boundaries from.
23387    repeated float bucket_boundary_lux = 2;
23388}
23389
23390// Logs information about bpf maps in BpfNetMaps.
23391//
23392// Logged from:
23393//   packages/modules/Connectivity/service/src/com/android/server/BpfNetMaps.java
23394message NetworkBpfMapInfo {
23395    // The size of cookie tag bpf map.
23396    optional int32 cookie_tag_map_size = 1;
23397
23398    // The size of uid owner bpf map.
23399    optional int32 uid_owner_map_size = 2;
23400
23401    // The size of uid permission bpf map.
23402    optional int32 uid_permission_map_size = 3;
23403}
23404
23405/**
23406 * Pulls information for a single outgoing short code sms.
23407 *
23408 * Each pull generates multiple atoms, one for each category and xml_version combination.
23409 *
23410 * Pulled from:
23411 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
23412 */
23413message OutgoingShortCodeSms {
23414    /* Short code sms category. */
23415    optional android.telephony.ShortCodeSmsEnum category = 1;
23416
23417    /* sms_short_codes.xml file version used by the device. */
23418    optional int32 xml_version = 2;
23419
23420    /* Number of short code sms with the same configuration. */
23421    optional int32 short_code_sms_count = 3;
23422}
23423
23424/**
23425 * Logs information when a hearing aid is bonded
23426 *
23427 * Logged from:
23428 *   frameworks/base/packages/SettingsLib/src/com/android/settingslib/bluetooth/
23429 *   LocalBluetoothProfileManager.java
23430 */
23431message HearingAidInfoReported {
23432    // The device mode of the bonded hearing aid
23433    // Mode definition for hearing aids. See {@link HearingAidInfo}
23434    enum DeviceMode {
23435        MODE_UNKNOWN = -1;
23436        MONAURAL = 0;
23437        BINAURAL = 1;
23438        BANDED = 2;
23439    }
23440    optional DeviceMode device_mode = 1;
23441
23442    // The device side of the bonded hearing aid
23443    // Side definition for hearing aids. See {@link HearingAidInfo}.
23444    enum DeviceSide {
23445        SIDE_UNKNOWN = -1;
23446        LEFT = 0;
23447        RIGHT = 1;
23448        LEFT_AND_RIGHT = 2;
23449    }
23450    optional DeviceSide device_side = 2;
23451
23452    // The entry page id where the bonding process starts
23453    enum BondEntry {
23454        PAGE_UNKNOWN = -1;
23455        CONNECTED_DEVICES = 0;
23456        ACCESSIBILITY_HEARING_AIDS = 1;
23457        ACCESSIBILITY_HEARING_AID_PAIR_ANOTHER = 2;
23458        BLUETOOTH = 3;
23459        ACCESSIBILITY_HEARING_AID_SETTINGS = 4;
23460    }
23461    optional BondEntry bond_entry = 3;
23462}
23463
23464/**
23465 * Logs when Ambient/OFFLOAD Mode is entered or exited.
23466 *
23467 * Logged from:
23468 *  1. vendor/google_clockwork/packages/Ambient/src/com/google/
23469 *     android/wearable/ambient/AmbientService.java
23470 *  2. vendor/google_clockwork/packages/Ambient/src/com/google/android/
23471 *     wearable/ambient/autoresume/AmbientLiteFlowController.java
23472 *  3. frameworks/opt/wear/src/com/google/android/clockwork/
23473 *     displayoffload/DisplayOffloadService.java
23474 */
23475message AmbientModeChanged {
23476    enum AmbientStateEnum {
23477        AMBIENT_ENTER = 1;
23478        AMBIENT_EXIT = 2;
23479        AMBIENT_LITE_ENTER = 3;
23480        AMBIENT_LITE_EXIT = 4;
23481        OFFLOAD_ENTER = 5;
23482        OFFLOAD_EXIT = 6;
23483    }
23484
23485    optional AmbientStateEnum state = 1;
23486}
23487
23488
23489/**
23490 * Contains statistics about time spent fetching resource information from an APK.
23491 * Logged from:
23492 *   frameworks/base/core/java/android/content/res/ResourceTimer.java
23493 */
23494message ResourceValueApiStatisticsReported {
23495
23496  // The api that is being reported.
23497  optional android.app.ResourceApiEnum api = 1;
23498
23499  // The total number of events recorded.
23500  optional int32 event_count = 2;
23501
23502  // The total time spent in thie API.  The units are ns.
23503  optional int64 cumulative_event_time_ns = 3;
23504
23505  // Four percentile values.  Units are in ns.  A value of zero means the percentile could not be
23506  // computed.
23507  optional int32 p50_ns = 4;
23508  optional int32 p90_ns = 5;
23509  optional int32 p95_ns = 6;
23510  optional int32 p99_ns = 7;
23511
23512  // The five largest values recorded.  Units are in ns.  A value of zero means the value is
23513  // missing (which means fewer than 5 events were recorded).  Values that exceed INT_MAX are
23514  // capped at INT_MAX.
23515  optional int32 l0_ns = 8;
23516  optional int32 l1_ns = 9;
23517  optional int32 l2_ns = 10;
23518  optional int32 l3_ns = 11;
23519  optional int32 l4_ns = 12;
23520}
23521
23522/**
23523 * Logs when Iwlan responds the setup data call request.
23524 *
23525 * Logged from:
23526 *   packages/services/Iwlan/src/com/google/android/iwlan/IwlanDataService.java
23527 */
23528message IwlanSetupDataCallResultReported {
23529  enum IwlanError {
23530    NO_ERROR = 0;
23531    IKE_PROTOCOL_EXCEPTION = 1;
23532    IKE_INTERNAL_IO_EXCEPTION = 2;
23533    IKE_GENERIC_EXCEPTION = 3;
23534    EPDG_SELECTOR_SERVER_SELECTION_FAILED = 4;
23535    TUNNEL_TRANSFORM_FAILED = 5;
23536    SIM_NOT_READY_EXCEPTION = 6;
23537    NETWORK_FAILURE = 7;
23538    UNKNOWN_EXCEPTION = 8;
23539  }
23540
23541  // Setup data call apn type
23542  // See go/apntypedefinition
23543  optional int32 apn_type = 1;
23544  // Is the request for handover
23545  optional bool is_handover = 2;
23546  // ePDG server address
23547  optional string epdg_server_address = 3;
23548  // If the request type is handover, record the source network type
23549  // See
23550  // frameworks/base/telephony/java/android/telephony/TelephonyManager.java
23551  optional int32 source_rat = 4;
23552  // If the request type is handover, record the source network roaming status
23553  optional bool is_cellular_roaming = 5;
23554  // Is network connected
23555  optional bool is_network_connected = 6;
23556  // Default network transport type
23557  // See
23558  // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23559  optional int32 transport_type = 7;
23560  // Setup result
23561  optional int32 setup_request_result = 8;
23562  // Iwlan error code if setup failed
23563  optional IwlanError iwlan_error = 9;
23564  // Data call fail cause
23565  // See
23566  // frameworks/base/telephony/java/android/telephony/DataFailCause.java
23567  optional int32 data_call_fail_cause = 10;
23568  // Setup request processing duration
23569  optional int32 processing_duration_millis = 11;
23570  // Time for doing ePDG server selection through DNS query of FQDNs
23571  optional int32 epdg_server_selection_duration_millis = 12;
23572  // Time for establishing IKE tunnel
23573  optional int32 ike_tunnel_establishment_duration_millis = 13;
23574  // Tunnel State
23575  // See
23576  // packages/services/Iwlan/src/com/google/android/iwlan/IwlanDataService.java
23577  optional int32 tunnel_state = 14;
23578  // Handover failure mode
23579  // See
23580  // frameworks/base/telephony/java/android/telephony/data/DataCallResponse.java
23581  optional int32 handover_failure_mode = 15;
23582  // Retry duration
23583  optional int32 retry_duration_millis = 16;
23584  // Iwlan error wrapped exception classname
23585  optional string iwlan_error_wrapped_classname = 17;
23586  // Iwlan error wrapped exception 1st line of stack trace
23587  optional string iwlan_error_wrapped_stack_first_frame = 18;
23588  // Error count of the same error cause
23589  optional int32 error_count_of_same_cause = 19;
23590  // Underlying network validation status
23591  optional bool is_underlying_network_validated = 20;
23592}
23593
23594/**
23595 * Logs when Iwlan reports IWLAN PDN disconnected without deactivation request.
23596 *
23597 * Logged from:
23598 *   packages/services/Iwlan/src/com/google/android/iwlan/IwlanDataService.java
23599 */
23600message IwlanPdnDisconnectedReasonReported {
23601  // Disconnection cause
23602  // See
23603  // frameworks/base/telephony/java/android/telephony/DataFailCause.java
23604  optional int32 cause = 1;
23605  // Is network connected
23606  optional bool is_network_connected = 2;
23607  // default network transport type
23608  // See
23609  // packages/services/Iwlan/src/com/google/android/iwlan/IwlanDataService.java
23610  optional int32 transport_type = 3;
23611  // Wifi signal level
23612  optional int32 wifi_signal_level = 4;
23613}
23614
23615/**
23616 * Logs the number of network count on each list of transports
23617 *
23618 * Logs from:
23619 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23620 */
23621message NetworkCountPerTransports {
23622    // the number of network count on each list of transports
23623    repeated NetworkCountForTransports network_count_for_transports = 1;
23624}
23625
23626/**
23627 * Logs the number of network count and transport type
23628 *
23629 * Logs from:
23630 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23631 */
23632message NetworkCountForTransports {
23633    // Transport types of the network
23634    optional int32 transport_types = 1;
23635
23636    // Number of networks for one list of transport types
23637    optional int32 network_count = 2;
23638}
23639
23640/**
23641 * Logs a list of networks
23642 *
23643 * Logs from:
23644 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23645 */
23646message NetworkList {
23647    repeated NetworkDescription network_description = 1;
23648}
23649
23650/**
23651 * Logs connection duration in seconds and list of transports
23652 *
23653 * Logs from:
23654 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23655 */
23656message ConnectionDurationForTransports {
23657    // Transport types of the network
23658    optional int32 transport_types = 1;
23659
23660    // Time duration that the device stays connected to the network
23661    optional int32 duration_sec = 2;
23662}
23663
23664/**
23665 * Logs connection duration on each list of transports, in seconds
23666 *
23667 * Logs from:
23668 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23669 */
23670message ConnectionDurationPerTransports {
23671    repeated ConnectionDurationForTransports connection_duration_for_transports = 1;
23672}
23673
23674/**
23675 * Logs network request count & request type
23676 *
23677 * Logs from:
23678 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23679 */
23680message RequestCountForType {
23681    // The type of network request
23682    optional android.stats.connectivity.RequestType request_type = 1;
23683
23684    // Number of network requests
23685    optional int32 request_count = 2;
23686}
23687
23688/**
23689 * Logs network request count
23690 *
23691 * Logs from:
23692 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23693 */
23694message NetworkRequestCount {
23695    // Network request count for request type
23696    repeated RequestCountForType request_count_for_type = 1;
23697}
23698
23699/**
23700 * Logs information about a network
23701 *
23702 * Logs from:
23703 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23704 */
23705message NetworkDescription {
23706    // The transport types of the network. A network may include multiple transport types.
23707    // Each transfer type is represented by a different bit, defined in
23708    // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23709    optional int32 transport_types = 1;
23710
23711    // Indicates the network is metered, non-metered or temporarily-unmetered
23712    optional android.stats.connectivity.MeteredState metered_state = 2;
23713
23714    // Indicates the network is validated, non-validated, partial or portal
23715    optional android.stats.connectivity.ValidatedState validated_state = 3;
23716
23717    // Record the bitmask of all the policies applied to this score of network.
23718    // Each policy is represented by a different bit, defined in
23719    // packages/modules/Connectivity/service/src/com/android/server/connectivity/FullScore.java
23720    optional int64 score_policies = 4;
23721
23722    // The capabilities of the network. A network may include multiple network capabilities.
23723    // Each capability is represented by a different bit, defined in
23724    // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23725    optional int64 capabilities = 5;
23726
23727    // Bitfield representing the network's enterprise capability identifier, defined in
23728    // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23729    optional int32 enterprise_id = 6;
23730}
23731
23732/**
23733 * Pulls a list of NumberOfRematchesPerReason.
23734 *
23735 * Pulled from:
23736 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23737 */
23738message NumberOfRematchesPerReason {
23739    // Number of network rematches for each rematch reason
23740    repeated NumberOfRematchesForReason number_of_rematches_per_reason= 1;
23741}
23742
23743/**
23744 * Logs number of network rematches for rematch reason
23745 *
23746 * Logs from:
23747 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23748 */
23749message NumberOfRematchesForReason {
23750    // The reason of network rematch
23751    optional android.stats.connectivity.RematchReason rematch_reason = 1;
23752
23753    // Number of network rematches
23754    optional int32 rematch_count = 2;
23755};
23756
23757/**
23758 * Pulls information for connectivity stats.
23759 *
23760 * Pulled from:
23761 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23762 */
23763message ConnectivityStateSample {
23764    // Number of networks per list of transports
23765    optional NetworkCountPerTransports network_count_per_transports = 1
23766    [(android.os.statsd.log_mode) = MODE_BYTES];
23767
23768    // This is a list of networks with their transports and the duration
23769    optional ConnectionDurationPerTransports connection_duration_per_transports = 2
23770    [(android.os.statsd.log_mode) = MODE_BYTES];
23771
23772    // Number of requests per category
23773    optional NetworkRequestCount network_request_count  = 3
23774    [(android.os.statsd.log_mode) = MODE_BYTES];
23775
23776    // Full list of network details (slice by transport / meteredness / internet+validated)
23777    optional NetworkList networks = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
23778}
23779
23780
23781/**
23782 * Pulls information for network selection rematch info.
23783 *
23784 * Pulled from:
23785 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23786 */
23787message NetworkSelectionRematchReasonsInfo {
23788    // Number of rematch per rematch reason
23789    optional NumberOfRematchesPerReason number_of_rematches_per_reason = 1
23790    [(android.os.statsd.log_mode) = MODE_BYTES];
23791}
23792
23793/**
23794 * Logs rematch information for the default network
23795 *
23796 * Logs from:
23797 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23798 */
23799message DefaultNetworkRematchInfo {
23800    // The session id comes from each reboot, this is used to correlate the statistics of the
23801    // networkselect on the same boot
23802    optional int64 session_id = 1;
23803
23804    // The information of old device default network
23805    optional NetworkDescription old_network = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
23806
23807    // The information of new device default network
23808    optional NetworkDescription new_network = 3 [(android.os.statsd.log_mode) = MODE_BYTES];
23809
23810    // The reason of network rematch
23811    optional android.stats.connectivity.RematchReason rematch_reason = 4;
23812
23813    // The time duration the device kept the old network as the default in seconds
23814    optional int32 time_duration_on_old_network_sec = 5;
23815}
23816
23817/**
23818 * Logs network selection performance
23819 *
23820 * Logs from:
23821 *   packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java
23822 */
23823message NetworkSelectionPerformance {
23824    // Number of network requests
23825    optional int32 number_of_network_requests = 1;
23826
23827    // List of networks right now
23828    // (slice by transport / meteredness / internet+validated)
23829    optional NetworkList networks = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
23830
23831    // The latency of selection computed in milli-second
23832    optional int32 selection_computed_latency_milli = 3;
23833
23834    // The latency of selection applied in milli-second
23835    optional int32 selection_applied_latency_milli = 4;
23836
23837    // The latency of selection issued in milli-second
23838    optional int32 selection_issued_latency_milli = 5;
23839}
23840
23841message NetworkSliceRequestCountSample {
23842    // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY),
23843    // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23844    optional int64 slice_id = 1;
23845
23846    // Bitfield representing the network's enterprise capability identifier
23847    // (e.g. NET_ENTERPRISE_ID_1), defined in
23848    // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23849    optional int32 enterprise_id = 2;
23850
23851    // number of request for this slice
23852    optional int32 request_count = 3;
23853
23854    // number of apps with outstanding request(s) for this slice
23855    optional int32 distinct_app_count = 4;
23856}
23857
23858message NetworkSliceSessionEnded {
23859    // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY),
23860    // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23861    optional int64 slice_id = 1;
23862
23863    // Bitfield representing the network's enterprise capability identifier
23864    // (e.g. NET_ENTERPRISE_ID_1), defined in
23865    // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23866    optional int32 enterprise_id = 2;
23867
23868    // Number of bytes received at the device on this slice id
23869    optional int64 rx_bytes = 3;
23870
23871    // Number of bytes transmitted by the device on this slice id
23872    optional int64 tx_bytes = 4;
23873
23874    // Number of apps that have used this slice
23875    optional int32 number_of_apps = 5;
23876
23877    // How long(in seconds) this slice has been connected
23878    optional int32 slice_connection_duration_sec = 6;
23879}
23880
23881message NetworkSliceDailyDataUsageReported {
23882    // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY),
23883    // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23884    optional int64 slice_id = 1;
23885
23886    // Bitfield representing the network's enterprise capability identifier
23887    // (e.g. NET_ENTERPRISE_ID_1), defined in
23888    // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java
23889    optional int32 enterprise_id = 2;
23890
23891    // Number of bytes received at the device on this slice id
23892    optional int64 rx_bytes = 3;
23893
23894    // Number of bytes transmitted by the device on this slice id
23895    optional int64 tx_bytes = 4;
23896
23897    // Number of apps that have used this slice
23898    optional int32 number_of_apps = 5;
23899
23900    // How long(in seconds) this slice has been connected
23901    optional int32 slice_connection_duration_sec = 6;
23902}
23903
23904/**
23905 * Logs the Brightness Configuration pushed by the long term model. The Brightness Configuration is
23906 * expressed as a curve where each point is a pair of ambient light (lux) and the corresponding
23907 * screen brightness (nits).
23908 *
23909 * Logged from:
23910 *    frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java
23911 */
23912message BrightnessConfigurationUpdated {
23913    // Array of ambient light values (in lux) to define the configuration.
23914    repeated float lux = 1;
23915    // Array of screen brightness values (in nits) corresponding to the lux
23916    // values above.
23917    repeated float nits = 2;
23918    // Physical display id, with format $ADAPTER_PREFIX:$ID, in this case
23919    // "local:$PHYSICAL_ID".
23920    optional string physical_display_id = 3;
23921}
23922
23923/**
23924 * Logs data when wear media output switcher is launched.
23925 *
23926 * Logged from:
23927 * package: vendor/google_clockwork/packages/Media
23928 */
23929message WearMediaOutputSwitcherLaunched {
23930    // Name of the media app package from where Output Switcher got triggered.
23931    optional string triggering_package_name = 1;
23932
23933    // The operation type for invoking the OutputSwitcher
23934    optional com.google.android.wearable.media.routing.OpType op_type = 2;
23935
23936    // The result of OutputSwticher launch.
23937    optional com.google.android.wearable.media.routing.LaunchResult result = 3;
23938}
23939
23940/**
23941 * Logs data when wear media output switcher is finished.
23942 *
23943 * Logged from:
23944 * package: vendor/google_clockwork/packages/Media
23945 */
23946message WearMediaOutputSwitcherFinished {
23947    optional bool user_did_some_activity = 1;
23948    optional bool is_device_connected = 2;
23949}
23950
23951/**
23952 * Logs data when wear media output switcher operation is INITIATED
23953 * or COMPLETED.
23954 *
23955 * Logged from:
23956 * package: vendor/google_clockwork/packages/Media
23957 */
23958message WearMediaOutputSwitcherConnectionReported {
23959    // Type of the medium through which media is played
23960    optional com.google.android.wearable.media.routing.MediumType source = 1;
23961    optional com.google.android.wearable.media.routing.MediumType target  = 2;
23962
23963    // Reason for the connection reported
23964    optional com.google.android.wearable.media.routing.ConnectionReportReason reason = 3;
23965
23966    // Current status of switching the media.
23967    optional com.google.android.wearable.media.routing.ConnectionState state =4;
23968
23969    // Type of target device.
23970    optional com.google.android.wearable.media.routing.MediaDeviceType target_device_type = 5;
23971
23972    // The operation type for invoking the OutputSwitcher
23973    optional com.google.android.wearable.media.routing.OpType op_type = 6;
23974
23975    optional bool is_retry = 7;
23976
23977    // For differentiating if the bluetooth device is connected from already
23978    // paired device list or from the bluetooth settings flow.
23979    optional bool is_already_paired = 8;
23980}
23981
23982/**
23983 * Logs data when wear media output switcher starts scanning
23984 * for already paired devices.
23985 *
23986 * Logged from:
23987 * package: vendor/google_clockwork/packages/Media
23988 */
23989message WearMediaOutputSwitcherDeviceScanTriggered {
23990    // The current status of the scanned device.
23991    optional com.google.android.wearable.media.routing.ScanState scan_state = 1;
23992
23993    // Name of the media app package from where Output Switcher got triggered.
23994    optional string triggering_package_name = 2;
23995
23996    optional com.google.android.wearable.media.routing.OpType op_type = 3;
23997}
23998
23999/**
24000 * Logs the latency for scanning the first device.
24001 *
24002 * Logged from:
24003 * package: vendor/google_clockwork/packages/Media
24004 */
24005message WearMediaOutputSwitcherFirstDeviceScanLatency {
24006    // The latency of scanning the first device
24007    optional int32 latency_in_millis = 1;
24008}
24009
24010/**
24011 * Logs the latency for scanning all devices.
24012 *
24013 * Logged from:
24014 * package: vendor/google_clockwork/packages/Media
24015 */
24016message WearMediaOutputSwitcherAllDevicesScanLatency {
24017    // The latency of scanning all available devices in milli-second
24018    optional int32 latency_in_millis = 1;
24019
24020    // Type of target device.
24021    optional com.google.android.wearable.media.routing.MediaDeviceType target_device_type = 2;
24022}
24023
24024/**
24025 * Logs the latency in connecting to an already paired device.
24026 *
24027 * Logged from:
24028 * package: vendor/google_clockwork/packages/Media
24029 */
24030message WearMediaOutputSwitcherConnectDeviceLatency {
24031    // The latency of connecting to an already paired device in milli-second.
24032    optional int32 latency_in_millis = 1;
24033
24034    // Type of target medium.
24035    optional com.google.android.wearable.media.routing.MediumType target_device_medium_type = 2;
24036
24037    // Type of target device.
24038    optional com.google.android.wearable.media.routing.MediaDeviceType target_device_type = 3;
24039}
24040
24041/**
24042 * Logs package manager snapshot performance.
24043 *
24044 * Logs from:
24045 *   frameworks/base/services/core/java/com/android/server/pm/SnapshotStatistics.java
24046 */
24047message PackageManagerSnapshotReported {
24048    // The histogram of snapshot rebuild latency in a period. Each bucket
24049    // represents a range of rebuild latency such as less than 1 ms, and the
24050    // value of the bucket is the number of snapshots in this range.
24051    repeated int32 rebuild_latency_buckets= 1;
24052
24053    // The histogram of the snapshot usage in a period. Each bucket
24054    // represents a range of snapshot uses such as less than 1, and the
24055    // value is the number of snapshots in this range.
24056    repeated int32 reuse_count_buckets = 2;
24057
24058    // The maximum rebuild latency in a period.
24059    optional int64 max_rebuild_latency_us = 3;
24060
24061    // The maximum number of snapshot usage in a period.
24062    optional int32 max_reuse_count = 4;
24063
24064    // The average rebuild latency for each snapshot in a period.
24065    optional int64 rebuild_latency_us_avg = 5;
24066
24067    // The average snapshot usage for each snapshot in a period.
24068    optional int32 reuse_count_avg = 6;
24069
24070    // The number of packages on the device.
24071    optional int32 packages_count = 7;
24072}
24073
24074/**
24075 * Logs package manager apps filter cache built performance.
24076 *
24077 * Logs from:
24078 *   frameworks/base/services/core/java/com/android/server/pm/AppsFilterImpl.java
24079 */
24080message PackageManagerAppsFilterCacheBuildReported {
24081    // An event id to indicate the type of the cache building.
24082    enum Event {
24083        UNSPECIFIED = 0;
24084        BOOT = 1;
24085        USER_CREATED = 2;
24086        USER_DELETED = 3;
24087    }
24088    optional Event event_type = 1;
24089
24090    // The time to build the cache in microseconds.
24091    optional int64 build_cache_latency_us = 2;
24092
24093    // The number of users on the device.
24094    optional int32 user_count = 3;
24095
24096    // The number of packages on the device.
24097    optional int32 packages_count = 4;
24098
24099    // The size of the cache.
24100    optional int32 cache_size_bytes = 5;
24101}
24102
24103/**
24104 * Logs package manager apps filter cache updated performance.
24105 *
24106 * Logs from:
24107 *   frameworks/base/services/core/java/com/android/server/pm/AppsFilterImpl.java
24108 */
24109message PackageManagerAppsFilterCacheUpdateReported {
24110    // An event id to indicate the type of cache updating.
24111    enum Event {
24112        UNSPECIFIED = 0;
24113        PACKAGE_ADDED = 1;
24114        PACKAGE_DELETED = 2;
24115        PACKAGE_REPLACED = 3;
24116        COMPAT_CHANGED = 4;
24117    }
24118    optional Event event_type = 1;
24119
24120    // The package's uid.
24121    optional int32 uid = 2 [(is_uid) = true];
24122
24123    // The time to update the cache in microseconds.
24124    optional int64 update_cache_latency_us = 3;
24125
24126    // The number of users on the device.
24127    optional int32 user_count = 4;
24128
24129    // The number of packages on the device.
24130    optional int32 packages_count = 5;
24131
24132    // The size of the cache.
24133    optional int32 cache_size_bytes = 6;
24134}
24135
24136/**
24137* Logged during the watch face editing session in Wear Services
24138* This atom will log the duration with SessionStateEnum#END.
24139*
24140* Logged from :
24141* com/google/wear/services/watchfaces/editing/api/WatchFaceEditingApiImpl.java
24142*/
24143message WsWatchFaceEdited {
24144   // Depicts the state of the session eg: START/END/ABORT.
24145   optional android.app.wearservices.SessionStateEnum session_state = 1;
24146
24147   // Session duration for watch face editing.
24148   optional int32 session_duration_millis = 2;
24149
24150   // Enum to depict the source of the request. Values (PHONE, WATCH)
24151   optional android.app.wearservices.RequestSource request_source = 3;
24152
24153   // Component package for watch face.
24154   optional int32 component_package_uid = 4 [(is_uid) = true];
24155}
24156
24157/**
24158* Logged for watch face favorite feature in Wear Services.
24159*
24160* Logged from :
24161* com/google/wear/services/watchfaces/api/WatchFacesApiImpl.java
24162*/
24163message WsWatchFaceFavouriteActionReported {
24164   // Component package for watch face.
24165   optional int32 component_package_uid = 1 [(is_uid) = true];
24166
24167   // Depicts the action for wf favorites eg: Add/Remove.
24168   optional android.app.wearservices.ActionEnum favorite_action = 2;
24169
24170   // Enum to depict the source of the request. Values (PHONE, WATCH)
24171   optional android.app.wearservices.RequestSource request_source = 3;
24172}
24173
24174/**
24175* Logged for the watch face set feature in Wear Services.
24176*
24177* Logged from :
24178* com/google/wear/services/watchfaces/api/WatchFacesApiImpl.java
24179*/
24180message WsWatchFaceSetActionReported {
24181   // Component package for watch face.
24182   optional int32 component_package_uid = 1 [(is_uid) = true];
24183
24184  // Result for WF, whether it resulted in SAME/FAVORITE/FALLBACK
24185  optional android.app.wearservices.SetResultEnum wf_set_result = 2;
24186
24187  // Enum to depict the source of the request. Values (PHONE, WATCH)
24188   optional android.app.wearservices.RequestSource request_source = 3;
24189}
24190
24191/**
24192* Logged when tile list is modified (go/wear-dd-wearservices-telemetry)
24193*/
24194message WsTileListChanged {
24195    enum Event {
24196        EVENT_UNKNOWN = 0;
24197        TILE_ADDED = 1;
24198        TILE_REMOVED = 2;
24199    }
24200    // Component package for the tile that is being changed.
24201    optional int32 component_package_uid = 1 [(is_uid) = true];
24202
24203    // Class name for the tile.
24204    optional string component_class_name = 2;
24205
24206    // The event in result of which tile list has changed.
24207    optional Event event = 3;
24208
24209    // Where a tile has been changed from. When changed on the companion equals
24210    // to the phone source, otherwise watch source if it's changed from the watch.
24211    optional android.app.wearservices.RequestSource request_source = 4;
24212
24213    // The package name of the app where the tile change has originated from.
24214    // Null for cases where the tile change originated from paired phone
24215    // where request_source would be RequestSource.PHONE.
24216    optional string origin_package_name = 5;
24217}
24218
24219/**
24220* A snapshot of all visible tiles in the order they appear on the watch.
24221* (go/wear-dd-wearservices-telemetry)
24222*/
24223message WsTileSnapshot {
24224    // Component package name for the tiles.
24225    repeated string component_package_name = 1;
24226
24227    // Class name for the tiles.
24228    repeated string component_class_name = 2;
24229}
24230/*
24231* Logs calls to getType of a contentProvider, where the caller has potentially no access to
24232* the provider.
24233*
24234* Logs from :
24235* frameworks/base/services/core/java/com/android/server/am/ContentProviderHelper.java
24236* frameworks/base/core/java/android/content/ContentProvider.java
24237*/
24238message GetTypeAccessedWithoutPermission{
24239  // Indicator of the type of permission failure
24240  enum FailureType{
24241      UNSPECIFIED = 0;
24242      AM_FRAMEWORK_PERMISSION = 1;
24243      AM_CHECK_URI_PERMISSION = 2;
24244      AM_ERROR = 3;
24245      PROVIDER_FRAMEWORK_PERMISSION = 4;
24246      PROVIDER_CHECK_URI_PERMISSION = 5;
24247      PROVIDER_ERROR = 6;
24248  }
24249  optional FailureType location = 1;
24250  // Name of the caller package
24251  optional int32 calling_uid = 2 [(is_uid) = true];
24252  // Name of the provider (authority) which is being accessed
24253  optional string provider = 3;
24254  // Type of the uri returned
24255  optional string type = 4;
24256}
24257
24258/** Logged when a complication is changed on a watch face. Both
24259  data for complication that is being placed in the complication
24260  slot (we call is new here) and for complication that is being
24261  replaced (we call is old) is reported.
24262*/
24263message WsWatchFaceComplicationSetChanged {
24264  // Watch face package uid
24265  optional int32 watch_face_package_uid = 1 [(is_uid) = true];
24266
24267  // Complication component package uid for complication that is being replaced.
24268  // Equals to -1 if new complication is placed on previously empty slot.
24269  optional int32 old_complication_component_package_uid = 2 [(is_uid) = true];
24270
24271  // Complication component class name for complication that is being replaced.
24272  // Equals to empty string if new complication is placed on previously empty slot.
24273  optional string old_complication_component_class_name = 3;
24274
24275  // Complication component package uid for new complication.
24276  // Equals to -1 if complication is removed from complication slot.
24277  optional int32 new_complication_component_package_uid = 4 [(is_uid) = true];
24278
24279  // Complication component class name for new complication.
24280  // Equals to empty string if complication is removed from complication slot.
24281  optional string new_complication_component_class_name = 5;
24282
24283  // Where a complication has been changed from. When changed on the companion equals
24284  // to SOURCE_PHONE, otherwise if it's changed from the watch SOURCE_WATCH.
24285  optional android.app.wearservices.RequestSource request_source = 6;
24286
24287  // Old complication type.
24288  optional int32 old_complication_type = 7;
24289
24290  // New complication type.
24291  optional int32 new_complication_type = 8;
24292}
24293
24294/** Snapshot of all active complications on the current watch face.
24295*   (go/wear-dd-wearservices-telemetry)
24296*/
24297message WsActiveWatchFaceComplicationSetSnapshot {
24298  // Complication package name.
24299  repeated string complication_component_package_name = 1;
24300
24301  // Complication component class name.
24302  repeated string complication_component_class_name = 2;
24303
24304  // Complication type.
24305  repeated int32 complication_type = 4;
24306
24307  // Active watch face package uid.
24308  optional int32 watch_face_package_uid = 3 [(is_uid) = true];
24309
24310  /* Active watch face class name. This will be
24311  null for Declarative WF packages, as these packages have only one WF. */
24312  optional string watch_face_class_name = 5;
24313}
24314
24315message UnsafeIntentEventReported {
24316    enum EventType {
24317        UNKNOWN = 0;
24318        // When a component is matched with a null action.
24319        NULL_ACTION_MATCH = 1;
24320        // When a non-exported internal component is matched.
24321        INTERNAL_NON_EXPORTED_COMPONENT_MATCH = 2;
24322        // When an explicit intent does not match
24323        // an external component intent filter.
24324        EXPLICIT_INTENT_FILTER_UNMATCH = 3;
24325        // When a mutable pending intent for an implicit intent is retrieved
24326        NEW_MUTABLE_IMPLICIT_PENDING_INTENT_RETRIEVED = 4;
24327    }
24328    // Type of matching event.
24329    optional EventType event_type = 1;
24330    // The calling UID.
24331    optional int32 calling_uid = 2;
24332    // The component name of the intent.
24333    optional string component_name = 3;
24334    // The package name of the intent.
24335    optional string package_name = 4;
24336    // The action of the intent.
24337    optional string action = 5;
24338    // List of categories of the intent.
24339    repeated string categories = 6;
24340    // Data type of the intent.
24341    optional string data_type = 7;
24342    // Data scheme of the intent.
24343    optional string data_scheme = 8;
24344    // Is the unsafe intent event blocked by the system.
24345    optional bool is_blocked = 9;
24346}
24347
24348/**
24349 * Snapshot of all favorite watch faces from the watch.
24350 */
24351message WsFavouriteWatchFaceListSnapshot {
24352  repeated string watch_face_component_name = 1;
24353}
24354