1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.os.statsd;
20option java_package = "com.android.os";
21option java_outer_classname = "AtomsProto";
22
23import "frameworks/proto_logging/stats/atom_field_options.proto";
24import "frameworks/proto_logging/stats/enums/app/enums.proto";
25import "frameworks/proto_logging/stats/enums/app/job/enums.proto";
26import "frameworks/proto_logging/stats/enums/app/settings_enums.proto";
27import "frameworks/proto_logging/stats/enums/app/media_output_enum.proto";
28import "frameworks/proto_logging/stats/enums/app/tvsettings_enums.proto";
29import "frameworks/proto_logging/stats/enums/bluetooth/a2dp/enums.proto";
30import "frameworks/proto_logging/stats/enums/bluetooth/enums.proto";
31import "frameworks/proto_logging/stats/enums/bluetooth/hci/enums.proto";
32import "frameworks/proto_logging/stats/enums/bluetooth/hfp/enums.proto";
33import "frameworks/proto_logging/stats/enums/bluetooth/smp/enums.proto";
34import "frameworks/proto_logging/stats/enums/debug/enums.proto";
35import "frameworks/proto_logging/stats/enums/hardware/biometrics/enums.proto";
36import "frameworks/proto_logging/stats/enums/hardware/sensor/assist/enums.proto";
37import "frameworks/proto_logging/stats/enums/net/enums.proto";
38import "frameworks/proto_logging/stats/enums/os/enums.proto";
39import "frameworks/proto_logging/stats/enums/server/connectivity/data_stall_event.proto";
40import "frameworks/proto_logging/stats/enums/server/enums.proto";
41import "frameworks/proto_logging/stats/enums/server/job/enums.proto";
42import "frameworks/proto_logging/stats/enums/server/location/enums.proto";
43import "frameworks/proto_logging/stats/enums/service/enums.proto";
44import "frameworks/proto_logging/stats/enums/service/procstats_enum.proto";
45import "frameworks/proto_logging/stats/enums/stats/connectivity/network_stack.proto";
46import "frameworks/proto_logging/stats/enums/stats/connectivity/tethering.proto";
47import "frameworks/proto_logging/stats/enums/stats/dnsresolver/dns_resolver.proto";
48import "frameworks/proto_logging/stats/enums/stats/devicepolicy/device_policy.proto";
49import "frameworks/proto_logging/stats/enums/stats/devicepolicy/device_policy_enums.proto";
50import "frameworks/proto_logging/stats/enums/stats/docsui/docsui_enums.proto";
51import "frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto";
52import "frameworks/proto_logging/stats/enums/stats/enums.proto";
53import "frameworks/proto_logging/stats/enums/stats/hdmi/enums.proto";
54import "frameworks/proto_logging/stats/enums/stats/intelligence/enums.proto";
55import "frameworks/proto_logging/stats/enums/stats/launcher/launcher.proto";
56import "frameworks/proto_logging/stats/enums/stats/location/location_enums.proto";
57import "frameworks/proto_logging/stats/enums/stats/mediametrics/mediametrics.proto";
58import "frameworks/proto_logging/stats/enums/stats/mediaprovider/mediaprovider_enums.proto";
59import "frameworks/proto_logging/stats/enums/stats/storage/storage_enums.proto";
60import "frameworks/proto_logging/stats/enums/stats/style/style_enums.proto";
61import "frameworks/proto_logging/stats/enums/stats/sysui/notification_enums.proto";
62import "frameworks/proto_logging/stats/enums/stats/tls/enums.proto";
63import "frameworks/proto_logging/stats/enums/stats/tv/tif_enums.proto";
64import "frameworks/proto_logging/stats/enums/stats/wm/enums.proto";
65import "frameworks/proto_logging/stats/enums/system/security/keystore2/enums.proto";
66import "frameworks/proto_logging/stats/enums/telecomm/enums.proto";
67import "frameworks/proto_logging/stats/enums/telephony/enums.proto";
68import "frameworks/proto_logging/stats/enums/view/enums.proto";
69import "frameworks/proto_logging/stats/enums/wifi/enums.proto";
70import "frameworks/proto_logging/stats/enums/stats/textclassifier/textclassifier_enums.proto";
71import "frameworks/proto_logging/stats/enums/stats/otaupdate/updateengine_enums.proto";
72import "frameworks/proto_logging/stats/message/mediametrics_message.proto";
73
74/**
75 * The primary atom class. This message defines all of the available
76 * raw stats log events from the Android system, also known as "atoms."
77 *
78 * This field contains a single oneof with all of the available messages.
79 * The stats-log-api-gen tool runs as part of the Android build and
80 * generates the android.util.StatsLog class, which contains the constants
81 * and methods that Android uses to log.
82 *
83 * This Atom class is not actually built into the Android system.
84 * Instead, statsd on Android constructs these messages synthetically,
85 * in the format defined here and in stats_log.proto.
86 */
87message Atom {
88    // Pushed atoms start at 2.
89    oneof pushed {
90        // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
91        BleScanStateChanged ble_scan_state_changed = 2
92                [(module) = "bluetooth", (module) = "statsdtest"];
93        ProcessStateChanged process_state_changed = 3 [(module) = "framework"];
94        BleScanResultReceived ble_scan_result_received = 4 [(module) = "bluetooth"];
95        SensorStateChanged sensor_state_changed =
96                5 [(module) = "framework", (module) = "statsdtest"];
97        GpsScanStateChanged gps_scan_state_changed = 6 [(module) = "framework"];
98        SyncStateChanged sync_state_changed = 7 [(module) = "framework", (module) = "statsdtest"];
99        ScheduledJobStateChanged scheduled_job_state_changed =
100                8 [(module) = "framework", (module) = "statsdtest"];
101        ScreenBrightnessChanged screen_brightness_changed =
102                9 [(module) = "framework", (module) = "statsdtest"];
103        WakelockStateChanged wakelock_state_changed =
104                10 [(module) = "framework", (module) = "statsdtest"];
105        LongPartialWakelockStateChanged long_partial_wakelock_state_changed =
106                11 [(module) = "framework"];
107        MobileRadioPowerStateChanged mobile_radio_power_state_changed =
108                12 [(module) = "framework", (truncate_timestamp) = true];
109        WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13 [(module) = "framework"];
110        ActivityManagerSleepStateChanged activity_manager_sleep_state_changed =
111                14 [(module) = "framework"];
112        MemoryFactorStateChanged memory_factor_state_changed = 15 [(module) = "framework"];
113        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16 [(module) = "framework"];
114        CachedKillReported cached_kill_reported = 17 [(module) = "framework"];
115        ProcessMemoryStatReported process_memory_stat_reported = 18 [(module) = "framework"];
116        LauncherUIChanged launcher_event = 19 [(module) = "sysui"];
117        BatterySaverModeStateChanged battery_saver_mode_state_changed =
118                20 [(module) = "framework", (module) = "statsdtest"];
119        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21 [(module) = "framework"];
120        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22 [(module) = "framework"];
121        AudioStateChanged audio_state_changed =
122                23 [(module) = "framework", (truncate_timestamp) = true];
123        MediaCodecStateChanged media_codec_state_changed = 24 [(module) = "framework"];
124        CameraStateChanged camera_state_changed = 25 [(module) = "framework"];
125        FlashlightStateChanged flashlight_state_changed = 26 [(module) = "framework"];
126        UidProcessStateChanged uid_process_state_changed =
127                27 [(module) = "framework", (module) = "statsdtest"];
128        ProcessLifeCycleStateChanged process_life_cycle_state_changed =
129                28 [(module) = "framework", (module) = "statsdtest"];
130        ScreenStateChanged screen_state_changed =
131                29 [(module) = "framework", (module) = "statsdtest"];
132        BatteryLevelChanged battery_level_changed =
133                30 [(module) = "framework", (module) = "statsdtest"];
134        ChargingStateChanged charging_state_changed = 31 [(module) = "framework"];
135        PluggedStateChanged plugged_state_changed = 32
136                [(module) = "framework", (module) = "statsdtest"];
137        InteractiveStateChanged interactive_state_changed = 33 [(module) = "framework"];
138        TouchEventReported touch_event_reported = 34;
139        WakeupAlarmOccurred wakeup_alarm_occurred = 35 [(module) = "framework"];
140        KernelWakeupReported kernel_wakeup_reported = 36 [(module) = "framework"];
141        WifiLockStateChanged wifi_lock_state_changed = 37 [(module) = "wifi"];
142        WifiSignalStrengthChanged wifi_signal_strength_changed = 38 [(module) = "wifi"];
143        WifiScanStateChanged wifi_scan_state_changed = 39 [(module) = "wifi"];
144        PhoneSignalStrengthChanged phone_signal_strength_changed =
145                40 [(module) = "framework", (truncate_timestamp) = true];
146        SettingChanged setting_changed = 41 [(module) = "framework"];
147        ActivityForegroundStateChanged activity_foreground_state_changed =
148                42 [(module) = "framework", (module) = "statsdtest"];
149        IsolatedUidChanged isolated_uid_changed =
150                43 [(module) = "framework", (module) = "statsd", (module) = "statsdtest"];
151        PacketWakeupOccurred packet_wakeup_occurred = 44 [(module) = "framework"];
152        WallClockTimeShifted wall_clock_time_shifted = 45 [(module) = "framework"];
153        AnomalyDetected anomaly_detected = 46 [(module) = "statsd"];
154        AppBreadcrumbReported app_breadcrumb_reported = 47 [(module) = "statsd"];
155        AppStartOccurred app_start_occurred = 48 [(module) = "framework", (module) = "statsdtest"];
156        AppStartCanceled app_start_canceled = 49 [(module) = "framework"];
157        AppStartFullyDrawn app_start_fully_drawn = 50 [(module) = "framework"];
158        LmkKillOccurred lmk_kill_occurred = 51 [(module) = "framework"];
159        PictureInPictureStateChanged picture_in_picture_state_changed = 52 [(module) = "framework"];
160        WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53 [(module) = "wifi"];
161        LmkStateChanged lmk_state_changed = 54 [(module) = "framework"];
162        AppStartMemoryStateCaptured app_start_memory_state_captured = 55 [(module) = "framework"];
163        ShutdownSequenceReported shutdown_sequence_reported = 56 [(module) = "framework"];
164        BootSequenceReported boot_sequence_reported = 57;
165        DaveyOccurred davey_occurred = 58 [(module) = "statsd", deprecated = true];
166        OverlayStateChanged overlay_state_changed =
167                59 [(module) = "framework", (module) = "statsdtest"];
168        ForegroundServiceStateChanged foreground_service_state_changed
169                = 60 [(module) = "framework"];
170        CallStateChanged call_state_changed =
171                61 [(module) = "telecom", (truncate_timestamp) = true];
172        KeyguardStateChanged keyguard_state_changed = 62 [(module) = "sysui"];
173        KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63 [(module) = "sysui"];
174        KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64 [(module) = "sysui"];
175        AppDied app_died = 65 [(module) = "framework"];
176        ResourceConfigurationChanged resource_configuration_changed = 66 [(module) = "framework"];
177        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67 [(module) = "framework"];
178        BluetoothConnectionStateChanged bluetooth_connection_state_changed =
179                68 [(module) = "bluetooth"];
180        GpsSignalQualityChanged gps_signal_quality_changed = 69 [(module) = "framework"];
181        UsbConnectorStateChanged usb_connector_state_changed = 70 [(module) = "framework"];
182        SpeakerImpedanceReported speaker_impedance_reported = 71;
183        HardwareFailed hardware_failed = 72;
184        PhysicalDropDetected physical_drop_detected = 73;
185        ChargeCyclesReported charge_cycles_reported = 74;
186        MobileConnectionStateChanged mobile_connection_state_changed = 75 [(module) = "telephony"];
187        MobileRadioTechnologyChanged mobile_radio_technology_changed = 76 [(module) = "telephony"];
188        UsbDeviceAttached usb_device_attached = 77 [(module) = "framework"];
189        AppCrashOccurred app_crash_occurred = 78 [(module) = "framework", (module) = "statsdtest"];
190        ANROccurred anr_occurred = 79 [(module) = "framework"];
191        WTFOccurred wtf_occurred = 80 [(module) = "framework"];
192        LowMemReported low_mem_reported = 81 [(module) = "framework"];
193        GenericAtom generic_atom = 82;
194        KeyValuePairsAtom key_value_pairs_atom = 83 [(module) = "framework", (module) = "statsd"];
195        VibratorStateChanged vibrator_state_changed = 84 [(module) = "framework"];
196        DeferredJobStatsReported deferred_job_stats_reported = 85 [(module) = "framework"];
197        ThermalThrottlingStateChanged thermal_throttling = 86 [deprecated=true];
198        BiometricAcquired biometric_acquired = 87 [(module) = "framework"];
199        BiometricAuthenticated biometric_authenticated = 88 [(module) = "framework"];
200        BiometricErrorOccurred biometric_error_occurred = 89 [(module) = "framework"];
201        UiEventReported ui_event_reported = 90 [(module) = "framework", (module) = "sysui"];
202        BatteryHealthSnapshot battery_health_snapshot = 91;
203        SlowIo slow_io = 92;
204        BatteryCausedShutdown battery_caused_shutdown = 93;
205        PhoneServiceStateChanged phone_service_state_changed = 94 [(module) = "framework"];
206        PhoneStateChanged phone_state_changed = 95 [(module) = "framework"];
207        UserRestrictionChanged user_restriction_changed = 96;
208        SettingsUIChanged settings_ui_changed = 97 [(module) = "settings"];
209        ConnectivityStateChanged connectivity_state_changed = 98 [(module) = "framework"];
210        // TODO: service state change is very noisy shortly after boot, as well
211        // as at other transitions - coming out of doze, device plugged in, etc.
212        // Consider removing this if it becomes a problem
213        ServiceStateChanged service_state_changed = 99 [(module) = "framework"];
214        ServiceLaunchReported service_launch_reported = 100 [(module) = "framework"];
215        FlagFlipUpdateOccurred flag_flip_update_occurred = 101 [(module) = "framework"];
216        BinaryPushStateChanged binary_push_state_changed = 102 [(module) = "statsd"];
217        DevicePolicyEvent device_policy_event = 103 [(module) = "framework"];
218        DocsUIFileOperationCanceledReported docs_ui_file_op_canceled = 104 [(module) = "docsui"];
219        DocsUIFileOperationCopyMoveModeReported docs_ui_file_op_copy_move_mode_reported =
220            105 [(module) = "docsui"];
221        DocsUIFileOperationFailureReported docs_ui_file_op_failure = 106 [(module) = "docsui"];
222        DocsUIFileOperationReported docs_ui_provider_file_op = 107 [(module) = "docsui"];
223        DocsUIInvalidScopedAccessRequestReported docs_ui_invalid_scoped_access_request =
224            108 [(module) = "docsui"];
225        DocsUILaunchReported docs_ui_launch_reported = 109 [(module) = "docsui"];
226        DocsUIRootVisitedReported docs_ui_root_visited = 110 [(module) = "docsui"];
227        DocsUIStartupMsReported docs_ui_startup_ms = 111 [(module) = "docsui"];
228        DocsUIUserActionReported docs_ui_user_action_reported = 112 [(module) = "docsui"];
229        WifiEnabledStateChanged wifi_enabled_state_changed = 113 [(module) = "framework"];
230        WifiRunningStateChanged wifi_running_state_changed = 114
231                [(module) = "framework", deprecated = true];
232        AppCompacted app_compacted = 115 [(module) = "framework"];
233        NetworkDnsEventReported network_dns_event_reported = 116 [(module) = "resolv"];
234        DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported =
235            117 [(module) = "docsui"];
236        DocsUIPickResultReported docs_ui_pick_result_reported = 118 [(module) = "docsui"];
237        DocsUISearchModeReported docs_ui_search_mode_reported = 119 [(module) = "docsui"];
238        DocsUISearchTypeReported docs_ui_search_type_reported = 120 [(module) = "docsui"];
239        DataStallEvent data_stall_event = 121 [(module) = "network_stack"];
240        RescuePartyResetReported rescue_party_reset_reported = 122 [(module) = "framework"];
241        SignedConfigReported signed_config_reported = 123 [(module) = "framework"];
242        GnssNiEventReported gnss_ni_event_reported = 124 [(module) = "framework"];
243        BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event =
244                125 [(module) = "bluetooth"];
245        BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed =
246                126 [(module) = "bluetooth"];
247        BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed =
248                127 [(module) = "bluetooth"];
249        AppDowngraded app_downgraded = 128 [(module) = "framework"];
250        AppOptimizedAfterDowngraded app_optimized_after_downgraded = 129;
251        LowStorageStateChanged low_storage_state_changed = 130 [(module) = "framework"];
252        GnssNfwNotificationReported gnss_nfw_notification_reported = 131 [(module) = "framework"];
253        GnssConfigurationReported gnss_configuration_reported = 132 [(module) = "framework"];
254        UsbPortOverheatEvent usb_port_overheat_event_reported = 133;
255        NfcErrorOccurred nfc_error_occurred = 134 [(module) = "nfc"];
256        NfcStateChanged nfc_state_changed = 135 [(module) = "nfc"];
257        NfcBeamOccurred nfc_beam_occurred = 136 [(module) = "nfc"];
258        NfcCardemulationOccurred nfc_cardemulation_occurred = 137 [(module) = "nfc"];
259        NfcTagOccurred nfc_tag_occurred = 138 [(module) = "nfc"];
260        NfcHceTransactionOccurred nfc_hce_transaction_occurred = 139 [(module) = "nfc"];
261        SeStateChanged se_state_changed = 140 [(module) = "secure_element"];
262        SeOmapiReported se_omapi_reported = 141 [(module) = "secure_element"];
263        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported =
264                142 [(module) = "framework"];
265        AttentionManagerServiceResultReported attention_manager_service_result_reported =
266                143 [(module) = "framework"];
267        AdbConnectionChanged adb_connection_changed = 144 [(module) = "framework"];
268        SpeechDspStatReported speech_dsp_stat_reported = 145;
269        UsbContaminantReported usb_contaminant_reported = 146 [(module) = "framework"];
270        WatchdogRollbackOccurred watchdog_rollback_occurred =
271                147 [(module) = "framework", (module) = "statsd"];
272        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected =
273                148 [(module) = "framework"];
274        BubbleUIChanged bubble_ui_changed = 149 [(module) = "framework"];
275        ScheduledJobConstraintChanged scheduled_job_constraint_changed =
276                150 [(module) = "framework"];
277        BluetoothActiveDeviceChanged bluetooth_active_device_changed =
278                151 [(module) = "bluetooth"];
279        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed =
280                152 [(module) = "bluetooth"];
281        BluetoothA2dpCodecConfigChanged bluetooth_a2dp_codec_config_changed =
282                153 [(module) = "bluetooth"];
283        BluetoothA2dpCodecCapabilityChanged bluetooth_a2dp_codec_capability_changed =
284                154 [(module) = "bluetooth"];
285        BluetoothA2dpAudioUnderrunReported bluetooth_a2dp_audio_underrun_reported =
286                155 [(module) = "bluetooth"];
287        BluetoothA2dpAudioOverrunReported bluetooth_a2dp_audio_overrun_reported =
288                156 [(module) = "bluetooth"];
289        BluetoothDeviceRssiReported bluetooth_device_rssi_reported =
290                157 [(module) = "bluetooth"];
291        BluetoothDeviceFailedContactCounterReported
292                bluetooth_device_failed_contact_counter_reported = 158 [(module) = "bluetooth"];
293        BluetoothDeviceTxPowerLevelReported bluetooth_device_tx_power_level_reported =
294                159 [(module) = "bluetooth"];
295        BluetoothHciTimeoutReported bluetooth_hci_timeout_reported =
296                160 [(module) = "bluetooth"];
297        BluetoothQualityReportReported bluetooth_quality_report_reported =
298                161 [(module) = "bluetooth"];
299        BluetoothDeviceInfoReported bluetooth_device_info_reported =
300                162 [(module) = "bluetooth"];
301        BluetoothRemoteVersionInfoReported bluetooth_remote_version_info_reported =
302                163 [(module) = "bluetooth"];
303        BluetoothSdpAttributeReported bluetooth_sdp_attribute_reported =
304                164 [(module) = "bluetooth"];
305        BluetoothBondStateChanged bluetooth_bond_state_changed =
306                165 [(module) = "bluetooth"];
307        BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported =
308                166 [(module) = "bluetooth"];
309        BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported =
310                167 [(module) = "bluetooth"];
311        ScreenTimeoutExtensionReported screen_timeout_extension_reported =
312                168 [(module) = "framework"];
313        ProcessStartTime process_start_time = 169 [(module) = "framework"];
314        PermissionGrantRequestResultReported permission_grant_request_result_reported =
315                170 [(module) = "permissioncontroller"];
316        BluetoothSocketConnectionStateChanged bluetooth_socket_connection_state_changed = 171;
317        DeviceIdentifierAccessDenied device_identifier_access_denied =
318                172 [(module) = "telephony_common"];
319        BubbleDeveloperErrorReported bubble_developer_error_reported = 173 [(module) = "framework"];
320        AssistGestureStageReported assist_gesture_stage_reported = 174 [(module) = "sysui"];
321        AssistGestureFeedbackReported assist_gesture_feedback_reported = 175 [(module) = "sysui"];
322        AssistGestureProgressReported assist_gesture_progress_reported = 176 [(module) = "sysui"];
323        TouchGestureClassified touch_gesture_classified = 177 [(module) = "framework"];
324        HiddenApiUsed hidden_api_used = 178 [(module) = "framework"];
325        StyleUIChanged style_ui_changed = 179 [(module) = "sysui"];
326        PrivacyIndicatorsInteracted privacy_indicators_interacted =
327                180 [(module) = "permissioncontroller"];
328        AppInstallOnExternalStorageReported app_install_on_external_storage_reported =
329                181 [(module) = "framework"];
330        NetworkStackReported network_stack_reported = 182 [(module) = "network_stack"];
331        AppMovedStorageReported app_moved_storage_reported = 183 [(module) = "framework"];
332        BiometricEnrolled biometric_enrolled = 184 [(module) = "framework"];
333        SystemServerWatchdogOccurred system_server_watchdog_occurred = 185 [(module) = "framework"];
334        TombStoneOccurred tomb_stone_occurred = 186 [(module) = "framework"];
335        BluetoothClassOfDeviceReported bluetooth_class_of_device_reported =
336                187 [(module) = "bluetooth"];
337        IntelligenceEventReported intelligence_event_reported =
338                188 [(module) = "intelligence"];
339        ThermalThrottlingSeverityStateChanged thermal_throttling_severity_state_changed =
340                189 [(module) = "framework"];
341        RoleRequestResultReported role_request_result_reported =
342                190 [(module) = "permissioncontroller"];
343        MediametricsAudiopolicyReported mediametrics_audiopolicy_reported = 191;
344        MediametricsAudiorecordReported mediametrics_audiorecord_reported = 192;
345        MediametricsAudiothreadReported mediametrics_audiothread_reported = 193;
346        MediametricsAudiotrackReported mediametrics_audiotrack_reported = 194;
347        MediametricsCodecReported mediametrics_codec_reported = 195;
348        MediametricsDrmWidevineReported mediametrics_drm_widevine_reported = 196;
349        MediametricsExtractorReported mediametrics_extractor_reported = 197;
350        MediametricsMediadrmReported mediametrics_mediadrm_reported = 198;
351        MediametricsNuPlayerReported mediametrics_nuplayer_reported = 199;
352        MediametricsRecorderReported mediametrics_recorder_reported = 200;
353        MediametricsDrmManagerReported mediametrics_drmmanager_reported = 201;
354        CarPowerStateChanged car_power_state_changed = 203 [(module) = "car"];
355        GarageModeInfo garage_mode_info = 204 [(module) = "car"];
356        TestAtomReported test_atom_reported = 205 [(module) = "cts"];
357        ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported =
358                206 [(module) = "framework"];
359        ContentCaptureServiceEvents content_capture_service_events = 207 [(module) = "framework"];
360        ContentCaptureSessionEvents content_capture_session_events = 208 [(module) = "framework"];
361        ContentCaptureFlushed content_capture_flushed = 209 [(module) = "framework"];
362        LocationManagerApiUsageReported location_manager_api_usage_reported =
363                210 [(module) = "framework"];
364        ReviewPermissionsFragmentResultReported review_permissions_fragment_result_reported =
365                211 [(module) = "permissioncontroller"];
366        RuntimePermissionsUpgradeResult runtime_permissions_upgrade_result =
367                212 [(module) = "permissioncontroller"];
368        GrantPermissionsActivityButtonActions grant_permissions_activity_button_actions =
369                213 [(module) = "permissioncontroller"];
370        LocationAccessCheckNotificationAction location_access_check_notification_action =
371                214 [(module) = "permissioncontroller"];
372        AppPermissionFragmentActionReported app_permission_fragment_action_reported =
373                215 [(module) = "permissioncontroller"];
374        AppPermissionFragmentViewed app_permission_fragment_viewed =
375                216 [(module) = "permissioncontroller"];
376        AppPermissionsFragmentViewed app_permissions_fragment_viewed =
377                217 [(module) = "permissioncontroller"];
378        PermissionAppsFragmentViewed permission_apps_fragment_viewed =
379                218  [(module) = "permissioncontroller"];
380        TextSelectionEvent text_selection_event = 219  [(module) = "textclassifier"];
381        TextLinkifyEvent text_linkify_event = 220  [(module) = "textclassifier"];
382        ConversationActionsEvent conversation_actions_event = 221  [(module) = "textclassifier"];
383        LanguageDetectionEvent language_detection_event = 222  [(module) = "textclassifier"];
384        ExclusionRectStateChanged exclusion_rect_state_changed = 223 [(module) = "framework"];
385        BackGesture back_gesture_reported_reported = 224 [(module) = "sysui"];
386        UpdateEngineUpdateAttemptReported update_engine_update_attempt_reported = 225;
387        UpdateEngineSuccessfulUpdateReported update_engine_successful_update_reported = 226;
388        CameraActionEvent camera_action_event = 227 [(module) = "framework"];
389        AppCompatibilityChangeReported app_compatibility_change_reported =
390                228 [(module) = "framework"];
391        PerfettoUploaded perfetto_uploaded = 229 [(module) = "perfetto"];
392        VmsClientConnectionStateChanged vms_client_connection_state_changed =
393                230 [(module) = "car"];
394        MediaProviderScanOccurred media_provider_scan_occurred = 233 [(module) = "mediaprovider"];
395        MediaContentDeleted media_content_deleted = 234 [(module) = "mediaprovider"];
396        MediaProviderPermissionRequested media_provider_permission_requested =
397            235 [(module) = "mediaprovider"];
398        MediaProviderSchemaChanged media_provider_schema_changed = 236 [(module) = "mediaprovider"];
399        MediaProviderIdleMaintenanceFinished media_provider_idle_maintenance_finished =
400            237 [(module) = "mediaprovider"];
401        RebootEscrowRecoveryReported reboot_escrow_recovery_reported = 238 [(module) = "framework"];
402        BootTimeEventDuration boot_time_event_duration_reported = 239 [(module) = "framework"];
403        BootTimeEventElapsedTime boot_time_event_elapsed_time_reported =
404                240 [(module) = "framework"];
405        BootTimeEventUtcTime boot_time_event_utc_time_reported = 241;
406        BootTimeEventErrorCode boot_time_event_error_code_reported = 242 [(module) = "framework"];
407        UserspaceRebootReported userspace_reboot_reported = 243 [(module) = "framework"];
408        NotificationReported notification_reported = 244 [(module) = "framework"];
409        NotificationPanelReported notification_panel_reported = 245 [(module) = "sysui"];
410        NotificationChannelModified notification_channel_modified = 246 [(module) = "framework"];
411        IntegrityCheckResultReported integrity_check_result_reported = 247 [(module) = "framework"];
412        IntegrityRulesPushed integrity_rules_pushed = 248 [(module) = "framework"];
413        CellBroadcastMessageReported cb_message_reported =
414            249 [(module) = "cellbroadcast"];
415        CellBroadcastMessageError cb_message_error =
416            250 [(module) = "cellbroadcast"];
417        WifiHealthStatReported wifi_health_stat_reported = 251 [(module) = "wifi"];
418        WifiFailureStatReported wifi_failure_stat_reported = 252 [(module) = "wifi"];
419        WifiConnectionResultReported wifi_connection_result_reported = 253 [(module) = "wifi"];
420        AppFreezeChanged app_freeze_changed = 254 [(module) = "framework"];
421        SnapshotMergeReported snapshot_merge_reported = 255;
422        ForegroundServiceAppOpSessionEnded foreground_service_app_op_session_ended =
423            256  [(module) = "framework"];
424        // DisplayJankReported was deprecated in Android 12+
425        DisplayJankReported display_jank_reported = 257 [deprecated = true];
426        AppStandbyBucketChanged app_standby_bucket_changed = 258 [(module) = "framework"];
427        SharesheetStarted sharesheet_started = 259 [(module) = "framework"];
428        RankingSelected ranking_selected = 260 [(module) = "framework", (module) = "sysui"];
429        TvSettingsUIInteracted tvsettings_ui_interacted = 261 [(module) = "tv_settings"];
430        LauncherStaticLayout launcher_snapshot = 262 [(module) = "sysui"];
431        PackageInstallerV2Reported package_installer_v2_reported = 263 [(module) = "framework"];
432        UserLifecycleJourneyReported user_lifecycle_journey_reported = 264 [(module) = "framework"];
433        UserLifecycleEventOccurred user_lifecycle_event_occurred = 265 [(module) = "framework"];
434        AccessibilityShortcutReported accessibility_shortcut_reported =
435            266 [(module) = "framework"];
436        AccessibilityServiceReported accessibility_service_reported = 267 [(module) = "settings"];
437        DocsUIDragAndDropReported docs_ui_drag_and_drop_reported = 268 [(module) = "docsui"];
438        AppUsageEventOccurred app_usage_event_occurred = 269 [(module) = "framework"];
439        AutoRevokeNotificationClicked auto_revoke_notification_clicked =
440            270 [(module) = "permissioncontroller"];
441        AutoRevokeFragmentAppViewed auto_revoke_fragment_app_viewed =
442            271 [(module) = "permissioncontroller"];
443        AutoRevokedAppInteraction auto_revoked_app_interaction =
444            272 [(module) = "permissioncontroller", (module) = "settings"];
445        AppPermissionGroupsFragmentAutoRevokeAction
446            app_permission_groups_fragment_auto_revoke_action =
447            273 [(module) = "permissioncontroller"];
448        EvsUsageStatsReported evs_usage_stats_reported = 274 [(module) = "evs"];
449        AudioPowerUsageDataReported audio_power_usage_data_reported = 275;
450        TvTunerStateChanged tv_tuner_state_changed = 276 [(module) = "framework"];
451        MediaOutputOpSwitchReported mediaoutput_op_switch_reported =
452            277 [(module) = "sysui"];
453        CellBroadcastMessageFiltered cb_message_filtered =
454            278 [(module) = "cellbroadcast"];
455        TvTunerDvrStatus tv_tuner_dvr_status = 279 [(module) = "framework"];
456        TvCasSessionOpenStatus tv_cas_session_open_status =
457            280 [(module) = "framework"];
458        AssistantInvocationReported assistant_invocation_reported = 281 [(module) = "framework"];
459        DisplayWakeReported display_wake_reported = 282 [(module) = "framework"];
460        CarUserHalModifyUserRequestReported car_user_hal_modify_user_request_reported =
461            283 [(module) = "car"];
462        CarUserHalModifyUserResponseReported car_user_hal_modify_user_response_reported =
463            284 [(module) = "car"];
464        CarUserHalPostSwitchResponseReported car_user_hal_post_switch_response_reported =
465            285 [(module) = "car"];
466        CarUserHalInitialUserInfoRequestReported car_user_hal_initial_user_info_request_reported =
467            286 [(module) = "car"];
468        CarUserHalInitialUserInfoResponseReported car_user_hal_initial_user_info_response_reported =
469            287 [(module) = "car"];
470        CarUserHalUserAssociationRequestReported car_user_hal_user_association_request_reported =
471            288 [(module) = "car"];
472        CarUserHalSetUserAssociationResponseReported car_user_hal_set_user_association_response_reported =
473            289 [(module) = "car"];
474        NetworkIpProvisioningReported network_ip_provisioning_reported =
475            290 [(module) = "network_stack"];
476        NetworkDhcpRenewReported network_dhcp_renew_reported = 291 [(module) = "network_stack"];
477        NetworkValidationReported network_validation_reported = 292 [(module) = "network_stack"];
478        NetworkStackQuirkReported network_stack_quirk_reported = 293 [(module) = "network_stack"];
479        MediametricsAudioRecordDeviceUsageReported mediametrics_audiorecorddeviceusage_reported =
480            294;
481        MediametricsAudioThreadDeviceUsageReported mediametrics_audiothreaddeviceusage_reported =
482            295;
483        MediametricsAudioTrackDeviceUsageReported mediametrics_audiotrackdeviceusage_reported =
484            296;
485        MediametricsAudioDeviceConnectionReported mediametrics_audiodeviceconnection_reported =
486            297;
487        BlobCommitted blob_committed = 298 [(module) = "framework"];
488        BlobLeased blob_leased = 299 [(module) = "framework"];
489        BlobOpened blob_opened = 300 [(module) = "framework"];
490        ContactsProviderStatusReported contacts_provider_status_reported = 301;
491        KeystoreKeyEventReported keystore_key_event_reported = 302;
492        NetworkTetheringReported  network_tethering_reported =
493            303 [(module) = "network_tethering"];
494        ImeTouchReported ime_touch_reported = 304 [(module) = "sysui"];
495        UIInteractionFrameInfoReported ui_interaction_frame_info_reported =
496            305 [(module) = "framework"];
497        UIActionLatencyReported ui_action_latency_reported = 306 [(module) = "framework"];
498        WifiDisconnectReported wifi_disconnect_reported = 307 [(module) = "wifi"];
499        WifiConnectionStateChanged wifi_connection_state_changed = 308 [(module) = "wifi"];
500        HdmiCecActiveSourceChanged hdmi_cec_active_source_changed = 309 [(module) = "framework"];
501        HdmiCecMessageReported hdmi_cec_message_reported = 310 [(module) = "framework"];
502        AirplaneMode airplane_mode = 311 [(module) = "telephony"];
503        ModemRestart modem_restart = 312 [(module) = "telephony"];
504        CarrierIdMismatchReported carrier_id_mismatch_reported = 313 [(module) = "telephony"];
505        CarrierIdTableUpdated carrier_id_table_updated = 314 [(module) = "telephony"];
506        DataStallRecoveryReported data_stall_recovery_reported = 315 [(module) = "telephony"];
507        MediametricsMediaParserReported mediametrics_mediaparser_reported = 316;
508        TlsHandshakeReported tls_handshake_reported = 317 [(module) = "conscrypt"];
509        TextClassifierApiUsageReported text_classifier_api_usage_reported = 318  [(module) = "textclassifier"];
510        CarWatchdogKillStatsReported car_watchdog_kill_stats_reported = 319 [(module) = "car"];
511        MediametricsPlaybackReported mediametrics_playback_reported = 320 [(module) = "media_metrics"];
512        MediaNetworkInfoChanged media_network_info_changed = 321 [(module) = "media_metrics"];
513        MediaPlaybackStateChanged media_playback_state_changed = 322 [(module) = "media_metrics"];
514        MediaPlaybackErrorReported media_playback_error_reported = 323 [(module) = "media_metrics"];
515        MediaPlaybackTrackChanged media_playback_track_changed = 324 [(module) = "media_metrics"];
516        WifiScanReported wifi_scan_reported = 325 [(module) = "wifi"];
517        WifiPnoScanReported wifi_pno_scan_reported = 326  [(module) = "wifi"];
518        TifTuneStateChanged tif_tune_changed = 327 [(module) = "framework"];
519        AutoRotateReported auto_rotate_reported = 328 [(module) = "framework"];
520        PerfettoTrigger perfetto_trigger = 329 [(module) = "perfetto"];
521        TranscodingData transcoding_data = 330 [(module) = "mediaprovider"];
522        ImsServiceEntitlementUpdated ims_service_entitlement_updated = 331 [(module) = "imsentitlement"];
523        ArtDatumReported art_datum_reported = 332 [(module) = "art"];
524        DeviceRotated device_rotated = 333 [(module) = "framework"];
525        SimSpecificSettingsRestored sim_specific_settings_restored = 334
526            [(module) = "telephony"];
527        PinStorageEvent pin_storage_event = 336 [(module) = "telephony"];
528        FaceDownReported face_down_reported = 337 [(module) = "framework"];
529        BluetoothHALCrashReasonReported bluetooth_hal_crash_reason_reported =
530            338 [(module) = "bluetooth"];
531        RebootEscrowPreparationReported reboot_escrow_preparation_reported =
532            339 [(module) = "framework"];
533        RebootEscrowLskfCaptureReported reboot_escrow_lskf_capture_reported =
534            340 [(module) = "framework"];
535        RebootEscrowRebootReported reboot_escrow_reboot_reported = 341 [(module) = "framework"];
536        BinderLatencyReported binder_latency_reported = 342 [(module) = "framework"];
537        MediametricsAAudioStreamReported mediametrics_aaudiostream_reported = 343;
538        MediaTranscodingSessionEnded media_transcoding_session_ended = 344
539            [(module) = "media"];
540        MagnificationUsageReported magnification_usage_reported =
541            345 [(module) = "framework"];
542        MagnificationModeWithImeOnReported magnification_mode_with_ime_on_reported =
543            346 [(module) = "framework"];
544        AppSearchCallStatsReported app_search_call_stats_reported = 347 [(module) = "appsearch"];
545        AppSearchPutDocumentStatsReported app_search_put_document_stats_reported = 348 [(module) = "appsearch"];
546        DeviceControlChanged device_control_changed = 349 [(module) = "sysui"];
547        DeviceStateChanged device_state_changed = 350 [(module) = "framework"];
548        InputDeviceRegistered inputdevice_registered = 351 [(module) = "framework"];
549        SmartSpaceCardReported smartspace_card_reported = 352 [(module) = "sysui"];
550        AuthPromptAuthenticateInvoked auth_prompt_authenticate_invoked = 353 [(module) = "framework"];
551        AuthManagerCanAuthenticateInvoked auth_manager_can_authenticate_invoked = 354 [(module) = "framework"];
552        AuthEnrollActionInvoked auth_enroll_action_invoked = 355 [(module) = "framework"];
553        AuthDeprecatedAPIUsed auth_deprecated_api_used = 356 [(module) = "framework"];
554        UnattendedRebootOccurred unattended_reboot_occurred = 357 [(module) = "scheduling"];
555        LongRebootBlockingReported long_reboot_blocking_reported = 358 [(module) = "scheduling"];
556        LocationTimeZoneProviderStateChanged location_time_zone_provider_state_changed =
557            359 [(module) = "framework"];
558        // 360-363 are reserved.
559        FdtrackEventOccurred fdtrack_event_occurred = 364 [(module) = "framework"];
560        TimeoutAutoExtendedReported timeout_auto_extended_reported = 365
561            [(module) = "framework"];
562        OdrefreshReported odrefresh_reported = 366 [(module) = "art"];
563        AlarmBatchDelivered alarm_batch_delivered = 367 [(module) = "framework"];
564        AlarmScheduled alarm_scheduled = 368 [(module) = "framework"];
565        CarWatchdogIoOveruseStatsReported car_watchdog_io_overuse_stats_reported = 369 [(module) = "car"];
566        UserLevelHibernationStateChanged user_level_hibernation_state_changed = 370 [(module) = "framework"];
567        AppSearchInitializeStatsReported app_search_initialize_stats_reported = 371 [(module) = "appsearch"];
568        AppSearchQueryStatsReported app_search_query_stats_reported = 372 [(module) = "appsearch"];
569        AppProcessDied app_process_died = 373 [(module) = "framework"];
570        NetworkIpReachabilityMonitorReported network_ip_reachability_monitor_reported =
571            374 [(module) = "network_stack"];
572        SlowInputEventReported slow_input_event_reported = 375 [(module) = "input"];
573        ANROccurredProcessingStarted anr_occurred_processing_started = 376 [(module) = "framework"];
574        AppSearchRemoveStatsReported app_search_remove_stats_reported = 377 [(module) = "appsearch"];
575        MediaCodecReported media_codec_reported = 378 [(module) = "framework"];
576        PermissionUsageFragmentInteraction permission_usage_fragment_interaction = 379 [(module) = "permissioncontroller"];
577        PermissionDetailsInteraction permission_details_interaction = 380 [(module) = "permissioncontroller"];
578        PrivacySensorToggleInteraction privacy_sensor_toggle_interaction = 381 [(module) = "framework"];
579        PrivacyToggleDialogInteraction privacy_toggle_dialog_interaction = 382 [(module) = "framework"];
580        AppSearchOptimizeStatsReported app_search_optimize_stats_reported = 383 [(module) = "appsearch"];
581        AppCompatStateChanged app_compat_state_changed = 386 [(module) = "framework"];
582        SizeCompatRestartButtonEventReported size_compat_restart_button_event_reported = 387 [(module) = "framework"];
583        SplitscreenUIChanged splitscreen_ui_changed = 388 [(module) = "framework"];
584        AccessibilityFloatingMenuUIChanged accessibility_floating_menu_ui_changed = 393 [(module) = "sysui"];
585        CameraCompatControlEventReported camera_compat_control_event_reported = 411 [(module) = "framework"];
586
587        // StatsdStats tracks platform atoms with ids upto 500.
588        // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
589    }
590
591    // Pulled events will start at field 10000.
592    // Next: 10146
593    oneof pulled {
594        WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
595        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
596        MobileBytesTransfer mobile_bytes_transfer =
597                10002 [(module) = "framework", (truncate_timestamp) = true];
598        MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg =
599                10003 [(module) = "framework", (truncate_timestamp) = true];
600        BluetoothBytesTransfer bluetooth_bytes_transfer = 10006 [(module) = "framework"];
601        KernelWakelock kernel_wakelock = 10004 [(module) = "framework"];
602        SubsystemSleepState subsystem_sleep_state = 10005 [(module) = "framework", (module) = "statsdtest"];
603        CpuTimePerUid cpu_time_per_uid = 10009 [(module) = "framework", (module) = "statsdtest"];
604        CpuTimePerUidFreq cpu_time_per_uid_freq =
605                10010 [(module) = "framework", (module) = "statsd"];
606        WifiActivityInfo wifi_activity_info = 10011 [(module) = "framework"];
607        ModemActivityInfo modem_activity_info = 10012 [(module) = "framework"];
608        BluetoothActivityInfo bluetooth_activity_info = 10007 [(module) = "framework"];
609        ProcessMemoryState process_memory_state = 10013 [(module) = "framework"];
610        SystemElapsedRealtime system_elapsed_realtime = 10014 [(module) = "framework"];
611        SystemUptime system_uptime = 10015 [(module) = "framework"];
612        CpuActiveTime cpu_active_time = 10016 [(module) = "framework", (module) = "statsdtest"];
613        CpuClusterTime cpu_cluster_time = 10017 [(module) = "framework"];
614        DiskSpace disk_space = 10018 [deprecated=true, (module) = "statsdtest"];
615        RemainingBatteryCapacity remaining_battery_capacity = 10019 [(module) = "framework"];
616        FullBatteryCapacity full_battery_capacity = 10020 [(module) = "framework"];
617        Temperature temperature = 10021 [(module) = "framework", (module) = "statsdtest"];
618        BinderCalls binder_calls = 10022 [(module) = "framework", (module) = "statsd"];
619        BinderCallsExceptions binder_calls_exceptions = 10023 [(module) = "framework"];
620        LooperStats looper_stats = 10024 [(module) = "framework", (module) = "statsd"];
621        DiskStats disk_stats = 10025 [(module) = "framework"];
622        DirectoryUsage directory_usage = 10026 [(module) = "framework"];
623        AppSize app_size = 10027 [(module) = "framework"];
624        CategorySize category_size = 10028 [(module) = "framework"];
625        ProcStats proc_stats = 10029 [(module) = "framework"];
626        BatteryVoltage battery_voltage = 10030 [(module) = "framework"];
627        NumFingerprintsEnrolled num_fingerprints_enrolled = 10031 [(module) = "framework"];
628        DiskIo disk_io = 10032 [(module) = "framework"];
629        PowerProfile power_profile = 10033 [(module) = "framework"];
630        ProcStatsPkgProc proc_stats_pkg_proc = 10034 [(module) = "framework"];
631        ProcessCpuTime process_cpu_time = 10035 [(module) = "framework"];
632        CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037 [(module) = "framework"];
633        OnDevicePowerMeasurement on_device_power_measurement = 10038 [(module) = "framework"];
634        DeviceCalculatedPowerUse device_calculated_power_use = 10039 [(module) = "framework"];
635        DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid =
636                10040 [(module) = "framework"];
637        DeviceCalculatedPowerBlameOther device_calculated_power_blame_other =
638                10041 [(module) = "framework"];
639        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042 [(module) = "framework"];
640        BatteryLevel battery_level = 10043 [(module) = "framework"];
641        BuildInformation build_information = 10044 [(module) = "framework"];
642        BatteryCycleCount battery_cycle_count = 10045 [(module) = "framework"];
643        DebugElapsedClock debug_elapsed_clock = 10046 [(module) = "framework"];
644        DebugFailingElapsedClock debug_failing_elapsed_clock = 10047 [(module) = "framework"];
645        NumFacesEnrolled num_faces_enrolled = 10048 [(module) = "framework"];
646        RoleHolder role_holder = 10049 [(module) = "framework"];
647        DangerousPermissionState dangerous_permission_state = 10050 [(module) = "framework"];
648        TrainInfo train_info = 10051 [(module) = "statsd"];
649        TimeZoneDataInfo time_zone_data_info = 10052 [(module) = "framework"];
650        ExternalStorageInfo external_storage_info = 10053 [(module) = "framework"];
651        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
652        GpuStatsAppInfo gpu_stats_app_info = 10055;
653        SystemIonHeapSize system_ion_heap_size = 10056 [deprecated = true, (module) = "framework"];
654        AppsOnExternalStorageInfo apps_on_external_storage_info = 10057 [(module) = "framework"];
655        FaceSettings face_settings = 10058 [(module) = "framework"];
656        CoolingDevice cooling_device = 10059 [(module) = "framework"];
657        AppOps app_ops = 10060 [(module) = "framework"];
658        ProcessSystemIonHeapSize process_system_ion_heap_size = 10061 [(module) = "framework"];
659        SurfaceflingerStatsGlobalInfo surfaceflinger_stats_global_info = 10062;
660        SurfaceflingerStatsLayerInfo surfaceflinger_stats_layer_info = 10063;
661        ProcessMemorySnapshot process_memory_snapshot = 10064 [(module) = "framework"];
662        VmsClientStats vms_client_stats = 10065 [(module) = "car"];
663        NotificationRemoteViews notification_remote_views = 10066 [(module) = "framework"];
664        DangerousPermissionStateSampled dangerous_permission_state_sampled =
665                10067 [(module) = "framework"];
666        GraphicsStats graphics_stats = 10068 [(module) = "hwui"];
667        RuntimeAppOpAccess runtime_app_op_access = 10069 [(module) = "framework"];
668        IonHeapSize ion_heap_size = 10070 [(module) = "framework"];
669        PackageNotificationPreferences package_notification_preferences =
670                10071 [(module) = "framework"];
671        PackageNotificationChannelPreferences package_notification_channel_preferences =
672                10072 [(module) = "framework"];
673        PackageNotificationChannelGroupPreferences package_notification_channel_group_preferences =
674                10073 [(module) = "framework"];
675        GnssStats gnss_stats = 10074 [(module) = "framework"];
676        AttributedAppOps attributed_app_ops = 10075 [(module) = "framework"];
677        VoiceCallSession voice_call_session = 10076 [(module) = "telephony"];
678        VoiceCallRatUsage voice_call_rat_usage = 10077 [(module) = "telephony"];
679        SimSlotState sim_slot_state = 10078 [(module) = "telephony"];
680        SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
681        SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
682        BlobInfo blob_info = 10081 [(module) = "framework"];
683        DataUsageBytesTransfer data_usage_bytes_transfer =
684                10082 [(module) = "framework", (truncate_timestamp) = true];
685        BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered =
686                10083 [(module) = "framework", (truncate_timestamp) = true];
687        DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"];
688        GeneralExternalStorageAccessStats general_external_storage_access_stats =
689            10085 [(module) = "mediaprovider"];
690        IncomingSms incoming_sms = 10086 [(module) = "telephony"];
691        OutgoingSms outgoing_sms = 10087 [(module) = "telephony"];
692        CarrierIdTableVersion carrier_id_table_version = 10088 [(module) = "telephony"];
693        DataCallSession data_call_session = 10089 [(module) = "telephony"];
694        CellularServiceState cellular_service_state = 10090 [(module) = "telephony"];
695        CellularDataServiceSwitch cellular_data_service_switch = 10091 [(module) = "telephony"];
696        SystemMemory system_memory = 10092 [(module) = "framework"];
697        ImsRegistrationTermination ims_registration_termination = 10093 [(module) = "telephony"];
698        ImsRegistrationStats ims_registration_stats = 10094 [(module) = "telephony"];
699        CpuTimePerClusterFreq cpu_time_per_cluster_freq = 10095 [(module) = "framework"];
700        CpuCyclesPerUidCluster cpu_cycles_per_uid_cluster = 10096 [(module) = "framework"];
701        DeviceRotatedData device_rotated_data = 10097 [(module) = "framework"];
702        CpuCyclesPerThreadGroupCluster cpu_cycles_per_thread_group_cluster = 10098 [(module) = "framework"];
703        MediaDrmActivityInfo media_drm_activity_info = 10099;
704        OemManagedBytesTransfer oem_managed_bytes_transfer = 10100 [(module) = "framework"];
705        GnssPowerStats gnss_power_stats = 10101 [(module) = "framework"];
706        TimeZoneDetectorState time_zone_detector_state = 10102 [(module) = "framework"];
707        Keystore2StorageStats keystore2_storage_stats = 10103 [(module) = "framework"];
708        RkpPoolStats rkp_pool_stats = 10104 [(module) = "framework"];
709        ProcessDmabufMemory process_dmabuf_memory = 10105 [(module) = "framework"];
710        PendingAlarmInfo pending_alarm_info = 10106 [(module) = "framework"];
711        UserLevelHibernatedApps user_level_hibernated_apps = 10107 [(module) = "framework"];
712        LauncherLayoutSnapshot launcher_layout_snapshot = 10108
713            [(module) = "sysui"];
714        GlobalHibernatedApps global_hibernated_apps = 10109 [(module) = "framework"];
715        InputEventLatencySketch input_event_latency_sketch = 10110 [(module) = "input"];
716        BatteryUsageStatsBeforeReset battery_usage_stats_before_reset =
717            10111 [(module) = "framework"];
718        BatteryUsageStatsSinceReset battery_usage_stats_since_reset =
719            10112 [(module) = "framework"];
720        BatteryUsageStatsSinceResetUsingPowerProfileModel
721            battery_usage_stats_since_reset_using_power_profile_model =
722            10113 [(module) = "framework"];
723        InstalledIncrementalPackage installed_incremental_package = 10114 [(module) = "framework"];
724        TelephonyNetworkRequests telephony_network_requests = 10115 [(module) = "telephony"];
725        AppSearchStorageInfo app_search_storage_info = 10116 [(module) = "appsearch"];
726        VmStat vmstat = 10117 [(module) = "framework"];
727        Keystore2KeyCreationWithGeneralInfo keystore2_key_creation_with_general_info =
728                10118 [(module) = "framework"];
729        Keystore2KeyCreationWithAuthInfo keystore2_key_creation_with_auth_info =
730                10119 [(module) = "framework"];
731        Keystore2KeyCreationWithPurposeAndModesInfo
732                keystore2_key_creation_with_purpose_and_modes_info = 10120 [(module) = "framework"];
733        Keystore2AtomWithOverflow keystore2_atom_with_overflow = 10121 [(module) = "framework"];
734        Keystore2KeyOperationWithPurposeAndModesInfo
735                keystore2_key_operation_with_purpose_and_modes_info =
736                        10122 [(module) = "framework"];
737        Keystore2KeyOperationWithGeneralInfo keystore2_key_operation_with_general_info =
738                10123 [(module) = "framework"];
739        RkpErrorStats rkp_error_stats = 10124 [(module) = "framework"];
740        Keystore2CrashStats keystore2_crash_stats = 10125 [(module) = "framework"];
741        AccessibilityShortcutStats accessibility_shortcut_stats = 10127 [(module) = "framework"];
742        AccessibilityFloatingMenuStats accessibility_floating_menu_stats =
743            10128 [(module) = "framework"];
744        CarWatchdogSystemIoUsageSummary car_watchdog_system_io_usage_summary =
745            10131 [(module) = "car"];
746        CarWatchdogUidIoUsageSummary car_watchdog_uid_io_usage_summary = 10132 [(module) = "car"];
747        ImsRegistrationFeatureTagStats ims_registration_feature_tag_stats =
748                10133 [(module) = "telephony"];
749        RcsClientProvisioningStats rcs_client_provisioning_stats =
750                10134 [(module) = "telephony"];
751        RcsAcsProvisioningStats rcs_acs_provisioning_stats =
752                10135 [(module) = "telephony"];
753        SipDelegateStats sip_delegate_stats = 10136 [(module) = "telephony"];
754        SipTransportFeatureTagStats sip_transport_feature_tag_stats =
755                10137 [(module) = "telephony"];
756        SipMessageResponse sip_message_response = 10138 [(module) = "telephony"];
757        SipTransportSession sip_transport_session = 10139 [(module) = "telephony"];
758        ImsDedicatedBearerListenerEvent ims_dedicated_bearer_listener_event =
759                10140 [(module) = "telephony"];
760        ImsDedicatedBearerEvent ims_dedicated_bearer_event = 10141 [(module) = "telephony"];
761        ImsRegistrationServiceDescStats ims_registration_service_desc_stats =
762                10142 [(module) = "telephony"];
763        UceEventStats uce_event_stats = 10143 [(module) = "telephony"];
764        PresenceNotifyEvent presence_notify_event = 10144 [(module) = "telephony"];
765        GbaEvent gba_event = 10145 [(module) = "telephony"];
766    }
767
768    // DO NOT USE field numbers above 100,000 in AOSP.
769    // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
770    // Field numbers 200,000 and above are reserved for future use; do not use them at all.
771
772    reserved 10008, 10036;
773}
774
775/**
776 * This proto represents a node of an attribution chain.
777 * Note: All attribution chains are represented as a repeated field of type
778 * AttributionNode. It is understood that in such arrays, the order is that
779 * of calls, that is [A, B, C] if A calls B that calls C.
780 */
781message AttributionNode {
782    // The uid for a given element in the attribution chain.
783    optional int32 uid = 1;
784
785    // The (optional) string tag for an element in the attribution chain. If the
786    // element has no tag, it is encoded as an empty string.
787    optional string tag = 2;
788}
789
790message KeyValuePair {
791    optional int32 key = 1;
792    oneof value {
793        int32 value_int = 2;
794        int64 value_long = 3;
795        string value_str = 4;
796        float value_float = 5;
797    }
798}
799
800message KeyValuePairsAtom {
801    optional int32 uid = 1;
802    repeated KeyValuePair pairs = 2;
803}
804
805/*
806 * *****************************************************************************
807 * Below are all of the individual atoms that are logged by Android via statsd.
808 *
809 * RULES:
810 *   - The field ids for each atom must start at 1, and count upwards by 1.
811 *     Skipping field ids is not allowed.
812 *   - These form an API, so renaming, renumbering or removing fields is
813 *     not allowed between android releases.  (This is not currently enforced,
814 *     but there will be a tool to enforce this restriction).
815 *   - The types must be built-in protocol buffer types, namely, no sub-messages
816 *     are allowed (yet).  The bytes type is also not allowed.
817 *   - The CamelCase name of the message type should match the
818 *     underscore_separated name as defined in Atom.
819 *   - If an atom represents work that can be attributed to an app, there can
820 *     be exactly one AttributionChain field. It must be field number 1.
821 *   - A field that is a uid should be a string field, tagged with the [xxx]
822 *     annotation. The generated code on android will be represented by UIDs,
823 *     and those UIDs will be translated in xxx to those strings.
824 *
825 * CONVENTIONS:
826 *   - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
827 *   - If there is a UID, it goes first. Think in an object-oriented fashion.
828 * *****************************************************************************
829 */
830
831/**
832 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
833 * Logs when the Thermal service HAL notifies the throttling start/stop events.
834 *
835 * Logged from:
836 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
837 */
838message ThermalThrottlingStateChanged {
839    // The type of temperature being reported (CPU, GPU, SKIN, etc)
840    optional android.os.TemperatureTypeEnum sensor_type = 1;
841
842    // Throttling state, this field is DEPRECATED
843    enum State {
844        UNKNOWN = 0;
845        START = 1; // START indicated that throttling was triggered.
846        STOP = 2; // STOP indicates that throttling was cleared.
847    }
848    optional State state = 2;
849
850    optional float temperature = 3;
851}
852
853/**
854 * Track transcoding service usage
855 * Logged from:
856 *   packages/providers/MediaProvider/src/com/android/providers/media/TranscodeHelper.java
857 * Next Tag: 14
858 */
859message TranscodingData {
860    // Reason that leads to the type of access.
861    enum AccessReason {
862        UNKNOWN = 0;
863        SYSTEM_DEFAULT = 1; // Default option
864        SYSTEM_CONFIG = 2;  // Server-side/on-device config
865        APP_MANIFEST = 3;  // media_capabilites.xml
866        APP_COMPAT = 4;   // App compat framework
867        APP_EXTRA = 5;   // ApplicationMediaCapabilities API in open()
868    }
869
870    // Causes that leads to the failure of transcode.
871    enum FailureCause {
872        CAUSE_UNKNOWN = 0;
873        TRANSCODING_SERVICE_ERROR = 1;     // Error from transcoding service.
874        TRANSCODING_CLIENT_TIMEOUT = 2;    // Timeout from MediaProvider.
875        TRANSCODING_SESSION_CANCELED = 3; // MediaProvider cancels the transcode.
876    }
877
878    enum AccessType {
879        HEVC_WRITE = 1;
880        READ_DIRECT = 2;
881        READ_CACHE = 3;
882        READ_TRANSCODE = 4;
883        WRITE_CACHE = 5; // App trying to write to transcodeid avc file in cache, this is rare.
884        AVC_WRITE = 6;
885    }
886
887    enum Result {
888        SUCCESS = 0;
889        FAIL = 1;
890        UNDEFINED = 2;
891    }
892
893    optional string requestor_package = 1;
894    optional AccessType access_type = 2;
895    optional int64 file_size_bytes = 3;
896    optional Result transcode_result = 4;
897    optional int64 transcode_duration_millis = 5; // The duration of transcoding.
898    optional int64 file_duration_millis = 6; // The duration of the video file.
899    optional int64 file_framerate_fps = 7; // The framerate of the video file.
900    optional AccessReason access_reason = 8;
901    optional int64 width = 9;
902    optional int64 height = 10;
903    optional bool hit_anr = 11;
904    optional FailureCause failure_cause = 12;   // This field is valid only when fails.
905    optional int64 transcoding_service_error_code = 13; // Error code from transcoding service.
906}
907
908/**
909 * Logs when the screen state changes.
910 *
911 * Logged from:
912 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
913 */
914message ScreenStateChanged {
915    // New screen state, from frameworks/proto_logging/stats/enums/view/enums.proto.
916    optional android.view.DisplayStateEnum state = 1
917            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
918}
919
920/**
921 * Logs that the process state of the uid, as determined by ActivityManager
922 * (i.e. the highest process state of that uid's processes) has changed.
923 *
924 * Logged from:
925 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
926 */
927message UidProcessStateChanged {
928    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
929
930    // The state, from frameworks/proto_logging/stats/enums/app/enums.proto.
931    optional android.app.ProcessStateEnum state = 2
932            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
933}
934
935/**
936 * Logs process state change of a process, as per the activity manager.
937 *
938 * Logged from:
939 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
940 */
941message ProcessStateChanged {
942    optional int32 uid = 1;
943    optional string process_name = 2;
944    optional string package_name = 3;
945    // TODO: remove this when validation is done
946    optional int64 version = 5;
947    // The state, from frameworks/proto_logging/stats/enums/app/enums.proto.
948    optional android.app.ProcessStateEnum state = 4;
949}
950
951/**
952 * Logs when ActivityManagerService sleep state is changed.
953 *
954 * Logged from:
955 *   frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
956 */
957message ActivityManagerSleepStateChanged {
958    // TODO: import frameworks proto
959    enum State {
960        UNKNOWN = 0;
961        ASLEEP = 1;
962        AWAKE = 2;
963    }
964    optional State state = 1
965            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
966}
967
968/**
969 * Logs when system memory state changes.
970 *
971 * Logged from:
972 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
973 */
974message MemoryFactorStateChanged {
975    // TODO: import frameworks proto
976    enum State {
977        MEMORY_UNKNOWN = 0;
978        NORMAL = 1;     // normal.
979        MODERATE = 2;   // moderate memory pressure.
980        LOW = 3;        // low memory.
981        CRITICAL = 4;   // critical memory.
982
983    }
984    optional State factor = 1 [(state_field_option).exclusive_state = true];
985}
986
987/**
988 * Logs when app is using too much cpu, according to ActivityManagerService.
989 *
990 * Logged from:
991 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
992 */
993message ExcessiveCpuUsageReported {
994    optional int32 uid = 1;
995    optional string process_name = 2;
996    optional string package_name = 3;
997    // package version. TODO: remove this when validation is done
998    optional int64 version = 4;
999}
1000
1001/**
1002 * Logs when a cached process is killed, along with its pss.
1003 *
1004 * Logged from:
1005 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1006 */
1007message CachedKillReported {
1008    optional int32 uid = 1;
1009    optional string process_name = 2;
1010    optional string package_name = 3;
1011    // TODO: remove this when validation is done
1012    optional int64 version = 5;
1013    optional int64 pss = 4;
1014}
1015
1016/**
1017 * Logs the change in wifi health.
1018 *
1019 * Logged from:
1020 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiDataStall.java
1021 */
1022message WifiHealthStatReported {
1023    enum Band {
1024        UNKNOWN = 0;
1025        // All of 2.4GHz band
1026        BAND_2G = 1;
1027        // Frequencies in the range of [5150, 5250) GHz
1028        BAND_5G_LOW = 2;
1029        // Frequencies in the range of [5250, 5725) GHz
1030        BAND_5G_MIDDLE = 3;
1031        // Frequencies in the range of [5725, 5850) GHz
1032        BAND_5G_HIGH = 4;
1033        // Frequencies in the range of [5925, 6425) GHz
1034        BAND_6G_LOW = 5;
1035        // Frequencies in the range of [6425, 6875) GHz
1036        BAND_6G_MIDDLE = 6;
1037        // Frequencies in the range of [6875, 7125) GHz
1038        BAND_6G_HIGH = 7;
1039    }
1040    // duration this stat is obtained over in milliseconds
1041    optional int32 duration_millis = 1;
1042    // whether wifi is classified as sufficient for the user's data traffic, determined
1043    // by whether the calculated throughput exceeds the average demand within |duration_millis|
1044    optional bool is_sufficient = 2;
1045    // whether cellular data is available
1046    optional bool is_cell_data_available = 3;
1047    // the Band bucket the connected network is on
1048    optional Band band = 4;
1049}
1050
1051/**
1052 * Logged when wifi detects a significant change in connection failure rate.
1053 *
1054 * Logged from: frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiHealthMonitor.java
1055 *
1056 */
1057message WifiFailureStatReported {
1058    enum AbnormalityType {
1059        UNKNOWN = 0;
1060        SIGNIFICANT_INCREASE = 1;
1061        SIGNIFICANT_DECREASE = 2;
1062        SIMPLY_HIGH = 3;
1063    }
1064    enum FailureType {
1065        FAILURE_UNKNOWN = 0;
1066        FAILURE_CONNECTION = 1;
1067        FAILURE_ASSOCIATION_REJECTION = 2;
1068        FAILURE_ASSOCIATION_TIMEOUT = 3;
1069        FAILURE_AUTHENTICATION = 4;
1070        FAILURE_NON_LOCAL_DISCONNECTION = 5;
1071        FAILURE_SHORT_CONNECTION_DUE_TO_NON_LOCAL_DISCONNECTION = 6;
1072    }
1073    // Reason for uploading this stat
1074    optional AbnormalityType abnormality_type = 1;
1075    // The particular type of failure
1076    optional FailureType failure_type = 2;
1077    // How many times we have encountered this combination of AbnormalityType and FailureType
1078    optional int32 failure_count = 3;
1079}
1080
1081/**
1082 * Logs whether a Wifi connection attempt was successful and reasons for failure if it wasn't.
1083 *
1084 * Logged from:
1085 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1086 */
1087message WifiConnectionResultReported {
1088    enum FailureCode {
1089        FAILURE_UNKNOWN = 0;
1090        FAILURE_ASSOCIATION_TIMEOUT = 1;
1091        FAILURE_ASSOCIATION_REJECTION = 2;
1092        FAILURE_AUTHENTICATION_GENERAL = 3;
1093        FAILURE_AUTHENTICATION_EAP = 4;
1094        FAILURE_DHCP = 5;
1095        FAILURE_NETWORK_DISCONNECTION = 6;
1096        FAILURE_ROAM_TIMEOUT = 7;
1097        FAILURE_WRONG_PASSWORD = 8;
1098    }
1099
1100    enum Trigger {
1101        UNKNOWN = 0;
1102        // Connection attempt was initiated manually.
1103        MANUAL = 1;
1104        // Automatic reconnection to the same network as connected previously.
1105        RECONNECT_SAME_NETWORK = 2;
1106        // Automatic reconnection to a saved network, but not the previous one.
1107        AUTOCONNECT_CONFIGURED_NETWORK = 3;
1108        // Automatic first connection attempt after device boot.
1109        AUTOCONNECT_BOOT = 4;
1110    }
1111
1112    // True represents a successful connection.
1113    optional bool connection_result = 1;
1114    // Reason for the connection failure.
1115    optional FailureCode failure_code = 2;
1116    // Scan RSSI before the connection attempt.
1117    optional int32 rssi = 3;
1118    // Time taken by this connection attempt.
1119    optional int32 connection_attempt_duration_millis = 4;
1120    // Band bucket the connected network is on.
1121    optional android.net.wifi.WifiBandBucket band = 5;
1122    // Authentication type.
1123    optional android.net.wifi.WifiAuthType auth_type = 6;
1124    // What triggered this connection attempt.
1125    optional Trigger trigger = 7;
1126    // Whether this network was used (successfully connected to) previously.
1127    optional bool network_used = 8;
1128    // Time taken from the last successful connection (or device boot if that's the first one).
1129    optional int32 time_since_last_connection_seconds = 9;
1130}
1131
1132/**
1133 * Logs when a Wifi connection drops.
1134 *
1135 * Logged from:
1136 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1137 */
1138message WifiDisconnectReported {
1139    enum FailureCode {
1140        UNKNOWN = 0;
1141
1142        // Wifi supplicant failure reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45).
1143        // See ISupplicantStaIfaceCallback.java:ReasonCode
1144        UNSPECIFIED = 1;
1145        PREV_AUTH_NOT_VALID = 2;
1146        DEAUTH_LEAVING = 3;
1147        DISASSOC_DUE_TO_INACTIVITY = 4;
1148        DISASSOC_AP_BUSY = 5;
1149        CLASS2_FRAME_FROM_NONAUTH_STA = 6;
1150        CLASS3_FRAME_FROM_NONASSOC_STA = 7;
1151        DISASSOC_STA_HAS_LEFT = 8;
1152        STA_REQ_ASSOC_WITHOUT_AUTH = 9;
1153        PWR_CAPABILITY_NOT_VALID = 10;
1154        SUPPORTED_CHANNEL_NOT_VALID = 11;
1155        BSS_TRANSITION_DISASSOC = 12;
1156        INVALID_IE = 13;
1157        MICHAEL_MIC_FAILURE = 14;
1158        FOURWAY_HANDSHAKE_TIMEOUT = 15;
1159        GROUP_KEY_UPDATE_TIMEOUT = 16;
1160        IE_IN_4WAY_DIFFERS = 17;
1161        GROUP_CIPHER_NOT_VALID = 18;
1162        PAIRWISE_CIPHER_NOT_VALID = 19;
1163        AKMP_NOT_VALID = 20;
1164        UNSUPPORTED_RSN_IE_VERSION = 21;
1165        INVALID_RSN_IE_CAPAB = 22;
1166        IEEE_802_1X_AUTH_FAILED = 23;
1167        CIPHER_SUITE_REJECTED = 24;
1168        TDLS_TEARDOWN_UNREACHABLE = 25;
1169        TDLS_TEARDOWN_UNSPECIFIED = 26;
1170        SSP_REQUESTED_DISASSOC = 27;
1171        NO_SSP_ROAMING_AGREEMENT = 28;
1172        BAD_CIPHER_OR_AKM = 29;
1173        NOT_AUTHORIZED_THIS_LOCATION = 30;
1174        SERVICE_CHANGE_PRECLUDES_TS = 31;
1175        UNSPECIFIED_QOS_REASON = 32;
1176        NOT_ENOUGH_BANDWIDTH = 33;
1177        DISASSOC_LOW_ACK = 34;
1178        EXCEEDED_TXOP = 35;
1179        STA_LEAVING = 36;
1180        END_TS_BA_DLS = 37;
1181        UNKNOWN_TS_BA = 38;
1182        TIMEOUT = 39;
1183        PEERKEY_MISMATCH = 45;
1184        AUTHORIZED_ACCESS_LIMIT_REACHED = 46;
1185        EXTERNAL_SERVICE_REQUIREMENTS = 47;
1186        INVALID_FT_ACTION_FRAME_COUNT = 48;
1187        INVALID_PMKID = 49;
1188        INVALID_MDE = 50;
1189        INVALID_FTE = 51;
1190        MESH_PEERING_CANCELLED = 52;
1191        MESH_MAX_PEERS = 53;
1192        MESH_CONFIG_POLICY_VIOLATION = 54;
1193        MESH_CLOSE_RCVD = 55;
1194        MESH_MAX_RETRIES = 56;
1195        MESH_CONFIRM_TIMEOUT = 57;
1196        MESH_INVALID_GTK = 58;
1197        MESH_INCONSISTENT_PARAMS = 59;
1198        MESH_INVALID_SECURITY_CAP = 60;
1199        MESH_PATH_ERROR_NO_PROXY_INFO = 61;
1200        MESH_PATH_ERROR_NO_FORWARDING_INFO = 62;
1201        MESH_PATH_ERROR_DEST_UNREACHABLE = 63;
1202        MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64;
1203        MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65;
1204        MESH_CHANNEL_SWITCH_UNSPECIFIED = 66;
1205
1206        // ClientModeImpl error codes
1207        // Defined in /frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1208        IFACE_DESTROYED = 10000;
1209        WIFI_DISABLED = 10001;
1210        SUPPLICANT_DISCONNECTED = 10002;
1211        CONNECTING_WATCHDOG_TIMER = 10003;
1212        ROAM_WATCHDOG_TIMER = 10004;
1213    }
1214
1215    // How long the session lasted from successful connection to disconnect.
1216    optional int32 connected_duration_seconds = 1;
1217
1218    // Reason for the disconnect.
1219    optional FailureCode failure_code = 2;
1220
1221    // Band bucket the connected network was on.
1222    optional android.net.wifi.WifiBandBucket band = 3;
1223
1224    // Authentication type.
1225    optional android.net.wifi.WifiAuthType auth_type = 4;
1226
1227    // Last seen RSSI before the disconnect.
1228    optional int32 last_rssi = 5;
1229
1230    // Last seen link speed before the disconnect.
1231    optional int32 last_link_speed = 6;
1232}
1233
1234/**
1235 * Logs when Wifi connection is established or dropped.
1236 *
1237 * Logged from:
1238 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1239 */
1240message WifiConnectionStateChanged {
1241    optional bool is_connected = 1;
1242
1243    // Band bucket the connected network was on.
1244    // Filled for both connected and disconnected cases.
1245    optional android.net.wifi.WifiBandBucket band = 2;
1246
1247    // Authentication type.
1248    // Filled for both connected and disconnected cases.
1249    optional android.net.wifi.WifiAuthType auth_type = 3;
1250}
1251
1252/**
1253 * Logs when memory stats of a process is reported.
1254 *
1255 * Logged from:
1256 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
1257 */
1258message ProcessMemoryStatReported {
1259    optional int32 uid = 1;
1260    optional string process_name = 2;
1261    optional string package_name = 3;
1262    //TODO: remove this when validation is done
1263    optional int64 version = 9;
1264    optional int64 pss = 4;
1265    optional int64 uss = 5;
1266    optional int64 rss = 6;
1267    enum Type {
1268        ADD_PSS_INTERNAL_SINGLE = 0;
1269        ADD_PSS_INTERNAL_ALL_MEM = 1;
1270        ADD_PSS_INTERNAL_ALL_POLL = 2;
1271        ADD_PSS_EXTERNAL = 3;
1272        ADD_PSS_EXTERNAL_SLOW = 4;
1273    }
1274    optional Type type = 7;
1275    optional int64 duration_millis = 8;
1276}
1277
1278/**
1279 * Logs that a process started, finished, crashed, or ANRed.
1280 *
1281 * Logged from:
1282 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1283 */
1284message ProcessLifeCycleStateChanged {
1285    optional int32 uid = 1 [(is_uid) = true];
1286
1287    // The process name (usually same as the app name).
1288    optional string process_name = 2;
1289
1290    // What lifecycle state the process changed to.
1291    // This enum is specific to atoms.proto.
1292    enum State {
1293        FINISHED = 0;
1294        STARTED = 1;
1295        CRASHED = 2;
1296    }
1297    optional State state = 3;
1298}
1299
1300/**
1301 * Logs when the ble scan state changes.
1302 *
1303 * Logged from:
1304 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
1305 */
1306message BleScanStateChanged {
1307    repeated AttributionNode attribution_node = 1
1308            [(state_field_option).primary_field_first_uid = true];
1309
1310    enum State {
1311        OFF = 0;
1312        ON = 1;
1313        // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
1314        RESET = 2;
1315    }
1316    optional State state = 2 [
1317        (state_field_option).exclusive_state = true,
1318        (state_field_option).default_state_value = 0 /* State.OFF */,
1319        (state_field_option).trigger_state_reset_value = 2 /* State.RESET */,
1320        (state_field_option).nested = true
1321    ];
1322
1323    // Does the scan have a filter.
1324    optional bool is_filtered = 3 [(state_field_option).primary_field = true];
1325    // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
1326    optional bool is_first_match = 4 [(state_field_option).primary_field = true];
1327    // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
1328    optional bool is_opportunistic = 5 [(state_field_option).primary_field = true];
1329}
1330
1331/**
1332 * Logs reporting of a ble scan finding results.
1333 *
1334 * Logged from:
1335 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
1336 */
1337// TODO: Consider also tracking per-scanner-id.
1338message BleScanResultReceived {
1339    repeated AttributionNode attribution_node = 1;
1340
1341    // Number of ble scan results returned.
1342    optional int32 num_results = 2;
1343}
1344
1345/**
1346 * Logs when a sensor state changes.
1347 *
1348 * Logged from:
1349 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1350 */
1351message SensorStateChanged {
1352    repeated AttributionNode attribution_node = 1;
1353
1354    // The id (int) of the sensor.
1355    optional int32 sensor_id = 2;
1356
1357    enum State {
1358        OFF = 0;
1359        ON = 1;
1360    }
1361    optional State state = 3;
1362}
1363
1364/**
1365 * Logs when GPS state changes.
1366 *
1367 * Logged from:
1368 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1369 */
1370message GpsScanStateChanged {
1371    repeated AttributionNode attribution_node = 1;
1372
1373    enum State {
1374        OFF = 0;
1375        ON = 1;
1376    }
1377    optional State state = 2;
1378}
1379
1380/**
1381 * Logs when GPS signal quality.
1382 *
1383 * Logged from:
1384 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
1385 */
1386message GpsSignalQualityChanged {
1387    optional android.server.location.GpsSignalQualityEnum level = 1;
1388}
1389
1390
1391/**
1392 * Logs when a sync manager sync state changes.
1393 *
1394 * Logged from:
1395 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1396 */
1397message SyncStateChanged {
1398    repeated AttributionNode attribution_node = 1;
1399
1400    // Name of the sync (as named in the app). Can be chosen at run-time.
1401    optional string sync_name = 2;
1402
1403    enum State {
1404        OFF = 0;
1405        ON = 1;
1406    }
1407    optional State state = 3;
1408}
1409
1410/*
1411 * Deferred job stats.
1412 *
1413 * Logged from:
1414 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
1415*/
1416message DeferredJobStatsReported {
1417    repeated AttributionNode attribution_node = 1;
1418
1419    // Number of jobs deferred.
1420    optional int32 num_jobs_deferred = 2;
1421
1422    // Time since the last job runs.
1423    optional int64 time_since_last_job_millis = 3;
1424}
1425
1426/**
1427 * Logs when a job scheduler job state changes.
1428 *
1429 * Logged from:
1430 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1431 *
1432 * Next tag: 18
1433 */
1434message ScheduledJobStateChanged {
1435    repeated AttributionNode attribution_node = 1;
1436
1437    // Name of the job (as named in the app)
1438    optional string job_name = 2;
1439
1440    enum State {
1441        FINISHED = 0;
1442        STARTED = 1;
1443        SCHEDULED = 2;
1444    }
1445    optional State state = 3;
1446
1447    // The internal reason a job has stopped.
1448    // This is only applicable when the state is FINISHED.
1449    // The default value is INTERNAL_STOP_REASON_UNKNOWN.
1450    optional android.app.job.InternalStopReasonEnum internal_stop_reason = 4;
1451
1452    // The publicly returned reason onStopJob() was called.
1453    // This is only applicable when the state is FINISHED, but may be undefined if
1454    // JobService.onStopJob() was never called for the job.
1455    // The default value is STOP_REASON_UNDEFINED.
1456    optional android.app.job.StopReasonEnum public_stop_reason = 17;
1457
1458    // The standby bucket of the app that scheduled the job. These match the framework constants
1459    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
1460    // already assigned 0.
1461    enum Bucket {
1462        UNKNOWN = -1;
1463        ACTIVE = 0;
1464        WORKING_SET = 1;
1465        FREQUENT = 2;
1466        RARE = 3;
1467        NEVER = 4;
1468        RESTRICTED = 5;
1469    }
1470    optional Bucket standby_bucket = 5 [default = UNKNOWN];
1471
1472    // The job id (as assigned by the app).
1473    optional int32 job_id = 6;
1474
1475    // One flag for each of the API constraints defined by Jobscheduler. Does not include implcit
1476    // constraints as they are always assumed to be set.
1477    optional bool has_charging_constraint = 7;
1478    optional bool has_battery_not_low_constraint = 8;
1479    optional bool has_storage_not_low_constraint = 9;
1480    optional bool has_timing_delay_constraint = 10;
1481    optional bool has_deadline_constraint = 11;
1482    optional bool has_idle_constraint = 12;
1483    optional bool has_connectivity_constraint = 13;
1484    optional bool has_content_trigger_constraint = 14;
1485
1486    // True if the app has requested this run as an expedited job.
1487    optional bool is_requested_expedited_job = 15;
1488    // True if the job is running as an expedited job. Only valid for STARTED and FINISHED states.
1489    optional bool is_running_as_expedited_job = 16;
1490}
1491
1492/**
1493 * Logs when the audio state changes.
1494 *
1495 * Logged from:
1496 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1497 */
1498message AudioStateChanged {
1499    repeated AttributionNode attribution_node = 1;
1500
1501    enum State {
1502        OFF = 0;
1503        ON = 1;
1504        // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
1505        RESET = 2;
1506    }
1507    optional State state = 2;
1508}
1509
1510/**
1511 * Logs when the video codec state changes.
1512 *
1513 * Logged from:
1514 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1515 */
1516message MediaCodecStateChanged {
1517    repeated AttributionNode attribution_node = 1;
1518
1519    enum State {
1520        OFF = 0;
1521        ON = 1;
1522        // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
1523        RESET = 2;
1524    }
1525    optional State state = 2;
1526}
1527
1528/**
1529 * Logs when the flashlight state changes.
1530 *
1531 * Logged from:
1532 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1533 */
1534message FlashlightStateChanged {
1535    repeated AttributionNode attribution_node = 1;
1536
1537    enum State {
1538        OFF = 0;
1539        ON = 1;
1540        // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
1541        RESET = 2;
1542    }
1543    optional State state = 2;
1544}
1545
1546/**
1547 * Logs when the camera state changes.
1548 *
1549 * Logged from:
1550 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1551 */
1552message CameraStateChanged {
1553    repeated AttributionNode attribution_node = 1;
1554
1555    enum State {
1556        OFF = 0;
1557        ON = 1;
1558        // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
1559        RESET = 2;
1560    }
1561    optional State state = 2;
1562}
1563
1564/**
1565 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
1566 *
1567 * Logged from:
1568 *   TODO
1569 */
1570message WakelockStateChanged {
1571    repeated AttributionNode attribution_node = 1
1572            [(state_field_option).primary_field_first_uid = true];
1573
1574    // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
1575    // From frameworks/proto_logging/stats/enums/os/enums.proto.
1576    optional android.os.WakeLockLevelEnum type = 2 [(state_field_option).primary_field = true];
1577
1578    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
1579    optional string tag = 3 [(state_field_option).primary_field = true];
1580
1581    enum State {
1582        RELEASE = 0;
1583        ACQUIRE = 1;
1584        CHANGE_RELEASE = 2;
1585        CHANGE_ACQUIRE = 3;
1586    }
1587    optional State state = 4 [
1588        (state_field_option).exclusive_state = true,
1589        (state_field_option).default_state_value = 0,
1590        (state_field_option).nested = true
1591    ];
1592}
1593
1594/**
1595 * Logs when a partial wakelock is considered 'long' (over 1 min).
1596 *
1597 * Logged from:
1598 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1599 */
1600message LongPartialWakelockStateChanged {
1601    repeated AttributionNode attribution_node = 1;
1602
1603    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
1604    optional string tag = 2;
1605
1606    // TODO: I have no idea what this is.
1607    optional string history_tag = 3;
1608
1609    enum State {
1610        OFF = 0;
1611        ON = 1;
1612    }
1613    optional State state = 4;
1614}
1615
1616/**
1617 * Logs when the device is interactive, according to the PowerManager Notifier.
1618 *
1619 * Logged from:
1620 *   frameworks/base/services/core/java/com/android/server/power/Notifier.java
1621 */
1622message InteractiveStateChanged {
1623    enum State {
1624        OFF = 0;
1625        ON = 1;
1626    }
1627    optional State state = 1;
1628}
1629
1630/**
1631 * Logs Battery Saver state change.
1632 *
1633 * Logged from:
1634 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1635 */
1636message BatterySaverModeStateChanged {
1637    enum State {
1638        OFF = 0;
1639        ON = 1;
1640    }
1641    optional State state = 1
1642            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1643}
1644
1645/**
1646 * Logs Doze mode state change.
1647 *
1648 * Logged from:
1649 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1650 */
1651message DeviceIdleModeStateChanged {
1652    optional android.server.DeviceIdleModeEnum state = 1
1653            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1654}
1655
1656
1657/**
1658 * Logs state change of Doze mode including maintenance windows.
1659 *
1660 * Logged from:
1661 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1662 */
1663message DeviceIdlingModeStateChanged {
1664    optional android.server.DeviceIdleModeEnum state = 1
1665            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1666}
1667
1668/**
1669 * Logs screen brightness level.
1670 *
1671 * Logged from:
1672 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1673 */
1674message ScreenBrightnessChanged {
1675    // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
1676    optional int32 level = 1;
1677}
1678
1679/**
1680 * Logs battery level (percent full, from 0 to 100).
1681 *
1682 * Logged from:
1683 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1684 */
1685message BatteryLevelChanged {
1686    // Battery level. Should be in [0, 100].
1687    optional int32 battery_level = 1;
1688}
1689
1690/**
1691 * Logs change in charging status of the device.
1692 *
1693 * Logged from:
1694 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1695 */
1696message ChargingStateChanged {
1697    // State of the battery, from frameworks/proto_logging/stats/enums/os/enums.proto.
1698    optional android.os.BatteryStatusEnum state = 1
1699            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1700}
1701
1702/**
1703 * Logs whether the device is plugged in, and what power source it is using.
1704 *
1705 * Logged from:
1706 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1707 */
1708message PluggedStateChanged {
1709    // Whether the device is plugged in, from frameworks/proto_logging/stats/enums/os/enums.proto.
1710    optional android.os.BatteryPluggedStateEnum state = 1
1711            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1712}
1713
1714/**
1715 * Logs when an app's wakeup alarm fires.
1716 *
1717 * Logged from:
1718 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1719 */
1720message WakeupAlarmOccurred {
1721    repeated AttributionNode attribution_node = 1;
1722
1723    // Name of the wakeup alarm.
1724    optional string tag = 2;
1725
1726    // Name of source package (for historical reasons, since BatteryStats tracked it).
1727    optional string package_name = 3;
1728
1729    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
1730    optional AppStandbyBucketChanged.Bucket app_standby_bucket = 4;
1731}
1732
1733/**
1734 * Logs when an an app causes the mobile radio to change state.
1735 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
1736 *
1737 * Logged from:
1738 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1739 */
1740message MobileRadioPowerStateChanged {
1741    repeated AttributionNode attribution_node = 1;
1742
1743    // Power state, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
1744    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1745}
1746
1747/**
1748 * Logs when an an app causes the wifi radio to change state.
1749 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
1750 *
1751 * Logged from:
1752 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1753 */
1754message WifiRadioPowerStateChanged {
1755    repeated AttributionNode attribution_node = 1;
1756
1757    // Power state, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
1758    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1759}
1760
1761/**
1762 * Logs kernel wakeup reasons and aborts.
1763 *
1764 * Logged from:
1765 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1766 */
1767message KernelWakeupReported {
1768    // Name of the kernel wakeup reason (or abort).
1769    optional string wakeup_reason_name = 1;
1770
1771    // Duration (in microseconds) for the wake-up interrupt to be serviced.
1772    optional int64 duration_micros = 2;
1773}
1774
1775/**
1776 * Logs when Wifi is toggled on/off.
1777 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
1778 *
1779 * Logged from:
1780 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1781 */
1782message WifiEnabledStateChanged {
1783    enum State {
1784        OFF = 0;
1785        ON = 1;
1786    }
1787    optional State state = 1;
1788}
1789
1790/**
1791 * This atom is deprecated starting in R.
1792 *
1793 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
1794 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
1795 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
1796 *
1797 * Logged from:
1798 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1799 */
1800message WifiRunningStateChanged {
1801    repeated AttributionNode attribution_node = 1;
1802
1803    enum State {
1804        OFF = 0;
1805        ON = 1;
1806    }
1807    optional State state = 2;
1808}
1809
1810/**
1811 * Logs wifi locks held by an app.
1812 *
1813 * Logged from:
1814 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1815 */
1816message WifiLockStateChanged {
1817    repeated AttributionNode attribution_node = 1;
1818
1819    enum State {
1820        OFF = 0;
1821        ON = 1;
1822    }
1823    optional State state = 2;
1824
1825    // WifiLock type, from frameworks/proto_logging/stats/enums/wifi/enums.proto.
1826    optional android.net.wifi.WifiModeEnum mode = 3;
1827}
1828
1829/**
1830 * Logs wifi signal strength changes.
1831 *
1832 * Logged from:
1833 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
1834 */
1835message WifiSignalStrengthChanged {
1836    // Signal strength, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
1837    optional android.telephony.SignalStrengthEnum signal_strength = 1;
1838}
1839
1840/**
1841 * Logs wifi scans performed by an app.
1842 *
1843 * Logged from:
1844 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
1845 */
1846message WifiScanStateChanged {
1847    repeated AttributionNode attribution_node = 1;
1848
1849    enum State {
1850        OFF = 0;
1851        ON = 1;
1852    }
1853    optional State state = 2;
1854}
1855
1856/**
1857 * Logs wifi multicast locks held by an app
1858 *
1859 * Logged from:
1860 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
1861 */
1862message WifiMulticastLockStateChanged {
1863    repeated AttributionNode attribution_node = 1;
1864
1865    enum State {
1866        OFF = 0;
1867        ON = 1;
1868    }
1869    optional State state = 2;
1870
1871    optional string tag = 3;
1872}
1873
1874/**
1875 * Logs shutdown reason and duration on next boot.
1876 *
1877 * Logged from:
1878 *   frameworks/base/core/java/com/android/server/BootReceiver.java
1879 */
1880message ShutdownSequenceReported {
1881    // True if shutdown is for a reboot. Default: false if we do not know.
1882    optional bool reboot = 1;
1883
1884    // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
1885    optional string reason = 2;
1886
1887    // Beginning of shutdown time in ms using wall clock time since unix epoch.
1888    // Default: 0 if no start time received.
1889    optional int64 start_time_millis = 3;
1890
1891    // Duration of shutdown in ms. Default: 0 if no duration received.
1892    optional int64 duration_millis = 4;
1893}
1894
1895
1896/**
1897 * Logs boot reason and duration.
1898 *
1899 * Logged from:
1900 *   system/core/bootstat/bootstat.cpp
1901 */
1902message BootSequenceReported {
1903    // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
1904    // Default: "<EMPTY>" if not available.
1905    optional string bootloader_reason = 1;
1906
1907    // Reason for system boot. Eg. bootloader, reboot,userrequested
1908    // Default: "<EMPTY>" if not available.
1909    optional string system_reason = 2;
1910
1911    // End of boot time in ms from unix epoch using system wall clock.
1912    optional int64 end_time_millis = 3;
1913
1914    // Total boot duration in ms.
1915    optional int64 total_duration_millis = 4;
1916
1917    // Bootloader duration in ms.
1918    optional int64 bootloader_duration_millis = 5;
1919
1920    // Time since last boot in ms. Default: 0 if not available.
1921    optional int64 time_since_last_boot = 6;
1922}
1923
1924
1925/**
1926 * Logs call state and disconnect cause (if applicable).
1927 *
1928 * Logged from:
1929 *   packages/services/Telecomm/src/com/android/server/telecom/Call.java
1930 */
1931message CallStateChanged {
1932    // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1933    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto.
1934    optional android.telecom.CallStateEnum call_state = 1;
1935
1936    // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1937    // This value is only applicable when the call_state is DISCONNECTED, and
1938    // should always be UNKNOWN if the call_state is not DISCONNECTED.
1939    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto.
1940    optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1941
1942    // True if the call is self-managed, which are apps that use the
1943    // telecom infrastructure to make their own calls.
1944    optional bool self_managed = 3;
1945
1946    // True if call is external. External calls are calls on connected Wear
1947    // devices but show up in Telecom so the user can pull them onto the device.
1948    optional bool external_call = 4;
1949}
1950
1951/**
1952 * Logs keyguard state. The keyguard is the lock screen.
1953 *
1954 * Logged from:
1955 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1956 */
1957message KeyguardStateChanged {
1958    enum State {
1959        UNKNOWN = 0;
1960        // The keyguard is hidden when the phone is unlocked.
1961        HIDDEN = 1;
1962        // The keyguard is shown when the phone is locked (screen turns off).
1963        SHOWN= 2;
1964        // The keyguard is occluded when something is overlaying the keyguard.
1965        // Eg. Opening the camera while on the lock screen.
1966        OCCLUDED = 3;
1967    }
1968    optional State state = 1;
1969}
1970
1971/**
1972 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1973 * prompts the user to enter a password (pattern, pin, etc).
1974 *
1975 * Logged from:
1976 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1977 */
1978
1979message KeyguardBouncerStateChanged {
1980    enum State {
1981        UNKNOWN = 0;
1982        // Bouncer is hidden, either as a result of successfully entering the
1983        // password, screen timing out, or user going back to lock screen.
1984        HIDDEN = 1;
1985        // The user is being prompted to enter the password and the keyguard is NOT in one
1986        // handed mode.
1987        SHOWN = 2;
1988        // The user is being prompted to enter the password and the keyguard shows in one
1989        // handed mode and left aligned.
1990        SHOWN_LEFT = 3;
1991        // The user is being prompted to enter the password and the keyguard shows in one
1992        // handed mode and right aligned.
1993        SHOWN_RIGHT = 4;
1994        // The keyguard switches to the left side while it is in one handed mode.
1995        SWITCH_LEFT = 5;
1996        // The keyguard switches to the right side while it is in one handed mode.
1997        SWITCH_RIGHT = 6;
1998    }
1999    optional State state = 1;
2000}
2001
2002/**
2003 * Logs the result of entering a password into the keyguard bouncer.
2004 *
2005 * Logged from:
2006 *   frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
2007 */
2008message KeyguardBouncerPasswordEntered {
2009    enum BouncerResult {
2010        UNKNOWN = 0;
2011        // The password entered was incorrect.
2012        FAILURE = 1;
2013        // The password entered was correct.
2014        SUCCESS = 2;
2015    }
2016    optional BouncerResult result = 1;
2017
2018    enum BouncerSide {
2019        DEFAULT = 0;
2020        LEFT = 1;
2021        RIGHT = 2;
2022    }
2023    optional BouncerSide side = 2;
2024}
2025
2026/*
2027 * Logs changes to the configuration of the device. The configuration is defined
2028 * in frameworks/base/core/java/android/content/res/Configuration.java
2029 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
2030 * Please go there to interpret the possible values each field can be.
2031 *
2032 * Logged from:
2033 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2034 */
2035message ResourceConfigurationChanged {
2036    // Bit mask of color capabilities of the screen.
2037    // Contains information about the color gamut and hdr mode of the screen.
2038    // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
2039    optional int32 color_mode = 1;
2040
2041    // The target screen density being rendered to.
2042    // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
2043    optional int32 density_dpi = 2;
2044
2045    // Current user preference for the scaling factor for fonts,
2046    // relative to the base density scaling.
2047    // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
2048    optional float font_scale = 3;
2049
2050    // Flag indicating whether the hard keyboard is hidden.
2051    // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
2052    optional int32 hard_keyboard_hidden = 4;
2053
2054    // The type of keyboard attached to the device.
2055    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
2056    optional int32 keyboard = 5;
2057
2058    // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
2059    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
2060    optional int32 keyboard_hidden = 6;
2061
2062    // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
2063    // 0 if undefined.
2064    // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
2065    optional int32 mcc = 7;
2066
2067    // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
2068    // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
2069    // MNC_ZERO symbol defined in Configuration.java.
2070    // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
2071    optional int32 mnc = 8;
2072
2073    // The kind of navigation available on the device.
2074    // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
2075    optional int32 navigation = 9;
2076
2077    // Flag indicating whether the navigation is available.
2078    // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
2079    optional int32 navigation_hidden = 10;
2080
2081    // Overall orientation of the screen.
2082    // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
2083    optional int32 orientation = 11;
2084
2085    // The current height of the available screen space, in dp units.
2086    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
2087    optional int32 screen_height_dp = 12;
2088
2089    // Bit mask of overall layout of the screen.
2090    // Contains information about screen size, whether the screen is wider/taller
2091    // than normal, whether the screen layout is right-tl-left or left-to-right,
2092    // and whether the screen has a rounded shape.
2093    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
2094    optional int32 screen_layout = 13;
2095
2096    // Current width of the available screen space, in dp units.
2097    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
2098    optional int32 screen_width_dp = 14;
2099
2100    // The smallest screen size an application will see in normal operation.
2101    // This is the smallest value of both screenWidthDp and screenHeightDp
2102    // in portrait and landscape.
2103    // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
2104    optional int32 smallest_screen_width_dp = 15;
2105
2106    // The type of touch screen attached to the device.
2107    // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
2108    optional int32 touchscreen = 16;
2109
2110    // Bit mask of the ui mode.
2111    // Contains information about the overall ui mode of the device.
2112    // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
2113    // Also contains information about whether the device is in night mode.
2114    // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
2115    optional int32 ui_mode = 17;
2116}
2117
2118
2119/**
2120 * Logs changes in the connection state of the mobile radio.
2121 *
2122 * Logged from:
2123 *    frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
2124 */
2125message MobileConnectionStateChanged {
2126    // States are from the state machine DataConnection.java.
2127    enum State {
2128        UNKNOWN = 0;
2129        // The connection is inactive, or disconnected.
2130        INACTIVE = 1;
2131        // The connection is being activated, or connecting.
2132        ACTIVATING = 2;
2133        // The connection is active, or connected.
2134        ACTIVE = 3;
2135        // The connection is disconnecting.
2136        DISCONNECTING = 4;
2137        // The connection is disconnecting after creating a connection.
2138        DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
2139    }
2140    optional State state  = 1;
2141    // For multi-sim phones, this distinguishes between the sim cards.
2142    optional int32 sim_slot_index = 2;
2143    // Used to identify the connection. Starts at 0 and increments by 1 for
2144    // every new network created. Resets whenever the device reboots.
2145    optional int32 data_connection_id = 3;
2146    // A bitmask for the capabilities of this connection.
2147    // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
2148    // Default value (if we have no information): 0
2149    optional int64 capabilities = 4;
2150    // If this connection has internet.
2151    // This just checks if the DEFAULT bit of capabilities is set.
2152    optional bool has_internet = 5;
2153}
2154
2155/**
2156 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
2157 *
2158 * Logged from:
2159 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
2160 */
2161message MobileRadioTechnologyChanged {
2162    optional android.telephony.NetworkTypeEnum state = 1;
2163    // For multi-sim phones, this distinguishes between the sim cards.
2164    optional int32 sim_slot_index = 2;
2165}
2166
2167/**
2168 * Logs the VID and PID of any connected USB devices.
2169 *
2170 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
2171 *
2172 * Logged by Vendor.
2173 */
2174message UsbDeviceAttached {
2175    optional int32 vid = 1;
2176    optional int32 pid = 2;
2177    optional bool has_audio = 3;
2178    optional bool has_hid = 4;
2179    optional bool has_storage = 5;
2180    enum State {
2181        STATE_DISCONNECTED = 0;
2182        STATE_CONNECTED = 1;
2183    }
2184    optional State state = 6;
2185    optional int64 last_connect_duration_millis = 7;
2186}
2187
2188
2189/**
2190 * Logs when Bluetooth is enabled and disabled.
2191 *
2192 * Logged from:
2193 *   services/core/java/com/android/server/BluetoothManagerService.java
2194 */
2195message BluetoothEnabledStateChanged {
2196    repeated AttributionNode attribution_node = 1;
2197    // Whether or not bluetooth is enabled on the device.
2198    enum State {
2199        UNKNOWN = 0;
2200        ENABLED = 1;
2201        DISABLED = 2;
2202    }
2203    optional State state = 2;
2204    // The reason for being enabled/disabled.
2205    // Eg. Airplane mode, crash, application request.
2206    optional android.bluetooth.EnableDisableReasonEnum reason = 3;
2207    // If the reason is an application request, this will be the package name.
2208    optional string pkg_name = 4;
2209}
2210
2211/**
2212 * Logs when profiles on a Bluetooth device connects and disconnects.
2213 *
2214 * Logged from:
2215 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
2216 *
2217 * Next Tag: 6
2218 */
2219message BluetoothConnectionStateChanged {
2220    // The state of the connection.
2221    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
2222    optional android.bluetooth.ConnectionStateEnum state = 1;
2223    // An identifier that can be used to match connect and disconnect events.
2224    // Currently is last two bytes of a hash of a device level ID and
2225    // the mac address of the bluetooth device that is connected.
2226    // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
2227    optional int32 obfuscated_id = 2 [deprecated = true];
2228    // The profile that is connected. Eg. GATT, A2DP, HEADSET.
2229    // From android.bluetooth.BluetoothAdapter.java
2230    // Default: 0 when not used
2231    optional int32 bt_profile = 3;
2232    // An identifier that can be used to match events for this device.
2233    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2234    // Salt: Randomly generated 256 bit value
2235    // Hash algorithm: HMAC-SHA256
2236    // Size: 32 byte
2237    // Default: null or empty if the device identifier is not known
2238    optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
2239    // An identifier that can be used to match events for this device.
2240    // The incremental identifier is locally generated and guaranteed not derived
2241    // from any globally unique hardware id.
2242    // For paired devices, it stays consistent between Bluetooth toggling for the
2243    // same remote device.
2244    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2245    // session for the same remote device.
2246    // Default: 0 if the device's metric id is unknown.
2247    optional int32 metric_id = 5;
2248}
2249
2250/**
2251 * Logs when a Bluetooth device connects and disconnects over ACL
2252 *
2253 * Logged from:
2254 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
2255 *
2256 * Next Tag: 4
2257 */
2258message BluetoothAclConnectionStateChanged {
2259    // An identifier that can be used to match events for this device.
2260    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2261    // Salt: Randomly generated 256 bit value
2262    // Hash algorithm: HMAC-SHA256
2263    // Size: 32 byte
2264    // Default: null or empty if the device identifier is not known
2265    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2266    // The state of the connection.
2267    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
2268    optional android.bluetooth.ConnectionStateEnum state = 2;
2269    // An identifier that can be used to match events for this device.
2270    // The incremental identifier is locally generated and guaranteed not derived
2271    // from any globally unique hardware id.
2272    // For paired devices, it stays consistent between Bluetooth toggling for the
2273    // same remote device.
2274    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2275    // session for the same remote device.
2276    // Default: 0 if the device's metric id is unknown.
2277    optional int32 metric_id = 3;
2278}
2279
2280/**
2281 * Logs when a Bluetooth device connects and disconnects over SCO
2282 *
2283 * Logged from:
2284 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
2285 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
2286 *
2287 * Next Tag: 5
2288 */
2289message BluetoothScoConnectionStateChanged {
2290    // An identifier that can be used to match events for this device.
2291    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2292    // Salt: Randomly generated 256 bit value
2293    // Hash algorithm: HMAC-SHA256
2294    // Size: 32 byte
2295    // Default: null or empty if the device identifier is not known
2296    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2297    // The state of the connection.
2298    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
2299    optional android.bluetooth.ConnectionStateEnum state = 2;
2300    // Codec used for this SCO connection
2301    // Default: UNKNOWN
2302    optional android.bluetooth.hfp.ScoCodec codec = 3;
2303    // An identifier that can be used to match events for this device.
2304    // The incremental identifier is locally generated and guaranteed not derived
2305    // from any globally unique hardware id.
2306    // For paired devices, it stays consistent between Bluetooth toggling for the
2307    // same remote device.
2308    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2309    // session for the same remote device.
2310    // Default: 0 if the device's metric id is unknown.
2311    optional int32 metric_id = 4;
2312}
2313
2314/**
2315 * Logged when active device of a profile changes
2316 *
2317 * Logged from:
2318 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2319 *     packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetService.java
2320 *     packages/apps/Bluetooth/src/com/android/bluetooth/hearingaid/HearingAidService.java
2321 */
2322message BluetoothActiveDeviceChanged {
2323    // The profile whose active device has changed. Eg. A2DP, HEADSET, HEARING_AID
2324    // From android.bluetooth.BluetoothProfile
2325    optional int32 bt_profile = 1;
2326    // An identifier that can be used to match events for this new active device.
2327    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2328    // Salt: Randomly generated 256 bit value
2329    // Hash algorithm: HMAC-SHA256
2330    // Size: 32 byte
2331    // Default: null or empty if there is no active device for this profile
2332    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
2333    // An identifier that can be used to match events for this device.
2334    // The incremental identifier is locally generated and guaranteed not derived
2335    // from any globally unique hardware id.
2336    // For paired devices, it stays consistent between Bluetooth toggling for the
2337    // same remote device.
2338    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2339    // session for the same remote device.
2340    // Default: 0 if the device's metric id is unknown.
2341    optional int32 metric_id = 3;
2342}
2343
2344// Logs when there is an event affecting Bluetooth device's link layer connection.
2345// - This event is triggered when there is a related HCI command or event
2346// - Users of this metrics can deduce Bluetooth device's connection state from these events
2347// - HCI commands are logged before the command is sent, after receiving command status, and after
2348//   receiving command complete
2349// - HCI events are logged when they arrive
2350//
2351// Low level log from system/bt
2352//
2353// Bluetooth classic commands:
2354// - CMD_CREATE_CONNECTION
2355// - CMD_DISCONNECT
2356// - CMD_CREATE_CONNECTION_CANCEL
2357// - CMD_ACCEPT_CONNECTION_REQUEST
2358// - CMD_REJECT_CONNECTION_REQUEST
2359// - CMD_SETUP_ESCO_CONNECTION
2360// - CMD_ACCEPT_ESCO_CONNECTION
2361// - CMD_REJECT_ESCO_CONNECTION
2362// - CMD_ENH_SETUP_ESCO_CONNECTION
2363// - CMD_ENH_ACCEPT_ESCO_CONNECTION
2364//
2365// Bluetooth low energy commands:
2366// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
2367// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
2368// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
2369// - CMD_BLE_CLEAR_WHITE_LIST
2370// - CMD_BLE_ADD_WHITE_LIST
2371// - CMD_BLE_REMOVE_WHITE_LIST
2372//
2373// Bluetooth classic events:
2374// - EVT_CONNECTION_COMP
2375// - EVT_CONNECTION_REQUEST
2376// - EVT_DISCONNECTION_COMP
2377// - EVT_ESCO_CONNECTION_COMP
2378// - EVT_ESCO_CONNECTION_CHANGED
2379//
2380// Bluetooth low energy meta events:
2381// - BLE_EVT_CONN_COMPLETE_EVT
2382// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
2383//
2384// Next tag: 10
2385message BluetoothLinkLayerConnectionEvent {
2386    // An identifier that can be used to match events for this device.
2387    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2388    // Salt: Randomly generated 256 bit value
2389    // Hash algorithm: HMAC-SHA256
2390    // Size: 32 byte
2391    // Default: null or empty if the device identifier is not known
2392    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2393    // Connection handle of this connection if available
2394    // Range: 0x0000 - 0x0EFF (12 bits)
2395    // Default: 0xFFFF if the handle is unknown
2396    optional int32 connection_handle = 2;
2397    // Direction of the link
2398    // Default: DIRECTION_UNKNOWN
2399    optional android.bluetooth.DirectionEnum direction = 3;
2400    // Type of this link
2401    // Default: LINK_TYPE_UNKNOWN
2402    optional android.bluetooth.LinkTypeEnum type = 4;
2403
2404    // Reason metadata for this link layer connection event, rules for interpretation:
2405    // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
2406    //    EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
2407    // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
2408    //    set and valid, ignore hci_ble_event
2409
2410    // HCI command associated with this event
2411    // Default: CMD_UNKNOWN
2412    optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
2413    // HCI event associated with this event
2414    // Default: EVT_UNKNOWN
2415    optional android.bluetooth.hci.EventEnum hci_event = 6;
2416    // HCI BLE meta event associated with this event
2417    // Default: BLE_EVT_UNKNOWN
2418    optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
2419    // HCI command status code if this is triggerred by hci_cmd
2420    // Default: STATUS_UNKNOWN
2421    optional android.bluetooth.hci.StatusEnum cmd_status = 8;
2422    // HCI reason code associated with this event
2423    // Default: STATUS_UNKNOWN
2424    optional android.bluetooth.hci.StatusEnum reason_code = 9;
2425    // An identifier that can be used to match events for this device.
2426    // The incremental identifier is locally generated and guaranteed not derived
2427    // from any globally unique hardware id.
2428    // For paired devices, it stays consistent between Bluetooth toggling for the
2429    // same remote device.
2430    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2431    // session for the same remote device.
2432    // Default: 0 if the device's metric id is unknown.
2433    optional int32 metric_id = 10;
2434}
2435
2436/**
2437 * Logs when a module is rolled back by Watchdog.
2438 *
2439 * Logged from: Rollback Manager
2440 */
2441message WatchdogRollbackOccurred {
2442    enum RollbackType {
2443        UNKNOWN = 0;
2444        ROLLBACK_INITIATE = 1;
2445        ROLLBACK_SUCCESS = 2;
2446        ROLLBACK_FAILURE = 3;
2447        ROLLBACK_BOOT_TRIGGERED = 4;
2448    }
2449    optional RollbackType rollback_type = 1;
2450
2451    optional string package_name = 2;
2452
2453    optional int32 package_version_code = 3;
2454
2455    enum RollbackReasonType {
2456        REASON_UNKNOWN = 0;
2457        REASON_NATIVE_CRASH = 1;
2458        REASON_EXPLICIT_HEALTH_CHECK = 2;
2459        REASON_APP_CRASH = 3;
2460        REASON_APP_NOT_RESPONDING = 4;
2461        REASON_NATIVE_CRASH_DURING_BOOT = 5;
2462    }
2463    optional RollbackReasonType rollback_reason = 4;
2464
2465    // Set by RollbackPackageHealthObserver to be the package that is failing when a rollback
2466    // is initiated. Empty if the package is unknown.
2467    optional string failing_package_name = 5;
2468
2469    optional TrainExperimentIds experiment_ids = 6 [(log_mode) = MODE_BYTES];
2470}
2471
2472/**
2473 * Logs when there is a change in Bluetooth A2DP playback state
2474 *
2475 * Logged from:
2476 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2477 */
2478message BluetoothA2dpPlaybackStateChanged {
2479    // An identifier that can be used to match events for this device.
2480    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2481    // Salt: Randomly generated 256 bit value
2482    // Hash algorithm: HMAC-SHA256
2483    // Size: 32 byte
2484    // Default: null or empty if the device identifier is not known
2485    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2486    // Current playback state
2487    // Default: PLAYBACK_STATE_UNKNOWN
2488    optional android.bluetooth.a2dp.PlaybackStateEnum playback_state = 2;
2489    // Current audio coding mode
2490    // Default: AUDIO_CODING_MODE_UNKNOWN
2491    optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
2492    // An identifier that can be used to match events for this device.
2493    // The incremental identifier is locally generated and guaranteed not derived
2494    // from any globally unique hardware id.
2495    // For paired devices, it stays consistent between Bluetooth toggling for the
2496    // same remote device.
2497    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2498    // session for the same remote device.
2499    // Default: 0 if the device's metric id is unknown.
2500    optional int32 metric_id = 4;
2501}
2502
2503/**
2504 * Logs when there is a change in A2DP codec config for a particular remote device
2505 *
2506 * Logged from:
2507 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
2508 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2509 */
2510message BluetoothA2dpCodecConfigChanged {
2511    // An identifier that can be used to match events for this device.
2512    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2513    // Salt: Randomly generated 256 bit value
2514    // Hash algorithm: HMAC-SHA256
2515    // Size: 32 byte
2516    // Default: null or empty if the device identifier is not known
2517    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2518    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
2519    // Default SOURCE_CODEC_TYPE_INVALID
2520    optional int32 codec_type = 2;
2521    // Codec priroity, the higher the more preferred, -1 for disabled
2522    // Default: CODEC_PRIORITY_DEFAULT
2523    optional int32 codec_priority = 3;
2524    // Sample rate in Hz as defined by various SAMPLE_RATE_* constants in BluetoothCodecConfig
2525    // Default: SAMPLE_RATE_NONE
2526    optional int32 sample_rate = 4;
2527    // Bits per sample as defined by various BITS_PER_SAMPLE_* constants in BluetoothCodecConfig
2528    // Default: BITS_PER_SAMPLE_NONE
2529    optional int32 bits_per_sample = 5;
2530    // Channel mode as defined by various CHANNEL_MODE_* constants in BluetoothCodecConfig
2531    // Default: CHANNEL_MODE_NONE
2532    optional int32 channel_mode = 6;
2533    // Codec specific values
2534    // Default 0
2535    optional int64 codec_specific_1 = 7;
2536    optional int64 codec_specific_2 = 8;
2537    optional int64 codec_specific_3 = 9;
2538    optional int64 codec_specific_4 = 10;
2539    // An identifier that can be used to match events for this device.
2540    // The incremental identifier is locally generated and guaranteed not derived
2541    // from any globally unique hardware id.
2542    // For paired devices, it stays consistent between Bluetooth toggling for the
2543    // same remote device.
2544    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2545    // session for the same remote device.
2546    // Default: 0 if the device's metric id is unknown.
2547    optional int32 metric_id = 11;
2548}
2549
2550/**
2551 * Logs when there is a change in selectable A2DP codec capability for a paricular remote device
2552 * Each codec's capability is logged separately due to statsd restriction
2553 *
2554 * Logged from:
2555 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
2556 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2557 */
2558message BluetoothA2dpCodecCapabilityChanged {
2559    // An identifier that can be used to match events for this device.
2560    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2561    // Salt: Randomly generated 256 bit value
2562    // Hash algorithm: HMAC-SHA256
2563    // Size: 32 byte
2564    // Default: null or empty if the device identifier is not known
2565    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2566    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
2567    // Default SOURCE_CODEC_TYPE_INVALID
2568    optional int32 codec_type = 2;
2569    // Codec priroity, the higher the more preferred, -1 for disabled
2570    // Default: CODEC_PRIORITY_DEFAULT
2571    optional int32 codec_priority = 3;
2572    // A bit field of supported sample rates as defined by various SAMPLE_RATE_* constants
2573    // in BluetoothCodecConfig
2574    // Default: empty and SAMPLE_RATE_NONE for individual item
2575    optional int32 sample_rate = 4;
2576    // A bit field of supported bits per sample as defined by various BITS_PER_SAMPLE_* constants
2577    // in BluetoothCodecConfig
2578    // Default: empty and BITS_PER_SAMPLE_NONE for individual item
2579    optional int32 bits_per_sample = 5;
2580    // A bit field of supported channel mode as defined by various CHANNEL_MODE_* constants in
2581    // BluetoothCodecConfig
2582    // Default: empty and CHANNEL_MODE_NONE for individual item
2583    optional int32 channel_mode = 6;
2584    // Codec specific values
2585    // Default 0
2586    optional int64 codec_specific_1 = 7;
2587    optional int64 codec_specific_2 = 8;
2588    optional int64 codec_specific_3 = 9;
2589    optional int64 codec_specific_4 = 10;
2590    // An identifier that can be used to match events for this device.
2591    // The incremental identifier is locally generated and guaranteed not derived
2592    // from any globally unique hardware id.
2593    // For paired devices, it stays consistent between Bluetooth toggling for the
2594    // same remote device.
2595    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2596    // session for the same remote device.
2597    // Default: 0 if the device's metric id is unknown.
2598    optional int32 metric_id = 11;
2599}
2600
2601/**
2602 * Logs when A2DP failed to read from PCM source.
2603 * This typically happens when audio HAL cannot supply A2DP with data fast enough for encoding.
2604 *
2605 * Logged from:
2606 *     system/bt
2607 */
2608message BluetoothA2dpAudioUnderrunReported {
2609    // An identifier that can be used to match events for this device.
2610    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2611    // Salt: Randomly generated 256 bit value
2612    // Hash algorithm: HMAC-SHA256
2613    // Size: 32 byte
2614    // Default: null or empty if the device identifier is not known
2615    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2616    // Encoding interval in nanoseconds
2617    // Default: 0
2618    optional int64 encoding_interval_nanos = 2;
2619    // Number of bytes of PCM data that could not be read from the source
2620    // Default: 0
2621    optional int32 num_missing_pcm_bytes = 3;
2622    // An identifier that can be used to match events for this device.
2623    // The incremental identifier is locally generated and guaranteed not derived
2624    // from any globally unique hardware id.
2625    // For paired devices, it stays consistent between Bluetooth toggling for the
2626    // same remote device.
2627    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2628    // session for the same remote device.
2629    // Default: 0 if the device's metric id is unknown.
2630    optional int32 metric_id = 4;
2631}
2632
2633/**
2634 * Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit
2635 * buffer queue is full and we have to drop data
2636 *
2637 * Logged from:
2638 *     system/bt
2639 */
2640message BluetoothA2dpAudioOverrunReported {
2641    // An identifier that can be used to match events for this device.
2642    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2643    // Salt: Randomly generated 256 bit value
2644    // Hash algorithm: HMAC-SHA256
2645    // Size: 32 byte
2646    // Default: null or empty if the device identifier is not known
2647    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2648    // Encoding interval in nanoseconds
2649    // Default: 0
2650    optional int64 encoding_interval_nanos = 2;
2651    // Number of buffers dropped in this event
2652    // Each buffer is encoded in one encoding interval and consists of multiple encoded frames
2653    // Default: 0
2654    optional int32 num_dropped_buffers = 3;
2655    // Number of encoded buffers dropped in this event
2656    // Default 0
2657    optional int32 num_dropped_encoded_frames = 4;
2658    // Number of encoded bytes dropped in this event
2659    // Default: 0
2660    optional int32 num_dropped_encoded_bytes = 5;
2661    // An identifier that can be used to match events for this device.
2662    // The incremental identifier is locally generated and guaranteed not derived
2663    // from any globally unique hardware id.
2664    // For paired devices, it stays consistent between Bluetooth toggling for the
2665    // same remote device.
2666    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2667    // session for the same remote device.
2668    // Default: 0 if the device's metric id is unknown.
2669    optional int32 metric_id = 6;
2670}
2671
2672/**
2673 * Logs when we receive reports regarding a device's RSSI value
2674 *
2675 * Logged from:
2676 *     system/bt
2677 */
2678message BluetoothDeviceRssiReported {
2679    // An identifier that can be used to match events for this device.
2680    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2681    // Salt: Randomly generated 256 bit value
2682    // Hash algorithm: HMAC-SHA256
2683    // Size: 32 byte
2684    // Default: null or empty if the device identifier is not known
2685    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2686    // Connection handle of this connection if available
2687    // Range: 0x0000 - 0x0EFF (12 bits)
2688    // Default: 0xFFFF if the handle is unknown
2689    optional int32 connection_handle = 2;
2690    // HCI command status code if this is triggerred by hci_cmd
2691    // Default: STATUS_UNKNOWN
2692    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2693    // BR/EDR
2694    //   Range: -128 ≤ N ≤ 127 (signed integer)
2695    //   Units: dB
2696    // LE:
2697    //   Range: -127 to 20, 127 (signed integer)
2698    //   Units: dBm
2699    // Invalid when an out of range value is reported
2700    optional int32 rssi = 4;
2701    // An identifier that can be used to match events for this device.
2702    // The incremental identifier is locally generated and guaranteed not derived
2703    // from any globally unique hardware id.
2704    // For paired devices, it stays consistent between Bluetooth toggling for the
2705    // same remote device.
2706    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2707    // session for the same remote device.
2708    // Default: 0 if the device's metric id is unknown.
2709    optional int32 metric_id = 5;
2710}
2711
2712/**
2713 * Logs when we receive reports regarding how many consecutive failed contacts for a connection
2714 *
2715 * Logged from:
2716 *     system/bt
2717 */
2718message BluetoothDeviceFailedContactCounterReported {
2719    // An identifier that can be used to match events for this device.
2720    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2721    // Salt: Randomly generated 256 bit value
2722    // Hash algorithm: HMAC-SHA256
2723    // Size: 32 byte
2724    // Default: null or empty if the device identifier is not known
2725    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2726    // Connection handle of this connection if available
2727    // Range: 0x0000 - 0x0EFF (12 bits)
2728    // Default: 0xFFFF if the handle is unknown
2729    optional int32 connection_handle = 2;
2730    // HCI command status code if this is triggerred by hci_cmd
2731    // Default: STATUS_UNKNOWN
2732    optional android.bluetooth.hci.StatusEnum cmd_status = 3;
2733    // Number of consecutive failed contacts for a connection corresponding to the Handle
2734    // Range: uint16_t, 0-0xFFFF
2735    // Default: 0xFFFFF
2736    optional int32 failed_contact_counter = 4;
2737    // An identifier that can be used to match events for this device.
2738    // The incremental identifier is locally generated and guaranteed not derived
2739    // from any globally unique hardware id.
2740    // For paired devices, it stays consistent between Bluetooth toggling for the
2741    // same remote device.
2742    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2743    // session for the same remote device.
2744    // Default: 0 if the device's metric id is unknown.
2745    optional int32 metric_id = 5;
2746}
2747
2748/**
2749 * Logs when we receive reports regarding the tranmit power level used for a specific connection
2750 *
2751 * Logged from:
2752 *     system/bt
2753 */
2754message BluetoothDeviceTxPowerLevelReported {
2755    // An identifier that can be used to match events for this device.
2756    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2757    // Salt: Randomly generated 256 bit value
2758    // Hash algorithm: HMAC-SHA256
2759    // Size: 32 byte
2760    // Default: null or empty if the device identifier is not known
2761    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2762    // Connection handle of this connection if available
2763    // Range: 0x0000 - 0x0EFF (12 bits)
2764    // Default: 0xFFFF if the handle is unknown
2765    optional int32 connection_handle = 2;
2766    // HCI command status code if this is triggered by hci_cmd
2767    // Default: STATUS_UNKNOWN
2768    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2769    // Range: -30 ≤ N ≤ 20
2770    // Units: dBm
2771    // Invalid when an out of range value is reported
2772    optional int32 transmit_power_level = 4;
2773    // An identifier that can be used to match events for this device.
2774    // The incremental identifier is locally generated and guaranteed not derived
2775    // from any globally unique hardware id.
2776    // For paired devices, it stays consistent between Bluetooth toggling for the
2777    // same remote device.
2778    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2779    // session for the same remote device.
2780    // Default: 0 if the device's metric id is unknown.
2781    optional int32 metric_id = 5;
2782}
2783
2784/**
2785 * Logs when Bluetooth controller failed to reply with command status within a timeout period after
2786 * receiving an HCI command from the host
2787 *
2788 * Logged from: system/bt
2789 */
2790message BluetoothHciTimeoutReported {
2791    // HCI command associated with this event
2792    // Default: CMD_UNKNOWN
2793    optional android.bluetooth.hci.CommandEnum hci_command = 1;
2794}
2795
2796/**
2797 * Logs when we receive Bluetooth Link Quality Report event from the controller
2798 * See Android Bluetooth HCI specification for more details
2799 *
2800 * Note: all count and bytes field are counted since last event
2801 *
2802 * Logged from: system/bt
2803 */
2804message BluetoothQualityReportReported {
2805    // Quality report ID
2806    // Original type: uint8_t
2807    // Default: BQR_ID_UNKNOWN
2808    optional android.bluetooth.hci.BqrIdEnum quality_report_id = 1;
2809    // Packet type of the connection
2810    // Original type: uint8_t
2811    // Default: BQR_PACKET_TYPE_UNKNOWN
2812    optional android.bluetooth.hci.BqrPacketTypeEnum packet_types = 2;
2813    // Connection handle of the connection
2814    // Original type: uint16_t
2815    optional int32 connection_handle = 3;
2816    // Performing Role for the connection
2817    // Original type: uint8_t
2818    optional int32 connection_role = 4;
2819    // Current Transmit Power Level for the connection. This value is the same as the controller's
2820    // response to the HCI_Read_Transmit_Power_Level HCI command
2821    // Original type: uint8_t
2822    optional int32 tx_power_level = 5;
2823    // Received Signal Strength Indication (RSSI) value for the connection. This value is an
2824    // absolute receiver signal strength value
2825    // Original type: int8_t
2826    optional int32 rssi = 6;
2827    // Signal-to-Noise Ratio (SNR) value for the connection. It is the average SNR of all the
2828    // channels used by the link currently
2829    // Original type: uint8_t
2830    optional int32 snr = 7;
2831    // Indicates the number of unused channels in AFH_channel_map
2832    // Original type: uint8_t
2833    optional int32 unused_afh_channel_count = 8;
2834    // Indicates the number of the channels which are interfered and quality is bad but are still
2835    // selected for AFH
2836    // Original type: uint8_t
2837    optional int32 afh_select_unideal_channel_count = 9;
2838    // Current Link Supervision Timeout Setting
2839    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2840    // Original type: uint16_t
2841    optional int32 lsto = 10;
2842    // Piconet Clock for the specified Connection_Handle. This value is the same as the controller's
2843    // response to HCI_Read_Clock HCI command with the parameter "Which_Clock" of
2844    // 0x01 (Piconet Clock)
2845    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2846    // Original type: uint32_t
2847    optional int64 connection_piconet_clock = 11;
2848    // The count of retransmission
2849    // Original type: uint32_t
2850    optional int64 retransmission_count = 12;
2851    // The count of no RX
2852    // Original type: uint32_t
2853    optional int64 no_rx_count = 13;
2854    // The count of NAK (Negative Acknowledge)
2855    // Original type: uint32_t
2856    optional int64 nak_count = 14;
2857    // Controller timestamp of last TX ACK
2858    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2859    // Original type: uint32_t
2860    optional int64 last_tx_ack_timestamp = 15;
2861    // The count of Flow-off (STOP)
2862    // Original type: uint32_t
2863    optional int64 flow_off_count = 16;
2864    // Controller timestamp of last Flow-on (GO)
2865    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2866    // Original type: uint32_t
2867    optional int64 last_flow_on_timestamp = 17;
2868    // Buffer overflow count (how many bytes of TX data are dropped) since the last event
2869    // Original type: uint32_t
2870    optional int64 buffer_overflow_bytes = 18;
2871    // Buffer underflow count (in byte) since last event
2872    // Original type: uint32_t
2873    optional int64 buffer_underflow_bytes = 19;
2874}
2875
2876/**
2877 * Logs when a Bluetooth device's manufacturer information is learnt by the Bluetooth stack
2878 *
2879 * Notes:
2880 * - Each event can be partially filled as we might learn different pieces of device
2881 *   information at different time
2882 * - Multiple device info events can be combined to give more complete picture
2883 * - When multiple device info events tries to describe the same information, the
2884 *   later one wins
2885 *
2886 * Logged from:
2887 *     packages/apps/Bluetooth
2888 */
2889message BluetoothDeviceInfoReported {
2890    // An identifier that can be used to match events for this device.
2891    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2892    // Salt: Randomly generated 256 bit value
2893    // Hash algorithm: HMAC-SHA256
2894    // Size: 32 byte
2895    // Default: null or empty if the device identifier is not known
2896    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2897    // Where is this device info obtained from
2898    optional android.bluetooth.DeviceInfoSrcEnum source_type = 2;
2899    // Name of the data source
2900    // For EXTERNAL: package name of the data source
2901    // For INTERNAL: null for general case, component name otherwise
2902    optional string source_name = 3;
2903    // Name of the manufacturer of this device
2904    optional string manufacturer = 4;
2905    // Model of this device
2906    optional string model = 5;
2907    // Hardware version of this device
2908    optional string hardware_version = 6;
2909    // Software version of this device
2910    optional string software_version = 7;
2911    // An identifier that can be used to match events for this device.
2912    // The incremental identifier is locally generated and guaranteed not derived
2913    // from any globally unique hardware id.
2914    // For paired devices, it stays consistent between Bluetooth toggling for the
2915    // same remote device.
2916    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2917    // session for the same remote device.
2918    // Default: 0 if the device's metric id is unknown.
2919    optional int32 metric_id = 8;
2920}
2921
2922/**
2923 * Logs when we receive Bluetooth Read Remote Version Information Complete Event from the remote
2924 * device, as documented by the Bluetooth Core HCI specification
2925 * Reference: https://www.bluetooth.com/specifications/bluetooth-core-specification
2926 * Vol 2, Part E, Page 1118
2927 *
2928 * Logged from:
2929 *     system/bt
2930 */
2931message BluetoothRemoteVersionInfoReported {
2932    // Connection handle of the connection
2933    // Original type: uint16_t
2934    optional int32 connection_handle = 1;
2935    // HCI command status code
2936    // Default: STATUS_UNKNOWN
2937    optional android.bluetooth.hci.StatusEnum hci_status = 2;
2938    // 1 byte Version of current LMP in the remote controller
2939    optional int32 lmp_version = 3;
2940    // 2 bytes LMP manufacturer code of the remote controller
2941    // https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
2942    optional int32 lmp_manufacturer_code = 4;
2943    // 4 bytes subversion of the LMP in the remote controller
2944    optional int32 lmp_subversion = 5;
2945}
2946
2947/**
2948 * Logs when certain Bluetooth SDP attributes are discovered
2949 * Constant definitions are from:
2950 *     https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
2951 *
2952 * Current logged attributes:
2953 * - BluetoothProfileDescriptorList
2954 * - Supported Features Bitmask
2955 *
2956 * Logged from:
2957 *     system/bt
2958 */
2959message BluetoothSdpAttributeReported {
2960    // An identifier that can be used to match events for this device.
2961    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2962    // Salt: Randomly generated 256 bit value
2963    // Hash algorithm: HMAC-SHA256
2964    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2965    // Short form UUIDs used to identify Bluetooth protocols, profiles, and service classes
2966    // Original type: uint16_t
2967    optional int32 protocol_uuid = 2;
2968    // Short form UUIDs used to identify Bluetooth SDP attribute types
2969    // Original type: uint16_t
2970    optional int32 attribute_id = 3;
2971    // Attribute value for the particular attribute
2972    optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
2973    // An identifier that can be used to match events for this device.
2974    // The incremental identifier is locally generated and guaranteed not derived
2975    // from any globally unique hardware id.
2976    // For paired devices, it stays consistent between Bluetooth toggling for the
2977    // same remote device.
2978    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2979    // session for the same remote device.
2980    // Default: 0 if the device's metric id is unknown.
2981    optional int32 metric_id = 5;
2982}
2983
2984/**
2985 * Logs when bond state of a Bluetooth device changes
2986 *
2987 * Logged from:
2988 *     frameworks/base/core/java/android/bluetooth/BluetoothDevice.java
2989 *     packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2990 */
2991message BluetoothBondStateChanged {
2992    // An identifier that can be used to match events for this device.
2993    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2994    // Salt: Randomly generated 256 bit value
2995    // Hash algorithm: HMAC-SHA256
2996    // Size: 32 byte
2997    // Default: null or empty if the device identifier is not known
2998    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2999    // Preferred transport type to remote dual mode device
3000    // Default: TRANSPORT_AUTO means no preference
3001    optional android.bluetooth.TransportTypeEnum transport = 2;
3002    // The type of this Bluetooth device (Classic, LE, or Dual mode)
3003    // Default: UNKNOWN
3004    optional android.bluetooth.DeviceTypeEnum type = 3;
3005    // Current bond state (NONE, BONDING, BONDED)
3006    // Default: BOND_STATE_UNKNOWN
3007    optional android.bluetooth.BondStateEnum bond_state = 4;
3008    // Bonding sub state
3009    // Default: BOND_SUB_STATE_UNKNOWN
3010    optional android.bluetooth.BondSubStateEnum bonding_sub_state = 5;
3011    // Unbond Reason
3012    // Default: UNBOND_REASON_UNKNOWN
3013    optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
3014    // An identifier that can be used to match events for this device.
3015    // The incremental identifier is locally generated and guaranteed not derived
3016    // from any globally unique hardware id.
3017    // For paired devices, it stays consistent between Bluetooth toggling for the
3018    // same remote device.
3019    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3020    // session for the same remote device.
3021    // Default: 0 if the device's metric id is unknown.
3022    optional int32 metric_id = 7;
3023}
3024
3025/**
3026 * Logs there is an event related Bluetooth classic pairing
3027 *
3028 * Logged from:
3029 *     system/bt
3030 */
3031message BluetoothClassicPairingEventReported {
3032    // An identifier that can be used to match events for this device.
3033    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3034    // Salt: Randomly generated 256 bit value
3035    // Hash algorithm: HMAC-SHA256
3036    // Size: 32 byte
3037    // Default: null or empty if the device identifier is not known
3038    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3039    // Connection handle of this connection if available
3040    // Range: 0x0000 - 0x0EFF (12 bits)
3041    // Default: 0xFFFF if the handle is unknown
3042    optional int32 connection_handle = 2;
3043    // HCI command associated with this event
3044    // Default: CMD_UNKNOWN
3045    optional android.bluetooth.hci.CommandEnum hci_cmd = 3;
3046    // HCI event associated with this event
3047    // Default: EVT_UNKNOWN
3048    optional android.bluetooth.hci.EventEnum hci_event = 4;
3049    // HCI command status code if this is triggerred by hci_cmd
3050    // Default: STATUS_UNKNOWN
3051    optional android.bluetooth.hci.StatusEnum cmd_status = 5;
3052    // HCI reason code associated with this event
3053    // Default: STATUS_UNKNOWN
3054    optional android.bluetooth.hci.StatusEnum reason_code = 6;
3055    // A status value related to this specific event
3056    // Default: 0
3057    optional int64 event_value = 7;
3058    // An identifier that can be used to match events for this device.
3059    // The incremental identifier is locally generated and guaranteed not derived
3060    // from any globally unique hardware id.
3061    // For paired devices, it stays consistent between Bluetooth toggling for the
3062    // same remote device.
3063    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3064    // session for the same remote device.
3065    // Default: 0 if the device's metric id is unknown.
3066    optional int32 metric_id = 8;
3067}
3068
3069/**
3070 * Logs when there is an event related to Bluetooth Security Manager Protocol (SMP)
3071 *
3072 * Logged from:
3073 *     system/bt
3074 */
3075message BluetoothSmpPairingEventReported {
3076    // An identifier that can be used to match events for this device.
3077    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3078    // Salt: Randomly generated 256 bit value
3079    // Hash algorithm: HMAC-SHA256
3080    // Size: 32 byte
3081    // Default: null or empty if the device identifier is not known
3082    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3083    // SMP command sent or received over L2CAP
3084    // Default: CMD_UNKNOWN
3085    optional android.bluetooth.smp.CommandEnum smp_command = 2;
3086    // Whether this command is sent or received
3087    // Default: DIRECTION_UNKNOWN
3088    optional android.bluetooth.DirectionEnum direction = 3;
3089    // SMP failure reason code
3090    // Default: PAIRING_FAIL_REASON_DEFAULT
3091    optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
3092    // An identifier that can be used to match events for this device.
3093    // The incremental identifier is locally generated and guaranteed not derived
3094    // from any globally unique hardware id.
3095    // For paired devices, it stays consistent between Bluetooth toggling for the
3096    // same remote device.
3097    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3098    // session for the same remote device.
3099    // Default: 0 if the device's metric id is unknown.
3100    optional int32 metric_id = 5;
3101}
3102
3103/**
3104 * Logs when a Bluetooth socket’s connection state changed
3105 *
3106 * Logged from:
3107 *   system/bt
3108 */
3109message BluetoothSocketConnectionStateChanged {
3110    // An identifier that can be used to match events for this device.
3111    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3112    // Salt: Randomly generated 256 bit value
3113    // Hash algorithm: HMAC-SHA256
3114    // Size: 32 byte
3115    // Default: null or empty if this is a server listener socket
3116    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3117    // Temporary port of this socket for the current connection or session only
3118    // Default 0 when unknown or don't care
3119    optional int32 port = 2;
3120    // Socket type as mentioned in
3121    // frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
3122    // Default: SOCKET_TYPE_UNKNOWN
3123    optional android.bluetooth.SocketTypeEnum type = 3;
3124    // Socket connection state
3125    // Default: SOCKET_CONNECTION_STATE_UNKNOWN
3126    optional android.bluetooth.SocketConnectionstateEnum state = 4;
3127    // Number of bytes sent to remote device during this connection
3128    optional int64 tx_bytes = 5;
3129    // Number of bytes received from remote device during this connection
3130    optional int64 rx_bytes = 6;
3131    // Socket owner's UID
3132    optional int32 uid = 7 [(is_uid) = true];
3133    // Server port of this socket, if any. When both |server_port| and |port| fields are populated,
3134    // |port| must be spawned by |server_port|
3135    // Default 0 when unknown or don't care
3136    optional int32 server_port = 8;
3137    // Whether this is a server listener socket
3138    optional android.bluetooth.SocketRoleEnum is_server = 9;
3139    // An identifier that can be used to match events for this device.
3140    // The incremental identifier is locally generated and guaranteed not derived
3141    // from any globally unique hardware id.
3142    // For paired devices, it stays consistent between Bluetooth toggling for the
3143    // same remote device.
3144    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3145    // session for the same remote device.
3146    // Default: 0 if the device's metric id is unknown.
3147    optional int32 metric_id = 10;
3148}
3149
3150/**
3151 * Logs when Class of Device (CoD) value is learnt for a device during pairing or connection
3152 *
3153 * Logged from:
3154 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
3155 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
3156 *
3157 */
3158message BluetoothClassOfDeviceReported {
3159    // An identifier that can be used to match events for this device.
3160    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3161    // Salt: Randomly generated 256 bit value
3162    // Hash algorithm: HMAC-SHA256
3163    // Size: 32 byte
3164    // Default: null or empty if this is a server listener socket
3165    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3166    // Class of Device (CoD) value including both Major, Minor device class and service class
3167    // Defined in: https://www.bluetooth.com/specifications/assigned-numbers/baseband
3168    // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
3169    // Default: 0
3170    optional int32 class_of_device = 2;
3171    // An identifier that can be used to match events for this device.
3172    // The incremental identifier is locally generated and guaranteed not derived
3173    // from any globally unique hardware id.
3174    // For paired devices, it stays consistent between Bluetooth toggling for the
3175    // same remote device.
3176    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3177    // session for the same remote device.
3178    // Default: 0 if the device's metric id is unknown.
3179    optional int32 metric_id = 3;
3180}
3181
3182/**
3183 * Logs when there is a crash in hardware abstraction layer (HAL)
3184 *
3185 * Logged from:
3186 *   system/bt
3187 *
3188 */
3189message BluetoothHALCrashReasonReported {
3190    // An identifier that can be used to match events for this device.
3191    // The incremental identifier is locally generated and guaranteed not derived
3192    // from any globally unique hardware id.
3193    // For paired devices, it stays consistent between Bluetooth toggling for the
3194    // same remote device.
3195    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3196    // session for the same remote device.
3197    // Default: 0 if the device's metric id is unknown.
3198    optional int32 metric_id = 1;
3199    // An identifier that can be used to match events for this device.
3200    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3201    // Salt: Randomly generated 256 bit value
3202    // Hash algorithm: HMAC-SHA256
3203    // Size: 32 byte
3204    // Default: null or empty if the device identifier is not known
3205    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
3206    // Bluetooth HAL crash reason error code.
3207    // Original type: uint8_t
3208    // Default: 0x00 (DEFAULT)
3209    optional int32 error_code = 3;
3210    // Bluetooth HAL crash reason vendor error code.
3211    // Original type: uint8_t
3212    // Default: 0x00 (DEFAULT)
3213    optional int32 vendor_error_code = 4;
3214}
3215
3216/* Logs input device information when input device is registered with Android device.
3217 * Reported at when a new input device is found by EventHub.
3218 *
3219 * Logged from:
3220 *   frameworks/native/services/inputflinger
3221 */
3222message InputDeviceRegistered {
3223    // The Input Device Name
3224    optional string name = 1;
3225    // The Input Device Vendor ID
3226    optional int32 vendor_id = 2;
3227    // The Input Device Product ID
3228    optional int32 product_id = 3;
3229    // The Input Device Version ID
3230    optional int32 version_id = 4;
3231    // The Input Device Bus ID
3232    optional int32 bus_id = 5;
3233    // The Input Device identifier generated from kernel device.
3234    // Hash algorithm: HMAC-SHA256
3235    optional string obfuscated_id = 6;
3236    // The Input Device Classes
3237    optional int32 device_classes = 7;
3238}
3239
3240/**
3241 * Logs when something is plugged into or removed from the USB-C connector.
3242 *
3243 * Logged from:
3244 *  UsbService
3245 */
3246message UsbConnectorStateChanged {
3247    enum State {
3248        STATE_DISCONNECTED = 0;
3249        STATE_CONNECTED = 1;
3250    }
3251    optional State state = 1
3252            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
3253    optional string id = 2 [(state_field_option).primary_field = true];
3254    // Last active session in ms.
3255    // 0 when the port is in connected state.
3256    optional int64 last_connect_duration_millis = 3;
3257}
3258
3259/**
3260 * Logs the reported speaker impedance.
3261 *
3262 * Logged from:
3263 *  Vendor audio implementation.
3264 */
3265message SpeakerImpedanceReported {
3266    optional int32 speaker_location = 1;
3267    optional int32 impedance = 2;
3268}
3269
3270/**
3271 * Logs the report of a failed hardware.
3272 *
3273 * Logged from:
3274 *  Vendor HALs.
3275 *
3276 */
3277message HardwareFailed {
3278    enum HardwareType {
3279        HARDWARE_FAILED_UNKNOWN = 0;
3280        HARDWARE_FAILED_MICROPHONE = 1;
3281        HARDWARE_FAILED_CODEC = 2;
3282        HARDWARE_FAILED_SPEAKER = 3;
3283        HARDWARE_FAILED_FINGERPRINT = 4;
3284    }
3285    optional HardwareType hardware_type = 1;
3286
3287   /**
3288    * hardware_location allows vendors to differentiate between multiple instances of
3289    * the same hardware_type.  The specific locations are vendor defined integers,
3290    * referring to board-specific numbering schemes.
3291    */
3292    optional int32 hardware_location = 2;
3293
3294    /**
3295     * failure_code is specific to the HardwareType of the failed hardware.
3296     * It should use one of the enum values defined below.
3297     */
3298    enum HardwareErrorCode {
3299        UNKNOWN = 0;
3300        COMPLETE = 1;
3301        SPEAKER_HIGH_Z = 2;
3302        SPEAKER_SHORT = 3;
3303        FINGERPRINT_SENSOR_BROKEN = 4;
3304        FINGERPRINT_TOO_MANY_DEAD_PIXELS = 5;
3305        DEGRADE = 6;
3306    }
3307    optional int32 failure_code = 3;
3308}
3309
3310/**
3311 * Log an event when the device has been physically dropped.
3312 * Reported from the /vendor partition.
3313 */
3314message PhysicalDropDetected {
3315    // Confidence that the event was actually a drop, 0 -> 100
3316    optional int32 confidence_pctg = 1;
3317    // Peak acceleration of the drop, in 1/1000s of a g.
3318    optional int32 accel_peak_thousandths_g = 2;
3319    // Duration of freefall in ms
3320    optional int32 freefall_time_millis = 3;
3321}
3322
3323/**
3324 * Log bucketed battery charge cycles.
3325 *
3326 * Each bucket represents cycles of the battery past
3327 * a given charge point.  For example, if 10 cycle buckets are
3328 * initialized, bucket 1 is the lowest 1/10th of the battery,
3329 * and bucket 10 is 100%.
3330 *
3331 * Logged from:
3332 * /sys/class/power_supply/bms/cycle_count, via Vendor.
3333 */
3334message ChargeCyclesReported {
3335    optional int32 cycle_bucket_1 = 1;
3336    optional int32 cycle_bucket_2 = 2;
3337    optional int32 cycle_bucket_3 = 3;
3338    optional int32 cycle_bucket_4 = 4;
3339    optional int32 cycle_bucket_5 = 5;
3340    optional int32 cycle_bucket_6 = 6;
3341    optional int32 cycle_bucket_7 = 7;
3342    optional int32 cycle_bucket_8 = 8;
3343    optional int32 cycle_bucket_9 = 9;
3344    optional int32 cycle_bucket_10 = 10;
3345}
3346
3347/**
3348 * Log battery health snapshot.
3349 *
3350 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
3351 * are snapshotted periodically over 24hrs.
3352 */
3353message BatteryHealthSnapshot {
3354    enum BatterySnapshotType {
3355        UNKNOWN = 0;
3356        MIN_TEMP = 1;         // Snapshot at min batt temp over 24hrs.
3357        MAX_TEMP = 2;         // Snapshot at max batt temp over 24hrs.
3358        MIN_RESISTANCE = 3;   // Snapshot at min batt resistance over 24hrs.
3359        MAX_RESISTANCE = 4;   // Snapshot at max batt resistance over 24hrs.
3360        MIN_VOLTAGE = 5;      // Snapshot at min batt voltage over 24hrs.
3361        MAX_VOLTAGE = 6;      // Snapshot at max batt voltage over 24hrs.
3362        MIN_CURRENT = 7;      // Snapshot at min batt current over 24hrs.
3363        MAX_CURRENT = 8;      // Snapshot at max batt current over 24hrs.
3364        MIN_BATT_LEVEL = 9;   // Snapshot at min battery level (SoC) over 24hrs.
3365        MAX_BATT_LEVEL = 10;  // Snapshot at max battery level (SoC) over 24hrs.
3366        AVG_RESISTANCE = 11;  // Snapshot at average battery resistance over 24hrs.
3367    }
3368    optional BatterySnapshotType type = 1;
3369    // Temperature, in 1/10ths of degree C.
3370    optional int32 temperature_deci_celsius = 2;
3371    // Voltage Battery Voltage, in microVolts.
3372    optional int32 voltage_micro_volt = 3;
3373    // Current Battery current, in microAmps.
3374    optional int32 current_micro_amps = 4;
3375    // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
3376    optional int32 open_circuit_micro_volt = 5;
3377    // Resistance Battery Resistance, in microOhms.
3378    optional int32 resistance_micro_ohm = 6;
3379    // Level Battery Level, as % of full.
3380    optional int32 level_percent = 7;
3381}
3382
3383/**
3384 * Log slow I/O operations on the primary storage.
3385 */
3386message SlowIo {
3387    // Classifications of IO Operations.
3388    enum IoOperation {
3389        UNKNOWN = 0;
3390        READ = 1;
3391        WRITE = 2;
3392        UNMAP = 3;
3393        SYNC = 4;
3394    }
3395    optional IoOperation operation = 1;
3396
3397    // The number of slow IO operations of this type over 24 hours.
3398    optional int32 count = 2;
3399}
3400
3401/**
3402 * Log battery caused shutdown with the last recorded voltage.
3403 */
3404message BatteryCausedShutdown {
3405    // The last recorded battery voltage prior to shutdown.
3406    optional int32 last_recorded_micro_volt = 1;
3407}
3408
3409/**
3410 * Logs when ThermalService receives throttling events.
3411 *
3412 * Logged from:
3413 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
3414 */
3415message ThermalThrottlingSeverityStateChanged {
3416    // The type of temperature being reported (CPU, GPU, SKIN, etc)
3417    optional android.os.TemperatureTypeEnum sensor_type = 1;
3418
3419    // The name of the temperature source. Eg. CPU0
3420    optional string sensor_name = 2;
3421
3422    // Temperature in tenths of a degree C.
3423    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
3424    optional int32 temperature_deci_celsius = 3;
3425
3426    // Relative severity of the throttling, see enum definition.
3427    optional android.os.ThrottlingSeverityEnum severity = 4;
3428}
3429
3430/**
3431 * Logs the duration of a davey (jank of >=700ms) when it occurs
3432 *
3433 * Logged from:
3434 *   frameworks/base/libs/hwui/JankTracker.cpp
3435 */
3436message DaveyOccurred {
3437    // The UID that logged this atom.
3438    optional int32 uid = 1 [(is_uid) = true];
3439
3440    // Amount of time it took to render the frame. Should be >=700ms.
3441    optional int64 jank_duration_millis = 2;
3442}
3443
3444/**
3445 * Logs phone signal strength changes.
3446 *
3447 * Logged from:
3448 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3449 */
3450message PhoneSignalStrengthChanged {
3451    // Signal strength, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
3452    optional android.telephony.SignalStrengthEnum signal_strength = 1;
3453}
3454
3455
3456/**
3457 * Logs when the phone state, sim state or signal strength changes
3458 *
3459 * Logged from:
3460 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3461 */
3462message PhoneServiceStateChanged {
3463    optional android.telephony.ServiceStateEnum state = 1;
3464    optional android.telephony.SimStateEnum sim_state = 2;
3465    optional android.telephony.SignalStrengthEnum signal_strength = 3;
3466}
3467
3468/**
3469 * Logs when the phone becomes on or off.
3470 *
3471 * Logged from:
3472 *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
3473 */
3474message PhoneStateChanged {
3475    enum State {
3476        OFF = 0;
3477        ON = 1;
3478    }
3479    optional State state = 1;
3480}
3481
3482message BackGesture {
3483    enum BackType {
3484        DEFAULT_BACK_TYPE = 0;
3485        COMPLETED = 1;
3486        COMPLETED_REJECTED = 2; // successful because coming from rejected area
3487        INCOMPLETE_EXCLUDED = 3; // would have been successful but in the exclusion area
3488        INCOMPLETE = 4;  // Unsuccessful, for reasons other than below.
3489        INCOMPLETE_FAR_FROM_EDGE = 5;  // Unsuccessful, far from the edge.
3490        INCOMPLETE_MULTI_TOUCH = 6;  // Unsuccessful, multi touch.
3491        INCOMPLETE_LONG_PRESS = 7;  // Unsuccessful, long press.
3492        INCOMPLETE_VERTICAL_MOVE = 8;  // Unsuccessful, move vertically.
3493    }
3494    optional BackType type = 1;
3495
3496    optional int32 y_coordinate = 2 [deprecated = true]; // y coordinate for ACTION_DOWN event
3497    optional int32 start_x = 4;  // X coordinate for ACTION_DOWN event.
3498    optional int32 start_y = 5;  // Y coordinate for ACTION_DOWN event.
3499    optional int32 end_x = 6;   // X coordinate for ACTION_MOVE event.
3500    optional int32 end_y = 7;  // Y coordinate for ACTION_MOVE event.
3501    optional int32 left_boundary = 8;  // left edge width + left inset
3502    optional int32 right_boundary = 9;  // screen width - (right edge width + right inset)
3503    // The score between 0 and 1 which is the prediction output for the Back Gesture model.
3504    optional float ml_model_score = 10;
3505    optional string package_name = 11;  // The name of the top 100 most used package by all users.
3506
3507    enum WindowHorizontalLocation {
3508        DEFAULT_LOCATION = 0;
3509        LEFT = 1;
3510        RIGHT = 2;
3511    }
3512    optional WindowHorizontalLocation x_location = 3 [deprecated = true];
3513}
3514
3515message ExclusionRectStateChanged {
3516    optional string component_name = 1;    // if not available, simply packageName
3517    optional int32 requested_height = 2;   // px
3518    optional int32 rejected_height = 3;    // px
3519
3520    enum WindowHorizontalLocation {
3521        DEFAULT_LOCATION = 0;
3522        LEFT = 1;
3523        RIGHT = 2;
3524    }
3525    optional WindowHorizontalLocation x_location = 4;
3526    optional bool landscape = 5;
3527    optional bool splitscreen = 6;
3528    optional int32 duration_millis = 7;
3529}
3530
3531/**
3532 * Logs when IME is on.
3533 *
3534 * Logged from: /packages/SystemUI/src/com/android/systemui/
3535                statusbar/phone/NavigationBarView.java
3536 *
3537 */
3538message ImeTouchReported {
3539    optional int32 x_coordinate = 1;  // X coordinate for ACTION_DOWN event.
3540    optional int32 y_coordinate = 2;  // Y coordinate for ACTION_DOWN event.
3541}
3542
3543/**
3544 * Logs when Launcher (HomeScreen) UI has changed or was interacted.
3545 *
3546 * Logged from:
3547 *   packages/apps/Launcher3
3548 */
3549message LauncherUIChanged {
3550    optional android.stats.launcher.LauncherAction action = 1 [deprecated = true];
3551    optional android.stats.launcher.LauncherState src_state = 2;
3552    optional android.stats.launcher.LauncherState dst_state = 3;
3553    optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES, deprecated = true];
3554    optional bool is_swipe_up_enabled = 5 [deprecated = true];
3555
3556    // The event id (e.g., app launch, drag and drop, long press)
3557    optional int32 event_id = 6;
3558    // The event's source or target id (e.g., icon, task, button)
3559    optional int32 target_id = 7;
3560    // If the target needs to be tracked, use this id field
3561    optional int32 instance_id = 8;
3562    optional int32 uid = 9 [(is_uid) = true];
3563    optional string package_name = 10;
3564    optional string component_name = 11;
3565
3566    // (x, y) coordinate and the index information of the target on the container
3567    optional int32 grid_x = 12 [default = -1];
3568    optional int32 grid_y = 13 [default = -1];
3569    optional int32 page_id = 14 [default = -2];
3570
3571    // e.g., folder icon's (x, y) location and index information on the workspace
3572    optional int32 grid_x_parent = 15 [default = -1];
3573    optional int32 grid_y_parent = 16 [default = -1];
3574    optional int32 page_id_parent = 17 [default = -2];
3575
3576    // e.g., SEARCHBOX_ALLAPPS, FOLDER_WORKSPACE
3577    optional int32 hierarchy = 18;
3578
3579    optional bool is_work_profile = 19;
3580
3581    // Used to store the predicted rank of the target
3582    optional int32 rank = 20 [default = -1];
3583
3584    // e.g., folderLabelState can be captured in the following two fields
3585    optional int32 from_state = 21;
3586    optional int32 to_state = 22;
3587
3588    // e.g., autofilled or suggested texts that are not user entered
3589    optional string edittext = 23;
3590
3591    // e.g., number of contents inside a container (e.g., icons inside a folder)
3592    optional int32 cardinality = 24;
3593
3594    // Used to store features of the target (e.g. widget is reconfigurable, etc)
3595    optional int32 features = 25;
3596}
3597
3598message SmartSpaceCardReported {
3599    // Different SmartSpace cards.
3600    enum CardType {
3601        UNKNOWN_CARD = 0;
3602        COMMUTE = 1;
3603        CALENDAR = 2;
3604        FLIGHT = 3;
3605        WEATHER = 4;
3606        WEATHER_ALERT = 5;
3607        AT_A_STORE_SHOPPING_LIST = 6;
3608        AT_A_STORE_LOYALTY_CARD = 7;
3609        HEADPHONE_RESUME_MEDIA = 8;
3610        HEADPHONE_MEDIA_RECOMMENDATIONS = 9;
3611        TIMER = 10;
3612        STOPWATCH = 11;
3613        FITNESS_ACTIVITY = 12;
3614        UPCOMING_REMINDER = 13;
3615        UPCOMING_BEDTIME = 14;
3616        TIME_TO_LEAVE = 15;
3617        PACKAGE_DELIVERED = 16;
3618        TIPS = 17;
3619        DOORBELL = 18;
3620        CROSS_DEVICE_TIMER = 19;
3621    }
3622
3623    // The surface that SmartSpace card is shown.
3624    enum DisplaySurface {
3625        DEFAULT_SURFACE = 0;
3626        HOMESCREEN = 1;
3627        LOCKSCREEN = 2;
3628        AOD = 3;
3629        SHADE = 4;
3630    }
3631
3632    // The event id (e.g., impression, click, longpress, dismiss)
3633    optional int32 event_id = 1;
3634    // Uniquely identifies a card. Should persist through updates.
3635    optional int32 instance_id = 2;
3636    // Uniquely identifies one of the possible types of the SmartSpace cards.
3637    // Deprecated. Please read card_type_id instead.
3638    optional CardType card_type = 3 [deprecated = true];
3639    // Location of the card when the event occurred.
3640    optional DisplaySurface display_surface = 4;
3641    // The position of the card in the carousel when the event occurred.
3642    optional int32 rank = 5;
3643    // The number of cards shown to the user.
3644    optional int32 cardinality = 6;
3645    // Uniquely identifies one of the possible types of the SmartSpace cards.
3646    // To replace card_type. See go/smartspace-aster-metrics#card-type-id.
3647    optional int32 card_type_id = 7;
3648    // The app that the Smartspace card is tied to.
3649    optional int32 uid = 8 [(is_uid) = true];
3650    // If multiple subcards are displayed simultaneously, the position of
3651    // the subcard that was interacted with.
3652    optional int32 interacted_subcard_rank = 9;
3653    // If multiple subcards are displayed simultaneously, the number of subcards
3654    // shown when the interaction occurred.
3655    optional int32 interacted_subcard_cardinality = 10;
3656    // The time it takes in ms from smartspace target is created to sysui receives
3657    // the target.
3658    optional int32 received_latency_millis = 11;
3659}
3660
3661/**
3662 * Used for snapshot of the HomeScreen UI elements
3663 *
3664 * Logged from:
3665 *   packages/apps/Launcher3
3666 */
3667message LauncherStaticLayout {
3668    // The event id (e.g., snapshot, drag and drop)
3669    optional int32 event_id = 1;
3670    // The event's source or target id (e.g., icon, shortcut, widget)
3671    optional int32 target_id = 2;
3672    // If the target needs to be tracked, use this id field
3673    optional int32 instance_id = 3;
3674    optional int32 uid = 4 [(is_uid) = true];
3675    optional string package_name = 5;
3676    optional string component_name = 6;
3677
3678    // (x, y) coordinate and the index information of the target on the container
3679    optional int32 grid_x = 7 [default = -1];
3680    optional int32 grid_y = 8 [default = -1];
3681    optional int32 page_id = 9 [default = -2];
3682
3683    // e.g., folder icon's (x, y) location and index information on the workspace
3684    // e.g., when used with widgets target, use these values for (span_x, span_y)
3685    optional int32 grid_x_parent = 10 [default = -1];
3686    optional int32 grid_y_parent = 11 [default = -1];
3687    optional int32 page_id_parent = 12 [default = -2];
3688
3689    // UNKNOWN = 0
3690    // HOTSEAT = 1
3691    // WORKSPACE = 2
3692    // FOLDER_HOTSEAT = 3
3693    // FOLDER_WORKSPACE = 4
3694    optional int32 hierarchy = 13;
3695
3696    optional bool is_work_profile = 14;
3697
3698    // e.g., PIN, WIDGET TRAY, APPS TRAY, PREDICTION
3699    optional int32 origin = 15;
3700
3701    // e.g., number of icons inside a folder
3702    optional int32 cardinality = 16;
3703
3704    // e.g., (x, y) span of the widget inside homescreen grid system
3705    optional int32 span_x = 17 [default = 1];
3706    optional int32 span_y = 18 [default = 1];
3707
3708    // Used to store features of the target (e.g. widget is reconfigurable, etc)
3709    optional int32 features = 19;
3710}
3711
3712/**
3713 * Used for logging launcher static elements using pulled atom.
3714 *
3715 * Logged from:
3716 *   packages/apps/Launcher3
3717 */
3718message LauncherLayoutSnapshot {
3719    // The event id (e.g., snapshot, drag and drop)
3720    optional int32 event_id = 1;
3721    // The event's source or target id (e.g., icon, shortcut, widget)
3722    optional int32 item_id = 2;
3723    // If the target needs to be tracked, use this id field
3724    optional int32 instance_id = 3;
3725    optional int32 uid = 4 [(is_uid) = true];
3726    optional string package_name = 5;
3727    optional string component_name = 6;
3728
3729    // (x, y) coordinate and the index information of the target on the container
3730    optional int32 grid_x = 7 [default = -1];
3731    optional int32 grid_y = 8 [default = -1];
3732    optional int32 page_id = 9 [default = -2];
3733
3734    // e.g., folder icon's (x, y) location and index information on the workspace
3735    // e.g., when used with widgets target, use these values for (span_x, span_y)
3736    optional int32 grid_x_parent = 10 [default = -1];
3737    optional int32 grid_y_parent = 11 [default = -1];
3738    optional int32 page_id_parent = 12 [default = -2];
3739
3740    // UNKNOWN = 0
3741    // HOTSEAT = 1
3742    // WORKSPACE = 2
3743    // FOLDER_HOTSEAT = 3
3744    // FOLDER_WORKSPACE = 4
3745    optional int32 container_id = 13;
3746
3747    optional bool is_work_profile = 14;
3748
3749    // e.g., PIN, WIDGET TRAY, APPS TRAY, PREDICTION
3750    optional int32 attribute_id = 15;
3751
3752    // e.g., number of icons inside a folder
3753    optional int32 cardinality = 16;
3754
3755    // e.g., (x, y) span of the widget inside homescreen grid system
3756    optional int32 span_x = 17 [default = 1];
3757    optional int32 span_y = 18 [default = 1];
3758}
3759
3760/**
3761 * Logs when Wallpaper or ThemePicker UI has changed.
3762 *
3763 * Logged from:
3764 *   packages/apps/ThemePicker
3765 *   packages/apps/WallpaperPicker2
3766 */
3767message StyleUIChanged {
3768    optional android.stats.style.Action action = 1;
3769    optional int32 color_package_hash = 2;
3770    optional int32 font_package_hash  = 3;
3771    optional int32 shape_package_hash = 4;
3772    optional int32 clock_package_hash = 5;
3773    optional int32 launcher_grid = 6;
3774    optional int32 wallpaper_category_hash = 7;
3775    optional int32 wallpaper_id_hash = 8;
3776    optional int32 color_preference = 9;
3777    optional android.stats.style.LocationPreference location_preference = 10;
3778    optional android.stats.style.DatePreference date_preference = 11;
3779    optional android.stats.style.LaunchedPreference launched_preference = 12;
3780}
3781
3782/**
3783 * Logs when Settings UI has changed.
3784 *
3785 * Logged from:
3786 *   packages/apps/Settings
3787 */
3788message SettingsUIChanged {
3789    /**
3790     * Where this SettingsUIChange event comes from. For example, if
3791     * it's a PAGE_VISIBLE event, where the page is opened from.
3792     */
3793    optional android.app.settings.PageId attribution = 1;
3794
3795    /**
3796     * What the UI action is.
3797     */
3798    optional android.app.settings.Action action = 2;
3799
3800    /**
3801     * Where the action is happening
3802     */
3803    optional android.app.settings.PageId page_id = 3;
3804
3805    /**
3806     * What preference changed in this event.
3807     */
3808    optional string changed_preference_key = 4;
3809
3810    /**
3811     * The new value of the changed preference.
3812     */
3813    optional int64 changed_preference_int_value = 5;
3814}
3815
3816/**
3817 * Logs basic timing information about touch events.
3818 * Reported at most every 5 minutes while device is being interacted with.
3819 *
3820 * Logged from:
3821 *   frameworks/native/services/inputflinger
3822 */
3823message TouchEventReported {
3824    /**
3825     * The fields latency_{min|max|mean|stdev} represent minimum, maximum, mean,
3826     * and the standard deviation of the time spent processing touchscreen events
3827     * in the kernel and inputflinger. The units are microseconds.
3828     *
3829     * On supported devices, the starting point is taken during the hard interrupt inside the
3830     * kernel touch driver. On all other devices, the starting point is taken inside
3831     * the kernel's input event subsystem upon receipt of the input event.
3832     * The ending point is taken inside InputDispatcher, just after the input event
3833     * is sent to the app.
3834     */
3835    // Minimum value
3836    optional float latency_min_micros = 1;
3837    // Maximum value
3838    optional float latency_max_micros = 2;
3839    // Average value
3840    optional float latency_mean_micros = 3;
3841    // Standard deviation
3842    optional float latency_stdev_micros = 4;
3843    // Number of touch events (input_event) in this report
3844    optional int32 count = 5;
3845}
3846
3847/**
3848 * Logs slow input events.
3849 * The reports are rate-limited via a configurable server flag.
3850 *
3851 * Logged from:
3852 *   frameworks/native/services/inputflinger
3853 */
3854message SlowInputEventReported {
3855    /**
3856     * This is logged when a slow input event occurs. The threshold for what is considered a slow
3857     * event is applied to the 'end_to_end' latency number, and is configurable via a server flag.
3858     *
3859     * The goal of this data is to identify the bottlenecks in processing of input events.
3860     * All of the *_micros fields below are durations. The start and end points for each value
3861     * are described in the comments.
3862     */
3863    // Whether or not this is a DOWN event. If false, this is a MOVE event
3864    optional bool is_down = 1;
3865    // Start: the input event was created (touch events: the touch interrupt received in the driver)
3866    // End: the event was read in userspace (in EventHub)
3867    optional int32 event_to_read_micros = 2;
3868    // Start: the event was read in EventHub
3869    // End: the event was send to the app via the InputChannel (written to the socket)
3870    optional int32 read_to_deliver_micros = 3;
3871    // Start: the input event was sent to the app
3872    // End: the app consumed the input event
3873    optional int32 deliver_to_consume_micros = 4;
3874    // Start: the app consumed the event
3875    // End: the app's 'finishInputEvent' call was received in inputflinger
3876    // The end point can also be called "the app finished processing input event"
3877    optional int32 consume_to_finish_micros = 5;
3878    // Start: the app consumed the input event
3879    // End: the app produced a buffer
3880    optional int32 consume_to_gpu_complete_micros = 6;
3881    // Start: the app produced a buffer
3882    // End: the frame was shown on the display
3883    optional int32 gpu_complete_to_present_micros = 7;
3884    // The end-to-end touch latency
3885    // Start: the input event was created (touch events: the touch interrupt received in the driver)
3886    // End: the frame was presented on the display
3887    optional int32 end_to_end_micros = 8;
3888    // Since the last time this atom was reported, how many total events occurred?
3889    optional int32 num_events_since_last_report = 9;
3890    // Since the last time this atom was reported, how many slow events did not get reported
3891    // due to rate limiting?
3892    optional int32 num_skipped_slow_events_since_last_report = 10;
3893}
3894
3895/**
3896 * Logs gesture classification and timing information for touch events.
3897 *
3898 * Logged from:
3899 *   frameworks/base/core/java/android/view/GestureDetector.java
3900 *   frameworks/base/core/java/android/view/View.java
3901 */
3902message TouchGestureClassified {
3903    // The source of the classification (e.g. Java class name).
3904    optional string source = 1;
3905
3906    enum Classification {
3907        UNKNOWN_CLASSIFICATION = 0;
3908        SINGLE_TAP = 1;
3909        DOUBLE_TAP = 2;
3910        LONG_PRESS = 3;
3911        DEEP_PRESS = 4;
3912        SCROLL = 5;
3913    }
3914    // The classification of the gesture.
3915    optional Classification classification = 2;
3916
3917    // The interval from the start of a touch event stream until the
3918    // classification was made.
3919    optional int32 latency_millis = 3;
3920
3921    // The distance from the location of the first touch event to the
3922    // location of the touch event when the classification was made.
3923    optional float displacement_px = 4;
3924}
3925
3926/**
3927 * Logs that a setting was updated.
3928 * Logged from:
3929 *   frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
3930 * The tag and is_default allow resetting of settings to default values based on the specified
3931 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
3932 */
3933message SettingChanged {
3934    // The name of the setting.
3935    optional string setting = 1;
3936
3937    // The change being imposed on this setting. May represent a number, eg "3".
3938    optional string value = 2;
3939
3940    // The new value of this setting. For most settings, this is same as value. For some settings,
3941    // value is +X or -X where X represents an element in a set. For example, if the previous value
3942    // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
3943    // The +/- feature is currently only used for location_providers_allowed.
3944    optional string new_value = 3;
3945
3946    // The previous value of this setting.
3947    optional string prev_value = 4;
3948
3949    // The tag used with the is_default for resetting sets of settings. This is generally null.
3950    optional string tag = 5;
3951
3952    // True if this setting with tag should be resettable.
3953    optional bool is_default = 6;
3954
3955    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
3956    optional int32 user = 7;
3957
3958    enum ChangeReason {
3959        UPDATED = 1; // Updated can be an insertion or an update.
3960        DELETED = 2;
3961    }
3962    optional ChangeReason reason = 8;
3963}
3964
3965/**
3966 * Logs activity going to foreground or background
3967 *
3968 * Logged from:
3969  *   frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
3970 */
3971message ActivityForegroundStateChanged {
3972    optional int32 uid = 1 [(is_uid) = true];
3973    optional string pkg_name = 2;
3974    optional string class_name = 3;
3975
3976    enum State {
3977        BACKGROUND = 0;
3978        FOREGROUND = 1;
3979    }
3980    optional State state = 4;
3981}
3982
3983/**
3984 * Logs when a volume entered low Storage state.
3985 * Logged from:
3986 *      frameworks/base/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
3987 */
3988message LowStorageStateChanged {
3989    // Volume that ran out of storage.
3990    optional string volume_description = 1;
3991
3992    enum State {
3993        UNKNOWN = 0;
3994        OFF = 1;
3995        ON = 2;
3996    }
3997    optional State state = 2;
3998}
3999
4000/**
4001 * Logs when an app is downgraded.
4002 * Logged from:
4003 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
4004 */
4005message AppDowngraded {
4006    optional string package_name = 1;
4007    // Size of the package (all data) before being downgraded.
4008    optional int64 size_in_bytes_before = 2;
4009    // Size of the package (all data) after being downgraded.
4010    optional int64 size_in_bytes_after = 3;
4011
4012    optional bool aggressive = 4;
4013}
4014
4015/**
4016 * Logs when an app is optimized after being downgraded.
4017 * Logged from:
4018 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
4019 */
4020message AppOptimizedAfterDowngraded {
4021    optional string package_name = 1;
4022}
4023
4024/**
4025 * Logs whenever an app is installed on external storage.
4026 * Logged from:
4027        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
4028 */
4029message AppInstallOnExternalStorageReported {
4030    // The type of external storage.
4031    optional android.stats.storage.ExternalStorageType storage_type = 1;
4032    // The name of the package that is installed on the sd card.
4033    optional string package_name = 2;
4034}
4035
4036/**
4037 * Logs when an app crashes.
4038 * Logged from:
4039 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4040 */
4041message AppCrashOccurred {
4042    optional int32 uid = 1 [(is_uid) = true];
4043
4044    optional string event_type = 2;
4045
4046    // The name of the process.
4047    // system_server if it is not by an app
4048    optional string process_name = 3;
4049
4050    // The pid if available. -1 means not available.
4051    optional int32 pid = 4;
4052
4053    optional string package_name = 5;
4054
4055    enum InstantApp {
4056        UNAVAILABLE = 0;
4057        FALSE = 1;
4058        TRUE = 2;
4059    }
4060    optional InstantApp is_instant_app = 6;
4061
4062    enum ForegroundState {
4063        UNKNOWN = 0;
4064        BACKGROUND = 1;
4065        FOREGROUND = 2;
4066    }
4067    optional ForegroundState foreground_state = 7;
4068
4069    optional android.server.ErrorSource error_source = 8;
4070
4071    optional bool is_incremental = 9;
4072
4073    optional float loading_progress = 10;
4074
4075    optional int64 millis_since_oldest_pending_read = 11;
4076
4077    // Status code to represent the health of the file system backing storage, as defined in
4078    // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
4079    // Value -1 if the app is not installed on Incremental
4080    optional int32 storage_health_code = 12;
4081
4082    // Status code to represent the status of data loader, as defined in
4083    // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
4084    // Value -1 if the app is not installed on Incremental
4085    optional int32 data_loader_status_code = 13;
4086
4087    // Whether read logs collection is enabled
4088    optional bool read_logs_enabled = 14;
4089
4090    // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
4091    // -1 means the app is not installed on Incremental.
4092    optional int64 millis_since_last_data_loader_bind = 15;
4093
4094    // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
4095    optional int64 data_loader_bind_delay_millis = 16;
4096
4097    // Total count of delayed reads, as reported by Incremental File System.
4098    optional int32 total_delayed_reads = 17;
4099
4100    // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
4101    optional int32 total_failed_reads = 18;
4102
4103    // UID of the process that tried to read a page from the app but failed.
4104    // This shows whether the read was initiated by the system, the app itself, or some other apps.
4105    // -1 means there was no read error or the app is not installed on Incremental.
4106    optional int32 last_read_error_uid = 19;
4107
4108    // Duration since that last read failure.
4109    // -1 means there was no read error or the app is not installed on Incremental.
4110    optional int64 last_read_error_millis_since = 20;
4111
4112    // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
4113    // and other positive values for other errors. -1 means app is not installed on Incremental.
4114    optional int32 last_read_error_code = 21;
4115
4116    // Total duration of delayed reads in milliseconds
4117    optional int64 total_delayed_reads_duration_millis = 22;
4118}
4119
4120/**
4121 * Logs when a WTF (What a Terrible Failure) happened.
4122 * Logged from:
4123 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4124 */
4125message WTFOccurred {
4126    optional int32 uid = 1 [(is_uid) = true];
4127
4128    optional string tag = 2;
4129
4130    // The name of the process.
4131    // system_server if it is not by an app
4132    optional string process_name = 3;
4133
4134    // The pid if available. -1 means not available.
4135    optional int32 pid = 4;
4136
4137    optional android.server.ErrorSource error_source = 5;
4138}
4139
4140/**
4141 * Logs when system server reports low memory.
4142 * Logged from:
4143 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4144 */
4145message LowMemReported {
4146}
4147
4148/**
4149 * Logs when an app ANR (App Not Responding) occurs.
4150 * Logged from:
4151 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
4152 */
4153message ANROccurred {
4154    optional int32 uid = 1 [(is_uid) = true];
4155
4156    optional string process_name = 2;
4157
4158    optional string short_component_name = 3;
4159
4160    optional string reason = 4;
4161
4162    enum InstantApp {
4163        UNAVAILABLE = 0;
4164        FALSE = 1;
4165        TRUE = 2;
4166    }
4167    optional InstantApp is_instant_app = 5;
4168
4169    enum ForegroundState {
4170        UNKNOWN = 0;
4171        BACKGROUND = 1;
4172        FOREGROUND = 2;
4173    }
4174    optional ForegroundState foreground_state = 6;
4175
4176    optional android.server.ErrorSource error_source = 7;
4177
4178    optional string package_name = 8;
4179
4180    optional bool is_incremental = 9;
4181
4182    optional float loading_progress = 10;
4183
4184    optional int64 millis_since_oldest_pending_read = 11;
4185
4186    // Status code to represent the health of the file system backing storage, as defined in
4187    // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
4188    // Value -1 if the app is not installed on Incremental
4189    optional int32 storage_health_code = 12;
4190
4191    // Status code to represent the status of data loader, as defined in
4192    // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
4193    // Value -1 if the app is not installed on Incremental
4194    optional int32 data_loader_status_code = 13;
4195
4196    // Whether read logs collection is enabled
4197    optional bool read_logs_enabled = 14;
4198
4199    // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
4200    // -1 means the app is not installed on Incremental.
4201    optional int64 millis_since_last_data_loader_bind = 15;
4202
4203    // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
4204    optional int64 data_loader_bind_delay_millis = 16;
4205
4206    // Total count of delayed reads, as reported by Incremental File System.
4207    optional int32 total_delayed_reads = 17;
4208
4209    // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
4210    optional int32 total_failed_reads = 18;
4211
4212    // UID of the process that tried to read a page from the app but failed.
4213    // This shows whether the read was initiated by the system, the app itself, or some other apps.
4214    // -1 means there was no read error or the app is not installed on Incremental.
4215    optional int32 last_read_error_uid = 19;
4216
4217    // Duration since that last read failure.
4218    // -1 means there was no read error or the app is not installed on Incremental.
4219    optional int64 last_read_error_millis_since = 20;
4220
4221    // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
4222    // and other positive values for other errors. -1 means app is not installed on Incremental.
4223    optional int32 last_read_error_code = 21;
4224
4225    // Total duration of delayed reads in milliseconds
4226    optional int64 total_delayed_reads_duration_millis = 22;
4227}
4228
4229/**
4230 * Logs immediately after an app ANR (App Not Responding) occurs. In contrast, ANROccurred (the
4231 * atom above) logs some time (not necessarily immediately) after the ANR is detected.
4232 * Logged from:
4233 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
4234 */
4235message ANROccurredProcessingStarted {
4236  optional string process_name = 1;
4237}
4238
4239/**
4240 * Logs when the vibrator state changes.
4241 * Logged from:
4242 *      frameworks/base/services/core/java/com/android/server/VibratorService.java
4243 */
4244message VibratorStateChanged {
4245    repeated AttributionNode attribution_node = 1;
4246
4247    enum State {
4248        OFF = 0;
4249        ON = 1;
4250    }
4251    optional State state = 2;
4252
4253    // Duration (in milliseconds) requested to keep the vibrator on.
4254    // Only applicable for State == ON.
4255    optional int64 duration_millis = 3;
4256}
4257
4258/*
4259 * Allows other apps to push events into statsd.
4260 * Logged from:
4261 *      frameworks/base/core/java/android/util/StatsLog.java
4262 */
4263message AppBreadcrumbReported {
4264    // The uid of the application that sent this custom atom.
4265    optional int32 uid = 1 [(is_uid) = true];
4266
4267    // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
4268    optional int32 label = 2;
4269
4270    // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
4271    // predicates for the metrics).
4272    enum State {
4273        UNKNOWN = 0;
4274        UNSPECIFIED = 1;  // For events that are known to not represent START/STOP.
4275        STOP = 2;
4276        START = 3;
4277    }
4278    optional State state = 3;
4279}
4280
4281/**
4282 * Logs the wall-clock time when a significant wall-clock time shift occurs.
4283 * For example, this could be due to the user manually changing the time.
4284 *
4285 * Logged from:
4286 *   frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
4287 */
4288message WallClockTimeShifted {
4289    // New wall-clock time in milliseconds, according to System.currentTimeMillis().
4290    optional int64 wall_clock_timestamp_millis = 1;
4291}
4292
4293/**
4294 * Logs when statsd detects an anomaly.
4295 *
4296 * Logged from:
4297 *   frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
4298 */
4299message AnomalyDetected {
4300    // Uid that owns the config whose anomaly detection alert fired.
4301    optional int32 config_uid = 1 [(is_uid) = true];
4302
4303    // Id of the config whose anomaly detection alert fired.
4304    optional int64 config_id = 2;
4305
4306    // Id of the alert (i.e. name of the anomaly that was detected).
4307    optional int64 alert_id = 3;
4308}
4309
4310message AppStartOccurred {
4311    // The uid if available. -1 means not available.
4312    optional int32 uid = 1 [(is_uid) = true];
4313
4314    // The app package name.
4315    optional string pkg_name = 2;
4316
4317    enum TransitionType {
4318        UNKNOWN = 0;
4319        WARM = 1;
4320        HOT = 2;
4321        COLD = 3;
4322        RELAUNCH = 4;
4323    }
4324    // The transition type.
4325    optional TransitionType type = 3;
4326
4327    // The activity name.
4328    optional string activity_name = 4;
4329
4330    // The name of the calling app. Empty if not set.
4331    optional string calling_pkg_name = 5;
4332
4333    // Whether the app is an instant app.
4334    optional bool is_instant_app = 6;
4335
4336    // Device uptime when activity started. Deprecated: use activity_start_timestamp_millis instead.
4337    optional int64 activity_start_millis = 7 [deprecated = true];
4338
4339    optional android.app.AppTransitionReasonEnum reason = 8;
4340
4341    optional int32 transition_delay_millis = 9;
4342    // -1 if not set.
4343    optional int32 starting_window_delay_millis = 10;
4344    // -1 if not set.
4345    optional int32 bind_application_delay_millis = 11;
4346    optional int32 windows_drawn_delay_millis = 12;
4347
4348    // Empty if not set.
4349    optional string launch_token = 13;
4350
4351    // The reason why the package was optimized.
4352    optional int32 package_optimization_compilation_reason = 14;
4353
4354    // The compiler filter used when when the package was optimized.
4355    optional int32 package_optimization_compilation_filter = 15;
4356
4357    enum SourceType {
4358        UNAVAILABLE = 0;
4359        LAUNCHER = 1;
4360        NOTIFICATION = 2;
4361        LOCKSCREEN = 3;
4362        RECENTS_ANIMATION = 4;
4363    }
4364    // The type of the startup source.
4365    optional SourceType source_type = 16;
4366
4367    // The time from the startup source to the beginning of handling the startup event.
4368    // -1 means not available.
4369    optional int32 source_event_delay_millis = 17;
4370
4371    // Whether the app is hibernating when it started
4372    optional bool is_hibernating = 18;
4373
4374    // Whether the app is installed on Incremental File System.
4375    optional bool is_incremental = 19;
4376
4377    // Whether the app is still being streamed.
4378    optional bool is_loading = 20;
4379
4380    // The hash value of the activity name.
4381    optional int32 activity_name_hash = 21;
4382
4383    // The timestamp(SystemClock#elapsedRealtime()) when starting activity.
4384    optional int64 activity_start_timestamp_millis = 22;
4385}
4386
4387message AppStartCanceled {
4388    // The uid if available. -1 means not available.
4389    optional int32 uid = 1 [(is_uid) = true];
4390
4391    // The app package name.
4392    optional string pkg_name = 2;
4393
4394    enum TransitionType {
4395        UNKNOWN = 0;
4396        WARM = 1;
4397        HOT = 2;
4398        COLD = 3;
4399        RELAUNCH = 4;
4400    }
4401    // The transition type.
4402    optional TransitionType type = 3;
4403
4404    // The activity name.
4405    optional string activity_name = 4;
4406}
4407
4408message AppStartFullyDrawn {
4409    // The uid if available. -1 means not available.
4410    optional int32 uid = 1 [(is_uid) = true];
4411
4412    // The app package name.
4413    optional string pkg_name = 2;
4414
4415    enum TransitionType {
4416        UNKNOWN = 0;
4417        WITH_BUNDLE = 1;
4418        WITHOUT_BUNDLE = 2;
4419    }
4420    // The transition type.
4421    optional TransitionType type = 3;
4422
4423    // The activity name.
4424    optional string activity_name = 4;
4425
4426    optional bool transition_process_running = 5;
4427
4428    // App startup time (until call to Activity#reportFullyDrawn()).
4429    optional int64 app_startup_time_millis = 6;
4430
4431    // The reason why the package was optimized.
4432    optional int32 package_optimization_compilation_reason = 7;
4433
4434    // The compiler filter used when when the package was optimized.
4435    optional int32 package_optimization_compilation_filter = 8;
4436
4437    enum SourceType {
4438        UNAVAILABLE = 0;
4439        LAUNCHER = 1;
4440        NOTIFICATION = 2;
4441        LOCKSCREEN = 3;
4442    }
4443    // The type of the startup source.
4444    optional SourceType source_type = 9;
4445
4446    // The time from the startup source to the beginning of handling the startup event.
4447    // -1 means not available.
4448    optional int32 source_event_delay_millis = 10;
4449
4450    // Whether the app is installed on Incremental File System.
4451    optional bool is_incremental = 11;
4452
4453    // Whether the app is still being streamed.
4454    optional bool is_loading = 12;
4455
4456    // The hash value of the activity name.
4457    optional int32 activity_name_hash = 13;
4458}
4459
4460/**
4461 * Logs when an app enters a different App Compat state.
4462 *
4463 * Logged from:
4464 *   frameworks/base/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
4465 */
4466message AppCompatStateChanged {
4467    // UID of the package whose state changed.
4468    optional int32 uid = 1 [(is_uid) = true];
4469
4470    enum State {
4471        UNKNOWN = 0;
4472        // The app is not visible or has been closed.
4473        NOT_VISIBLE = 1;
4474        // The app’s bounds aren’t letterboxed.
4475        NOT_LETTERBOXED = 2;
4476        // The app’s bounds are letterboxed because of size-compat-mode.
4477        LETTERBOXED_FOR_SIZE_COMPAT_MODE = 3;
4478        // The app’s bounds are letterboxed because of fixed orientation.
4479        LETTERBOXED_FOR_FIXED_ORIENTATION = 4;
4480        // The app’s bounds are letterboxed because of aspect ratio restrictions.
4481        LETTERBOXED_FOR_ASPECT_RATIO = 5;
4482    }
4483
4484    // The state that was entered.
4485    optional State state = 2 [
4486      (state_field_option).exclusive_state = true,
4487      (state_field_option).nested = false];
4488}
4489
4490/**
4491 * Logs events reported for the Size Compat restart button of an app.
4492 *
4493 * Logged from:
4494 *   frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java
4495 */
4496message SizeCompatRestartButtonEventReported {
4497    // UID of the package that has the button.
4498    optional int32 uid = 1 [(is_uid) = true];
4499
4500    enum Event {
4501        UNKNOWN = 0;
4502        APPEARED = 1;
4503        CLICKED = 2;
4504    }
4505
4506    // The event that was reported.
4507    optional Event event = 2;
4508}
4509
4510/**
4511 * Logs events reported for the Camera App Compat control, which is used to
4512 * correct stretched viewfinder in apps that don't handle all possible
4513 * configurations, and changes between them, correctly.
4514 *
4515 * Logged from:
4516 *   frameworks/base/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
4517 */
4518message CameraCompatControlEventReported {
4519  // UID of the package that has the control.
4520  optional int32 uid = 1 [(is_uid) = true];
4521
4522  enum Event {
4523    UNKNOWN = 0;
4524    // Button to apply the treatment appeared.
4525    APPEARED_APPLY_TREATMENT = 1;
4526    // Button to revert the treatment appeared.
4527    APPEARED_REVERT_TREATMENT = 2;
4528    // Users clicked on the button to apply the treatment.
4529    CLICKED_APPLY_TREATMENT = 3;
4530    // Users clicked on the button to revert the treatment.
4531    CLICKED_REVERT_TREATMENT = 4;
4532    // Users clicked on the button to dismiss the control.
4533    CLICKED_DISMISS = 5;
4534  }
4535
4536  // The event that was reported.
4537  optional Event event = 2;
4538}
4539
4540/**
4541 * Logs a picture-in-picture action
4542 * Logged from:
4543 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4544 *      frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4545 *      frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
4546 */
4547message PictureInPictureStateChanged {
4548    // -1 if it is not available
4549    optional int32 uid = 1 [(is_uid) = true];
4550
4551    optional string short_name = 2;
4552
4553    enum State {
4554        ENTERED = 1;
4555        EXPANDED_TO_FULL_SCREEN = 2;
4556        MINIMIZED = 3;
4557        DISMISSED = 4;
4558    }
4559    optional State state = 3;
4560}
4561
4562/**
4563 * Logs overlay action
4564 * Logged from:
4565 *     services/core/java/com/android/server/wm/Session.java
4566 */
4567message OverlayStateChanged {
4568    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
4569
4570    optional string package_name = 2 [(state_field_option).primary_field = true];
4571
4572    optional bool using_alert_window = 3;
4573
4574    enum State {
4575        ENTERED = 1;
4576        EXITED = 2;
4577    }
4578    optional State state = 4
4579            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
4580}
4581
4582/**
4583 * Logs foreground service starts and stops.
4584 * Note that this is not when a service starts or stops, but when it is
4585 * considered foreground.
4586 * Logged from
4587 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
4588 */
4589message ForegroundServiceStateChanged {
4590    optional int32 uid = 1 [(is_uid) = true];
4591    // package_name + "/" + class_name
4592    optional string short_name = 2;
4593
4594    enum State {
4595        ENTER = 1;
4596        EXIT = 2;
4597        DENIED = 3;
4598    }
4599    optional State state = 3;
4600
4601    // Whether the fgs is allowed while-in-use permissions, i.e. is considered 'in-use' to the user.
4602    // (If the fgs was started while the app wasn't TOP it usually will be denied these permissions)
4603    optional bool allow_while_in_use_permission = 4;
4604    // the reason why FGS is allowed or denied to start. The reason code is defined as
4605    // PowerExemptionManager#ReasonCode.
4606    optional int32 fgs_start_reason_code = 5;
4607    // FGS service's targetSdkVersion.
4608    optional int32 target_sdk_version = 6;
4609    // uid of the app that start/bind this service.
4610    optional int32 calling_uid = 7;
4611    // targetSdkVersion of the app that start/bind this service.
4612    optional int32 caller_target_sdk_version = 8;
4613    // uid of the app that set the temp-allowlist, INVALID_UID (-1) if not in any
4614    // temp-allowlist.
4615    optional int32 temp_allow_list_calling_uid = 9;
4616    // FGS notification was deferred.
4617    optional bool fgs_notification_deferred = 10;
4618    // FGS notification was shown before the FGS finishes, or it wasn't deferred in the first place.
4619    optional bool fgs_notification_shown = 11;
4620    // The duration from state ENTER to state EXIT. Only meaningful when the state is EXIT.
4621    optional int32 fgs_duration_ms = 12;
4622    // Number of times startForeground() is called on this service.
4623    optional int32 fgs_start_count = 13;
4624    // SHA-1 hashed short_name combined with ANDROID_ID.
4625    optional int32 short_name_hash = 14;
4626}
4627
4628/**
4629 * Logs the number of times a uid accesses a sensitive AppOp during a foreground service session.
4630 * A foreground service session is any continuous period during which the uid holds at least one
4631 * foreground service; the atom will be pushed when the uid no longer holds any foreground services.
4632 * Accesses initiated while the uid is in the TOP state are ignored.
4633 * Sessions with no attempted accesses are not logged.
4634 * Logged from
4635 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
4636 */
4637message ForegroundServiceAppOpSessionEnded {
4638    optional int32 uid = 1 [(is_uid) = true];
4639
4640    // The operation's name.
4641    // Only following four ops are logged
4642    // COARSE_LOCATION = 0
4643    // FINE_LOCATION = 1
4644    // CAMERA = 26
4645    // RECORD_AUDIO = 27
4646    optional android.app.AppOpEnum app_op_name = 2 [default = APP_OP_NONE];
4647
4648    // The uid's permission mode for accessing the AppOp during this fgs session.
4649    enum Mode {
4650        MODE_UNKNOWN = 0;
4651        MODE_ALLOWED = 1; // Always allowed
4652        MODE_IGNORED = 2; // Denied
4653        MODE_FOREGROUND = 3; // Allow-while-in-use (or allowed-one-time)
4654    }
4655    optional Mode app_op_mode = 3;
4656
4657    // Number of times this AppOp was requested and allowed.
4658    optional int32 count_ops_accepted = 4;
4659    // Number of times this AppOp was requested but denied.
4660    optional int32 count_ops_rejected = 5;
4661}
4662
4663/**
4664 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
4665 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
4666 * attributed back to the parent (host) uid. One example is Chrome.
4667 *
4668 * Logged from:
4669 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4670 */
4671message IsolatedUidChanged {
4672    // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
4673    // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
4674    // This field is ignored when event == REMOVED.
4675    optional int32 parent_uid = 1;
4676
4677    optional int32 isolated_uid = 2;
4678
4679    // We expect an isolated uid to be removed before if it's used for another parent uid.
4680    enum Event {
4681        REMOVED = 0;
4682        CREATED = 1;
4683    }
4684    optional Event event = 3;
4685}
4686
4687/*
4688 * Logs the reception of an incoming network packet causing the main system to wake up for
4689 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
4690 * and processed by WakeupController.cpp.
4691 */
4692message PacketWakeupOccurred {
4693    // The uid owning the socket into which the packet was delivered, or -1 if the packet was
4694    // delivered nowhere.
4695    optional int32 uid = 1 [(is_uid) = true];
4696    // The interface name on which the packet was received.
4697    optional string iface = 2;
4698    // The ethertype value of the packet.
4699    optional int32 ethertype = 3;
4700    // String representation of the destination MAC address of the packet.
4701    optional string destination_hardware_address = 4;
4702    // String representation of the source address of the packet if this was an IP packet.
4703    optional string source_ip = 5;
4704    // String representation of the destination address of the packet if this was an IP packet.
4705    optional string destination_ip = 6;
4706    // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
4707    // field if this was an IPv6 packet. The range of possible values is the same for both IP
4708    // families.
4709    optional int32 ip_next_header = 7;
4710    // The source port if this was a TCP or UDP packet.
4711    optional int32 source_port = 8;
4712    // The destination port if this was a TCP or UDP packet.
4713    optional int32 destination_port = 9;
4714}
4715
4716/*
4717 * Logs the memory stats for an app on startup.
4718 * Logged from:
4719 *     frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4720 */
4721message AppStartMemoryStateCaptured {
4722    // The uid if available. -1 means not available.
4723    optional int32 uid = 1 [(is_uid) = true];
4724
4725    // The process name.
4726    optional string process_name = 2;
4727
4728    // The activity name.
4729    optional string activity_name = 3;
4730
4731    // # of page-faults
4732    optional int64 page_fault = 4;
4733
4734    // # of major page-faults
4735    optional int64 page_major_fault = 5;
4736
4737    // RSS
4738    optional int64 rss_in_bytes = 6;
4739
4740    // CACHE
4741    optional int64 cache_in_bytes = 7;
4742
4743    // SWAP
4744    optional int64 swap_in_bytes = 8;
4745}
4746
4747/*
4748 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
4749 * for LMK event.
4750 * Logged from:
4751 *      system/core/lmkd/lmkd.c
4752 */
4753message LmkStateChanged {
4754    enum State {
4755        UNKNOWN = 0;
4756        START = 1;
4757        STOP = 2;
4758    }
4759    optional State state = 1;
4760}
4761
4762/*
4763 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
4764 * Logged from:
4765 *      system/core/lmkd/lmkd.c
4766 */
4767message LmkKillOccurred {
4768    enum Reason {
4769        UNKNOWN = 0;
4770        PRESSURE_AFTER_KILL = 1;
4771        NOT_RESPONDING = 2;
4772        LOW_SWAP_AND_THRASHING = 3;
4773        LOW_MEM_AND_SWAP = 4;
4774        LOW_MEM_AND_THRASHING = 5;
4775        DIRECT_RECL_AND_THRASHING = 6;
4776        LOW_MEM_AND_SWAP_UTIL = 7;
4777        LOW_FILECACHE_AFTER_THRASHING = 8;
4778    }
4779
4780    // The uid if available. -1 means not available.
4781    optional int32 uid = 1 [(is_uid) = true];
4782
4783    // The process name.
4784    optional string process_name = 2;
4785
4786    // oom adj score.
4787    optional int32 oom_adj_score = 3;
4788
4789    // # of page-faults
4790    optional int64 page_fault = 4;
4791
4792    // # of major page-faults
4793    optional int64 page_major_fault = 5;
4794
4795    // RSS
4796    optional int64 rss_in_bytes = 6;
4797
4798    // CACHE
4799    optional int64 cache_in_bytes = 7;
4800
4801    // SWAP
4802    optional int64 swap_in_bytes = 8;
4803
4804    // The elapsed real time of start of the process.
4805    optional int64 process_start_time_nanos = 9;
4806
4807    // Min oom adj score considered by lmkd.
4808    optional int32 min_oom_score = 10;
4809
4810    // Free physical memory on device at LMK time.
4811    optional int32 free_mem_kb = 11;
4812
4813    // Free swap on device at LMK time.
4814    optional int32 free_swap_kb = 12;
4815
4816    // What triggered the LMK event.
4817    optional Reason reason = 13;
4818
4819    // Current thrashing levels (workingset_refaults/filecache in %).
4820    optional int32 thrashing = 14;
4821
4822    // Max thrashing levels (workingset_refaults/filecache in %).
4823    optional int32 max_thrashing = 15;
4824}
4825
4826/*
4827 * Logs when the ActivityManagerService detects that an app died.
4828 *
4829 * Logged from:
4830 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4831 */
4832message AppDied {
4833    // timestamp(elapsedRealtime) of record creation
4834    optional uint64 timestamp_millis = 1 [(state_field_option).exclusive_state = true];
4835}
4836
4837/**
4838 * An atom for generic metrics logging. Available from Android Q.
4839 */
4840message GenericAtom {
4841    // The uid of the application that sent this custom atom.
4842    optional int32 uid = 1 [(is_uid) = true];
4843
4844    // An event_id indicates the type of event.
4845    optional android.stats.EventType event_id = 2;
4846}
4847
4848/**
4849 * Atom for simple logging of user interaction and impression events, such as "the user touched
4850 * this button" or "this dialog was displayed".
4851 * Keep the UI event stream clean: don't use for system or background events.
4852 * Log using the UiEventLogger wrapper - don't write with the StatsLog API directly.
4853 *
4854 * Logged from:
4855 *   frameworks/base/services/core/java/com/android/server/
4856 *   frameworks/base/packages/SystemUI/src/com/android/systemui/
4857 */
4858message UiEventReported {
4859    // The event_id.
4860    optional int32 event_id = 1;
4861    // The event's source or target uid and package, if applicable.
4862    // For example, the package posting a notification, or the destination package of a share.
4863    optional int32 uid = 2 [(is_uid) = true];
4864    optional string package_name = 3;
4865    // An identifier used to disambiguate which logs refer to a particular instance of some
4866    // UI element. Useful when there might be multiple instances simultaneously active.
4867    optional int32 instance_id = 4;
4868}
4869
4870/**
4871 * Reports a notification was created or updated.
4872 *
4873 * Logged from:
4874 *   frameworks/base/services/core/java/com/android/server/notification/
4875 */
4876message NotificationReported {
4877    // The event_id (as for UiEventReported).
4878    optional int32 event_id = 1;
4879    // The notifying app's uid and package.
4880    optional int32 uid = 2 [(is_uid) = true];
4881    optional string package_name = 3;
4882    // A small system-assigned identifier for the notification.
4883    // Locally probably-unique, but expect collisions across users and/or days.
4884    optional int32 instance_id = 4;
4885    optional int32 notification_id_hash = 5;  // Small hash of the app-assigned notif ID + tag
4886    optional int32 channel_id_hash = 6;  // Small hash of app-assigned channel ID
4887
4888    // Grouping information
4889    optional int32 group_id_hash = 7;  // Small hash of the group ID of the notification
4890    optional int32 group_instance_id = 8;  // Instance_id of the group-summary notification
4891    optional bool is_group_summary = 9;  // Tags the group-summary notification
4892
4893    // Attributes
4894    optional string category = 10;   // App-assigned notification category (API-defined strings)
4895    optional int32 style = 11;       // App-assigned notification style
4896    optional int32 num_people = 12;  // Number of Person records attached to the notification
4897
4898    // Ordering, importance and interruptiveness
4899
4900    optional int32 position = 13;    // Position in NotificationManager's list
4901
4902    optional android.stats.sysui.NotificationImportance importance = 14;
4903    optional int32 alerting = 15;    // Bitfield, 1=buzz 2=beep 4=blink
4904
4905    enum NotificationImportanceExplanation {
4906        IMPORTANCE_EXPLANATION_UNKNOWN = 0;
4907        IMPORTANCE_EXPLANATION_APP = 1;     // App-specified channel importance.
4908        IMPORTANCE_EXPLANATION_USER = 2;    // User-specified channel importance.
4909        IMPORTANCE_EXPLANATION_ASST = 3;    // Notification Assistant override.
4910        IMPORTANCE_EXPLANATION_SYSTEM = 4;  // System override.
4911        // Like _APP, but based on pre-channels priority signal.
4912        IMPORTANCE_EXPLANATION_APP_PRE_CHANNELS = 5;
4913    }
4914
4915    optional NotificationImportanceExplanation importance_source = 16;
4916    optional android.stats.sysui.NotificationImportance importance_initial = 17;
4917    optional NotificationImportanceExplanation importance_initial_source = 18;
4918    optional android.stats.sysui.NotificationImportance importance_asst = 19;
4919    optional int32 assistant_hash = 20;
4920    optional float assistant_ranking_score = 21;
4921}
4922
4923message Notification {
4924    // The notifying app's uid and package.
4925    optional int32 uid = 1 [(is_uid) = true];
4926    optional string package_name = 2;
4927    // A small system-assigned identifier for the notification.
4928    optional int32 instance_id = 3;
4929
4930    // Grouping information.
4931    optional int32 group_instance_id = 4;
4932    optional bool is_group_summary = 5;
4933
4934    // The section of the shade that the notification is in.
4935    // See SystemUI Notifications.proto.
4936    enum NotificationSection {
4937        SECTION_UNKNOWN = 0;
4938        SECTION_HEADS_UP = 1;
4939        SECTION_MEDIA_CONTROLS = 2;
4940        SECTION_PEOPLE = 3;
4941        SECTION_ALERTING = 4;
4942        SECTION_SILENT = 5;
4943        SECTION_FOREGROUND_SERVICE = 6;
4944    }
4945    optional NotificationSection section = 6;
4946}
4947
4948message NotificationList {
4949    repeated Notification notifications = 1;  // An ordered sequence of notifications.
4950}
4951
4952/**
4953 * Reports a notification panel was displayed, e.g. from the lockscreen or status bar.
4954 *
4955 * Logged from:
4956 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/
4957 */
4958message NotificationPanelReported {
4959    // The event_id (as for UiEventReported).
4960    optional int32 event_id = 1;
4961    optional int32 num_notifications = 2;
4962    // The notifications in the panel, in the order that they appear there.
4963    optional NotificationList notifications = 3 [(log_mode) = MODE_BYTES];
4964}
4965
4966/**
4967 * Reports a notification channel, or channel group, was created, updated, or deleted.
4968 *
4969 * Logged from:
4970 *   frameworks/base/services/core/java/com/android/server/notification/
4971 */
4972message NotificationChannelModified {
4973    // The event_id (as for UiEventReported).
4974    optional int32 event_id = 1;
4975    // The notifying app's uid and package.
4976    optional int32 uid = 2 [(is_uid) = true];
4977    optional string package_name = 3;
4978    // Hash of app-assigned notification channel ID or channel-group ID
4979    optional int32 channel_id_hash = 4;
4980    // Previous importance setting, if applicable
4981    optional android.stats.sysui.NotificationImportance old_importance = 5;
4982    // New importance setting
4983    optional android.stats.sysui.NotificationImportance importance = 6;
4984    // whether or not this channel represents a conversation
4985    optional bool is_conversation = 7;
4986    // Hash of app-assigned notification conversation id
4987    optional int32 conversation_id_hash = 8;
4988    // whether or not the user demoted this channel out of the conversation space
4989    optional bool is_conversation_demoted = 9;
4990    // whether this conversation is marked as being a priority
4991    optional bool is_conversation_priority = 10;
4992}
4993
4994/**
4995 * Logs when a biometric acquire event occurs.
4996 *
4997 * Logged from:
4998 *   frameworks/base/services/core/java/com/android/server/biometrics
4999 */
5000message BiometricAcquired {
5001    // Biometric modality that was acquired.
5002    optional android.hardware.biometrics.ModalityEnum modality = 1;
5003    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java.
5004    optional int32 user = 2;
5005    // If this acquire is for a crypto operation. e.g. Secure purchases, unlock password storage.
5006    optional bool is_crypto = 3;
5007    // Action that the device is performing. Acquired messages are only expected for enroll and
5008    // authenticate. Other actions may indicate an error.
5009    optional android.hardware.biometrics.ActionEnum action = 4;
5010    // The client that this acquisition was received for.
5011    optional android.hardware.biometrics.ClientEnum client = 5;
5012    // Acquired constants, e.g. ACQUIRED_GOOD. See constants defined by <Biometric>Manager.
5013    optional int32 acquire_info = 6;
5014    // Vendor-specific acquire info. Valid only if acquire_info == ACQUIRED_VENDOR.
5015    optional int32 acquire_info_vendor = 7;
5016    // Dictates if this message should trigger additional debugging.
5017    optional bool debug = 8;
5018    // The ID of the biometric sensor associated with this action.
5019    optional int32 sensor_id = 9;
5020}
5021
5022/**
5023 * Logs when a biometric authentication event occurs.
5024 *
5025 * Logged from:
5026 *   frameworks/base/services/core/java/com/android/server/biometrics
5027 */
5028message BiometricAuthenticated {
5029    // Biometric modality that was used.
5030    optional android.hardware.biometrics.ModalityEnum modality = 1;
5031    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
5032    optional int32 user = 2;
5033    // If this authentication is for a crypto operation. e.g. Secure purchases, unlock password
5034    // storage.
5035    optional bool is_crypto = 3;
5036    // The client that this acquisition was received for.
5037    optional android.hardware.biometrics.ClientEnum client = 4;
5038    // If authentication requires user confirmation. See BiometricPrompt's
5039    // setRequireConfirmation(bool) method.
5040    optional bool require_confirmation = 5;
5041
5042    enum State {
5043        UNKNOWN = 0;
5044        REJECTED = 1;
5045        PENDING_CONFIRMATION = 2;
5046        CONFIRMED = 3;
5047    }
5048
5049    // State of the current auth attempt.
5050    optional State state = 6;
5051    // Time it took to authenticate. For BiometricPrompt where setRequireConfirmation(false) is
5052    // specified and supported by the biometric modality, this is from the first ACQUIRED_GOOD to
5053    // AUTHENTICATED. for setRequireConfirmation(true), this is from PENDING_CONFIRMATION to
5054    // CONFIRMED.
5055    optional int64 latency_millis = 7;
5056    // Dictates if this message should trigger additional debugging.
5057    optional bool debug = 8;
5058    // The ID of the biometric sensor associated with this action.
5059    optional int32 sensor_id = 9;
5060    // The ambient light lux when authenticated.
5061    optional float ambient_light_lux = 10;
5062}
5063
5064/**
5065 * Logs when a biometric error occurs.
5066 *
5067 * Logged from:
5068 *   frameworks/base/services/core/java/com/android/server/biometrics
5069 */
5070message BiometricErrorOccurred {
5071    // Biometric modality that was used.
5072    optional android.hardware.biometrics.ModalityEnum modality = 1;
5073    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
5074    optional int32 user = 2;
5075    // If this error is for a crypto operation. e.g. Secure purchases, unlock password storage.
5076    optional bool is_crypto = 3;
5077    // Action that the device is performing.
5078    optional android.hardware.biometrics.ActionEnum action = 4;
5079    // The client that this acquisition was received for.
5080    optional android.hardware.biometrics.ClientEnum client = 5;
5081    // Error constants. See constants defined by <Biometric>Manager. Enums won't work since errors
5082    // are unique to modality.
5083    optional int32 error_info = 6;
5084    // Vendor-specific error info. Valid only if acquire_info == ACQUIRED_VENDOR. These are defined
5085    // by the vendor and not specified by the HIDL interface.
5086    optional int32 error_info_vendor = 7;
5087    // Dictates if this message should trigger additional debugging.
5088    optional bool debug = 8;
5089    // Time spent during the authentication attempt.
5090    optional int64 latency_millis = 9;
5091    // The ID of the biometric sensor associated with this action.
5092    optional int32 sensor_id = 10;
5093}
5094
5095/**
5096 * Logs when a system health issue is detected.
5097 * Logged from:
5098 *   frameworks/base/services/core/java/com/android/server/biometrics
5099 */
5100message BiometricSystemHealthIssueDetected {
5101    // Biometric modality.
5102    optional android.hardware.biometrics.ModalityEnum modality = 1;
5103    // Type of issue detected.
5104    optional android.hardware.biometrics.IssueEnum issue = 2;
5105    // Dictates if this message should trigger additional debugging.
5106    optional bool debug = 3;
5107    // The ID of the biometric sensor associated with this action.
5108    optional int32 sensor_id = 4;
5109}
5110
5111/**
5112 * Logs when a biometric enrollment occurs.
5113 *
5114 * Logged from:
5115 *   frameworks/base/services/core/java/com/android/server/biometrics
5116 */
5117message BiometricEnrolled {
5118    // Biometric modality that was used.
5119    optional android.hardware.biometrics.ModalityEnum modality = 1;
5120    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
5121    optional int32 user = 2;
5122    // The amount of time the enrollment took in milliseconds.
5123    optional int64 latency_millis = 3;
5124    // Whether or not the enrollment was successful.
5125    optional bool success = 4;
5126    // The ID of the biometric sensor associated with this action.
5127    optional int32 sensor_id = 5;
5128    // The ambient light lux when the user enrolled.
5129    optional float ambient_light_lux = 6;
5130}
5131
5132/*
5133 * Logs when one of the BiometricPrompt#authenticate() method variants is called.
5134 *
5135 * Logged from:
5136 *   frameworks/base/services/core/java/com/android/server/biometrics
5137 *
5138 */
5139 message AuthPromptAuthenticateInvoked {
5140    // Whether an explicit CryptoObject was passed to the biometric prompt.
5141    optional bool is_crypto = 1;
5142    // The value passed to setConfirmationRequired(boolean), or true if not set.
5143    optional bool is_confirmation_required = 2;
5144    // The value passed to setDeviceCredentialAllowed(boolean), or false if not set.
5145    optional bool is_credential_allowed = 3;
5146    // Whether a value was passed to setAllowedAuthenticators(int).
5147    optional bool is_allowed_authenticators_set = 4;
5148    // The value passed to setAllowedAuthenticators(int), if any.
5149    optional int32 allowed_authenticators = 5;
5150}
5151
5152/*
5153 * Logs when one of the BiometricPrompt#canAuthenticate() method variants is called.
5154 *
5155 * Logged from:
5156 *   frameworks/base/services/core/java/com/android/server/biometrics
5157 *
5158 */
5159message AuthManagerCanAuthenticateInvoked {
5160    // Whether a bit field of allowed authenticator types was provided as an argument.
5161    optional bool is_allowed_authenticators_set = 1;
5162    // The bit field of allowed authenticator types provided, if any.
5163    optional int32 allowed_authenticators = 2;
5164    // The authentication status code that was returned.
5165    optional int32 result_code = 3;
5166}
5167
5168/*
5169 * Logs when Biometric enrollment is requested via the ACTION_BIOMETRIC_ENROLL intent action.
5170 *
5171 * Logged from:
5172 *   frameworks/base/services/core/java/com/android/server/biometrics
5173 *
5174 */
5175message AuthEnrollActionInvoked {
5176    // Whether a Class 3 (strong) biometric was previously enrolled on this device.
5177    optional bool is_strong_biometric_enrolled = 1;
5178    // Whether a Class 2 (weak) biometric was previously enrolled on this device.
5179    optional bool is_weak_biometric_enrolled = 2;
5180    // Whether a PIN/pattern/password was previously enrolled on this device.
5181    optional bool is_device_credential_enrolled = 3;
5182    // Whether a bit field of allowed authenticator types was provided as an extra.
5183    optional bool is_allowed_authenticators_set = 4;
5184    // The bit field of allowed authenticator types provided, if any.
5185    optional int32 allowed_authenticators = 5;
5186}
5187
5188/*
5189 * Logs when an application uses a deprecated biometric or authentication API feature.
5190 *
5191 * Logged from:
5192 *   frameworks/base/services/core/java/com/android/server/biometrics
5193 */
5194 message AuthDeprecatedAPIUsed {
5195    enum APIEnum {
5196        API_UNKNOWN = 0;
5197        // android.hardware.fingerprint.FingerprintManager#authenticate(CryptoObject,
5198        // CancellationSignal, int, AuthenticationCallback, Handler)
5199        API_FINGERPRINT_MANAGER_AUTHENTICATE = 1;
5200        // android.hardware.fingerprint.FingerprintManager#hasEnrolledFingerprints()
5201        API_FINGERPRINT_MANAGER_HAS_ENROLLED_FINGERPRINTS = 2;
5202        // android.hardware.fingerprint.FingerprintManager#isHardwareDetected()
5203        API_FINGERPRINT_MANAGER_IS_HARDWARE_DETECTED = 3;
5204        // android.hardware.biometrics.BiometricManager#canAuthenticate()
5205        API_BIOMETRIC_MANAGER_CAN_AUTHENTICATE = 4;
5206    }
5207
5208     // The deprecated API feature that was used.
5209     optional APIEnum deprecated_api = 1;
5210     // The UID of the application that used the deprecated API.
5211     optional int32 app_uid = 2;
5212     // The target SDK version (API level) of the application that used the deprecated API.
5213     optional int32 target_sdk = 3;
5214 }
5215
5216/*
5217 * Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
5218 */
5219message FlagFlipUpdateOccurred {
5220    // If the event is from a flag config package, specify the package name.
5221    optional string flag_flip_package_name = 1;
5222
5223    // The order id of the package
5224    optional int64 order_id = 2;
5225}
5226
5227/**
5228 * Potential experiment ids that goes with a train install.
5229 * Should be kept in sync with experiment_ids.proto.
5230 */
5231message TrainExperimentIds {
5232    repeated int64 experiment_id = 1;
5233}
5234
5235/*
5236 * Logs when a binary push state changes.
5237 * Logged by the installer via public api.
5238 */
5239message BinaryPushStateChanged {
5240    // Name of the train.
5241    optional string train_name = 1;
5242    // Version code for a "train" of packages that need to be installed atomically
5243    optional int64 train_version_code = 2;
5244    // After installation of this package, device requires a restart.
5245    optional bool requires_staging = 3;
5246    // Rollback should be enabled for this install.
5247    optional bool rollback_enabled = 4;
5248    // Requires low latency monitoring if possible.
5249    optional bool requires_low_latency_monitor = 5;
5250
5251    enum State {
5252        UNKNOWN = 0;
5253        INSTALL_REQUESTED = 1;
5254        INSTALL_STARTED = 2;
5255        INSTALL_STAGED_NOT_READY = 3;
5256        INSTALL_STAGED_READY = 4;
5257        INSTALL_SUCCESS = 5;
5258        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
5259        // and INSTALL_FAILURE_COMMIT.
5260        INSTALL_FAILURE = 6  [deprecated = true];
5261        // This enum is for installs that are manually cancelled via the Manual Update UI.
5262        INSTALL_CANCELLED = 7;
5263        INSTALLER_ROLLBACK_REQUESTED = 8;
5264        INSTALLER_ROLLBACK_INITIATED = 9;
5265        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
5266        INSTALLER_ROLLBACK_STAGED = 11;
5267        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
5268        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
5269        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
5270        INSTALLER_ROLLBACK_SUCCESS = 15;
5271        INSTALLER_ROLLBACK_FAILURE = 16;
5272        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
5273        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
5274        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
5275        INSTALL_STAGED_CANCEL_REQUESTED = 20;
5276        INSTALL_STAGED_CANCEL_SUCCESS = 21;
5277        INSTALL_STAGED_CANCEL_FAILURE = 22;
5278        INSTALL_FAILURE_DOWNLOAD = 23;
5279        INSTALL_FAILURE_STATE_MISMATCH = 24;
5280        INSTALL_FAILURE_COMMIT = 25;
5281        REBOOT_TRIGGERED = 26;
5282        // Logged after INSTALL_REQUESTED for devices installing a train that
5283        // contains no module requiring reboot.
5284        REBOOT_NOT_REQUIRED = 27;
5285        // Logged after INSTALL_REQUESTED for devices that are installing a train
5286        // which requires reboot and eligible for soft restart.
5287        SOFT_RESTART_ELIGIBLE = 28;
5288        // Logged after INSTALL_REQUESTED for devices that are installing a train
5289        // which requires reboot and eligible for notification restart.
5290        NOTIFICATION_RESTART_ELIGIBLE = 29;
5291        // Logged after INSTALL_REQUESTED for devices that are installing a train
5292        // which requires reboot and not eligible for any reboot promotion strategy
5293        // (e.g. soft restart, notification restart).
5294        NO_REBOOT_PROMOTION_STRATEGY_ELIGIBLE = 30;
5295        REBOOT_TRIGGER_FAILURE = 31;
5296    }
5297    optional State state = 6;
5298    // Possible experiment ids for monitoring this push.
5299    optional TrainExperimentIds experiment_ids = 7 [(log_mode) = MODE_BYTES];
5300    // user id
5301    optional int32 user_id = 8;
5302    optional int32 reason = 9;
5303    // Whether or not this is a rollback event
5304    optional bool is_rollback = 10;
5305}
5306
5307/* Test atom, is not logged anywhere */
5308message TestAtomReported {
5309    repeated AttributionNode attribution_node = 1;
5310    optional int32 int_field = 2;
5311    optional int64 long_field = 3;
5312    optional float float_field = 4;
5313    optional string string_field = 5;
5314    optional bool boolean_field = 6;
5315    enum State {
5316        UNKNOWN = 0;
5317        OFF = 1;
5318        ON = 2;
5319    }
5320    optional State state = 7;
5321    optional TrainExperimentIds bytes_field = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
5322}
5323
5324/** Represents USB port overheat event. */
5325message UsbPortOverheatEvent {
5326    /* Temperature of USB port at USB plug event, in 1/10ths of degree C. */
5327    optional int32 plug_temperature_deci_c = 1;
5328
5329    /* Maximum temperature of USB port during overheat event, in 1/10ths of degree C. */
5330    optional int32 max_temperature_deci_c = 2;
5331
5332    /* Time between USB plug event and overheat threshold trip, in seconds. */
5333    optional int32 time_to_overheat_secs = 3;
5334
5335    /* Time between overheat threshold trip and hysteresis, in seconds. */
5336    optional int32 time_to_hysteresis_secs = 4;
5337
5338    /* Time between hysteresis and active mitigation ending, in seconds. */
5339    optional int32 time_to_inactive_secs = 5;
5340};
5341
5342/**
5343 * Logs total effective full charge and discharge cycles on a battery.
5344 * Here are some examples of one effective cycle:
5345 *   1) the battery charges from 0% to 100% and drains back to 0%,
5346 *   2) charging from 50% to 100% and draining back to 50% twice.
5347 * Pulled from:
5348 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
5349 */
5350message BatteryCycleCount {
5351    /* Number of total charge and discharge cycles on the system battery. */
5352    optional int32 cycle_count = 1;
5353}
5354
5355/**
5356 * Logs that external storage is mounted and information about it, the storage type (sd card/usb/
5357 * others), its type (public or private) and the size in bytes.
5358 * Pulled from:
5359 *   StatsCompanionService
5360 */
5361
5362message ExternalStorageInfo {
5363
5364    enum VolumeType {
5365        UNKNOWN = 0;
5366        PUBLIC = 1;
5367        PRIVATE = 2;
5368        OTHER = 3;
5369    }
5370
5371    // The type of external storage.
5372    optional android.stats.storage.ExternalStorageType storage_type = 1;
5373    // Type of the volume: TYPE_PUBLIC if portable and TYPE_PRIVATE if internal.
5374    optional VolumeType volume_type = 2;
5375    // Total size of the sd card in bytes.
5376    optional int64 size_bytes = 3;
5377}
5378
5379/*
5380 * Logs when a connection becomes available and lost.
5381 * Logged in StatsCompanionService.java
5382 */
5383message ConnectivityStateChanged {
5384  // Id of the network.
5385  optional int32 net_id = 1;
5386
5387  enum State {
5388    UNKNOWN = 0;
5389    CONNECTED = 1;
5390    DISCONNECTED = 2;
5391  }
5392  // Connected state of a network.
5393  optional State state = 2;
5394}
5395
5396/**
5397 * Logs when a service starts and stops.
5398 * Logged from:
5399 *   services/core/java/com/android/server/am/ActiveServices.java
5400 */
5401message ServiceStateChanged {
5402
5403    optional int32 uid = 1 [(is_uid) = true];
5404
5405    optional string package_name = 2;
5406
5407    optional string service_name = 3;
5408
5409    enum State {
5410        START = 1;
5411        STOP = 2;
5412    }
5413
5414    optional State state = 4;
5415}
5416
5417/**
5418 * Logs when a service is launched.
5419 * Logged from:
5420 *   services/core/java/com/android/server/am/ActiveServices.java
5421 */
5422message ServiceLaunchReported {
5423
5424    optional int32 uid = 1 [(is_uid) = true];
5425
5426    optional string package_name = 2;
5427
5428    optional string service_name = 3;
5429}
5430
5431/**
5432 * Logs when a hidden API is used.
5433 *
5434 * Logged from:
5435 *     libcore/libart/src/main/java/dalvik/system/VMRuntime.java
5436 */
5437message HiddenApiUsed {
5438    // The uid of the app making the hidden access.
5439    optional int32 uid = 1 [(is_uid) = true];
5440
5441    // Signature of the method or field accessed.
5442    optional string signature = 2;
5443
5444    enum AccessMethod {
5445        NONE = 0;
5446        REFLECTION = 1;
5447        JNI = 2;
5448        LINKING = 3;
5449    }
5450
5451    // Type of access.
5452    optional AccessMethod access_method = 3;
5453
5454    // Whether the access was prevented or not.
5455    optional bool access_denied = 4;
5456}
5457
5458/**
5459 * Logs user interaction with the Privacy Indicators added in Q. In particular:
5460 * - When user sees privacy chip
5461 * - When user clicks privacy chip
5462 * - How does the user exit the Privacy Dialog
5463 * Logged from:
5464 *   packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
5465 */
5466message PrivacyIndicatorsInteracted {
5467
5468    enum Type {
5469        UNKNOWN = 0;
5470        CHIP_VIEWED = 1;
5471        CHIP_CLICKED = 2;
5472        reserved 3; // Used only in beta builds, never shipped
5473        DIALOG_DISMISS = 4;
5474        DIALOG_LINE_ITEM = 5;
5475    }
5476
5477    optional Type type = 1 [(state_field_option).exclusive_state = true];
5478}
5479
5480/**
5481 * Logs information about a package that is moved from the internal to external storage and vice
5482 * versa.
5483 * It logs the package name, the type of the external storage where the package is installed
5484 * (if moved to external storage, or UNKNOWN if moved to internal storage),
5485 * and the move type: if it's from internal to external or the other way around.
5486 *
5487 * Logged from:
5488        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
5489 */
5490message AppMovedStorageReported {
5491    enum MoveType {
5492        UNKNOWN = 0;
5493        TO_EXTERNAL = 1;
5494        TO_INTERNAL = 2;
5495    }
5496    // The type of the external storage.
5497    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
5498    // The type of move.
5499    optional MoveType move_type = 2;
5500    // The name of the package that was moved.
5501    optional string package_name = 3;
5502}
5503
5504/**
5505 * Logs when system server watchdog occurs.
5506 * Logged from:
5507 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
5508 */
5509message SystemServerWatchdogOccurred {
5510    optional string subject = 1;
5511}
5512
5513/**
5514 * Logs when new file added to tombstones.
5515 * Logged from:
5516 *      frameworks/base/core/java/com/android/server/BootReceiver.java
5517 */
5518message TombStoneOccurred {
5519}
5520
5521/*
5522 * Information about a role request
5523 *
5524 * Logged from:
5525 *   packages/apps/PermissionController/src/com/android/packageinstaller/role/ui/RequestRoleFragment.java
5526 */
5527message RoleRequestResultReported {
5528    // UID of application requesting the role
5529    optional int32 requesting_uid = 1;
5530
5531    // Package name of application requesting the role
5532    optional string requesting_package_name = 2;
5533
5534    // The role to be granted
5535    optional string role_name = 3;
5536
5537    // The count of applications qualifying for the role
5538    optional int32 qualifying_count = 4;
5539
5540    // UID of application current granted the role
5541    optional int32 current_uid = 5;
5542
5543    // Package name of application current granted the role
5544    optional string current_package_name = 6;
5545
5546    // UID of another application that user chose to grant the role to, instead of the requesting
5547    // application
5548    optional int32 granted_another_uid = 7;
5549
5550    // Package name of another application that user chose to grant the role to, instead of the
5551    // requesting application
5552    optional string granted_another_package_name = 8;
5553
5554    enum Result {
5555        UNDEFINED = 0;
5556        // role request was ignored
5557        IGNORED = 1;
5558        // role request was ignored because it's already granted
5559        IGNORED_ALREADY_GRANTED = 2;
5560        // role request was ignored because the application isn't qualified
5561        IGNORED_NOT_QUALIFIED = 3;
5562        // role request was ignored because user said it should be always denied
5563        IGNORED_USER_ALWAYS_DENIED = 4;
5564        // role was granted by user action
5565        USER_GRANTED = 5;
5566        // role was denied by user action
5567        USER_DENIED = 6;
5568        // role was denied by user granting another application the role
5569        USER_DENIED_GRANTED_ANOTHER = 7;
5570        // role was denied and set to be always denied by the user
5571        USER_DENIED_WITH_ALWAYS = 8;
5572    }
5573    // The result of the role request
5574    optional Result result = 9;
5575}
5576
5577/**
5578 * Logs when a Vehicle Maps Service client's connection state has changed
5579 *
5580 * Logged from:
5581 *   packages/services/Car/service/src/com/android/car/stats/VmsClientLog.java
5582 */
5583message VmsClientConnectionStateChanged {
5584    // The UID of the VMS client app
5585    optional int32 uid = 1 [(is_uid) = true];
5586
5587    enum State {
5588        UNKNOWN = 0;
5589        // Attempting to connect to the client
5590        CONNECTING = 1;
5591        // Client connection established
5592        CONNECTED = 2;
5593        // Client connection closed unexpectedly
5594        DISCONNECTED = 3;
5595        // Client connection closed by VMS
5596        TERMINATED = 4;
5597        // Error establishing the client connection
5598        CONNECTION_ERROR = 5;
5599    }
5600
5601    optional State state  = 2;
5602}
5603
5604message MimeTypes {
5605    repeated string mime_types = 1;
5606}
5607
5608/**
5609 * Logs statistics regarding accesses to external storage.
5610 * All stats are normalized for one day period.
5611 *
5612 * Logged from:
5613 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
5614 */
5615message GeneralExternalStorageAccessStats {
5616    optional int32 uid = 1 [(is_uid) = true];
5617    // Total number of accesses like creation, open, delete and rename/update.
5618    // Includes file path and ContentResolver accesses
5619    optional uint32 total_accesses = 2;
5620    // Number of file path accesses, as opposed to file path and ContentResolver.
5621    optional uint32 file_path_accesses = 3;
5622    // Number of accesses on secondary volumes like SD cards.
5623    // Includes file path and ContentResolver accesses
5624    optional uint32 secondary_storage_accesses = 4;
5625    // Comma-separated list of mime types that were accessed.
5626    optional MimeTypes mime_types_accessed = 5 [(log_mode) = MODE_BYTES];
5627}
5628
5629/**
5630 * Logs when MediaProvider has successfully finished scanning a storage volume.
5631 *
5632 * Logged from:
5633 *   packages/providers/MediaProvider/src/com/android/providers/media/scan/ModernMediaScanner.java
5634 */
5635message MediaProviderScanOccurred {
5636    enum Reason {
5637        // Scan triggered due to unknown reason
5638        UNKNOWN = 0;
5639        // Scan triggered due to storage volume being mounted
5640        MOUNTED = 1;
5641        // Scan triggered due to explicit user action or app request
5642        DEMAND = 2;
5643        // Scan triggered due to idle maintenance
5644        IDLE = 3;
5645    }
5646
5647    // Volume type that this event pertains to
5648    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5649    // Reason why this scan was triggered
5650    optional Reason reason = 2;
5651    // Total number of files scanned
5652    optional int64 item_count = 3;
5653    // Duration of scan, normalized per file
5654    optional float normalized_duration_millis = 4;
5655    // Number of database inserts, normalized per file
5656    optional float normalized_insert_count = 5;
5657    // Number of database updates, normalized per file
5658    optional float normalized_update_count = 6;
5659    // Number of database deletes, normalized per file
5660    optional float normalized_delete_count = 7;
5661}
5662
5663/**
5664 * Logs when an app has asked MediaProvider to delete media belonging to the user.
5665 *
5666 * Logged from:
5667 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
5668 */
5669message MediaContentDeleted {
5670    // Volume type that this event pertains to
5671    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5672    // UID of app that requested deletion
5673    optional int32 uid = 2 [(is_uid) = true];
5674    // Number of items that were deleted
5675    optional int32 item_count = 3;
5676}
5677
5678/**
5679 * Logs when an app has asked MediaProvider to grant them access to media belonging to the user.
5680 *
5681 * Logged from:
5682 *   packages/providers/MediaProvider/src/com/android/providers/media/PermissionActivity.java
5683 */
5684message MediaProviderPermissionRequested {
5685    enum Result {
5686        UNKNOWN = 0;
5687        USER_GRANTED = 1;
5688        AUTO_GRANTED = 2;
5689        USER_DENIED = 3;
5690        USER_DENIED_WITH_PREJUDICE = 4;
5691        AUTO_DENIED = 5;
5692    }
5693
5694    // Volume type that this event pertains to
5695    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5696    // UID of app that requested permission
5697    optional int32 uid = 2 [(is_uid) = true];
5698    // Number of items that were requested
5699    optional int32 item_count = 3;
5700    // Result of this request
5701    optional Result result = 4;
5702}
5703
5704/**
5705 * Logs when MediaProvider has finished upgrading or downgrading its database schema.
5706 *
5707 * Logged from:
5708 *   packages/providers/MediaProvider/src/com/android/providers/media/DatabaseHelper.java
5709 */
5710message MediaProviderSchemaChanged {
5711    // Volume type that this event pertains to
5712    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5713    // Old database version code
5714    optional int32 version_from = 2;
5715    // New database version code
5716    optional int32 version_to = 3;
5717    // Total number of files in database
5718    optional int64 item_count = 4;
5719    // Duration of schema change, normalized per file
5720    optional float normalized_duration_millis = 5;
5721}
5722
5723/**
5724 * Logs when MediaProvider has finished an idle maintenance job.
5725 *
5726 * Logged from:
5727 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
5728 */
5729message MediaProviderIdleMaintenanceFinished {
5730    // Volume type that this event pertains to
5731    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5732
5733    // Total number of files in database
5734    optional int64 item_count = 2;
5735    // Duration of idle maintenance, normalized per file
5736    optional float normalized_duration_millis = 3;
5737    // Number of thumbnails found to be stale, normalized per file
5738    optional float normalized_stale_thumbnails = 4;
5739    // Number of items found to be expired, normalized per file
5740    optional float normalized_expired_media = 5;
5741}
5742
5743/**
5744 * Represents boot time event with duration in ms.
5745 *
5746 * Logged from: bootstat and various system server components. Check each enums for details.
5747 */
5748message BootTimeEventDuration {
5749    enum DurationEvent {
5750        UNKNOWN = 0;
5751        // Bootloader time excluding BOOTLOADER_UI_WAIT + boot complete time. Logged from bootstat.
5752        ABSOLUTE_BOOT_TIME = 1;
5753        // Bootloader's 1st stage execution time.
5754        // Logged from bootstat.
5755        BOOTLOADER_FIRST_STAGE_EXEC = 2;
5756        // Bootloader's 1st stage loading time.
5757        // Logged from bootstat.
5758        BOOTLOADER_FIRST_STAGE_LOAD = 3;
5759        // Bootloader's kernel loading time.
5760        // Logged from bootstat.
5761        BOOTLOADER_KERNEL_LOAD = 4;
5762        // Bootloader's 2nd stage execution time.
5763        // Logged from bootstat.
5764        BOOTLOADER_SECOND_STAGE_EXEC = 5;
5765        // Bootloader's 2nd stage loading time.
5766        // Logged from bootstat.
5767        BOOTLOADER_SECOND_STAGE_LOAD = 6;
5768        // Duration for Bootloader to show unlocked device's warning UI. This should not happen
5769        // for locked device.
5770        // Logged from bootstat.
5771        BOOTLOADER_UI_WAIT = 7;
5772        // Total time spend in bootloader. This is the sum of all BOOTLOADER_* listed above.
5773        // Logged from bootstat.
5774        BOOTLOADER_TOTAL = 8;
5775        // Shutdown duration inside init for the reboot before the current boot up.
5776        // Logged from f/b/services/.../BootReceiver.java.
5777        SHUTDOWN_DURATION = 9;
5778        // Total time for mounting of disk devices during bootup.
5779        // Logged from f/b/services/.../BootReceiver.java.
5780        MOUNT_DEFAULT_DURATION = 10;
5781        // Total time for early stage mounting of disk devices during bootup.
5782        // Logged from f/b/services/.../BootReceiver.java.
5783        MOUNT_EARLY_DURATION = 11;
5784        // Total time for late stage mounting of disk devices during bootup.
5785        // Logged from f/b/services/.../BootReceiver.java.
5786        MOUNT_LATE_DURATION = 12;
5787        // Average time to scan non-system app after OTA
5788        // Logged from f/b/services/.../PackageManagerService.java
5789        OTA_PACKAGE_MANAGER_INIT_TIME = 13;
5790        // Time to initialize Package manager after OTA
5791        // Logged from f/b/services/.../PackageManagerService.java
5792        OTA_PACKAGE_MANAGER_DATA_APP_AVG_SCAN_TIME = 14;
5793        // Time to scan all system app from Package manager after OTA
5794        // Logged from f/b/services/.../PackageManagerService.java
5795        OTA_PACKAGE_MANAGER_SYSTEM_APP_AVG_SCAN_TIME = 15;
5796        // Init's total time for cold boot stage.
5797        // Logged from bootstat.
5798        COLDBOOT_WAIT = 16;
5799        // Init's total time for initializing selinux.
5800        // Logged from bootstat.
5801        SELINUX_INIT = 17;
5802        // Time since last factory reset.
5803        // Logged from bootstat.
5804        FACTORY_RESET_TIME_SINCE_RESET = 18;
5805        // Init's total time spent for completing the 1st stage.
5806        // Logged from bootstat.
5807        ANDROID_INIT_STAGE_1 = 19;
5808    }
5809
5810    // Type of the event.
5811    optional DurationEvent event = 1;
5812    // Duration of the event in ms.
5813    optional int64 duration_millis = 2;
5814}
5815
5816/**
5817 * Represents the start of specific boot time event during bootup in ms. This is usually a time
5818 * since boot-up.
5819 *
5820 * Logged from: bootstat and various system server components. Check each enums for details.
5821 */
5822message BootTimeEventElapsedTime {
5823    enum ElapsedTimeEvent {
5824        UNKNOWN = 0;
5825        // Time when init starts 1st stage. Logged from bootstat.
5826        ANDROID_INIT_STAGE_1 = 1;
5827        // Time when sys.boot_completed prop is set.
5828        // Logged from bootstat.
5829        BOOT_COMPLETE = 2;
5830        // BOOT_COMPLETE for encrypted device.
5831        BOOT_COMPLETE_ENCRYPTION = 3;
5832        // BOOT_COMPLETE for device with no encryption.
5833        BOOT_COMPLETE_NO_ENCRYPTION = 4;
5834        // Adjusted BOOT_COMPLETE for encrypted device extracting decryption time.
5835        BOOT_COMPLETE_POST_DECRYPT = 5;
5836        // BOOT_COMPLETE after factory reset.
5837        FACTORY_RESET_BOOT_COMPLETE = 6;
5838        // BOOT_COMPLETE_NO_ENCRYPTION after factory reset.
5839        FACTORY_RESET_BOOT_COMPLETE_NO_ENCRYPTION = 7;
5840        // BOOT_COMPLETE_POST_DECRYPT after factory reset.
5841        FACTORY_RESET_BOOT_COMPLETE_POST_DECRYPT = 8;
5842        // BOOT_COMPLETE after OTA.
5843        OTA_BOOT_COMPLETE = 9;
5844        // BOOT_COMPLETE_NO_ENCRYPTION after OTA.
5845        OTA_BOOT_COMPLETE_NO_ENCRYPTION = 10;
5846        // BOOT_COMPLETE_POST_DECRYPT after OTA.
5847        OTA_BOOT_COMPLETE_POST_DECRYPT = 11;
5848        // Time when the system starts sending LOCKED_BOOT_COMPLETED broadcast.
5849        // Logged from  f/b/services/.../UserController.java
5850        FRAMEWORK_LOCKED_BOOT_COMPLETED = 12;
5851        // Time when the system starts sending BOOT_COMPLETED broadcast.
5852        // Logged from  f/b/services/.../UserController.java
5853        FRAMEWORK_BOOT_COMPLETED = 13;
5854        // Time when the package manager starts init.
5855        // Logged from f/b/services/.../SystemServer.java
5856        PACKAGE_MANAGER_INIT_START = 14;
5857        // Time when package manager is ready
5858        // Logged from f/b/services/.../SystemServer.java
5859        PACKAGE_MANAGER_INIT_READY = 15;
5860        // Represents the time when user has entered unlock credential for system with user pin.
5861        // Logged from bootstat.
5862        POST_DECRYPT = 16;
5863        // Represents the start of zygote's init.
5864        // Logged from zygote itself.
5865        ZYGOTE_INIT_START = 17;
5866        // Represents the start of secondary zygote's init.
5867        // TODO: add logging to zygote
5868        SECONDARY_ZYGOTE_INIT_START = 18;
5869        // Represents the start of system server's init.
5870        // Logged from f/b/services/.../SystemServer.java
5871        SYSTEM_SERVER_INIT_START = 19;
5872        // Represents the completion of system server's init.
5873        // Logged from f/b/services/.../SystemServer.java
5874        SYSTEM_SERVER_READY = 20;
5875        // Represents the start of launcher during boot-up.
5876        // TODO: add logging
5877        LAUNCHER_START = 21;
5878        // Represents the completion of launcher's initial rendering. User can use other apps from
5879        // launcher from this point.
5880        // TODO: add logging
5881        LAUNCHER_SHOWN = 22;
5882    }
5883
5884    // Type of the event.
5885    optional ElapsedTimeEvent event = 1;
5886    // Time since bootup for the event.
5887    // It should be acquired from SystemClock elapsedRealtime() call or equivalent.
5888    optional int64 time_millis = 2;
5889}
5890
5891/**
5892 * Boot time events with UTC time.
5893 *
5894 * Logged from: bootstat and various system server components. Check each enums for details.
5895 */
5896message BootTimeEventUtcTime {
5897    enum UtcTimeEvent {
5898        UNKNOWN = 0;
5899        // Time of the bootstat's marking of 1st boot after the last factory reset.
5900        // Logged from bootstat.
5901        FACTORY_RESET_RESET_TIME = 1;
5902        // The time when bootstat records FACTORY_RESET_* events. This is close to
5903        // BOOT_COMPLETE time for the current bootup.
5904        // Logged from bootstat.
5905        FACTORY_RESET_CURRENT_TIME = 2;
5906        // DUplicate of FACTORY_RESET_RESET_TIME added for debugging purpose.
5907        // Logged from bootstat.
5908        FACTORY_RESET_RECORD_VALUE = 3;
5909    }
5910
5911    // Type of the event.
5912    optional UtcTimeEvent event = 1;
5913    // UTC time for the event.
5914    optional int64 utc_time_secs = 2;
5915}
5916
5917/**
5918 * Boot time events representing specific error code during bootup.
5919 * Meaning of error code can be different per each event type.
5920 *
5921 * Logged from: bootstat and various system server components. Check each enums for details.
5922 */
5923message BootTimeEventErrorCode {
5924    enum ErrorCodeEvent {
5925        UNKNOWN = 0;
5926        // Linux error code for time() call to get the current UTC time.
5927        // Logged from bootstat.
5928        FACTORY_RESET_CURRENT_TIME_FAILURE = 1;
5929        // Represents UmountStat before the reboot for the current boot up. Error codes defined
5930        // as UMOUNT_STAT_* from init/reboot.cpp.
5931        // Logged from f/b/services/.../BootReceiver.java.
5932        SHUTDOWN_UMOUNT_STAT = 2;
5933        // Reprepsents fie system mounting error code of /data partition for the current boot.
5934        // Error codes defined as combination of FsStatFlags from system/core/fs_mgr/fs_mgr.cpp.
5935        // Logged from f/b/services/.../BootReceiver.java.
5936        FS_MGR_FS_STAT_DATA_PARTITION = 3;
5937    }
5938
5939    // Type of the event.
5940    optional ErrorCodeEvent event = 1;
5941    // error code defined per each event type.
5942    // For example, this can have a value of FsStatFlags.FS_STAT_FULL_MOUNT_FAILED for the event of
5943    // FS_MGR_FS_STAT.
5944    optional int32 error_code = 2;
5945}
5946
5947/**
5948 * Collects Virtual A/B statistics related to the use of dm-snapshot performed
5949 * after an OTA.
5950 *
5951 * Logged from:
5952 *  - system/update_engine/cleanup_previous_update_action.cc
5953 */
5954message SnapshotMergeReported {
5955    // Keep in sync with
5956    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
5957    enum UpdateState {
5958        // No update or merge is in progress.
5959        NONE = 0;
5960        // An update is applying; snapshots may already exist.
5961        INITIATED = 1;
5962        // An update is pending, but has not been successfully booted yet.
5963        UNVERIFIED = 2;
5964        // The kernel is merging in the background.
5965        MERGING = 3;
5966        // Post-merge cleanup steps could not be completed due to a transient
5967        // error, but the next reboot will finish any pending operations.
5968        MERGE_NEEDS_REBOOT = 4;
5969        // Merging is complete, and needs to be acknowledged.
5970        MERGE_COMPLETED = 5;
5971        // Merging failed due to an unrecoverable error.
5972        MERGE_FAILED = 6;
5973        // The update was implicitly cancelled, either by a rollback or a flash
5974        // operation via fastboot. This state can only be returned by WaitForMerge.
5975        CANCELLED = 7;
5976    };
5977
5978    // Status codes correspond to specific failure conditions in
5979    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.cpp
5980    //
5981    // Keep in sync with
5982    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
5983    enum MergeFailureCode {
5984        OK = 0;
5985        READ_STATUS = 1;
5986        GET_TABLE_INFO = 2;
5987        UNKNOWN_TABLE = 3;
5988        GET_TABLE_PARAMS = 4;
5989        ACTIVATE_NEW_TABLE = 5;
5990        ACQUIRE_LOCK = 6;
5991        LIST_SNAPSHOTS = 7;
5992        WRITE_STATUS = 8;
5993        UNKNOWN_TARGET_TYPE = 9;
5994        QUERY_SNAPSHOT_STATUS = 10;
5995        EXPECTED_MERGE_TARGET = 11;
5996        UNMERGED_SECTORS_AFTER_COMPLETION = 12;
5997        UNEXPECTED_MERGE_STATE = 13;
5998    };
5999
6000    // Status of the update after the merge attempts.
6001    optional UpdateState final_state = 1;
6002
6003    // Time to complete a merge operation in milliseconds.
6004    // A negative value corresponds to the case in which the merge operation
6005    // was interrupted and resumed (e.g. in case of a system reboot during the
6006    // merge).
6007    optional int64 duration_millis = 2;
6008
6009    // Number of reboots that occurred after issuing and before completing the
6010    // merge of all the snapshot devices.
6011    optional int32 intermediate_reboots = 3;
6012
6013    // The device has been upgraded to Virtual A/B.
6014    optional bool is_vab_retrofit = 4;
6015
6016    // Space that has been temporarily allocated in the /data partition
6017    // containing the dm-snapshot's copy-on-write data generated during a
6018    // Virtual A/B update.
6019    optional int64 cow_file_size_bytes = 5;
6020
6021    // Whether the device enables Virtual A/B compression.
6022    optional bool vab_compression_enabled = 6;
6023
6024    // Whether this update attempt uses Virtual A/B compression.
6025    optional bool vab_compression_used = 7;
6026
6027    // Total size used by COWs, including /data and the super partition.
6028    optional int64 total_cow_size_bytes = 8;
6029
6030    // Sum of the estimated COW fields in the OTA manifest.
6031    optional int64 estimated_cow_size_bytes = 9;
6032
6033    // Time from boot to sys.boot_completed, in milliseconds.
6034    optional int32 boot_complete_time_millis = 10;
6035
6036    // Time from sys.boot_completed to merge start, in milliseconds.
6037    optional int32 boot_complete_to_merge_start_time_millis = 11;
6038
6039    optional MergeFailureCode merge_failure_code = 12;
6040
6041    // Build fingerprint at the time the OTA was downloaded.
6042    optional string source_build_fingerprint = 13;
6043
6044    // Build fingerprint at the time the merge was initiated.
6045    optional string target_build_fingerprint = 14;
6046}
6047
6048/**
6049 * Event representing when BlobStoreManager.Session#commit() is called
6050 *
6051 * Logged from:
6052 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
6053 */
6054message BlobCommitted {
6055    // Uid of the Blob committer
6056    optional int32 uid = 1 [(is_uid) = true];
6057
6058    // Id of the Blob committed
6059    optional int64 blob_id = 2;
6060
6061    // Size of the Blob
6062    optional int64 size = 3;
6063
6064    enum Result {
6065        UNKNOWN = 0;
6066        // Commit Succeeded
6067        SUCCESS = 1;
6068        // Commit Failed: Error occurred during commit
6069        ERROR_DURING_COMMIT = 2;
6070        // Commit Failed: Digest of the data did not match Blob digest
6071        DIGEST_MISMATCH = 3;
6072        // Commit Failed: Allowed count limit exceeded
6073        COUNT_LIMIT_EXCEEDED = 4;
6074    }
6075    optional Result result = 4;
6076}
6077
6078/**
6079 * Event representing when BlobStoreManager#acquireLease() is called
6080 *
6081 * Logged from:
6082 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
6083 */
6084message BlobLeased{
6085    // Uid of the Blob leasee
6086    optional int32 uid = 1 [(is_uid) = true];
6087
6088    // Id of the Blob leased or 0 if the Blob does not exist
6089    optional int64 blob_id = 2;
6090
6091    // Size of the Blob or 0 if the Blob does not exist
6092    optional int64 size = 3;
6093
6094    enum Result {
6095        UNKNOWN = 0;
6096        // Lease Succeeded
6097        SUCCESS = 1;
6098        // Lease Failed: Blob does not exist
6099        BLOB_DNE = 2;
6100        // Lease Failed: Leasee does not have access to the Blob
6101        ACCESS_NOT_ALLOWED = 3;
6102        // Lease Failed: Leasee requested an invalid expiry duration
6103        LEASE_EXPIRY_INVALID = 4;
6104        // Lease Failed: Leasee has exceeded the total data lease limit
6105        DATA_SIZE_LIMIT_EXCEEDED = 5;
6106        // Leasee Failed: Allowed count limit exceeded
6107        COUNT_LIMIT_EXCEEDED = 6;
6108    }
6109    optional Result result = 4;
6110}
6111
6112/**
6113 * Event representing when BlobStoreManager#openBlob() is called
6114 *
6115 * Logged from:
6116 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
6117 */
6118message BlobOpened{
6119    // Uid of the Blob opener
6120    optional int32 uid = 1 [(is_uid) = true];
6121
6122    // Id of the Blob opened or 0 if the Blob does not exist
6123    optional int64 blob_id = 2;
6124
6125    // Size of the Blob or 0 if the Blob does not exist
6126    optional int64 size = 3;
6127
6128    enum Result {
6129        UNKNOWN = 0;
6130        // Open Succeeded
6131        SUCCESS = 1;
6132        // Open Failed: Blob does not exist
6133        BLOB_DNE = 2;
6134        // Open Failed: Opener does not have access to the Blob
6135        ACCESS_NOT_ALLOWED = 3;
6136    }
6137    optional Result result = 4;
6138}
6139
6140/**
6141 * Event to track Jank for various system interactions.
6142 *
6143 * Logged from:
6144 *  frameworks/base/core/java/com/android/internal/jank/FrameTracker.java
6145 *
6146 * Next Tag: 41
6147 */
6148message UIInteractionFrameInfoReported {
6149    enum InteractionType {
6150        UNKNOWN = 0;
6151        NOTIFICATION_SHADE_SWIPE = 1;
6152        SHADE_EXPAND_COLLAPSE_LOCK = 2;
6153        SHADE_SCROLL_FLING = 3;
6154        SHADE_ROW_EXPAND = 4;
6155        SHADE_ROW_SWIPE = 5;
6156        SHADE_QS_EXPAND_COLLAPSE = 6;
6157        SHADE_QS_SCROLL_SWIPE = 7;
6158        LAUNCHER_APP_LAUNCH_FROM_RECENTS = 8;
6159        LAUNCHER_APP_LAUNCH_FROM_ICON = 9;
6160        LAUNCHER_APP_CLOSE_TO_HOME = 10;
6161        LAUNCHER_APP_CLOSE_TO_PIP = 11;
6162        LAUNCHER_QUICK_SWITCH = 12;
6163        SHADE_HEADS_UP_APPEAR = 13;
6164        SHADE_HEADS_UP_DISAPPEAR = 14;
6165        SHADE_NOTIFICATION_ADD = 15;
6166        SHADE_NOTIFICATION_REMOVE = 16;
6167        SHADE_APP_LAUNCH = 17;
6168        LOCKSCREEN_PASSWORD_APPEAR = 18;
6169        LOCKSCREEN_PATTERN_APPEAR = 19;
6170        LOCKSCREEN_PIN_APPEAR = 20;
6171        LOCKSCREEN_PASSWORD_DISAPPEAR = 21;
6172        LOCKSCREEN_PATTERN_DISAPPEAR = 22;
6173        LOCKSCREEN_PIN_DISAPPEAR = 23;
6174        LOCKSCREEN_TRANSITION_FROM_AOD = 24;
6175        LOCKSCREEN_TRANSITION_TO_AOD = 25;
6176        LAUNCHER_OPEN_ALL_APPS = 26;
6177        LAUNCHER_ALL_APPS_SCROLL = 27;
6178        LAUNCHER_APP_LAUNCH_FROM_WIDGET = 28;
6179        SETTINGS_PAGE_SCROLL = 29;
6180        LOCKSCREEN_UNLOCK_ANIMATION = 30;
6181        SHADE_APP_LAUNCH_FROM_HISTORY_BUTTON = 31;
6182        SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER = 32;
6183        SHADE_APP_LAUNCH_FROM_QS_TILE = 33;
6184        SHADE_APP_LAUNCH_FROM_SETTINGS_BUTTON = 34;
6185        STATUS_BAR_APP_LAUNCH_FROM_CALL_CHIP = 35;
6186        PIP_TRANSITION = 36;
6187        WALLPAPER_TRANSITION = 37;
6188        USER_SWITCH = 38;
6189        SPLASHSCREEN_AVD = 39;
6190        SPLASHSCREEN_EXIT_ANIM = 40;
6191    }
6192
6193    optional InteractionType interaction_type = 1;
6194
6195    // Number of frames rendered during the interaction.
6196    optional int64 total_frames = 2;
6197
6198    // Number of frames that were skipped in rendering during the interaction.
6199    optional int64 missed_frames = 3;
6200
6201    // Number of frames that were missed in Surface Flinger during the interaction.
6202    optional int64 sf_missed_frames = 5;
6203
6204    // Number of frames that were missed in the app during the interaction.
6205    optional int64 app_missed_frames = 6;
6206
6207    // Maximum time it took to render a single frame during the interaction.
6208    optional int64 max_frame_time_nanos = 4;
6209}
6210
6211/**
6212 * Event to track various latencies in SystemUI.
6213 *
6214 * Logged from:
6215 *  frameworks/base/core/java/com/android/internal/util/LatencyTracker.java
6216 */
6217message UIActionLatencyReported {
6218    enum ActionType {
6219        UNKNOWN = 0;
6220        ACTION_EXPAND_PANEL = 1;
6221        ACTION_TOGGLE_RECENTS = 2;
6222        ACTION_FINGERPRINT_WAKE_AND_UNLOCK = 3;
6223        ACTION_CHECK_CREDENTIAL = 4;
6224        ACTION_CHECK_CREDENTIAL_UNLOCKED = 5;
6225        ACTION_TURN_ON_SCREEN = 6;
6226        ACTION_ROTATE_SCREEN = 7;
6227        ACTION_FACE_WAKE_AND_UNLOCK = 8;
6228        ACTION_START_RECENTS_ANIMATION = 9;
6229        ACTION_ROTATE_SCREEN_CAMERA_CHECK = 10;
6230        ACTION_ROTATE_SCREEN_SENSOR = 11;
6231        ACTION_LOCKSCREEN_UNLOCK = 12;
6232        ACTION_USER_SWITCH = 13;
6233    }
6234
6235    optional ActionType action = 1;
6236
6237    optional int64 latency_millis = 2;
6238}
6239
6240//////////////////////////////////////////////////////////////////////
6241// Pulled atoms below this line //
6242//////////////////////////////////////////////////////////////////////
6243
6244/**
6245 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
6246 *
6247 * Pulled from:
6248 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
6249 */
6250message WifiBytesTransfer {
6251    optional int32 uid = 1 [(is_uid) = true];
6252
6253    optional int64 rx_bytes = 2;
6254
6255    optional int64 rx_packets = 3;
6256
6257    optional int64 tx_bytes = 4;
6258
6259    optional int64 tx_packets = 5;
6260}
6261
6262/**
6263 * Pulls bytes transferred via wifi (separated by foreground and background usage).
6264 *
6265 * Pulled from:
6266 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
6267 */
6268message WifiBytesTransferByFgBg {
6269    optional int32 uid = 1 [(is_uid) = true];
6270
6271    // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
6272    optional bool is_foreground = 2;
6273
6274    optional int64 rx_bytes = 3;
6275
6276    optional int64 rx_packets = 4;
6277
6278    optional int64 tx_bytes = 5;
6279
6280    optional int64 tx_packets = 6;
6281}
6282
6283/**
6284 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
6285 *
6286 * Pulled from:
6287 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
6288 */
6289message MobileBytesTransfer {
6290    optional int32 uid = 1 [(is_uid) = true];
6291
6292    optional int64 rx_bytes = 2;
6293
6294    optional int64 rx_packets = 3;
6295
6296    optional int64 tx_bytes = 4;
6297
6298    optional int64 tx_packets = 5;
6299}
6300
6301/**
6302 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
6303 *
6304 * Pulled from:
6305 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
6306 */
6307message MobileBytesTransferByFgBg {
6308    optional int32 uid = 1 [(is_uid) = true];
6309
6310    // 1 denotes foreground and 0 denotes background. This is called Set in
6311    // NetworkStats.
6312    optional bool is_foreground = 2;
6313
6314    optional int64 rx_bytes = 3;
6315
6316    optional int64 rx_packets = 4;
6317
6318    optional int64 tx_bytes = 5;
6319
6320    optional int64 tx_packets = 6;
6321}
6322
6323/**
6324 * Used for pull network statistics via mobile|wifi networks, and sliced by interesting dimensions.
6325 * Note that the data is expected to be sliced into more dimensions in future. In other words,
6326 * the caller must not assume any row of data is one full report when filtering with a set of
6327 * matching conditions, because future data may represent with multiple rows what is currently
6328 * represented by one.
6329 * To avoid being broken by future slicing, callers must take care to aggregate rows even if they
6330 * query all the existing columns.
6331 *
6332 * Pulled from:
6333 *   StatsPullAtomService (using NetworkStatsService to get NetworkStats)
6334 */
6335message DataUsageBytesTransfer {
6336    // State of this record. Should be NetworkStats#SET_DEFAULT or NetworkStats#SET_FOREGROUND to
6337    // indicate the foreground state, or NetworkStats#SET_ALL to indicate the record is for all
6338    // states combined, not including debug states. See NetworkStats#SET_*.
6339    optional int32 state = 1;
6340
6341    optional int64 rx_bytes = 2;
6342
6343    optional int64 rx_packets = 3;
6344
6345    optional int64 tx_bytes = 4;
6346
6347    optional int64 tx_packets = 5;
6348
6349    // Radio Access Technology (RAT) type of this record, should be one of
6350    // TelephonyManager#NETWORK_TYPE_* constants, or NetworkTemplate#NETWORK_TYPE_ALL to indicate
6351    // the record is for all rat types combined.
6352    optional int32 rat_type = 6;
6353
6354    // Mcc/Mnc read from sim if the record is for a specific subscription, null indicates the
6355    // record is combined across subscriptions.
6356    optional string sim_mcc = 7;
6357    optional string sim_mnc = 8;
6358
6359    // Allows mobile virtual network operators (MVNOs) to be identified with individual IDs.
6360    // See TelephonyManager#getSimCarrierId.
6361    optional int32 carrier_id = 9;
6362
6363    // Enumeration of opportunistic states with an additional ALL state indicates the record is
6364    // combined regardless of the boolean value in its field.
6365    enum DataSubscriptionState {
6366        UNKNOWN = 0; // For server side backward compatibility.
6367        ALL = 1;
6368        OPPORTUNISTIC = 2;
6369        NOT_OPPORTUNISTIC = 3;
6370    }
6371    // Mark whether the subscription is an opportunistic data subscription, and ALL indicates the
6372    // record is combined across opportunistic data subscriptions.
6373    // See {@link SubscriptionManager#setOpportunistic}.
6374    optional DataSubscriptionState opportunistic_data_sub = 10;
6375
6376    // Indicate whether NR is connected, server side could use this with RAT type to determine if
6377    // the record is for 5G NSA (Non Stand Alone) mode, where the primary cell is still LTE and
6378    // network allocates a secondary 5G cell so telephony reports RAT = LTE along with NR state as
6379    // connected.
6380    optional bool is_nr_connected = 11;
6381}
6382
6383/**
6384 * Pulls bytes transferred via OEM managed networks. Data is split up by which
6385 * type of OEM managed network it is, what transport it went over, and if it was
6386 * in the foreground or background.
6387 *
6388 * Pulled from:
6389 *   StatsPullAtomService
6390 */
6391 message OemManagedBytesTransfer {
6392    optional int32 uid = 1 [(is_uid) = true];
6393
6394    // 1 denotes foreground and 0 denotes background. This is called Set in
6395    // NetworkStats.
6396    optional bool is_foreground = 2;
6397
6398    // Corresponds to the type of OEM managed network, see
6399    // {@link NetworkTemplate#OEM_MANAGED_ANY} and {@code NetworkIdentity#OEM_*}.
6400    optional int32 oem_managed_type = 3;
6401
6402    // Corresponds to the type of transport the bytes were transferred over, see
6403    // {@link NetworkTemplate#transportToMatchRule} and
6404    // {@code NetworkCapabilities#TRANSPORT_*}
6405    optional int32 transport_type = 4;
6406
6407    optional int64 rx_bytes = 5;
6408
6409    optional int64 rx_packets = 6;
6410
6411    optional int64 tx_bytes = 7;
6412
6413    optional int64 tx_packets = 8;
6414  }
6415
6416/**
6417 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
6418 *
6419 * Pulled from:
6420 *   StatsCompanionService
6421 */
6422message BluetoothBytesTransfer {
6423    optional int32 uid = 1 [(is_uid) = true];
6424
6425    optional int64 rx_bytes = 2;
6426
6427    optional int64 tx_bytes = 3;
6428}
6429
6430/**
6431 * Pulls the kernel wakelock durations. This atom is adapted from
6432 * android/internal/os/KernelWakelockStats.java
6433 *
6434 * Pulled from:
6435 *   StatsCompanionService using KernelWakelockReader.
6436 */
6437message KernelWakelock {
6438    optional string name = 1;
6439
6440    optional int32 count = 2;
6441
6442    optional int32 version = 3;
6443
6444    optional int64 time_micros = 4;
6445}
6446
6447/**
6448 * Pulls power state information.
6449 * Pulled from:
6450 *   frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
6451 */
6452message SubsystemSleepState {
6453    // Subsystem name
6454    optional string subsystem_name = 1;
6455    // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
6456    // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
6457    // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
6458    //    powerEntityStateName from the corresponding PowerEntityStateInfo.
6459    optional string subname = 2;
6460    // The number of times it entered, or voted for entering the sleep state
6461    optional uint64 count = 3;
6462    // The length of time spent in, or spent voting for, the sleep state
6463    optional uint64 time_millis = 4;
6464}
6465
6466/**
6467 * Pulls on-device power measurement information.
6468 * Pulled from:
6469 *   frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
6470 */
6471message OnDevicePowerMeasurement {
6472    // Name of the subsystem (to which the rail belongs).
6473    optional string subsystem_name = 1;
6474
6475    // Rail name. The rail lies within the subsystem.
6476    optional string rail_name = 2;
6477
6478    // Time (in ms since boot) at which the rail energy value was measured.
6479    // This may differ slightly from the time that statsd logs this information.
6480    optional uint64 measurement_timestamp_millis = 3;
6481
6482    // Accumulated energy used via the rail since device boot in uWs.
6483    optional uint64 energy_microwatt_secs = 4;
6484}
6485
6486/**
6487 * Pulls Cpu time per cluster per frequency.
6488 * This is tracked by the time_in_state eBPF program.
6489 */
6490message CpuTimePerClusterFreq {
6491    optional uint32 cluster = 1;
6492    optional uint32 freq_khz = 2;
6493    // Time spent at this frequency excluding sleep since tracking started.
6494    optional uint64 time_millis = 3;
6495}
6496
6497/**
6498 * Pulls Cpu Time Per Uid.
6499 * Note that isolated process uid time should be attributed to host uids.
6500 */
6501message CpuTimePerUid {
6502    optional int32 uid = 1 [(is_uid) = true];
6503    optional uint64 user_time_micros = 2;
6504    optional uint64 sys_time_micros = 3;
6505}
6506
6507/**
6508 * Pulls Cpu Cycles Per Uid Per Cluster.
6509 * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
6510 * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
6511 * because they are recycled and removed from the underlying data source. All uids are normalized
6512 * to their base uids.
6513 */
6514message CpuCyclesPerUidCluster {
6515    optional int32 uid = 1 [(is_uid) = true];
6516    optional int32 cluster = 2;
6517    // Megacycles, i.e. millions of cycles.
6518    optional int64 mcycles = 3;
6519    // Time excluding sleep since tracking started.
6520    optional int64 time_millis = 4;
6521    // Power estimate: time * average power for frequency / 1000.
6522    optional int64 power_profile_estimate = 5;
6523}
6524
6525/**
6526 * Pulls Cpu Time Per Uid per frequency.
6527 * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
6528 * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
6529 * because they are recycled and removed from the underlying data source. All uids are normalized
6530 * to their base uids.
6531 */
6532message CpuTimePerUidFreq {
6533    optional int32 uid = 1 [(is_uid) = true];
6534    optional uint32 freq_index = 2;
6535    optional uint64 time_millis = 3;
6536}
6537
6538/**
6539  * Pulls Cpu Cycles Per ThreadGroup Per Cluster.
6540  * This is tracked by the time_in_state eBPF program.
6541  */
6542message CpuCyclesPerThreadGroupCluster {
6543    enum ThreadGroup {
6544        UNKNOWN_THREAD_GROUP = 0;
6545
6546        // System server threads serving Binder calls.
6547        SYSTEM_SERVER_BINDER = 1;
6548
6549        // All system server threads.
6550        SYSTEM_SERVER = 2;
6551
6552        // All surface flinger threads.
6553        SURFACE_FLINGER = 3;
6554    }
6555    optional ThreadGroup thread_group = 1;
6556
6557    optional int32 cluster = 2;
6558
6559    // Megacycles, i.e. millions of cycles.
6560    optional int64 mcycles = 3;
6561    // Time excluding sleep since tracking started.
6562    optional int64 time_millis = 4;
6563}
6564
6565/**
6566 * Pulls Wifi Controller Activity Energy Info
6567 */
6568message WifiActivityInfo {
6569    // timestamp(wall clock) of record creation
6570    optional uint64 timestamp_millis = 1;
6571    // stack reported state
6572    // TODO: replace this with proto enum
6573    optional int32 stack_state = 2;
6574    // tx time in millis
6575    optional uint64 controller_tx_time_millis = 3;
6576    // rx time in millis
6577    optional uint64 controller_rx_time_millis = 4;
6578    // idle time in millis
6579    optional uint64 controller_idle_time_millis = 5;
6580    // product of current(mA), voltage(V) and time(ms)
6581    optional uint64 controller_energy_used = 6;
6582}
6583
6584/**
6585 * Pulls Modem Activity Energy Info
6586 */
6587message ModemActivityInfo {
6588    // timestamp(wall clock) of record creation
6589    optional uint64 timestamp_millis = 1;
6590    // sleep time in millis.
6591    optional uint64 sleep_time_millis = 2;
6592    // idle time in millis
6593    optional uint64 controller_idle_time_millis = 3;
6594    /**
6595     * Tx power index
6596     * index 0 = tx_power < 0dBm
6597     * index 1 = 0dBm < tx_power < 5dBm
6598     * index 2 = 5dBm < tx_power < 15dBm
6599     * index 3 = 15dBm < tx_power < 20dBm
6600     * index 4 = tx_power > 20dBm
6601     */
6602    // tx time in ms at power level 0
6603    optional uint64 controller_tx_time_pl0_millis = 4;
6604    // tx time in ms at power level 1
6605    optional uint64 controller_tx_time_pl1_millis = 5;
6606    // tx time in ms at power level 2
6607    optional uint64 controller_tx_time_pl2_millis = 6;
6608    // tx time in ms at power level 3
6609    optional uint64 controller_tx_time_pl3_millis = 7;
6610    // tx time in ms at power level 4
6611    optional uint64 controller_tx_time_pl4_millis = 8;
6612    // rx time in ms at power level 5
6613    optional uint64 controller_rx_time_millis = 9;
6614    // product of current(mA), voltage(V) and time(ms)
6615    optional uint64 energy_used = 10 [deprecated=true];
6616}
6617
6618/**
6619 * Pulls Bluetooth Activity Energy Info
6620 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
6621 */
6622message BluetoothActivityInfo {
6623    // timestamp(wall clock) of record creation
6624    optional uint64 timestamp_millis = 1;
6625    // bluetooth stack state
6626    optional int32 bluetooth_stack_state = 2;
6627    // tx time in millis
6628    optional uint64 controller_tx_time_millis = 3;
6629    // rx time in millis
6630    optional uint64 controller_rx_time_millis = 4;
6631    // idle time in millis
6632    optional uint64 controller_idle_time_millis = 5;
6633    // product of current(mA), voltage(V) and time(ms)
6634    optional uint64 energy_used = 6;
6635}
6636
6637/*
6638 * Logs the memory stats for a process.
6639 *
6640 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
6641 */
6642message ProcessMemoryState {
6643    // The uid if available. -1 means not available.
6644    optional int32 uid = 1 [(is_uid) = true];
6645
6646    // The process name.
6647    // Usually package name, "system" for system server.
6648    // Provided by ActivityManagerService.
6649    optional string process_name = 2;
6650
6651    // Current OOM score adjustment. Value read from ProcessRecord.
6652    optional int32 oom_adj_score = 3;
6653
6654    // # of page-faults
6655    optional int64 page_fault = 4;
6656
6657    // # of major page-faults
6658    optional int64 page_major_fault = 5;
6659
6660    // RSS
6661    // Value is read from memory.stat, field total_rss if per-app memory
6662    // cgroups are enabled. Otherwise, value from /proc/pid/stat.
6663    optional int64 rss_in_bytes = 6;
6664
6665    // CACHE
6666    // Value is read from memory.stat, field total_cache if per-app memory
6667    // cgroups are enabled. Otherwise, 0.
6668    optional int64 cache_in_bytes = 7;
6669
6670    // SWAP
6671    // Value is read from memory.stat, field total_swap if per-app memory
6672    // cgroups are enabled. Otherwise, 0.
6673    optional int64 swap_in_bytes = 8;
6674
6675    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always -1.
6676    optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
6677
6678    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
6679    optional int64 start_time_nanos = 10 [deprecated = true];
6680
6681    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
6682    optional int32 anon_rss_and_swap_in_kilobytes = 11 [deprecated = true];
6683}
6684
6685/*
6686 * Logs the memory high-water mark for a process.
6687 *
6688 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
6689 * and for selected native processes.
6690 *
6691 * Pulling this atom resets high-water mark counters for all processes.
6692 */
6693message ProcessMemoryHighWaterMark {
6694    // The uid if available. -1 means not available.
6695    optional int32 uid = 1 [(is_uid) = true];
6696
6697    // The process name.
6698    // Usually package name or process cmdline.
6699    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
6700    optional string process_name = 2;
6701
6702    // Deprecated: use rss_high_water_mark_in_kilobytes instead. This field is
6703    // computed by converting kilobytes to bytes.
6704    optional int64 rss_high_water_mark_in_bytes = 3 [deprecated = true];
6705
6706    // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
6707    // /proc/PID/status.
6708    optional int32 rss_high_water_mark_in_kilobytes = 4;
6709}
6710
6711/*
6712 * Logs the memory stats for a process.
6713 *
6714 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService)
6715 * and for selected native processes.
6716 */
6717message ProcessMemorySnapshot {
6718    // The uid if available. -1 means not available.
6719    optional int32 uid = 1 [(is_uid) = true];
6720
6721    // The process name.
6722    // Usually package name or process cmdline.
6723    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
6724    optional string process_name = 2;
6725
6726    // The pid of the process.
6727    // Allows to disambiguate instances of the process.
6728    optional int32 pid = 3;
6729
6730    // The current OOM score adjustment value.
6731    // Read from ProcessRecord for managed processes.
6732    // Placeholder -1001 (OOM_SCORE_ADJ_MIN - 1, outside of allowed range) for native ones.
6733    optional int32 oom_score_adj = 4;
6734
6735    // The current RSS of the process.
6736    // VmRSS from /proc/pid/status.
6737    optional int32 rss_in_kilobytes = 5;
6738
6739    // The current anon RSS of the process.
6740    // RssAnon from /proc/pid/status.
6741    optional int32 anon_rss_in_kilobytes = 6;
6742
6743    // The current swap size of the process.
6744    // VmSwap from /proc/pid/status.
6745    optional int32 swap_in_kilobytes = 7;
6746
6747    // The sum of rss_in_kilobytes and swap_in_kilobytes.
6748    optional int32 anon_rss_and_swap_in_kilobytes = 8;
6749}
6750
6751/*
6752 * Elapsed real time from SystemClock.
6753 */
6754message SystemElapsedRealtime {
6755    optional uint64 time_millis = 1;
6756}
6757
6758/*
6759 * Up time from SystemClock.
6760 */
6761message SystemUptime {
6762    // Milliseconds since the system was booted.
6763    // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
6764    // for external input).
6765    // It is not affected by clock scaling, idle, or other power saving mechanisms.
6766    optional uint64 uptime_millis = 1;
6767}
6768
6769/*
6770 * Reads from /proc/uid_concurrent_active_time which has the format:
6771 * active: X (X is # cores)
6772 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
6773 * [uid1]: [time-0] [time-1] [time-2] ... ...
6774 * ...
6775 * Time-N means the CPU time a UID spent running concurrently with N other processes.
6776 * The file contains a monotonically increasing count of time for a single boot.
6777 */
6778message CpuActiveTime {
6779    optional int32 uid = 1 [(is_uid) = true];
6780    optional uint64 time_millis = 2;
6781}
6782
6783/**
6784 * Reads from /proc/uid_concurrent_policy_time which has the format:
6785 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
6786 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
6787 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
6788 * ...
6789 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
6790 * The file contains a monotonically increasing count of time for a single boot.
6791 */
6792message CpuClusterTime {
6793    optional int32 uid = 1 [(is_uid) = true];
6794    optional int32 cluster_index = 2;
6795    optional uint64 time_millis = 3;
6796}
6797
6798/*
6799 * Pulls free disk space, for data, system partition and temporary directory.
6800 */
6801message DiskSpace {
6802    // available bytes in data partition
6803    optional uint64 data_available_bytes = 1;
6804    // available bytes in system partition
6805    optional uint64 system_available_bytes = 2;
6806    // available bytes in download cache or temp directories
6807    optional uint64 temp_available_bytes = 3;
6808}
6809
6810/**
6811 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
6812 *
6813 * Pulled from StatsCompanionService.java
6814 */
6815message RemainingBatteryCapacity {
6816    optional int32 charge_micro_ampere_hour = 1;
6817}
6818
6819/**
6820 * Pulls battery capacity, which is the battery capacity when full in uAh.
6821 * Pulled from:
6822 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
6823 */
6824message FullBatteryCapacity {
6825    optional int32 capacity_micro_ampere_hour = 1;
6826}
6827
6828/**
6829 * Pulls battery voltage.
6830 * Pulled from:
6831 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
6832 */
6833message BatteryVoltage {
6834    // The voltage of the battery, in millivolts.
6835    optional int32 voltage_millivolt = 1;
6836}
6837
6838/**
6839 * Pulls battery level (percent full, from 0 to 100).
6840 *
6841 * Pulled from:
6842 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
6843 */
6844message BatteryLevel {
6845    // Battery level. Should be in [0, 100].
6846    optional int32 battery_level = 1;
6847}
6848
6849/**
6850 * Pulls the temperature of various parts of the device.
6851 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
6852 *
6853 * Pulled from StatsCompanionService.java
6854 */
6855message Temperature {
6856    // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
6857    optional android.os.TemperatureTypeEnum sensor_location = 1;
6858
6859    // The name of the temperature source. Eg. CPU0
6860    optional string sensor_name = 2;
6861
6862    // Temperature in tenths of a degree C.
6863    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
6864    optional int32 temperature_deci_celsius = 3;
6865
6866    // Relative severity of the throttling, see enum definition.
6867    optional android.os.ThrottlingSeverityEnum severity = 4;
6868}
6869
6870/**
6871 * Pulls the statistics of calls to Binder.
6872 *
6873 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
6874 * config on the device.
6875 *
6876 * Next tag: 15
6877 */
6878message BinderCalls {
6879    // UID of the process responsible for the binder transaction. It will be set if the process
6880    // executing the binder transaction attribute the transaction to another uid using
6881    // Binder.setThreadWorkSource().
6882    //
6883    // If not set, the value will be -1.
6884    optional int32 uid = 1 [(is_uid) = true];
6885    // UID of the process executing the binder transaction.
6886    optional int32 direct_caller_uid = 14;
6887    // Fully qualified class name of the API call.
6888    //
6889    // This is a system server class name.
6890    //
6891    // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
6892    // gets recycled and we have isolated uids, we might attribute the data incorrectly.
6893    // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
6894    // commonly used APIs.
6895    optional string service_class_name = 2;
6896    // Method name of the API call. It can also be a transaction code if we cannot
6897    // resolve it to a name. See Binder#getTransactionName.
6898    //
6899    // This is a system server method name.
6900    optional string service_method_name = 3;
6901    // Total number of API calls.
6902    optional int64 call_count = 4;
6903    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
6904    optional bool screen_interactive = 13;
6905    // Total number of API calls we have data recorded for. If we collected data for all the calls,
6906    // call_count will be equal to recorded_call_count.
6907    //
6908    // If recorded_call_count is different than call_count, it means data collection has been
6909    // sampled. All the fields below will be sampled in this case.
6910    optional int64 recorded_call_count = 12;
6911    // Number of exceptions thrown by the API.
6912    optional int64 recorded_exception_count = 5;
6913    // Total latency of all API calls.
6914    // Average can be computed using total_latency_micros / recorded_call_count.
6915    optional int64 recorded_total_latency_micros = 6;
6916    // Maximum latency of one API call.
6917    optional int64 recorded_max_latency_micros = 7;
6918    // Total CPU usage of all API calls.
6919    // Average can be computed using total_cpu_micros / recorded_call_count.
6920    // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
6921    optional int64 recorded_total_cpu_micros = 8;
6922    // Maximum CPU usage of one API call.
6923    optional int64 recorded_max_cpu_micros = 9;
6924    // Maximum parcel reply size of one API call.
6925    optional int64 recorded_max_reply_size_bytes = 10;
6926    // Maximum parcel request size of one API call.
6927    optional int64 recorded_max_request_size_bytes = 11;
6928}
6929
6930/**
6931 * Pulls the statistics of exceptions during calls to Binder.
6932 *
6933 * Binder stats are cumulative from boot unless somebody reset the data using
6934 * > adb shell dumpsys binder_calls_stats --reset
6935 */
6936message BinderCallsExceptions {
6937    // Exception class name, e.g. java.lang.IllegalArgumentException.
6938    //
6939    // This is an exception class name thrown by the system server.
6940    optional string exception_class_name = 1;
6941    // Total number of exceptions.
6942    optional int64 exception_count = 2;
6943}
6944
6945/**
6946 * Pulls the statistics of message dispatching on HandlerThreads.
6947 *
6948 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
6949 * config on the device.
6950 *
6951 * Next tag: 11
6952 */
6953message LooperStats {
6954    // The uid that made a call to the System Server and caused the message to be enqueued.
6955    optional int32 uid = 1 [(is_uid) = true];
6956
6957    // Fully qualified class name of the handler target class.
6958    //
6959    // This field does not contain PII. This is a system server class name.
6960    optional string handler_class_name = 2;
6961
6962    // The name of the thread that runs the Looper.
6963    //
6964    // This field does not contain PII. This is a system server thread name.
6965    optional string looper_thread_name = 3;
6966
6967    // The name of the dispatched message.
6968    //
6969    // This field does not contain PII. This is a system server constant or class
6970    // name.
6971    optional string message_name = 4;
6972
6973    // Total number of successfully dispatched messages.
6974    optional int64 message_count = 5;
6975
6976    // Total number of messages that failed dispatching.
6977    optional int64 exception_count = 6;
6978
6979    // Total number of processed messages we have data recorded for. If we
6980    // collected data for all the messages, message_count will be equal to
6981    // recorded_message_count.
6982    //
6983    // If recorded_message_count is different than message_count, it means data
6984    // collection has been sampled. The fields below will be sampled in this case.
6985    optional int64 recorded_message_count = 7;
6986
6987    // Total latency of all processed messages.
6988    // Average can be computed using recorded_total_latency_micros /
6989    // recorded_message_count.
6990    optional int64 recorded_total_latency_micros = 8;
6991
6992    // Total CPU usage of all processed message.
6993    // Average can be computed using recorded_total_cpu_micros /
6994    // recorded_message_count. Total can be computed using
6995    // recorded_total_cpu_micros / recorded_message_count * message_count.
6996    optional int64 recorded_total_cpu_micros = 9;
6997
6998    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
6999    optional bool screen_interactive = 10;
7000
7001    // Max recorded CPU usage of all processed messages.
7002    optional int64 recorded_max_cpu_micros = 11;
7003
7004    // Max recorded latency of all processed messages.
7005    optional int64 recorded_max_latency_micros = 12;
7006
7007    // Total number of messages we tracked the dispatching delay for. If we
7008    // collected data for all the messages, message_count will be equal to
7009    // recorded_delay_message_count.
7010    //
7011    // If recorded_delay_message_count is different than message_count, it means data
7012    // collection has been sampled or/and not all messages specified the target dispatch time.
7013    // The fields below will be sampled in this case.
7014    optional int64 recorded_delay_message_count = 13;
7015
7016    // Total dispatching delay of all processed messages.
7017    // Calculated as a difference between the target dispatching time (Message.when)
7018    // and the actual dispatching time.
7019    // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
7020    optional int64 recorded_total_delay_millis = 14;
7021
7022    // Max dispatching delay of all processed messages.
7023    // Calculated as a difference between the target dispatching time (Message.when)
7024    // and the actual dispatching time.
7025    optional int64 recorded_max_delay_millis = 15;
7026}
7027
7028/**
7029 * Pulls disk information, such as write speed and latency.
7030 */
7031message DiskStats {
7032    // Time taken to open, write 512B to, and close a file.
7033    // -1 if error performing the check.
7034    optional int64 data_write_latency_millis = 1;
7035
7036    optional bool file_based_encryption = 2;
7037
7038    // Recent disk write speed in kB/s.
7039    // -1 if error querying storageed.
7040    // 0 if data is unavailable.
7041    optional int32 recent_disk_write_speed = 3;
7042}
7043
7044
7045/**
7046 * Free and total bytes of the Data, Cache, and System partition.
7047 */
7048message DirectoryUsage {
7049    enum Directory {
7050        UNKNOWN = 0;
7051        DATA = 1;
7052        CACHE = 2;
7053        SYSTEM = 3;
7054    }
7055    optional Directory directory = 1;
7056    optional int64 free_bytes = 2;
7057    optional int64 total_bytes = 3;
7058}
7059
7060
7061/**
7062 * Size of an application: apk size, data size, and cache size.
7063 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
7064 * Information is only reported for apps with the primary user (user 0).
7065 * Sizes are aggregated by package name.
7066 */
7067message AppSize {
7068    // Including uids will involve modifying diskstats logic.
7069    optional string package_name = 1;
7070    // App size in bytes. -1 if unavailable.
7071    optional int64 app_size_bytes = 2;
7072    // App data size in bytes. -1 if unavailable.
7073    optional int64 app_data_size_bytes = 3;
7074    // App cache size in bytes. -1 if unavailable.
7075    optional int64 app_cache_size_bytes = 4;
7076    // Time that the cache file was produced.
7077    // Uses System.currentTimeMillis(), which is wall clock time.
7078    optional int64 cache_time_millis = 5;
7079}
7080
7081
7082/**
7083 * Size of a particular category. Eg: photos, videos.
7084 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
7085 */
7086message CategorySize {
7087    enum Category {
7088        UNKNOWN = 0;
7089        APP_SIZE = 1;
7090        APP_DATA_SIZE = 2;
7091        APP_CACHE_SIZE = 3;
7092        PHOTOS = 4;
7093        VIDEOS = 5;
7094        AUDIO = 6;
7095        DOWNLOADS = 7;
7096        SYSTEM = 8;
7097        OTHER = 9;
7098    }
7099    optional Category category = 1;
7100    // Category size in bytes.
7101    optional int64 size_bytes = 2;
7102    // Time that the cache file was produced.
7103    // Uses System.currentTimeMillis(), which is wall clock time.
7104    optional int64 cache_time_millis = 3;
7105}
7106
7107/**
7108 * Pulls per uid I/O stats. The stats are cumulative since boot.
7109 *
7110 * Read/write bytes are I/O events from a storage device
7111 * Read/write chars are data requested by read/write syscalls, and can be
7112 *   satisfied by caching.
7113 *
7114 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
7115 */
7116message DiskIo {
7117    optional int32 uid = 1 [(is_uid) = true];
7118    optional int64 fg_chars_read = 2;
7119    optional int64 fg_chars_write = 3;
7120    optional int64 fg_bytes_read = 4;
7121    optional int64 fg_bytes_write = 5;
7122    optional int64 bg_chars_read = 6;
7123    optional int64 bg_chars_write = 7;
7124    optional int64 bg_bytes_read = 8;
7125    optional int64 bg_bytes_write = 9;
7126    optional int64 fg_fsync = 10;
7127    optional int64 bg_fsync= 11;
7128}
7129
7130
7131/**
7132 * Pulls the number of fingerprints for each user.
7133 *
7134 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
7135 */
7136message NumFingerprintsEnrolled {
7137    // The associated user. Eg: 0 for owners, 10+ for others.
7138    // Defined in android/os/UserHandle.java
7139    optional int32 user = 1;
7140    // Number of fingerprints registered to that user.
7141    optional int32 num_fingerprints_enrolled = 2;
7142}
7143
7144/**
7145 * Pulls the number of faces for each user.
7146 *
7147 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
7148 */
7149message NumFacesEnrolled {
7150    // The associated user. Eg: 0 for owners, 10+ for others.
7151    // Defined in android/os/UserHandle.java
7152    optional int32 user = 1;
7153    // Number of faces registered to that user.
7154    optional int32 num_faces_enrolled = 2;
7155}
7156/**
7157 * A mapping of role holder -> role
7158 */
7159message RoleHolder {
7160    // uid of the role holder
7161    optional int32 uid = 1 [(is_uid) = true];
7162
7163    // package name of the role holder
7164    optional string package_name = 2;
7165
7166    // the role held
7167    optional string role = 3;
7168}
7169
7170message AggStats {
7171    // These are all in byte resolution.
7172    optional int64 min = 1 [deprecated = true];
7173    optional int64 average = 2 [deprecated = true];
7174    optional int64 max = 3 [deprecated = true];
7175
7176    // These are all in kilobyte resolution. Can fit in int32, so smaller on the wire than the above
7177    // int64 fields.
7178    optional int32 mean_kb = 4;
7179    optional int32 max_kb = 5;
7180}
7181
7182// A reduced subset of process states; reducing the number of possible states allows more
7183// aggressive device-side aggregation of statistics and hence reduces metric upload size.
7184enum ProcessStateAggregated {
7185    PROCESS_STATE_UNKNOWN = 0;
7186    // Persistent system process.
7187    PROCESS_STATE_PERSISTENT = 1;
7188    // Top activity; actually any visible activity.
7189    PROCESS_STATE_TOP = 2;
7190    // Process binding to top or a foreground service.
7191    PROCESS_STATE_BOUND_TOP_OR_FGS = 3;
7192    // Processing running a foreground service.
7193    PROCESS_STATE_FGS = 4;
7194    // Important foreground process (ime, wallpaper, etc).
7195    PROCESS_STATE_IMPORTANT_FOREGROUND = 5;
7196    // Important background process.
7197    PROCESS_STATE_BACKGROUND = 6;
7198    // Process running a receiver.
7199    PROCESS_STATE_RECEIVER = 7;
7200    // All kinds of cached processes.
7201    PROCESS_STATE_CACHED = 8;
7202}
7203
7204// Next tag: 13
7205message ProcessStatsStateProto {
7206    optional android.service.procstats.ScreenState screen_state = 1;
7207
7208    optional android.service.procstats.MemoryState memory_state = 2 [deprecated = true];
7209
7210    // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
7211    // and not frameworks/base/core/java/android/app/ActivityManager.java
7212    optional android.service.procstats.ProcessState process_state = 3 [deprecated = true];
7213
7214    optional ProcessStateAggregated process_state_aggregated = 10;
7215
7216    // Millisecond uptime duration spent in this state
7217    optional int64 duration_millis = 4 [deprecated = true];
7218    // Same as above, but with minute resolution so it fits into an int32.
7219    optional int32 duration_minutes = 11;
7220
7221    // Millisecond elapsed realtime duration spent in this state
7222    optional int64 realtime_duration_millis = 9 [deprecated = true];
7223    // Same as above, but with minute resolution so it fits into an int32.
7224    optional int32 realtime_duration_minutes = 12;
7225
7226    // # of samples taken
7227    optional int32 sample_size = 5;
7228
7229    // PSS is memory reserved for this process
7230    optional AggStats pss = 6 [deprecated = true];
7231
7232    // USS is memory shared between processes, divided evenly for accounting
7233    optional AggStats uss = 7 [deprecated = true];
7234
7235    // RSS is memory resident for this process
7236    optional AggStats rss = 8;
7237}
7238
7239// Next Tag: 8
7240message ProcessStatsProto {
7241    // Name of process.
7242    optional string process = 1;
7243
7244    // Uid of the process.
7245    optional int32 uid = 2 [(is_uid) = true];
7246
7247    // Information about how often kills occurred
7248    message Kill {
7249        // Count of excessive CPU kills
7250        optional int32 cpu = 1;
7251
7252        // Count of kills when cached
7253        optional int32 cached = 2;
7254
7255        // PSS stats during cached kill
7256        optional AggStats cached_pss = 3;
7257    }
7258    optional Kill kill = 3 [deprecated = true];
7259
7260    // Time and memory spent in various states.
7261    repeated ProcessStatsStateProto states = 5;
7262
7263    // Total time process has been running...  screen_state, memory_state, and process_state
7264    // will not be set.
7265    optional ProcessStatsStateProto total_running_state = 6;
7266
7267    // Association data for this process in this state;
7268    // each entry here is one association.
7269    repeated ProcessStatsAssociationProto assocs = 7;
7270}
7271
7272// Next Tag: 6
7273message ProcessStatsAssociationProto {
7274    // Procss Name of the associated process (client process of service binding)
7275    optional string assoc_process_name = 1;
7276
7277    // Package Name of the associated package (client package of service binding)
7278    optional string assoc_package_name = 2 [deprecated = true];
7279
7280    // UID of the associated process/package (client package of service binding)
7281    optional int32 assoc_uid = 5 [(is_uid) = true];
7282
7283    // Total count of the times this association (service binding) appeared.
7284    optional int32 total_count = 3;
7285
7286    // Uptime total duration in seconds this association (service binding) was around.
7287    optional int32 total_duration_secs = 4;
7288}
7289
7290message PackageServiceOperationStatsProto {
7291    // Operate enum: Started, Foreground, Bound, Executing
7292    optional android.service.procstats.ServiceOperationState operation = 1;
7293
7294    // Number of times the service was in this operation.
7295    optional int32 count = 2;
7296
7297    // Information about a state the service can be in.
7298    message StateStats {
7299        // Screen state enum.
7300        optional android.service.procstats.ScreenState screen_state = 1;
7301        // Memory state enum.
7302        optional android.service.procstats.MemoryState memory_state = 2;
7303
7304        // duration in milliseconds.
7305        optional int64 duration_millis = 3;
7306        // Millisecond elapsed realtime duration spent in this state
7307        optional int64 realtime_duration_millis = 4;
7308    }
7309    repeated StateStats state_stats = 3;
7310}
7311
7312message PackageServiceStatsProto {
7313    // Name of service component.
7314    optional string service_name = 1;
7315
7316    // The operation stats.
7317    // The package_name, package_uid, package_version, service_name will not be set to save space.
7318    repeated PackageServiceOperationStatsProto operation_stats = 2;
7319}
7320
7321message PackageAssociationSourceProcessStatsProto {
7322    // Uid of the process.
7323    optional int32 process_uid = 1;
7324    // Process name.
7325    optional string process_name = 2;
7326    // Package name.
7327    optional string package_name = 7;
7328    // Total count of the times this association appeared.
7329    optional int32 total_count = 3;
7330
7331    // Millisecond uptime total duration this association was around.
7332    optional int64 total_duration_millis = 4;
7333
7334    // Total count of the times this association became actively impacting its target process.
7335    optional int32 active_count = 5;
7336
7337    // Information on one source in this association.
7338    message StateStats {
7339        // Process state enum.
7340        optional android.service.procstats.ProcessState process_state = 1;
7341        // Millisecond uptime duration spent in this state
7342        optional int64 duration_millis = 2;
7343        // Millisecond elapsed realtime duration spent in this state
7344        optional int64 realtime_duration_mmillis = 3;
7345    }
7346    repeated StateStats active_state_stats = 6;
7347}
7348
7349message PackageAssociationProcessStatsProto {
7350    // Name of the target component.
7351    optional string component_name = 1;
7352    // Information on one source in this association.
7353    repeated PackageAssociationSourceProcessStatsProto sources = 2;
7354}
7355
7356
7357message ProcessStatsPackageProto {
7358    // Name of package.
7359    optional string package = 1;
7360
7361    // Uid of the package.
7362    optional int32 uid = 2;
7363
7364    // Version of the package.
7365    optional int64 version = 3;
7366
7367    // Stats for each process running with the package loaded in to it.
7368    repeated ProcessStatsProto process_stats = 4;
7369
7370    // Stats for each of the package's services.
7371    repeated PackageServiceStatsProto service_stats = 5;
7372
7373    // Stats for each association with the package.
7374    repeated PackageAssociationProcessStatsProto association_stats = 6;
7375}
7376
7377message ProcessStatsSectionProto {
7378    // Elapsed realtime at start of report.
7379    optional int64 start_realtime_millis = 1;
7380
7381    // Elapsed realtime at end of report.
7382    optional int64 end_realtime_millis = 2;
7383
7384    // CPU uptime at start of report.
7385    optional int64 start_uptime_millis = 3;
7386
7387    // CPU uptime at end of report.
7388    optional int64 end_uptime_millis = 4;
7389
7390    // System runtime library. e.g. "libdvm.so", "libart.so".
7391    optional string runtime = 5;
7392
7393    // whether kernel reports swapped pss.
7394    optional bool has_swapped_pss = 6;
7395
7396    // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
7397    enum Status {
7398        STATUS_UNKNOWN = 0;
7399        STATUS_COMPLETE = 1;
7400        STATUS_PARTIAL = 2;
7401        STATUS_SHUTDOWN = 3;
7402        STATUS_SYSPROPS = 4;
7403    }
7404    repeated Status status = 7;
7405
7406    // Number of pages available of various types and sizes, representation fragmentation.
7407    repeated ProcessStatsAvailablePagesProto available_pages = 10;
7408
7409    // Stats for each process.
7410    repeated ProcessStatsProto process_stats = 8;
7411
7412    // Stats for each package.
7413    repeated ProcessStatsPackageProto package_stats = 9;
7414}
7415
7416message ProcessStatsAvailablePagesProto {
7417    // Node these pages are in (as per /proc/pagetypeinfo)
7418    optional int32 node = 1;
7419
7420    // Zone these pages are in (as per /proc/pagetypeinfo)
7421    optional string zone = 2;
7422
7423    // Label for the type of these pages (as per /proc/pagetypeinfo)
7424    optional string label = 3;
7425
7426    // Distribution of number of pages available by order size.  First entry in array is
7427    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
7428    repeated int32 pages_per_order = 4;
7429}
7430
7431/**
7432 * Pulled from ProcessStatsService.java
7433 */
7434message ProcStats {
7435    optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
7436    // Data pulled from device into this is sometimes sharded across multiple atoms to work around
7437    // a size limit. When this happens, this shard ID will contain an increasing 1-indexed integer
7438    // with the number of this shard.
7439    optional int32 shard_id = 2;
7440}
7441
7442/**
7443 * Pulled from ProcessStatsService.java
7444 */
7445message ProcStatsPkgProc {
7446    optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
7447}
7448
7449// Next Tag: 2
7450message PackageRemoteViewInfoProto {
7451    optional string package_name = 1;
7452    // add per-package additional info here (like channels)
7453}
7454
7455// Next Tag: 2
7456message NotificationRemoteViewsProto {
7457    repeated PackageRemoteViewInfoProto package_remote_view_info = 1;
7458}
7459
7460/**
7461 * Pulled from NotificationManagerService.java
7462 */
7463message NotificationRemoteViews {
7464    optional NotificationRemoteViewsProto notification_remote_views = 1 [(log_mode) = MODE_BYTES];
7465}
7466
7467/**
7468 * Atom that contains a list of a package's preferences, pulled from NotificationManagerService.java
7469 */
7470message PackageNotificationPreferences {
7471    // Uid under which the package is installed.
7472    optional int32 uid = 1 [(is_uid) = true];
7473    // Notification importance, which specifies when and how a notification is displayed.
7474    // Specified under core/java/android/app/NotificationManager.java.
7475    optional int32 importance = 2;
7476    // Lockscreen visibility as set by the user.
7477    optional int32 visibility = 3;
7478    // Bitfield mask indicating what fields were locked by the user (see LockableAppfields in
7479    // PreferencesHelper.java)
7480    optional int32 user_locked_fields = 4;
7481}
7482
7483/**
7484 * Atom that contains a list of a package's channel preferences, pulled from
7485 * NotificationManagerService.java.
7486 */
7487message PackageNotificationChannelPreferences {
7488    // Uid under which the package is installed.
7489    optional int32 uid = 1 [(is_uid) = true];
7490    // Channel's ID. Should always be available.
7491    optional string channel_id = 2;
7492    // Channel's name. Should always be available.
7493    optional string channel_name = 3;
7494    // Channel's description. Optionally set by the channel creator.
7495    optional string description = 4;
7496    // Notification importance, which specifies when and how a notification is displayed. Specified
7497    // under core/java/android/app/NotificationManager.java.
7498    optional int32 importance = 5;
7499    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
7500    // at core/java/android/app/NotificationChannel.java
7501    optional int32 user_locked_fields = 6;
7502    // Indicates if the channel was deleted by the app.
7503    optional bool is_deleted = 7;
7504    // Indicates if the channel was marked as a conversation by the app.
7505    optional bool is_conversation = 8;
7506    // Indicates if the channel is a conversation that was demoted by the user.
7507    optional bool is_demoted_conversation = 9;
7508    // Indicates if the channel is a conversation that was marked as important by the user.
7509    optional bool is_important_conversation = 10;
7510}
7511
7512/**
7513 * Atom that represents an item in the list of Do Not Disturb rules, pulled from
7514 * NotificationManagerService.java.
7515 */
7516message DNDModeProto {
7517    enum Mode {
7518        ROOT_CONFIG = -1;  // Used to distinguish the config (one per user) from the rules.
7519        ZEN_MODE_OFF = 0;
7520        ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
7521        ZEN_MODE_NO_INTERRUPTIONS = 2;
7522        ZEN_MODE_ALARMS = 3;
7523    }
7524    optional int32 user = 1;  // Android user ID (0, 1, 10, ...)
7525    optional bool enabled = 2;  // true for ROOT_CONFIG if a manualRule is enabled
7526    optional bool channels_bypassing = 3; // only valid for ROOT_CONFIG
7527    optional Mode zen_mode = 4;
7528    // id is one of the system default rule IDs, or empty
7529    // May also be "MANUAL_RULE" to indicate app-activation of the manual rule.
7530    optional string id = 5;
7531    optional int32 uid = 6 [(is_uid) = true]; // currently only SYSTEM_UID or 0 for other
7532    optional DNDPolicyProto policy = 7 [(log_mode) = MODE_BYTES];
7533}
7534
7535/**
7536 * Atom that represents a Do Not Disturb policy, an optional detail proto for DNDModeProto.
7537 */
7538message DNDPolicyProto {
7539    enum State {
7540        STATE_UNSET = 0;
7541        STATE_ALLOW = 1;
7542        STATE_DISALLOW = 2;
7543    }
7544    optional State calls = 1;
7545    optional State repeat_callers = 2;
7546    optional State messages = 3;
7547    optional State conversations = 4;
7548    optional State reminders = 5;
7549    optional State events = 6;
7550    optional State alarms = 7;
7551    optional State media = 8;
7552    optional State system = 9;
7553    optional State fullscreen = 10;
7554    optional State lights = 11;
7555    optional State peek = 12;
7556    optional State status_bar = 13;
7557    optional State badge = 14;
7558    optional State ambient = 15;
7559    optional State notification_list = 16;
7560
7561    enum PeopleType {
7562        PEOPLE_UNSET = 0;
7563        PEOPLE_ANYONE = 1;
7564        PEOPLE_CONTACTS = 2;
7565        PEOPLE_STARRED = 3;
7566        PEOPLE_NONE = 4;
7567    }
7568
7569    optional PeopleType allow_calls_from = 17;
7570    optional PeopleType allow_messages_from = 18;
7571
7572    enum ConversationType {
7573        CONV_UNSET = 0;
7574        CONV_ANYONE = 1;
7575        CONV_IMPORTANT = 2;
7576        CONV_NONE = 3;
7577    }
7578
7579    optional ConversationType allow_conversations_from = 19;
7580}
7581
7582/**
7583 * Atom that contains a list of a package's channel group preferences, pulled from
7584 * NotificationManagerService.java.
7585 */
7586message PackageNotificationChannelGroupPreferences {
7587    // Uid under which the package is installed.
7588    optional int32 uid = 1 [(is_uid) = true];
7589    // Channel Group's ID. Should always be available.
7590    optional string group_id = 2;
7591    // Channel Group's name. Should always be available.
7592    optional string group_name = 3;
7593    // Channel Group's description. Optionally set by group creator.
7594    optional string description = 4;
7595    // Indicates if notifications from this channel group are blocked.
7596    optional bool is_blocked = 5;
7597    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
7598    // at core/java/android/app/NotificationChannelGroup.java
7599    optional int32 user_locked_fields = 6;
7600}
7601
7602message PowerProfileProto {
7603    optional double cpu_suspend = 1;
7604
7605    optional double cpu_idle = 2;
7606
7607    optional double cpu_active = 3;
7608
7609    message CpuCluster {
7610        optional int32 id = 1;
7611        optional double cluster_power = 2;
7612        optional int32 cores = 3;
7613        repeated int64 speed = 4;
7614        repeated double core_power = 5;
7615    }
7616
7617    repeated CpuCluster cpu_cluster = 40;
7618
7619    optional double wifi_scan = 4;
7620
7621    optional double wifi_on = 5;
7622
7623    optional double wifi_active = 6;
7624
7625    optional double wifi_controller_idle = 7;
7626
7627    optional double wifi_controller_rx = 8;
7628
7629    optional double wifi_controller_tx = 9;
7630
7631    repeated double wifi_controller_tx_levels = 10;
7632
7633    optional double wifi_controller_operating_voltage = 11;
7634
7635    optional double bluetooth_controller_idle = 12;
7636
7637    optional double bluetooth_controller_rx = 13;
7638
7639    optional double bluetooth_controller_tx = 14;
7640
7641    optional double bluetooth_controller_operating_voltage = 15;
7642
7643    optional double modem_controller_sleep = 16;
7644
7645    optional double modem_controller_idle = 17;
7646
7647    optional double modem_controller_rx = 18;
7648
7649    repeated double modem_controller_tx = 19;
7650
7651    optional double modem_controller_operating_voltage = 20;
7652
7653    optional double gps_on = 21;
7654
7655    repeated double gps_signal_quality_based = 22;
7656
7657    optional double gps_operating_voltage = 23;
7658
7659    optional double bluetooth_on = 24;
7660
7661    optional double bluetooth_active = 25;
7662
7663    optional double bluetooth_at_cmd = 26;
7664
7665    optional double ambient_display = 27;
7666
7667    optional double screen_on = 28;
7668
7669    optional double radio_on = 29;
7670
7671    optional double radio_scanning = 30;
7672
7673    optional double radio_active = 31;
7674
7675    optional double screen_full = 32;
7676
7677    optional double audio = 33;
7678
7679    optional double video = 34;
7680
7681    optional double flashlight = 35;
7682
7683    optional double memory = 36;
7684
7685    optional double camera = 37;
7686
7687    optional double wifi_batched_scan = 38;
7688
7689    optional double battery_capacity = 39;
7690}
7691
7692/**
7693 * power_profile.xml and other constants for power model calculations.
7694 * Pulled from PowerProfile.java
7695 */
7696message PowerProfile {
7697    optional PowerProfileProto power_profile = 1 [(log_mode) = MODE_BYTES];
7698}
7699
7700/**
7701 * Logs when a user restriction was added or removed.
7702 *
7703 * Logged from:
7704 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
7705 */
7706message UserRestrictionChanged {
7707    // The raw string of the user restriction as defined in UserManager.
7708    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
7709    optional string restriction = 1;
7710    // Whether the restriction is enabled or disabled.
7711    optional bool enabled = 2;
7712}
7713
7714/**
7715 * Pulls process user time and system time. Puller takes a snapshot of all pids
7716 * in the system and returns cpu stats for those that are working at the time.
7717 * Dead pids will be dropped. Kernel processes are excluded.
7718 * Min cool-down is 5 sec.
7719 */
7720message ProcessCpuTime {
7721    optional int32 uid = 1 [(is_uid) = true];
7722
7723    optional string process_name = 2;
7724    // Process cpu time in user space, cumulative from boot/process start
7725    optional int64 user_time_millis = 3;
7726    // Process cpu time in system space, cumulative from boot/process start
7727    optional int64 system_time_millis = 4;
7728}
7729
7730/**
7731 * Pulls the CPU usage for each thread.
7732 *
7733 * Read from /proc/$PID/task/$TID/time_in_state files.
7734 *
7735 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
7736 * time_in_state files not being present on some phones, have not been addressed. These should be
7737 * considered before a public release.
7738 */
7739message CpuTimePerThreadFreq {
7740    // UID that owns the process.
7741    optional int32 uid = 1 [(is_uid) = true];
7742    // ID of the process.
7743    optional int32 process_id = 2;
7744    // ID of the thread.
7745    optional int32 thread_id = 3;
7746    // Name of the process taken from `/proc/$PID/cmdline`.
7747    optional string process_name = 4;
7748    // Name of the thread taken from `/proc/$PID/task/$TID/comm`
7749    optional string thread_name = 5;
7750
7751    // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
7752    // are given in KHz, and time is given in milliseconds since the thread started. All eight
7753    // frequencies are given here as the alternative is sending eight separate atoms. This method
7754    // significantly reduces the amount of data created
7755    optional int32 frequency1_khz = 6;
7756    optional int32 time1_millis = 7;
7757    optional int32 frequency2_khz = 8;
7758    optional int32 time2_millis = 9;
7759    optional int32 frequency3_khz = 10;
7760    optional int32 time3_millis = 11;
7761    optional int32 frequency4_khz = 12;
7762    optional int32 time4_millis = 13;
7763    optional int32 frequency5_khz = 14;
7764    optional int32 time5_millis = 15;
7765    optional int32 frequency6_khz = 16;
7766    optional int32 time6_millis = 17;
7767    optional int32 frequency7_khz = 18;
7768    optional int32 time7_millis = 19;
7769    optional int32 frequency8_khz = 20;
7770    optional int32 time8_millis = 21;
7771}
7772
7773/**
7774 * Pulls information about the device's build.
7775 */
7776message BuildInformation {
7777    // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
7778    // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
7779    optional string fingerprint = 1;
7780
7781    // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
7782    optional string brand = 2;
7783
7784    // Build.PRODUCT. The name of the overall product.
7785    optional string product = 3;
7786
7787    // Build.DEVICE. The name of the industrial design.
7788    optional string device = 4;
7789
7790    // Build.VERSION.RELEASE. The user-visible version string.  E.g., "1.0" or "3.4b5" or "bananas".
7791    optional string version_release = 5;
7792
7793    // Build.ID. E.g. a label like "M4-rc20".
7794    optional string id = 6;
7795
7796    // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
7797    // represent this build.
7798    optional string version_incremental = 7;
7799
7800    // Build.TYPE. The type of build, like "user" or "eng".
7801    optional string type = 8;
7802
7803    // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
7804    optional string tags = 9;
7805}
7806
7807/**
7808 * Logs information about mismatched caller for content capture.
7809 *
7810 * Logged from:
7811 *   frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java
7812 */
7813message ContentCaptureCallerMismatchReported {
7814    optional string intended_package = 1;
7815    optional string calling_package = 2;
7816}
7817
7818/**
7819 * Logs information about content capture service events.
7820 *
7821 * Logged from:
7822 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
7823 */
7824message ContentCaptureServiceEvents {
7825    // The type of event.
7826    enum Event {
7827        UNKNOWN = 0;
7828        ON_CONNECTED = 1;
7829        ON_DISCONNECTED = 2;
7830        SET_WHITELIST = 3;
7831        SET_DISABLED = 4;
7832        ON_USER_DATA_REMOVED = 5;
7833        ON_DATA_SHARE_REQUEST = 6;
7834        ACCEPT_DATA_SHARE_REQUEST = 7;
7835        REJECT_DATA_SHARE_REQUEST = 8;
7836        DATA_SHARE_WRITE_FINISHED = 9;
7837        DATA_SHARE_ERROR_IOEXCEPTION = 10;
7838        DATA_SHARE_ERROR_EMPTY_DATA = 11;
7839        DATA_SHARE_ERROR_CLIENT_PIPE_FAIL = 12;
7840        DATA_SHARE_ERROR_SERVICE_PIPE_FAIL = 13;
7841        DATA_SHARE_ERROR_CONCURRENT_REQUEST = 14;
7842        DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED = 15;
7843        ON_REMOTE_SERVICE_DIED = 16;
7844    }
7845    optional Event event = 1;
7846    // component/package of content capture service.
7847    optional string service_info = 2;
7848    // component/package of target.
7849    // it's a concatenated list of component/package for SET_WHITELIST event
7850    // separated by " ".
7851    optional string target_info = 3;
7852}
7853
7854/**
7855 * Logs information about content capture session events.
7856 *
7857 * Logged from:
7858 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
7859 */
7860message ContentCaptureSessionEvents {
7861    // The type of event.
7862    enum Event {
7863        UNKNOWN = 0;
7864        ON_SESSION_STARTED = 1;
7865        ON_SESSION_FINISHED = 2;
7866        SESSION_NOT_CREATED = 3;
7867    }
7868    optional int32 session_id = 1;
7869    optional Event event = 2;
7870    // (n/a on session finished)
7871    optional int32 state_flags = 3;
7872    // component/package of content capture service.
7873    optional string service_info = 4;
7874    // component/package of app.
7875    // (n/a on session finished)
7876    optional string app_info = 5;
7877    optional bool is_child_session = 6;
7878}
7879
7880/**
7881 * Logs information about session being flushed.
7882 *
7883 * Logged from:
7884 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
7885 */
7886message ContentCaptureFlushed {
7887    optional int32 session_id = 1;
7888    // component/package of content capture service.
7889    optional string service_info = 2;
7890    // component/package of app.
7891    optional string app_info = 3;
7892    // session start/finish events
7893    optional int32 child_session_started = 4;
7894    optional int32 child_session_finished = 5;
7895    // count of view events.
7896    optional int32 view_appeared_count = 6;
7897    optional int32 view_disappeared_count = 7;
7898    optional int32 view_text_changed_count = 8;
7899
7900    // Flush stats.
7901    optional int32 max_events = 9;
7902    optional int32 idle_flush_freq = 10;
7903    optional int32 text_flush_freq = 11;
7904    optional int32 flush_reason = 12;
7905}
7906
7907/**
7908 * Pulls on-device BatteryStats power use calculations for the overall device.
7909 */
7910message DeviceCalculatedPowerUse {
7911    // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
7912    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
7913    // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
7914    optional int64 computed_power_nano_amp_secs = 1;
7915}
7916
7917/**
7918 * Pulls on-device BatteryStats power use calculations broken down by uid.
7919 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
7920 * that is attributed to non-uid items. They must all be included to get the total power use.
7921 */
7922message DeviceCalculatedPowerBlameUid {
7923    // Uid being blamed. Note: isolated uids have already been mapped to host uid.
7924    optional int32 uid = 1 [(is_uid) = true];
7925
7926    // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
7927    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
7928    optional int64 power_nano_amp_secs = 2;
7929}
7930
7931/**
7932 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
7933 * drain type.
7934 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
7935 * is attributed uids. They must all be included to get the total power use.
7936 */
7937message DeviceCalculatedPowerBlameOther {
7938    // The type of item whose power use is being reported.
7939    enum DrainType {
7940        AMBIENT_DISPLAY = 0;
7941        // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
7942        BLUETOOTH = 2;
7943        CAMERA = 3;
7944        // Cell-standby
7945        CELL = 4;
7946        FLASHLIGHT = 5;
7947        IDLE = 6;
7948        MEMORY = 7;
7949        // Amount that total computed drain exceeded the drain estimated using the
7950        // battery level changes and capacity.
7951        OVERCOUNTED = 8;
7952        PHONE = 9;
7953        SCREEN = 10;
7954        // Amount that total computed drain was below the drain estimated using the
7955        // battery level changes and capacity.
7956        UNACCOUNTED = 11;
7957        // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
7958        WIFI = 13;
7959    }
7960    optional DrainType drain_type = 1;
7961
7962    // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
7963    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
7964    optional int64 power_nano_amp_secs = 2;
7965}
7966
7967// Keep in sync with frameworks/base/core/proto/android/os/batteryusagestats.proto
7968/**
7969 * Represents a device's BatteryUsageStats, with power usage information about the device
7970 * and each app.
7971 */
7972message BatteryUsageStatsAtomsProto {
7973
7974    // The session start timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
7975    // All data is no older than this time.
7976    optional int64 session_start_millis = 1;
7977
7978    // The session end timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
7979    // All data is no more recent than this time.
7980    optional int64 session_end_millis = 2;
7981
7982    // Length that the reported data covered. This usually will be equal to the entire session,
7983    // session_end_millis - session_start_millis, but may not be if some data during this time frame
7984    // is missing.
7985    optional int64 session_duration_millis = 3;
7986
7987    // Represents usage of a consumer, storing all of its power component usage.
7988    message BatteryConsumerData {
7989        // Total power consumed by this BatteryConsumer (including all of its PowerComponents).
7990        // May not equal the sum of the PowerComponentUsage due to under- or over-estimations.
7991        // Multiply by 1/36 to obtain mAh.
7992        optional int64 total_consumed_power_deci_coulombs = 1;
7993
7994        // Represents power and time usage of a particular power component.
7995        message PowerComponentUsage {
7996            // Holds android.os.PowerComponentEnum, or custom component value between 1000 and 9999.
7997            // Evidently, if one attempts to write an int to an enum field that is out of range, it
7998            // is treated as 0, so we must make this an int32.
7999            optional int32 component = 1;
8000
8001            // Power consumed by this component. Multiply by 1/36 to obtain mAh.
8002            optional int64 power_deci_coulombs = 2;
8003
8004            optional int64 duration_millis = 3;
8005        }
8006        repeated PowerComponentUsage power_components = 2;
8007    }
8008
8009    // Total power usage for the device during this session.
8010    optional BatteryConsumerData device_battery_consumer = 4;
8011
8012    // Power usage by a uid during this session.
8013    message UidBatteryConsumer {
8014        optional int32 uid = 1 [(is_uid) = true];
8015        optional BatteryConsumerData battery_consumer_data = 2;
8016        optional int64 time_in_foreground_millis = 3;
8017        optional int64 time_in_background_millis = 4;
8018    }
8019    repeated UidBatteryConsumer uid_battery_consumers = 5;
8020
8021    // Sum of all discharge percentage point drops during the reported session.
8022    optional int32 session_discharge_percentage = 6;
8023}
8024
8025/**
8026 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
8027 * using the best data available.
8028 *
8029 * Includes the data since the last time statsd pulled this atom (i.e. since the
8030 * last-BatteryStats-reset-prior-to-last-statsd-pull) until the most recent BatteryStats reset.
8031 *
8032 * Does NOT include data after the most recent reset (use BatteryUsageStatsSinceReset too for that).
8033 *
8034 * Pulled from BatteryManager.getBatteryUsageStats().
8035 */
8036message BatteryUsageStatsBeforeReset {
8037    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
8038}
8039
8040/**
8041 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
8042 * using the best data available.
8043 *
8044 * Includes all data since the most recent BatteryStats reset event, but none prior to it.
8045 *
8046 * Pulled from BatteryManager.getBatteryUsageStats().
8047 */
8048message BatteryUsageStatsSinceReset {
8049    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
8050}
8051
8052/**
8053 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
8054 * using only PowerProfile Model data (even if better data is available).
8055 *
8056 * Includes all data since the most recent BatteryStats reset event, but none prior to it.
8057 *
8058 * @see android.os.BatteryUsageStatsQuery#FLAG_BATTERY_USAGE_STATS_POWER_PROFILE_MODEL
8059 * Pulled from BatteryManager.getBatteryUsageStats().
8060 */
8061message BatteryUsageStatsSinceResetUsingPowerProfileModel {
8062    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
8063}
8064
8065/**
8066 * Logs device policy features.
8067 *
8068 * Logged from:
8069 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
8070 *   packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
8071 */
8072message DevicePolicyEvent {
8073    // The event id - unique for each event.
8074    optional android.stats.devicepolicy.EventId event_id = 1;
8075    // The admin package name.
8076    optional string admin_package_name = 2;
8077    // A generic integer parameter.
8078    optional int32 integer_value = 3;
8079    // A generic boolean parameter.
8080    optional bool boolean_value = 4;
8081    // A parameter specifying a time period in milliseconds.
8082    optional uint64 time_period_millis = 5;
8083    // A parameter specifying a list of package names, bundle extras or string parameters.
8084    optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
8085}
8086
8087/**
8088 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
8089 *
8090 * Logged from:
8091 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8092 */
8093message DocsUILaunchReported {
8094    optional android.stats.docsui.LaunchAction launch_action = 1;
8095    optional bool has_initial_uri = 2;
8096    optional android.stats.docsui.MimeType mime_type = 3;
8097    optional android.stats.docsui.Root initial_root = 4;
8098}
8099
8100/**
8101 * Logs root/app visited event in file managers/picker. Call this when the user
8102 * taps on root/app in hamburger menu.
8103 *
8104 * Logged from:
8105 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8106 */
8107message DocsUIRootVisitedReported {
8108    optional android.stats.docsui.ContextScope scope = 1;
8109    optional android.stats.docsui.Root root = 2;
8110}
8111
8112/**
8113 * Logs file operation stats. Call this when a file operation has completed.
8114 *
8115 * Logged from:
8116 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8117 */
8118message DocsUIFileOperationReported {
8119    optional android.stats.docsui.Provider provider = 1;
8120    optional android.stats.docsui.FileOperation file_op = 2;
8121}
8122
8123/**
8124 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
8125 * mode.
8126 *
8127 * Logged from:
8128 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8129 */
8130message DocsUIFileOperationCopyMoveModeReported {
8131    optional android.stats.docsui.FileOperation file_op = 1;
8132    optional android.stats.docsui.CopyMoveOpMode mode = 2;
8133}
8134
8135
8136/**
8137 * Logs file sub operation stats. Call this when a file operation has failed.
8138 *
8139 * Logged from:
8140 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8141 */
8142message DocsUIFileOperationFailureReported {
8143    optional android.stats.docsui.Authority authority = 1;
8144    optional android.stats.docsui.SubFileOperation sub_op = 2;
8145}
8146
8147/**
8148* Logs the cancellation of a file operation. Call this when a job is canceled
8149*
8150* Logged from:
8151*     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8152*/
8153message DocsUIFileOperationCanceledReported {
8154    optional android.stats.docsui.FileOperation file_op = 1;
8155}
8156
8157/**
8158 * Logs startup time in milliseconds.
8159 *
8160 * Logged from:
8161 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8162 */
8163message DocsUIStartupMsReported {
8164    optional int32 startup_millis = 1;
8165}
8166
8167/**
8168 * Logs the action that was started by user.
8169 *
8170 * Logged from:
8171 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8172 */
8173message DocsUIUserActionReported {
8174    optional android.stats.docsui.UserAction action = 1;
8175}
8176
8177/**
8178 * Logs the invalid type when invalid scoped access is requested.
8179 *
8180 * Logged from:
8181 *     package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
8182 */
8183message DocsUIInvalidScopedAccessRequestReported {
8184    optional android.stats.docsui.InvalidScopedAccess type = 1;
8185}
8186
8187/**
8188 * Logs the package name that launches docsui picker mode.
8189 *
8190 * Logged from:
8191 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8192 */
8193message DocsUIPickerLaunchedFromReported {
8194    optional string package_name = 1;
8195}
8196
8197/**
8198 * Logs the search type.
8199 *
8200 * Logged from:
8201 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8202 */
8203message DocsUISearchTypeReported {
8204    optional android.stats.docsui.SearchType search_type = 1;
8205}
8206
8207/**
8208 * Logs the search mode.
8209 *
8210 * Logged from:
8211 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8212 */
8213message DocsUISearchModeReported {
8214    optional android.stats.docsui.SearchMode search_mode = 1;
8215}
8216
8217/**
8218 * Logs the pick result information.
8219 *
8220 * Logged from:
8221 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8222 */
8223message DocsUIPickResultReported {
8224    optional int32 total_action_count = 1;
8225    optional int64 duration_millis = 2;
8226    optional int32 file_count= 3;
8227    optional bool is_searching = 4;
8228    optional android.stats.docsui.Root picked_from = 5;
8229    optional android.stats.docsui.MimeType mime_type = 6;
8230    optional int32 repeatedly_pick_times = 7;
8231}
8232
8233/** Logs the drag and drop of files.
8234
8235 * Logged from:
8236 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8237 */
8238message DocsUIDragAndDropReported {
8239    optional bool drag_initiated_from_docsui = 1;
8240}
8241
8242/**
8243 * Logs when an app's memory is compacted.
8244 *
8245 * Logged from:
8246 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8247 */
8248message AppCompacted {
8249  // The pid of the process being compacted.
8250  optional int32 pid = 1;
8251
8252  // The name of the process being compacted.
8253  optional string process_name = 2;
8254
8255  // The type of compaction.
8256  enum Action {
8257    UNKNOWN = 0;
8258    SOME = 1;
8259    FULL = 2;
8260    PERSISTENT = 3;
8261    BFGS = 4;
8262  }
8263  optional Action action = 3;
8264
8265  // Total RSS in kilobytes consumed by the process prior to compaction.
8266  optional int64 before_rss_total_kilobytes = 4;
8267
8268  // File RSS in kilobytes consumed by the process prior to compaction.
8269  optional int64 before_rss_file_kilobytes = 5;
8270
8271  // Anonymous RSS in kilobytes consumed by the process prior to compaction.
8272  optional int64 before_rss_anon_kilobytes = 6;
8273
8274  // Swap in kilobytes consumed by the process prior to compaction.
8275  optional int64 before_swap_kilobytes = 7;
8276
8277  // Total RSS in kilobytes consumed by the process after compaction.
8278  optional int64 after_rss_total_kilobytes = 8;
8279
8280  // File RSS in kilobytes consumed by the process after compaction.
8281  optional int64 after_rss_file_kilobytes = 9;
8282
8283  // Anonymous RSS in kilobytes consumed by the process after compaction.
8284  optional int64 after_rss_anon_kilobytes = 10;
8285
8286  // Swap in kilobytes consumed by the process after compaction.
8287  optional int64 after_swap_kilobytes = 11;
8288
8289  // The time taken to perform compaction in milliseconds.
8290  optional int64 time_to_compact_millis = 12;
8291
8292  // The last compaction action performed for this app.
8293  optional Action last_action = 13;
8294
8295  // The last time that compaction was attempted on this process in milliseconds
8296  // since boot, not including sleep (see SystemClock.uptimeMillis()).
8297  optional int64 last_compact_timestamp_ms_since_boot = 14;
8298
8299  // The "setAdj" (i.e. previous) oom_score_adj at the time of compaction.
8300  optional int32 oom_score_adj = 15;
8301
8302  // The process state at the time of compaction.
8303  optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
8304
8305  // Free ZRAM in kilobytes before compaction.
8306  optional int64 before_zram_free_kilobytes = 17;
8307
8308  // Free ZRAM in kilobytes after compaction.
8309  optional int64 after_zram_free_kilobytes = 18;
8310}
8311
8312/**
8313 * Logs when a Tethering event occurs.
8314 *
8315 */
8316message NetworkTetheringReported {
8317  // tethering error code
8318  optional android.stats.connectivity.ErrorCode error_code = 1;
8319
8320  // tethering downstream type
8321  optional android.stats.connectivity.DownstreamType downstream_type = 2;
8322
8323  // transport type of upstream network
8324  optional android.stats.connectivity.UpstreamType upstream_type = 3;
8325
8326  // The user type of Tethering
8327  optional android.stats.connectivity.UserType user_type= 4;
8328}
8329
8330/**
8331 * Logs a DNS lookup operation initiated by the system resolver on behalf of an application
8332 * invoking native APIs such as getaddrinfo() or Java APIs such as Network#getAllByName().
8333 *
8334 * The NetworkDnsEventReported message represents the entire lookup operation, which may
8335 * result one or more queries to the recursive DNS resolvers. Those are individually logged
8336 * in DnsQueryEvents to enable computing error rates and network latency and timeouts
8337 * broken up by query type, transport, network interface, etc.
8338 */
8339message NetworkDnsEventReported {
8340    optional android.stats.dnsresolver.EventType event_type = 1;
8341
8342    optional android.stats.dnsresolver.ReturnCode return_code = 2;
8343
8344    // The latency in microseconds of the entire DNS lookup operation.
8345    optional int32 latency_micros = 3;
8346
8347    // Only valid for event_type = EVENT_GETADDRINFO.
8348    optional int32 hints_ai_flags = 4;
8349
8350    // Flags passed to android_res_nsend() defined in multinetwork.h
8351    // Only valid for event_type = EVENT_RESNSEND.
8352    optional int32 res_nsend_flags = 5;
8353
8354    optional android.stats.dnsresolver.NetworkType network_type = 6;
8355
8356    // The DNS over TLS mode on a specific netId.
8357    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7;
8358
8359    // Additional pass-through fields opaque to statsd.
8360    // The DNS resolver Mainline module can add new fields here without requiring an OS update.
8361    optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES];
8362
8363    // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom.
8364    optional int32 sampling_rate_denom = 9;
8365}
8366
8367/**
8368 * logs the CapportApiData info
8369 * Logged from:
8370 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8371 */
8372message CapportApiData {
8373    // The TTL of the network connection provided by captive portal
8374    optional int32 remaining_ttl_secs = 1;
8375
8376    // The limit traffic data of the network connection provided by captive portal
8377    optional int32 remaining_bytes = 2;
8378
8379    // Is portal url option included in the DHCP packet (Yes, No)
8380    optional bool has_portal_url = 3;
8381
8382    // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
8383    optional bool has_venue_info = 4;
8384}
8385
8386/**
8387 * logs a network Probe Event
8388 * Logged from:
8389 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8390 */
8391message ProbeEvent {
8392    // The probe type (http or https, or captive portal API...)
8393    optional android.stats.connectivity.ProbeType probe_type = 1;
8394
8395    // The latency in microseconds of the probe event
8396    optional int32 latency_micros = 2;
8397
8398    // The result of the probe event
8399    optional android.stats.connectivity.ProbeResult probe_result = 3;
8400
8401    // The CaptivePortal API info
8402    optional CapportApiData capport_api_data = 4;
8403}
8404
8405/**
8406 * log each ProbeEvent in ProbeEvents
8407 * Logged from:
8408 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8409 */
8410message ProbeEvents {
8411    // Record probe event during the validation
8412    repeated ProbeEvent probe_event = 1;
8413}
8414
8415/**
8416 * The DHCP (Dynamic Host Configuration Protocol) session info
8417 * Logged from:
8418 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
8419 */
8420message DhcpSession {
8421    // The DHCP Feature(s) enabled in this session
8422    repeated android.stats.connectivity.DhcpFeature used_features = 1;
8423
8424    // The discover packet (re)transmit count
8425    optional int32 discover_count = 2;
8426
8427    // The request packet (re)transmit count
8428    optional int32 request_count = 3;
8429
8430    // The IPv4 address conflict count
8431    // (only be meaningful when duplicate address detection is enabled)
8432    optional int32 conflict_count = 4;
8433
8434    // The DHCP packet parsing error code in this session
8435    // (defined in android.net.metrics.DhcpErrorEvent)
8436    repeated android.stats.connectivity.DhcpErrorCode error_code = 5;
8437
8438    // The result of DHCP hostname transliteration
8439    optional android.stats.connectivity.HostnameTransResult ht_result = 6;
8440}
8441
8442/**
8443 * Logs Network IP provisioning event
8444 * Logged from:
8445 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
8446 */
8447message NetworkIpProvisioningReported {
8448    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8449    optional android.stats.connectivity.TransportType transport_type = 1;
8450
8451    // The latency in microseconds of IP Provisioning over IPV4
8452    optional int32 ipv4_latency_micros = 2;
8453
8454    // The latency in microseconds of IP Provisioning over IPV6
8455    optional int32 ipv6_latency_micros = 3;
8456
8457    // The time duration between provisioning start and end (success or failure)
8458    optional int64 provisioning_duration_micros = 4;
8459
8460    // The specific disconnect reason for this IP provisioning
8461    optional android.stats.connectivity.DisconnectCode disconnect_code = 5;
8462
8463    // Log DHCP session info (Only valid for IPv4)
8464    optional DhcpSession dhcp_session = 6 [(log_mode) = MODE_BYTES];
8465
8466    // The random number between 0 ~ 999 for sampling
8467    optional int32 random_number = 7;
8468}
8469
8470/**
8471 * Logs Network DHCP Renew event
8472 * Logged from:
8473 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
8474 */
8475message NetworkDhcpRenewReported {
8476    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8477    optional android.stats.connectivity.TransportType transport_type = 1;
8478
8479    // The request packet (re)transmit count
8480    optional int32 request_count = 2;
8481
8482    // The latency in microseconds of DHCP Renew
8483    optional int32 latency_micros = 3;
8484
8485    // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
8486    optional android.stats.connectivity.DhcpErrorCode error_code = 4;
8487
8488    // The result of DHCP renew
8489    optional android.stats.connectivity.DhcpRenewResult renew_result = 5;
8490
8491    // The random number between 0 ~ 999 for sampling
8492    optional int32 random_number = 6;
8493}
8494
8495/**
8496 * Logs Network Validation event
8497 * Logged from:
8498 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8499 */
8500message NetworkValidationReported {
8501    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8502    optional android.stats.connectivity.TransportType transport_type = 1;
8503
8504    // Record each probe event
8505    optional ProbeEvents probe_events = 2 [(log_mode) = MODE_BYTES];
8506
8507    // The result of the network validation
8508    optional android.stats.connectivity.ValidationResult validation_result = 3;
8509
8510    // The latency in microseconds of network validation
8511    optional int32 latency_micros = 4;
8512
8513    // The validation index (the first validation attempt or second, third...)
8514    optional int32 validation_index = 5;
8515
8516    // The random number between 0 ~ 999 for sampling
8517    optional int32 random_number = 6;
8518}
8519
8520/**
8521 * Logs NetworkStack Quirk event
8522 * Logged from:
8523 * packages/modules/NetworkStack/src/com/android/networkstack/
8524 */
8525message NetworkStackQuirkReported {
8526    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8527    optional android.stats.connectivity.TransportType transport_type = 1;
8528
8529    // Record each Quirk event
8530    optional android.stats.connectivity.NetworkQuirkEvent event = 2;
8531}
8532
8533/**
8534 * Logs Neighbor Unreachability Detection event
8535 * Logged from:
8536 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpReachabilityMonitorMetrics.java
8537 */
8538message NetworkIpReachabilityMonitorReported {
8539    // Neighbor Unreachability Detection event.
8540    optional android.stats.connectivity.NudEventType event_type = 1;
8541
8542    // NUD probe based on IPv4 ARP or IPv6 ND packet.
8543    optional android.stats.connectivity.IpType ip_type = 2;
8544
8545    // NUD neighbor type, default gateway, DNS server or both.
8546    optional android.stats.connectivity.NudNeighborType neighbor_type = 3;
8547}
8548
8549/**
8550 * Logs when a data stall event occurs.
8551 *
8552 * Log from:
8553 *     packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8554 */
8555message DataStallEvent {
8556    // Data stall evaluation type.
8557    // See packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8558    // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
8559    optional int32 evaluation_type = 1;
8560    // See definition in data_stall_event.proto.
8561    optional com.android.server.connectivity.ProbeResult validation_result = 2;
8562    // See definition in data_stall_event.proto.
8563    optional android.net.Transport network_type = 3;
8564    // See definition in data_stall_event.proto.
8565    optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
8566    // See definition in data_stall_event.proto.
8567    optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
8568    // See definition in data_stall_event.proto.
8569    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
8570    // The tcp packets fail rate from the latest tcp polling.
8571    optional int32 tcp_fail_rate = 7;
8572    // Number of packets sent since the last received packet.
8573    optional int32 tcp_sent_since_last_recv = 8;
8574}
8575
8576/*
8577 * Logs when RescueParty resets some set of experiment flags.
8578 *
8579 * Logged from:
8580 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
8581 */
8582message RescuePartyResetReported {
8583    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
8584    optional int32 rescue_level = 1;
8585}
8586
8587/**
8588 * Logs when signed config is received from an APK, and if that config was applied successfully.
8589 * Logged from:
8590 *   frameworks/base/services/core/java/com/android/server/signedconfig/SignedConfigService.java
8591 */
8592message SignedConfigReported {
8593    enum Type {
8594        UNKNOWN_TYPE = 0;
8595        GLOBAL_SETTINGS = 1;
8596    }
8597    optional Type type = 1;
8598
8599    // The final status of the signed config received.
8600    enum Status {
8601        UNKNOWN_STATUS = 0;
8602        APPLIED = 1;
8603        BASE64_FAILURE_CONFIG = 2;
8604        BASE64_FAILURE_SIGNATURE = 3;
8605        SECURITY_EXCEPTION = 4;
8606        INVALID_CONFIG = 5;
8607        OLD_CONFIG = 6;
8608        SIGNATURE_CHECK_FAILED = 7;
8609        NOT_APPLICABLE = 8;
8610        SIGNATURE_CHECK_FAILED_PROD_KEY_ABSENT = 9;
8611    }
8612    optional Status status = 2;
8613
8614    // The version of the signed config processed.
8615    optional int32 version = 3;
8616
8617    // The package name that the config was extracted from.
8618    optional string from_package = 4;
8619
8620    enum Key {
8621        NO_KEY = 0;
8622        DEBUG = 1;
8623        PRODUCTION = 2;
8624    }
8625    // Which key was used to verify the config.
8626    optional Key verified_with = 5;
8627}
8628
8629/*
8630 * Logs GNSS Network-Initiated (NI) location events.
8631 *
8632 * Logged from:
8633 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
8634 */
8635message GnssNiEventReported {
8636    // The type of GnssNiEvent.
8637    enum EventType {
8638        UNKNOWN = 0;
8639        NI_REQUEST = 1;
8640        NI_RESPONSE = 2;
8641    }
8642    optional EventType event_type = 1;
8643
8644    // An ID generated by HAL to associate NI notifications and UI responses.
8645    optional int32 notification_id = 2;
8646
8647    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
8648    optional android.server.location.GnssNiType ni_type = 3;
8649
8650    // NI requires notification.
8651    optional bool need_notify = 4;
8652
8653    // NI requires verification.
8654    optional bool need_verify = 5;
8655
8656    // NI requires privacy override, no notification/minimal trace.
8657    optional bool privacy_override = 6;
8658
8659    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
8660    // seconds.
8661    optional int32 timeout = 7;
8662
8663    // Default response when timeout.
8664    optional android.server.location.GnssUserResponseType default_response = 8;
8665
8666    // String representing the requester of the network inititated location request.
8667    optional string requestor_id = 9;
8668
8669    // Notification message text string representing the service(for eg. SUPL-service) who sent the
8670    // network initiated location request.
8671    optional string text = 10;
8672
8673    // requestorId decoding scheme.
8674    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;
8675
8676    // Notification message text decoding scheme.
8677    optional android.server.location.GnssNiEncodingType text_encoding = 12;
8678
8679    // True if SUPL ES is enabled.
8680    optional bool is_supl_es_enabled = 13;
8681
8682    // True if GNSS location is enabled.
8683    optional bool is_location_enabled = 14;
8684
8685    // GNSS NI responses which define the response in NI structures.
8686    optional android.server.location.GnssUserResponseType user_response = 15;
8687}
8688
8689/**
8690 * Logs GNSS non-framework (NFW) location notification.
8691 *
8692 * Logged from:
8693 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
8694 */
8695message GnssNfwNotificationReported {
8696    // Package name of the Android proxy application representing the non-framework entity that
8697    // requested location. Set to empty string if unknown.
8698    optional string proxy_app_package_name = 1;
8699
8700    // Protocol stack that initiated the non-framework location request.
8701    optional android.server.location.NfwProtocolStack protocol_stack = 2;
8702
8703    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
8704    // set to empty string. This field is opaque to the framework and used for logging purposes.
8705    optional string other_protocol_stack_name = 3;
8706
8707    // Source initiating/receiving the location information.
8708    optional android.server.location.NfwRequestor requestor = 4;
8709
8710    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
8711    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
8712    // and used for logging purposes.
8713    optional string requestor_id = 5;
8714
8715    // Indicates whether location information was provided for this request.
8716    optional android.server.location.NfwResponseType response_type = 6;
8717
8718    // True if the device is in user initiated emergency session.
8719    optional bool in_emergency_mode = 7;
8720
8721    // True if cached location is provided.
8722    optional bool is_cached_location = 8;
8723
8724    // True if proxy app permission mismatch between framework and GNSS HAL.
8725    optional bool is_permission_mismatched = 9;
8726}
8727
8728/**
8729 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
8730 *
8731 * Logged from:
8732 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
8733 */
8734message GnssConfigurationReported {
8735    // SUPL host name.
8736    optional string supl_host = 1;
8737
8738    // SUPL port number.
8739    optional int32 supl_port = 2;
8740
8741    // C2K host name.
8742    optional string c2k_host = 3;
8743
8744    // C2K port number.
8745    optional int32 c2k_port = 4;
8746
8747    // The SUPL version requested by Carrier.
8748    optional int32 supl_ver = 5;
8749
8750    // The SUPL mode.
8751    optional android.server.location.SuplMode supl_mode = 6;
8752
8753    // True if NI emergency SUPL restrictions is enabled.
8754    optional bool supl_es = 7;
8755
8756    // LTE Positioning Profile settings
8757    optional android.server.location.LppProfile lpp_profile = 8;
8758
8759    // Positioning protocol on A-Glonass system.
8760    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;
8761
8762    // True if emergency PDN is used. Otherwise, regular PDN is used.
8763    optional bool use_emergency_pdn_for_emergency_supl= 10;
8764
8765    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
8766    optional android.server.location.GpsLock gps_lock = 11;
8767
8768    // Number of seconds to extend the emergency session duration post emergency call.
8769    optional int32 es_extension_sec = 12;
8770
8771    // The full list of package names of proxy Android applications representing the non-framework
8772    // location access entities (on/off the device) for which the framework user has granted
8773    // non-framework location access permission. The package names are concatenated in one string
8774    // with spaces as separators.
8775    optional string enabled_proxy_app_package_name_list = 13;
8776}
8777
8778/**
8779 * Logs when a NFC device's error occurred.
8780 * Logged from:
8781 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
8782 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
8783 */
8784message NfcErrorOccurred {
8785    enum Type {
8786        UNKNOWN = 0;
8787        CMD_TIMEOUT = 1;
8788        ERROR_NOTIFICATION = 2;
8789        AID_OVERFLOW = 3;
8790    }
8791    optional Type type = 1;
8792    // If it's nci cmd timeout, log the timeout command.
8793    optional uint32 nci_cmd = 2;
8794
8795    optional uint32 error_ntf_status_code = 3;
8796}
8797
8798/**
8799 * Logs when a NFC device's state changed event
8800 * Logged from:
8801 *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
8802 */
8803message NfcStateChanged {
8804    enum State {
8805        UNKNOWN = 0;
8806        OFF = 1;
8807        ON = 2;
8808        ON_LOCKED = 3; // Secure Nfc enabled.
8809        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
8810    }
8811    optional State state = 1;
8812}
8813
8814/**
8815 * Logs when a NFC Beam Transaction occurred.
8816 * Logged from:
8817 *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
8818 */
8819message NfcBeamOccurred {
8820    enum Operation {
8821        UNKNOWN = 0;
8822        SEND = 1;
8823        RECEIVE = 2;
8824    }
8825    optional Operation operation = 1;
8826}
8827
8828/**
8829 * Logs when a NFC Card Emulation Transaction occurred.
8830 * Logged from:
8831 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
8832 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
8833 */
8834message NfcCardemulationOccurred {
8835    enum Category {
8836        UNKNOWN = 0;
8837        HCE_PAYMENT = 1;
8838        HCE_OTHER = 2;
8839        OFFHOST = 3;
8840    }
8841    // Transaction belongs to HCE payment or HCE other category, or offhost.
8842    optional Category category = 1;
8843    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
8844    optional string se_name = 2;
8845}
8846
8847/**
8848 * Logs when a NFC Tag event occurred.
8849 * Logged from:
8850 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
8851 */
8852message NfcTagOccurred {
8853    enum Type {
8854        UNKNOWN = 0;
8855        URL = 1;
8856        BT_PAIRING = 2;
8857        PROVISION = 3;
8858        WIFI_CONNECT = 4;
8859        APP_LAUNCH = 5;
8860        OTHERS = 6;
8861    }
8862    optional Type type = 1;
8863}
8864
8865/**
8866 * Logs when Hce transaction triggered
8867 * Logged from:
8868 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
8869 */
8870message NfcHceTransactionOccurred {
8871    // The latency period(in microseconds) it took for the first HCE data
8872    // exchange.
8873    optional uint32 latency_micros = 1;
8874}
8875
8876/**
8877 * Logs when SecureElement state event changed
8878 * Logged from:
8879 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
8880 */
8881message SeStateChanged {
8882    enum State {
8883        UNKNOWN = 0;
8884        INITIALIZED = 1;
8885        DISCONNECTED = 2;
8886        CONNECTED = 3;
8887        HALCRASH = 4;
8888    }
8889    optional State state = 1;
8890
8891    optional string state_change_reason = 2;
8892    // SIMx or eSEx.
8893    optional string terminal = 3;
8894}
8895
8896/**
8897 * Information about a permission grant request
8898 */
8899message PermissionGrantRequestResultReported {
8900    // unique value identifying an API call. A API call might result in multiple of these atoms
8901    optional int64 request_id = 1;
8902
8903    // UID of package requesting the permission grant
8904    optional int32 uid = 2 [(is_uid) = true];
8905
8906    // Name of package requesting the permission grant
8907    optional string package_name = 3;
8908
8909    // The permission to be granted
8910    optional string permission_name = 4;
8911
8912    // If the permission was explicitly requested via the API or added by the system
8913    optional bool is_implicit = 5;
8914
8915    enum Result {
8916        UNDEFINED = 0;
8917        // permission request was ignored
8918        IGNORED = 1;
8919        // permission request was ignored because it was user fixed
8920        IGNORED_USER_FIXED = 2;
8921        // permission request was ignored because it was policy fixed
8922        IGNORED_POLICY_FIXED = 3;
8923        // permission was granted by user action
8924        USER_GRANTED = 4;
8925        // permission was automatically granted
8926        AUTO_GRANTED = 5;
8927        // permission was denied by user action
8928        USER_DENIED = 6;
8929        // permission was denied with prejudice by the user
8930        USER_DENIED_WITH_PREJUDICE = 7;
8931        // permission was automatically denied
8932        AUTO_DENIED = 8;
8933        // permission request was ignored because permission is restricted
8934        IGNORED_RESTRICTED_PERMISSION = 9;
8935        // one time permission was granted by user action
8936        USER_GRANTED_ONE_TIME = 10;
8937        // user ignored request by leaving the request screen without choosing any option
8938        USER_IGNORED = 11;
8939        // user granted the permission after being linked to settings
8940        USER_GRANTED_IN_SETTINGS = 12;
8941        // user denied the permission after being linked to settings
8942        USER_DENIED_IN_SETTINGS = 13;
8943        // user denied the permission with prejudice after being linked to settings
8944        USER_DENIED_WITH_PREJUDICE_IN_SETTINGS = 14;
8945        // permission was automatically revoked after one-time permission expired
8946        AUTO_ONE_TIME_PERMISSION_REVOKED = 15;
8947        // permission was automatically revoked for unused app
8948        AUTO_UNUSED_APP_PERMISSION_REVOKED = 16;
8949    }
8950    // The result of the permission grant
8951    optional Result result = 6;
8952}
8953
8954/**
8955 * Logs when Omapi API used
8956 * Logged from:
8957 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
8958 */
8959message SeOmapiReported {
8960    enum Operation {
8961        UNKNOWN = 0;
8962        OPEN_CHANNEL = 1;
8963    }
8964    optional Operation operation = 1;
8965    // SIMx or eSEx.
8966    optional string terminal = 2;
8967
8968    optional string package_name = 3;
8969}
8970
8971/**
8972  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
8973  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
8974  * Logged from:
8975  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
8976  */
8977message BroadcastDispatchLatencyReported {
8978    optional int64 dispatch_latency_millis = 1;
8979}
8980
8981/**
8982   * Logs AttentionManagerService attention check result.
8983   *
8984   * Logged from:
8985   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
8986   */
8987message AttentionManagerServiceResultReported {
8988    // See core/java/android/service/attention/AttentionService.java
8989    enum AttentionCheckResult {
8990        UNKNOWN = 20;
8991        ATTENTION_SUCCESS_ABSENT = 0;
8992        ATTENTION_SUCCESS_PRESENT = 1;
8993        ATTENTION_FAILURE_UNKNOWN = 2;
8994        ATTENTION_FAILURE_CANCELLED = 3;
8995        ATTENTION_FAILURE_PREEMPTED = 4;
8996        ATTENTION_FAILURE_TIMED_OUT = 5;
8997        ATTENTION_FAILURE_CAMERA_PERMISSION_ABSENT = 6;
8998    }
8999    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
9000}
9001
9002/**
9003 * Logs when an adb connection changes state.
9004 *
9005 * Logged from:
9006 *     frameworks/base/services/core/java/com/android/server/adb/AdbDebuggingManager.java
9007 */
9008message AdbConnectionChanged {
9009    // The last time this system connected via adb, or 0 if the 'always allow' option was not
9010    // previously selected for this system.
9011    optional int64 last_connection_time_millis = 1;
9012
9013    // The time in ms within which a subsequent connection from an 'always allow' system is allowed
9014    // to reconnect via adb without user interaction.
9015    optional int64 auth_window_millis = 2;
9016
9017    // The state of the adb connection from frameworks/proto_logging/stats/enums/debug/enums.proto.
9018    optional android.debug.AdbConnectionStateEnum state = 3;
9019
9020    // True if the 'always allow' option was selected for this system.
9021    optional bool always_allow = 4;
9022}
9023
9024/*
9025 * Logs the reported speech DSP status.
9026 *
9027 * Logged from:
9028 *  Vendor audio implementation.
9029 */
9030message SpeechDspStatReported {
9031    // The total Speech DSP uptime in milliseconds.
9032    optional int32 total_uptime_millis = 1;
9033    // The total Speech DSP downtime in milliseconds.
9034    optional int32 total_downtime_millis = 2;
9035    optional int32 total_crash_count = 3;
9036    optional int32 total_recover_count = 4;
9037}
9038
9039/**
9040 * Logs USB connector contaminant status.
9041 *
9042 * Logged from: USB Service.
9043 */
9044message UsbContaminantReported {
9045    optional string id = 1;
9046    optional android.service.ContaminantPresenceStatus status = 2;
9047}
9048
9049/**
9050 * This atom is for debugging purpose.
9051 */
9052message DebugElapsedClock {
9053    // Monotically increasing value for each pull.
9054    optional int64 pull_count = 1;
9055    // Time from System.elapsedRealtime.
9056    optional int64 elapsed_clock_millis = 2;
9057    // Time from System.elapsedRealtime.
9058    optional int64 same_elapsed_clock_millis = 3;
9059    // Diff between current elapsed time and elapsed time from previous pull.
9060    optional int64 elapsed_clock_diff_millis = 4;
9061
9062    enum Type {
9063      TYPE_UNKNOWN = 0;
9064      ALWAYS_PRESENT = 1;
9065      PRESENT_ON_ODD_PULLS = 2;
9066    }
9067    // Type of behavior for the pulled data.
9068    optional Type type = 5;
9069}
9070
9071/**
9072 * This atom is for debugging purpose.
9073 */
9074message DebugFailingElapsedClock {
9075    // Monotically increasing value for each pull.
9076    optional int64 pull_count = 1;
9077    // Time from System.elapsedRealtime.
9078    optional int64 elapsed_clock_millis = 2;
9079    // Time from System.elapsedRealtime.
9080    optional int64 same_elapsed_clock_millis = 3;
9081    // Diff between current elapsed time and elapsed time from previous pull.
9082    optional int64 elapsed_clock_diff_millis = 4;
9083}
9084
9085/** Logs System UI bubbles event changed.
9086 *
9087 * Logged from:
9088 *     frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen
9089 */
9090message SplitscreenUIChanged {
9091    // User interactions with splitscreen
9092    enum Action {
9093        UNKNOWN_ACTION = 0;
9094        ENTER = 1;
9095        EXIT = 2;
9096        APP_CHANGE = 3;
9097        RESIZE = 4;
9098        SWAP = 5;
9099    }
9100
9101    // The physical side on the device of the split
9102    enum Position {
9103        UNKNOWN_POSITION = 0;
9104        LEFT = 1;
9105        RIGHT = 2;
9106        TOP = 3;
9107        BOTTOM = 4;
9108    }
9109
9110    // The reason for entering splitscreen
9111    enum EnterReason {
9112        UNKNOWN_ENTER = 0;
9113        OVERVIEW = 1;
9114        DRAG_LEFT = 2;
9115        DRAG_TOP = 3;
9116        DRAG_RIGHT = 4;
9117        DRAG_BOTTOM = 5;
9118    }
9119
9120    // The reason for exiting splitscreen
9121    enum ExitReason {
9122        UNKNOWN_EXIT = 0;
9123        DRAG_DIVIDER = 1;
9124        RETURN_HOME = 2;
9125        SCREEN_LOCKED = 3;
9126        SCREEN_LOCKED_SHOW_ON_TOP = 4;
9127        DEVICE_FOLDED = 5;
9128        ROOT_TASK_VANISHED = 6;
9129        APP_FINISHED = 7;
9130        APP_DOES_NOT_SUPPORT_MULTIWINDOW = 8;
9131    }
9132
9133    // The event action
9134    optional Action action = 1;
9135    // What triggered splitscreen (if the action is ENTER)
9136    optional EnterReason enter_reason = 2;
9137    // What triggered leaving splitscreen (if the action is EXIT)
9138    optional ExitReason exit_reason = 3;
9139    // The ratio of split between the main/side stages
9140    optional float split_ratio = 4;
9141    // Data about the main stage in split
9142    optional Position main_stage_position = 5;
9143    optional int32 main_stage_uid = 6 [(is_uid) = true];
9144    // Data about the side stage in split
9145    optional Position side_stage_position = 7;
9146    optional int32 side_stage_uid = 8 [(is_uid) = true];
9147    // The drag session id (if the enter_trigger was DRAG)
9148    optional int32 drag_instance_id = 9;
9149    // An identifier used to identify a splitscreen session
9150    optional int32 instance_id = 10;
9151}
9152
9153/** Logs System UI bubbles event changed.
9154 *
9155 * Logged from:
9156 *     frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles
9157 */
9158message BubbleUIChanged {
9159
9160    // The app package that is posting the bubble.
9161    optional string package_name = 1;
9162
9163    // The notification channel that is posting the bubble.
9164    optional string notification_channel = 2;
9165
9166    // The notification id associated with the posted bubble.
9167    optional int32 notification_id = 3;
9168
9169    // The position of the bubble within the bubble stack.
9170    optional int32 position = 4;
9171
9172    // The total number of bubbles within the bubble stack.
9173    optional int32 total_number = 5;
9174
9175    // User interactions with the bubble.
9176    enum Action {
9177        UNKNOWN = 0;
9178        POSTED = 1;
9179        UPDATED = 2;
9180        EXPANDED = 3;
9181        COLLAPSED = 4;
9182        DISMISSED = 5;
9183        STACK_DISMISSED = 6;
9184        STACK_MOVED = 7;
9185        HEADER_GO_TO_APP = 8;
9186        HEADER_GO_TO_SETTINGS = 9;
9187        PERMISSION_OPT_IN = 10;
9188        PERMISSION_OPT_OUT = 11;
9189        PERMISSION_DIALOG_SHOWN = 12;
9190        SWIPE_LEFT = 13;
9191        SWIPE_RIGHT = 14;
9192        STACK_EXPANDED = 15;
9193        FLYOUT = 16;
9194    }
9195    optional Action action = 6;
9196
9197    // Normalized screen position of the bubble stack. The range is between 0 and 1.
9198    optional float normalized_x_position = 7;
9199    optional float normalized_y_position = 8;
9200
9201    // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
9202    optional bool is_unread = 9;
9203
9204    // Whether the bubble is an on-going one.
9205    optional bool is_ongoing = 10;
9206
9207    // Whether the bubble is produced by an app running in foreground.
9208    // This is deprecated and the value should be ignored.
9209    optional bool is_foreground = 11 [deprecated = true];
9210}
9211
9212/**
9213  * Logs System UI bubbles developer errors.
9214  *
9215  * Logged from:
9216  *   frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
9217  */
9218message BubbleDeveloperErrorReported {
9219
9220    // The app package that is posting the bubble.
9221    optional string package_name = 1;
9222
9223    // Bubble developer error type enums.
9224    enum Error {
9225        UNKNOWN = 0;
9226        ACTIVITY_INFO_MISSING = 1;
9227        ACTIVITY_INFO_NOT_RESIZABLE = 2;
9228        DOCUMENT_LAUNCH_NOT_ALWAYS = 3;
9229    }
9230    optional Error error = 2 [default = UNKNOWN];
9231}
9232
9233/**
9234 * Logs that a constraint for a scheduled job has changed.
9235 *
9236 * Logged from:
9237 *     frameworks/base/services/core/java/com/android/server/job/controllers/JobStatus.java
9238 */
9239message ScheduledJobConstraintChanged {
9240    repeated AttributionNode attribution_node = 1;
9241
9242    // Name of the job.
9243    optional string job_name = 2;
9244
9245    optional com.android.server.job.ConstraintEnum constraint = 3;
9246
9247    enum State {
9248        UNKNOWN = 0;
9249        UNSATISFIED = 1;
9250        SATISFIED = 2;
9251    }
9252    optional State state = 4;
9253}
9254
9255/**
9256 * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
9257 * returns true.
9258 *
9259 * Logged from:
9260 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
9261 */
9262message ScreenTimeoutExtensionReported {
9263    // Describes how many times in a row did the power manager reset the screen off timeout.
9264    optional uint32 consecutive_timeout_extended_count = 1;
9265}
9266
9267/*
9268* Logs number of milliseconds it takes to start a process.
9269* The definition of app process start time is from the app launch time to
9270* the time that Zygote finished forking the app process and loaded the
9271* application package's java classes.
9272
9273* This metric is different from AppStartOccurred which is for foreground
9274* activity only.
9275
9276* ProcessStartTime can report all processes (both foreground and background)
9277* start time.
9278*
9279* Logged from:
9280*   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9281*/
9282message ProcessStartTime {
9283    // The uid of the ProcessRecord.
9284    optional int32 uid = 1 [(is_uid) = true];
9285
9286    // The process pid.
9287    optional int32 pid = 2;
9288
9289    // The process name.
9290    // Usually package name, "system" for system server.
9291    // Provided by ActivityManagerService.
9292    optional string process_name = 3;
9293
9294    enum StartType {
9295        UNKNOWN = 0;
9296        WARM = 1;
9297        HOT = 2;
9298        COLD = 3;
9299    }
9300
9301    // The start type.
9302    optional StartType type = 4;
9303
9304    // The elapsed realtime at the start of the process.
9305    optional int64 process_start_time_millis = 5;
9306
9307    // Number of milliseconds it takes to reach bind application.
9308    optional int32 bind_application_delay_millis = 6;
9309
9310    // Number of milliseconds it takes to finish start of the process.
9311    optional int32 process_start_delay_millis = 7;
9312
9313    // hostingType field in ProcessRecord, the component type such as "activity",
9314    // "service", "content provider", "broadcast" or other strings.
9315    optional string hosting_type = 8;
9316
9317    // hostingNameStr field in ProcessRecord. The component class name that runs
9318    // in this process.
9319    optional string hosting_name = 9;
9320}
9321
9322/**
9323 * Track Media Codec usage (nested proto version)
9324 *   This atom is being deprecated in favor of MediaCodecReported which has a
9325 *   flattened CodecData to enable field filtering. The data is identical
9326 *   except MediaCodecReported also has the playback_duration field.
9327 * Logged from:
9328 *   frameworks/av/media/libstagefright/MediaCodec.cpp
9329 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
9330 */
9331message MediametricsCodecReported {
9332    optional int64 timestamp_nanos = 1;
9333    optional string package_name = 2;
9334    optional int64 package_version_code = 3;
9335    optional int64 media_apex_version = 4;
9336
9337    optional android.stats.mediametrics_message.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9338}
9339
9340/**
9341 * Track Media Codec usage
9342 *   This atom is the new version of MediametricsCodecReported and has a
9343 *   flattened CodecData to enable field filtering. The data is identical
9344 *   except for the addition of the playback_duration field.
9345 * Logged from:
9346 *   frameworks/av/media/libstagefright/MediaCodec.cpp
9347 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
9348 */
9349message MediaCodecReported {
9350    optional int64 timestamp_nanos = 1;
9351    // The inclusion of package name in a metric should be carefully analyzed to
9352    // determine if it is absolutely necessary for system health. It is strongly
9353    // discouraged to collect the package name along with other metrics (e.g.
9354    // playback duration).
9355    optional string package_name = 2;
9356    optional int64 package_version_code = 3;
9357    optional int64 media_apex_version = 4;
9358    optional string codec = 5;
9359    optional string mime = 6;
9360    optional string mode = 7;
9361    optional int32 encoder = 8;
9362    optional int32 secure = 9;
9363    optional int32 width = 10;
9364    optional int32 height = 11;
9365    optional int32 rotation = 12;
9366    optional int32 crypto = 13;
9367    optional int32 profile = 14;
9368    optional int32 level = 15;
9369    optional int32 max_width = 16;
9370    optional int32 max_height = 17;
9371    optional int32 error_code = 18;
9372    optional string error_state = 19;
9373    optional int64 latency_max = 20;
9374    optional int64 latency_min = 21;
9375    optional int64 latency_avg = 22;
9376    optional int64 latency_count = 23;
9377    optional int64 latency_unknown = 24;
9378    optional int32 queue_input_buffer_error = 25;
9379    optional int32 queue_secure_input_buffer_error = 26;
9380    optional string bitrate_mode = 27;
9381    optional int32 bitrate = 28;
9382    optional int64 lifetime_millis = 29;
9383    optional int64 playback_duration_seconds = 30;
9384    optional string log_session_id = 31;
9385    optional int32 channel_count = 32;
9386    optional int32 sample_rate = 33;
9387    optional int64 video_encode_bytes = 34;
9388    optional int64 video_encode_frames = 35;
9389    optional int64 video_input_bytes = 36;
9390    optional int64 video_input_frames = 37;
9391    optional int64 video_encode_duration_us = 38;
9392    optional int32 color_format = 39;
9393    optional float frame_rate = 40;
9394    optional float capture_rate = 41;
9395    optional float operating_rate = 42;
9396    optional int32 priority = 43;
9397    optional int32 video_qp_i_min = 44;
9398    optional int32 video_qp_i_max = 45;
9399    optional int32 video_qp_p_min = 46;
9400    optional int32 video_qp_p_max = 47;
9401    optional int32 video_qp_b_min = 48;
9402    optional int32 video_qp_b_max = 49;
9403    optional int32 original_bitrate = 50;
9404    optional int32 shaping_enhanced = 51;
9405    optional int32 original_video_qp_i_min = 52;
9406    optional int32 original_video_qp_i_max = 53;
9407    optional int32 original_video_qp_p_min = 54;
9408    optional int32 original_video_qp_p_max = 55;
9409    optional int32 original_video_qp_b_min = 56;
9410    optional int32 original_video_qp_b_max = 57;
9411    // !!! WARNING
9412    // Keep synchronized with MediametricsCodecReported.CodecData in
9413    // mediametrics_message.proto.
9414    // Also keep AStatsEvent serialization synchronized in statsd_codec.cpp
9415    // !!! WARNING
9416}
9417
9418/**
9419 * Track Media Extractor (pulling video/audio streams out of containers) usage
9420 * Logged from:
9421 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
9422 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
9423 */
9424message MediametricsExtractorReported {
9425    optional int64 timestamp_nanos = 1;
9426    optional string package_name = 2;
9427    optional int64 package_version_code = 3;
9428    optional int64 media_apex_version = 4;
9429
9430    optional android.stats.mediametrics_message.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9431}
9432
9433/**
9434 * Track MediaParser (parsing video/audio streams from containers) usage
9435 * Logged from:
9436 *
9437 *   frameworks/av/services/mediametrics/statsd_mediaparser.cpp
9438 *   frameworks/base/apex/media/framework/jni/android_media_MediaParserJNI.cpp
9439 */
9440message MediametricsMediaParserReported {
9441    optional int64 timestamp_nanos = 1;
9442    optional string package_name = 2;
9443    optional int64 package_version_code = 3;
9444
9445    // MediaParser specific data.
9446    /**
9447     * The name of the parser selected for parsing the media, or an empty string
9448     * if no parser was selected.
9449     */
9450    optional string parser_name = 4;
9451    /**
9452     * Whether the parser was created by name. 1 represents true, and 0
9453     * represents false.
9454     */
9455    optional int32 created_by_name = 5;
9456    /**
9457     * The parser names in the sniffing pool separated by "|".
9458     */
9459    optional string parser_pool = 6;
9460    /**
9461     * The fully qualified name of the last encountered exception, or an empty
9462     * string if no exception was encountered.
9463     */
9464    optional string last_exception = 7;
9465    /**
9466     * The size of the parsed media in bytes, or -1 if unknown. Note this value
9467     * contains intentional random error to prevent media content
9468     * identification.
9469     */
9470    optional int64 resource_byte_count = 8;
9471    /**
9472     * The duration of the media in milliseconds, or -1 if unknown. Note this
9473     * value contains intentional random error to prevent media content
9474     * identification.
9475     */
9476    optional int64 duration_millis = 9;
9477    /**
9478     * The MIME types of the tracks separated by "|".
9479     */
9480    optional string track_mime_types = 10;
9481    /**
9482     * The tracks' RFC 6381 codec strings separated by "|".
9483     */
9484    optional string track_codecs = 11;
9485    /**
9486     * Concatenation of the parameters altered by the client, separated by "|".
9487     */
9488    optional string altered_parameters = 12;
9489    /**
9490     * The video width in pixels, or -1 if unknown or not applicable.
9491     */
9492    optional int32 video_width = 13;
9493    /**
9494     * The video height in pixels, or -1 if unknown or not applicable.
9495     */
9496    optional int32 video_height = 14;
9497    /**
9498     * Session id for correlating playback metrics.
9499     */
9500    optional string log_session_id = 15;
9501}
9502
9503/**
9504 * Track how we arbitrate between microphone/input requests.
9505 * Logged from
9506 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
9507 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
9508 */
9509message MediametricsAudiopolicyReported {
9510    optional int64 timestamp_nanos = 1;
9511    optional string package_name = 2;
9512    optional int64 package_version_code = 3;
9513    optional int64 media_apex_version = 4;
9514
9515    optional android.stats.mediametrics_message.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9516}
9517
9518/**
9519 * Track how we arbitrate between microphone requests.
9520 * Logged from
9521 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
9522 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
9523 */
9524message MediametricsAudiorecordReported {
9525    optional int64 timestamp_nanos = 1;
9526    optional string package_name = 2;
9527    optional int64 package_version_code = 3;
9528    optional int64 media_apex_version = 4;
9529
9530    optional android.stats.mediametrics_message.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9531
9532    // Android S
9533    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
9534    // An empty string means no session id is set.
9535    optional string log_session_id = 6;
9536}
9537
9538/**
9539 * Track how we arbitrate between microphone/input requests.
9540 * Logged from
9541 *   frameworks/av/media/libnblog/ReportPerformance.cpp
9542 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
9543 */
9544message MediametricsAudiothreadReported {
9545    optional int64 timestamp_nanos = 1;
9546    optional string package_name = 2;
9547    optional int64 package_version_code = 3;
9548    optional int64 media_apex_version = 4;
9549
9550    optional android.stats.mediametrics_message.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9551}
9552
9553/**
9554 * Track how we arbitrate between microphone/input requests.
9555 * Logged from
9556 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
9557 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
9558 */
9559message MediametricsAudiotrackReported {
9560    optional int64 timestamp_nanos = 1;
9561    optional string package_name = 2;
9562    optional int64 package_version_code = 3;
9563    optional int64 media_apex_version = 4;
9564
9565    optional android.stats.mediametrics_message.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9566
9567    // Android S
9568    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
9569    // An empty string means no session id is set.
9570    optional string log_session_id = 6;
9571}
9572
9573/**
9574 * Track information about DRM framework performance
9575 * Logged from
9576 *   frameworks/av/drm/libmediadrm/DrmHal.cpp
9577 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
9578 */
9579message MediametricsMediadrmReported {
9580    optional int64 timestamp_nanos = 1;
9581    optional string package_name = 2;
9582    optional int64 package_version_code = 3;
9583    optional int64 media_apex_version = 4;
9584
9585    // vendor+description tell about which DRM plugin is in use on this device
9586    optional string vendor = 5;
9587    optional string description = 6;
9588    // from frameworks/av/drm/libmediadrm/protos/metrics.proto
9589    optional bytes framework_stats = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
9590}
9591
9592/**
9593 * Track information about the widevine DRM plugin performance
9594 * Logged from
9595 *   vendor/widevine/libwvdrmengine/cdm/metrics
9596 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
9597 *
9598 * TODO b/182382094 -remove after migrated mediadrm metrics
9599 * reporting to statsd.
9600 */
9601message MediametricsDrmWidevineReported {
9602    optional int64 timestamp_nanos = 1;
9603    optional string package_name = 2;
9604    optional int64 package_version_code = 3;
9605    optional int64 media_apex_version = 4;
9606
9607    optional bytes vendor_specific_stats = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9608}
9609
9610/**
9611 * Track information about recordings (e.g. camcorder)
9612 * Logged from
9613 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
9614 *   frameworks/av/services/mediaanalytics/statsd_recorder.cpp
9615 */
9616message MediametricsRecorderReported {
9617    optional int64 timestamp_nanos = 1;
9618    optional string package_name = 2;
9619    optional int64 package_version_code = 3;
9620    optional int64 media_apex_version = 4;
9621
9622    optional android.stats.mediametrics_message.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9623}
9624
9625/**
9626 * Track Media Player usage
9627 * Logged from:
9628 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
9629 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
9630 */
9631message MediametricsNuPlayerReported {
9632    optional int64 timestamp_nanos = 1;
9633    optional string package_name = 2;
9634    optional int64 package_version_code = 3;
9635    optional int64 media_apex_version = 4;
9636
9637    optional android.stats.mediametrics_message.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9638}
9639
9640/**
9641 * Track Legacy DRM usage
9642 * Logged from
9643 *   frameworks/av/drm/drmserver/DrmManager.cpp
9644 */
9645message MediametricsDrmManagerReported {
9646    optional int64 timestamp_nanos = 1;
9647    optional string package_name = 2;
9648    optional int64 package_version_code = 3;
9649    optional int64 media_apex_version = 4;
9650
9651    enum Method {
9652        METHOD_NOT_FOUND       = -1;
9653        GET_CONSTRAINTS        =  0;
9654        GET_METADATA           =  1;
9655        CAN_HANDLE             =  2;
9656        PROCESS_DRM_INFO       =  3;
9657        ACQUIRE_DRM_INFO       =  4;
9658        SAVE_RIGHTS            =  5;
9659        GET_ORIGINAL_MIME_TYPE =  6;
9660        GET_DRM_OBJECT_TYPE    =  7;
9661        CHECK_RIGHTS_STATUS    =  8;
9662        REMOVE_RIGHTS          =  9;
9663        REMOVE_ALL_RIGHTS      = 10;
9664        OPEN_CONVERT_SESSION   = 11;
9665        OPEN_DECRYPT_SESSION   = 12;
9666    }
9667
9668    // plugin_id+description inform which Legacy DRM plugins are still in use on device
9669    optional string plugin_id = 5;
9670    optional string description = 6;
9671    optional Method method = 7;
9672    optional string mime_types = 8;
9673
9674    optional int64 get_constraints_count =  9;
9675    optional int64 get_metadata_count = 10;
9676    optional int64 can_handle_count = 11;
9677    optional int64 process_drm_info_count = 12;
9678    optional int64 acquire_drm_info_count = 13;
9679    optional int64 save_rights_count = 14;
9680    optional int64 get_original_mime_type_count = 15;
9681    optional int64 get_drm_object_type_count = 16;
9682    optional int64 check_rights_status_count = 17;
9683    optional int64 remove_rights_count = 18;
9684    optional int64 remove_all_rights_count = 19;
9685    optional int64 open_convert_session_count = 20;
9686    optional int64 open_decrypt_session_count = 21;
9687}
9688
9689/**
9690 * State of a all permission requested by a all package
9691 * Pulled from: StatsCompanionService
9692*/
9693message DangerousPermissionState {
9694    // Name of the permission
9695    optional string permission_name = 1;
9696
9697    // Uid of the package
9698    optional int32 uid = 2 [(is_uid) = true];
9699
9700    // Package requesting the permission
9701    optional string package_name = 3;
9702
9703    // If the permission is granted to the uid
9704    optional bool is_granted = 4;
9705
9706    // Permission flags as per android.content.pm.PermissionFlags
9707    optional int32 permission_flags = 5;
9708
9709    // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
9710    optional int32 protection_flags = 6;
9711}
9712
9713/**
9714 * Logs when a package is denied access to a device identifier based on the new access requirements.
9715 *
9716 * Logged from:
9717 *     frameworks/base/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
9718 */
9719message DeviceIdentifierAccessDenied {
9720    // The name of the package denied access to the requested device identifier.
9721    optional string package_name = 1;
9722
9723    // The name of the device identifier method the package attempted to invoke.
9724    optional string method_name = 2;
9725
9726    // True if the package is preinstalled.
9727    // Starting from Android 11, this boolean is not set and will always be false.
9728    optional bool is_preinstalled = 3 [deprecated = true];
9729
9730    // True if the package is privileged.
9731    // Starting from Android 11, this boolean is not set and will always be false.
9732    optional bool is_priv_app = 4 [deprecated = true];
9733}
9734
9735/**
9736 * Pulls the ongoing mainline install train version code.
9737 * Pulled from StatsCompanionService
9738 */
9739message TrainInfo {
9740    optional int64 train_version_code = 1;
9741
9742    optional TrainExperimentIds train_experiment_id = 2 [(log_mode) = MODE_BYTES];
9743
9744    optional string train_name = 3;
9745
9746    enum Status {
9747        UNKNOWN = 0;
9748        INSTALL_REQUESTED = 1;
9749        INSTALL_STARTED = 2;
9750        INSTALL_STAGED_NOT_READY = 3;
9751        INSTALL_STAGED_READY = 4;
9752        INSTALL_SUCCESS = 5;
9753        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
9754        // and INSTALL_FAILURE_COMMIT.
9755        INSTALL_FAILURE = 6  [deprecated = true];
9756        // This enum is for installs that are manually cancelled via the Manual Update UI.
9757        INSTALL_CANCELLED = 7;
9758        INSTALLER_ROLLBACK_REQUESTED = 8;
9759        INSTALLER_ROLLBACK_INITIATED = 9;
9760        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
9761        INSTALLER_ROLLBACK_STAGED = 11;
9762        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
9763        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
9764        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
9765        INSTALLER_ROLLBACK_SUCCESS = 15;
9766        INSTALLER_ROLLBACK_FAILURE = 16;
9767        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
9768        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
9769        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
9770        INSTALL_STAGED_CANCEL_REQUESTED = 20;
9771        INSTALL_STAGED_CANCEL_SUCCESS = 21;
9772        INSTALL_STAGED_CANCEL_FAILURE = 22;
9773        INSTALL_FAILURE_DOWNLOAD = 23;
9774        INSTALL_FAILURE_STATE_MISMATCH = 24;
9775        INSTALL_FAILURE_COMMIT = 25;
9776        REBOOT_TRIGGERED = 26;
9777    }
9778    optional Status status = 4;
9779}
9780
9781/**
9782 * Logs the gesture stage changed event.
9783 *
9784 * Logged from:
9785 *   frameworks/base/packages/SystemUI/
9786 */
9787message AssistGestureStageReported {
9788    optional android.hardware.sensor.assist.AssistGestureStageEnum gesture_stage = 1;
9789}
9790
9791/**
9792 * Logs the feedback type.
9793 *
9794 * Logged from:
9795 *   frameworks/base/packages/SystemUI/
9796 */
9797message AssistGestureFeedbackReported {
9798    // Whether or not the gesture was used.
9799    optional android.hardware.sensor.assist.AssistGestureFeedbackEnum feedback_type = 1;
9800}
9801
9802/**
9803 * Logs the progress.
9804 *
9805 * Logged from:
9806 *   frameworks/base/packages/SystemUI/
9807 */
9808message AssistGestureProgressReported {
9809    // [0,100] progress for the assist gesture.
9810    optional int32 progress = 1;
9811}
9812
9813/*
9814 * Information about the time zone data on a device.
9815 */
9816message TimeZoneDataInfo {
9817    // A version identifier for the data set on device. e.g. "2018i"
9818    optional string tzdb_version = 1;
9819}
9820
9821/**
9822 * Logs the GPU stats global health information.
9823 *
9824 * Logged from:
9825 *   frameworks/native/services/gpuservice/gpustats/
9826 */
9827message GpuStatsGlobalInfo {
9828    // Package name of the gpu driver.
9829    optional string driver_package_name = 1;
9830
9831    // Version name of the gpu driver.
9832    optional string driver_version_name = 2;
9833
9834    // Version code of the gpu driver.
9835    optional int64 driver_version_code = 3;
9836
9837    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
9838    optional int64 driver_build_time = 4;
9839
9840    // Total count of the gl driver gets loaded.
9841    optional int64 gl_loading_count = 5;
9842
9843    // Total count of the gl driver fails to be loaded.
9844    optional int64 gl_loading_failure_count = 6;
9845
9846    // Total count of the Vulkan driver gets loaded.
9847    optional int64 vk_loading_count = 7;
9848
9849    // Total count of the Vulkan driver fails to be loaded.
9850    optional int64 vk_loading_failure_count = 8;
9851
9852    // Api version of the system Vulkan driver.
9853    optional int32 vulkan_version = 9;
9854
9855    // Api version of the system CPU Vulkan driver.
9856    optional int32 cpu_vulkan_version = 10;
9857
9858    // Api version of the system GLES driver.
9859    optional int32 gles_version = 11;
9860
9861    // Total count of the angle driver gets loaded.
9862    optional int64 angle_loading_count = 12;
9863
9864    // Total count of the angle driver fails to be loaded.
9865    optional int64 angle_loading_failure_count = 13;
9866}
9867
9868/**
9869 * GPU driver loading time info.
9870 */
9871message GpuDriverLoadingTime {
9872    // List of all the driver loading times for this app. The list size is
9873    // capped at 50.
9874    repeated int64 driver_loading_time = 1;
9875}
9876
9877/**
9878 * Logs the GPU stats per app health information.
9879 *
9880 * Logged from:
9881 *   frameworks/native/services/gpuservice/gpustats/
9882 */
9883message GpuStatsAppInfo {
9884    // Package name of the application that loads the gpu driver. Total number
9885    // of different packages is capped at 100.
9886    optional string app_package_name = 1;
9887
9888    // Version code of the gpu driver this app loads.
9889    optional int64 driver_version_code = 2;
9890
9891    // gl driver loading time info.
9892    optional GpuDriverLoadingTime gl_driver_loading_time = 3
9893            [(android.os.statsd.log_mode) = MODE_BYTES];
9894
9895    // Vulkan driver loading time info.
9896    optional GpuDriverLoadingTime vk_driver_loading_time = 4
9897            [(android.os.statsd.log_mode) = MODE_BYTES];
9898
9899    // Angle driver loading time info.
9900    optional GpuDriverLoadingTime angle_driver_loading_time = 5
9901            [(android.os.statsd.log_mode) = MODE_BYTES];
9902
9903    // CPU Vulkan implementation is in use.
9904    optional bool cpu_vulkan_in_use = 6;
9905
9906    // App is not doing pre-rotation correctly.
9907    optional bool false_prerotation = 7;
9908
9909    // App creates GLESv1 context.
9910    optional bool gles_1_in_use = 8;
9911}
9912
9913/*
9914 * Logs the size of the system ion heap.
9915 *
9916 * Pulled from StatsCompanionService.
9917 */
9918message SystemIonHeapSize {
9919    // Deprecated due to limited support of ion stats in debugfs.
9920    // Use `IonHeapSize` instead.
9921    option deprecated = true;
9922
9923    // Size of the system ion heap in bytes.
9924    // Read from debugfs.
9925    optional int64 size_in_bytes = 1;
9926}
9927
9928/*
9929 * Logs the total size of the ion heap.
9930 *
9931 * Pulled from StatsCompanionService.
9932 */
9933message IonHeapSize {
9934    // Total size of all ion heaps in kilobytes.
9935    // Read from: /sys/kernel/ion/total_heaps_kb.
9936    optional int32 total_size_kb = 1;
9937}
9938
9939/*
9940 * Logs the per-process size of the system ion heap.
9941 *
9942 * Pulled from StatsCompanionService.
9943 */
9944message ProcessSystemIonHeapSize {
9945    // The uid if available. -1 means not available.
9946    optional int32 uid = 1 [(is_uid) = true];
9947
9948    // The process name (from /proc/PID/cmdline).
9949    optional string process_name = 2;
9950
9951    // Sum of sizes of all allocations.
9952    optional int32 total_size_in_kilobytes = 3;
9953
9954    // Number of allocations.
9955    optional int32 allocation_count = 4;
9956
9957    // Size of the largest allocation.
9958    optional int32 max_size_in_kilobytes = 5;
9959}
9960
9961/*
9962 * Logs system-wide (primarily kernel) memory stats. Sourced from
9963 * /proc/meminfo unless explicitly stated otherwise.
9964 *
9965 * Pulled from StatsCompanionService.
9966 */
9967message SystemMemory {
9968    // /proc/meminfo SUnreclaim
9969    optional int32 unreclaimable_slab_kb = 1;
9970
9971    // /proc/meminfo VmallocUsed
9972    optional int32 vmalloc_used_kb = 2;
9973
9974    // /proc/meminfo PageTables
9975    optional int32 page_tables_kb = 3;
9976
9977    // /proc/meminfo KernelStack
9978    optional int32 kernel_stack_kb = 4;
9979
9980    // Total unreclaimable ion.
9981    // Reported from os.Debug.getIonHeapsSizeKb (R+)
9982    optional int32 total_ion_kb = 5;
9983
9984    // Measures for the amount of memory we could not account for.
9985    // Essentially points to kernel allocations (as all userspace allocs are
9986    // already tracked).
9987    // Device-specific.
9988    optional int32 unaccounted_kb = 6;
9989
9990    // GPU kernel driver allocations.
9991    // Can overlap with ion memory.
9992    // Reported from os.Debug.getGpuTotalUsageKb (S+)
9993    optional int32 gpu_total_usage_kb = 7;
9994
9995    // GPU kernel driver private allocations.
9996    // Does not overlap with ion memory
9997    // Computed as total usage - Debug.getGpuDmaBufUsageKb()
9998    // Only available on supported kernel versions (5.4+)
9999    optional int32 gpu_private_usage_kb = 8;
10000
10001    // Total DMABUF memory allocations
10002    // Reported from os.Debug.getDmabufTotalExportedKb (S+)
10003    optional int32 dmabuf_total_exported_kb = 9;
10004}
10005
10006/*
10007 * Log dmabuf memory retained by userspace processes.
10008 * Pulled from StatsPullAtomService.
10009 */
10010 message ProcessDmabufMemory {
10011  // The uid if available. -1 means not available.
10012  optional int32 uid = 1 [(is_uid) = true];
10013
10014  // The process name (from ActivityManager).
10015  optional string process_name = 2;
10016
10017  // OOM adj score.
10018  optional int32 oom_adj_score = 3;
10019
10020  // Size of dmabufs retained by the process. The buffers are either mapped,
10021  // retained via an fd, or both.
10022  // Only available on supported kernel versions (5.4+). When unavailable, set
10023  // to -1.
10024  optional int32 retained_dmabuf_kb = 4;
10025
10026  // Number of buffers retained by the process (mapped / fd).
10027  // Only available on supported kernel versions (5.4+). When unavailable, set
10028  // to -1.
10029  optional int32 retained_dmabuf_count = 5;
10030
10031  // Size of dmabufs mapped to the process address space.
10032  optional int32 mapped_dmabuf_kb = 6;
10033
10034  // Number of dmabufs mapped to the process address space.
10035  optional int32 mapped_dmabuf_count = 7;
10036}
10037
10038/**
10039 * Push network stack events.
10040 *
10041 * Log from:
10042 *     frameworks/base/packages/NetworkStack/
10043 */
10044message NetworkStackReported {
10045    // The id that indicates the event reported from NetworkStack.
10046    optional int32 event_id = 1;
10047    // The data for the reported events.
10048    optional android.stats.connectivity.NetworkStackEventData network_stack_event = 2 [(log_mode) = MODE_BYTES];
10049}
10050
10051/**
10052 * Logs the apps that are installed on the external storage.
10053 * Pulled from:
10054 *   StatsCompanionService
10055 */
10056message AppsOnExternalStorageInfo {
10057    // The type of the external storage.
10058    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
10059    // The name of the package that is installed on the external storage.
10060    optional string package_name = 2;
10061}
10062
10063/**
10064 * Logs the settings related to Face.
10065 * Logged from:
10066 *   frameworks/base/services/core/java/com/android/server/stats
10067 */
10068message FaceSettings {
10069    // Whether or not face unlock is allowed on Keyguard.
10070    optional bool unlock_keyguard_enabled = 1;
10071    // Whether or not face unlock dismisses the Keyguard.
10072    optional bool unlock_dismisses_keyguard = 2;
10073    // Whether or not face unlock requires attention.
10074    optional bool unlock_attention_required = 3;
10075    // Whether or not face unlock is allowed for apps (through BiometricPrompt).
10076    optional bool unlock_app_enabled = 4;
10077    // Whether or not face unlock always requires user confirmation.
10078    optional bool unlock_always_require_confirmation = 5;
10079    // Whether or not a diverse set of poses are required during enrollment.
10080    optional bool unlock_diversity_required = 6;
10081}
10082
10083/**
10084 * Logs cooling devices maintained by the kernel.
10085 *
10086 * Pulled from StatsCompanionService.java
10087 */
10088message CoolingDevice {
10089    // The type of cooling device being reported. Eg. CPU, GPU...
10090    optional android.os.CoolingTypeEnum device_location = 1;
10091    // The name of the cooling device source. Eg. CPU0
10092    optional string device_name = 2;
10093    // Current throttle state of the cooling device. The value can any unsigned
10094    // integer between 0 and max_state defined in its driver. 0 means device is
10095    // not in throttling, higher value means deeper throttling.
10096    optional int32 state = 3;
10097}
10098
10099/**
10100 * Intelligence has several counter-type events that don't warrant a
10101 * full separate atom. These are primarily API call counters but also include
10102 * counters for feature usage and specific failure modes.
10103 *
10104 * Logged from the Intelligence mainline module.
10105 */
10106message IntelligenceEventReported {
10107  // The event type.
10108  optional android.stats.intelligence.EventType event_id = 1;
10109  // Success, failure.
10110  optional android.stats.intelligence.Status status = 2;
10111  // How many times the event occured (to report a batch of high frequency events).
10112  optional int32 count = 3;
10113  // How long the event took (sum of durations if count > 1)
10114  optional int64 duration_millis = 4;
10115}
10116
10117/**
10118 * Logs when Car Power state changed.
10119 *
10120 * Logged from:
10121 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
10122 */
10123message CarPowerStateChanged {
10124    // States come from CpmsState in CarPowerManagementService.java.
10125    enum State {
10126       WAIT_FOR_VHAL = 0;
10127       ON = 1;
10128       SHUTDOWN_PREPARE = 2;
10129       WAIT_FOR_FINISH = 3;
10130       SUSPEND = 4;
10131       SIMULATE_SLEEP = 5;
10132    }
10133    optional State state = 1;
10134}
10135
10136/**
10137 * Logs when Car User Hal is requested to switch/create/remove user.
10138 *
10139 * Logged from:
10140 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10141 */
10142message CarUserHalModifyUserRequestReported {
10143    // Request id for the request.
10144    optional int32 request_id = 1;
10145    // Request type.
10146    enum RequestType {
10147        UNKNOWN = 0;
10148        // Car user manager requested user switch.
10149        SWITCH_REQUEST_ANDROID = 1;
10150        // OEM requested User switch.
10151        SWITCH_REQUEST_OEM = 2;
10152        // Hal switch requested after android switch using activity manager.
10153        SWITCH_REQUEST_LEGACY = 3;
10154        // Create User
10155        CREATE_REQUEST = 4;
10156        // Remove User
10157        REMOVE_REQUEST = 5;
10158    }
10159    optional RequestType request_type = 2;
10160    // Android User id of the current user which can only be 0, 10, 11 and so on.
10161    // -1 if not available.
10162    optional int32 user_id = 3;
10163    // VHAL flags of the current user. (-1 if not available)
10164    optional int32 user_flags = 4;
10165    // Android User id of the target user for switch/create/remove. It can only
10166    // be 0, 10, 11 and so on. -1 if not available.
10167    optional int32 target_user_id = 5;
10168    // VHAL flags of the target user for switch/create/remove. (-1 if not available)
10169    optional int32 target_user_flags = 6;
10170    // Request timeout Milliseconds (-1 if not available)
10171    optional int32 timeout_millis = 7;
10172}
10173
10174/**
10175 * Logs when Car User Hal responds to switch/create user request.
10176 *
10177 * Logged from:
10178 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10179 */
10180message CarUserHalModifyUserResponseReported {
10181    // Request id of the request associated with the response.
10182    optional int32 request_id = 1;
10183    // Car user hal callback status.
10184    enum CallbackStatus {
10185        UNKNOWN = 0;
10186        // Hal response was invalid.
10187        INVALID = 1;
10188        // Hal response was ok.
10189        OK = 2;
10190        // Hal timeout during set call.
10191        HAL_SET_TIMEOUT = 3;
10192        // Hal response timeout.
10193        HAL_RESPONSE_TIMEOUT = 4;
10194        // Hal responded with wrong info.
10195        WRONG_HAL_RESPONSE = 5;
10196        // Hal is processing multiple requests simultaneously.
10197        CONCURRENT_OPERATION = 6;
10198    }
10199    optional CallbackStatus callback_status = 2;
10200
10201    // Hal request status for user switch/create/remove.
10202    enum HalRequestStatus {
10203        UNSPECIFIED = 0;
10204        // Hal request for user switch/create is successful.
10205        SUCCESS = 1;
10206        // Hal request for user switch/create failed.
10207        FAILURE = 2;
10208    }
10209    optional HalRequestStatus request_status = 3;
10210}
10211
10212/**
10213 * Logs when post switch response is posted to Car User Hal.
10214 *
10215 * Logged from:
10216 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10217 */
10218message CarUserHalPostSwitchResponseReported {
10219    // Request id.
10220    optional int32 request_id = 1;
10221
10222    // Android user switch status.
10223    enum UserSwitchStatus {
10224        UNKNOWN = 0;
10225        // Android user switch is successful.
10226        SUCCESS = 1;
10227        // Android user switch failed.
10228        FAILURE = 2;
10229    }
10230    optional UserSwitchStatus switch_status = 2;
10231}
10232
10233/**
10234 * Logs when initial user information is requested from Car User Hal.
10235 *
10236 * Logged from:
10237 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10238 */
10239message CarUserHalInitialUserInfoRequestReported {
10240    // Request id for the request.
10241    optional int32 request_id = 1;
10242
10243    // Request type for initial user information.
10244    enum InitialUserInfoRequestType {
10245        UNKNOWN = 0;
10246        // At the first time Android was booted (or after a factory reset).
10247        FIRST_BOOT = 1;
10248        // At the first time Android was booted after the system was updated.
10249        FIRST_BOOT_AFTER_OTA = 2;
10250        // When Android was booted "from scratch".
10251        COLD_BOOT = 3;
10252        // When Android was resumed after the system was suspended to memory.
10253        RESUME = 4;
10254    }
10255    optional InitialUserInfoRequestType request_type = 2;
10256    // Request timeout Milliseconds (-1 if not available)
10257    optional int32 timeout_millis = 3;
10258}
10259
10260/**
10261 * Logs when Car User Hal responds to initial user information requests.
10262 *
10263 * Logged from:
10264 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10265 */
10266message CarUserHalInitialUserInfoResponseReported {
10267    // Request id of the request associated with the response.
10268    optional int32 request_id = 1;
10269    // Car user hal callback status.
10270    enum CallbackStatus {
10271        UNKNOWN = 0;
10272        // Hal response was invalid.
10273        INVALID = 1;
10274        // Hal response was ok.
10275        OK = 2;
10276        // Hal timeout during set call.
10277        HAL_SET_TIMEOUT = 3;
10278        // Hal response timeout.
10279        HAL_RESPONSE_TIMEOUT = 4;
10280        // Hal responded with wrong info.
10281        WRONG_HAL_RESPONSE = 5;
10282        // Hal is processing multiple requests simultaneously.
10283        CONCURRENT_OPERATION = 6;
10284    }
10285    optional CallbackStatus callback_status = 2;
10286    // Response for initial user information request.
10287    enum InitialUserInfoResponseAction {
10288        UNSPECIFIED = 0;
10289        // Let the Android System decide what to do.
10290        DEFAULT = 1;
10291        // Switch to an existing Android user.
10292        SWITCH = 2;
10293        // Create a new Android user (and switch to it).
10294        CREATE = 3;
10295    }
10296    optional InitialUserInfoResponseAction response_action = 3;
10297    // Android User id of the target user which can only be 0, 10, 11 and so on.
10298    // -1 if not available.
10299    optional int32 target_user = 4;
10300    // VHAL flags of the current user. (-1 if not available)
10301    optional int32 target_user_flags = 5;
10302    // User locales
10303    optional string user_locales = 6;
10304}
10305
10306/**
10307 * Logs when set user association is requested from Car User Hal.
10308 *
10309 * Logged from:
10310 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10311 */
10312message CarUserHalUserAssociationRequestReported {
10313    // Request id for the request.
10314    optional int32 request_id = 1;
10315    // Request type.
10316    enum RequestType {
10317        UNKNOWN = 0;
10318        // For setting user association information.
10319        SET = 1;
10320        // For getting user association information.
10321        GET = 2;
10322    }
10323    optional RequestType request_type = 2;
10324    // Android User id of the current user which can only be 0, 10, 11 and so on.
10325    // -1 if not available.
10326    optional int32 current_user_id = 3;
10327    // VHAL flags of the current user. (-1 if not available)
10328    optional int32 current_user_flags = 4;
10329    // Number of the set associations requested.
10330    optional int32 number_associations = 5;
10331    // Concatenated string for the types from set associations request.
10332    // This is a string converted from an array of integers.
10333    optional string user_identification_association_types = 6;
10334    // Concatenated string for the values from set associations request.
10335    // This is a string converted from an array of integers.
10336    optional string user_identification_association_values = 7;
10337}
10338
10339/**
10340 * Logs when Car User Hal responds to set user association requests.
10341 *
10342 * Logged from:
10343 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10344 */
10345message CarUserHalSetUserAssociationResponseReported {
10346    // Request id of the request associated with the response.
10347    optional int32 request_id = 1;
10348    // Car user hal callback status.
10349    enum CallbackStatus {
10350        UNKNOWN = 0;
10351        // Hal response was invalid.
10352        INVALID = 1;
10353        // Hal response was ok.
10354        OK = 2;
10355        // Hal timeout during set call.
10356        HAL_SET_TIMEOUT = 3;
10357        // Hal response timeout.
10358        HAL_RESPONSE_TIMEOUT = 4;
10359        // Hal responded with wrong info.
10360        WRONG_HAL_RESPONSE = 5;
10361        // Hal is processing multiple requests simultaneously.
10362        CONCURRENT_OPERATION = 6;
10363    }
10364    optional CallbackStatus callback_status = 2;
10365    // Number of the set associations in the response.
10366    optional int32 number_associations = 3;
10367    // Concatenated string for the types from set associations request.
10368    // This is a string converted from an array of integers.
10369    optional string user_identification_association_types = 4;
10370    // Concatenated string for the values from set associations request.
10371    // This is a string converted from an array of integers.
10372    optional string user_identification_association_values = 5;
10373}
10374
10375/**
10376 * Logs whether GarageMode is entered.
10377 *
10378 * Logged from:
10379 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
10380 */
10381message GarageModeInfo {
10382    // Whether GarageMode is entered.
10383    optional bool is_garage_mode = 1;
10384}
10385
10386/**
10387 * Historical app ops data per package.
10388 */
10389message AppOps {
10390    // Uid of the package requesting the op
10391    optional int32 uid = 1 [(is_uid) = true];
10392
10393    // Name of the package performing the op
10394    optional string package_name = 2;
10395
10396    // operation id
10397    optional android.app.AppOpEnum op_id = 3 [default = APP_OP_NONE];
10398
10399    // The number of times the op was granted while the app was in the
10400    // foreground (only for trusted requests)
10401    optional int64 trusted_foreground_granted_count = 4;
10402
10403    // The number of times the op was granted while the app was in the
10404    // background (only for trusted requests)
10405    optional int64 trusted_background_granted_count = 5;
10406
10407    // The number of times the op was rejected while the app was in the
10408    // foreground (only for trusted requests)
10409    optional int64 trusted_foreground_rejected_count = 6;
10410
10411    // The number of times the op was rejected while the app was in the
10412    // background (only for trusted requests)
10413    optional int64 trusted_background_rejected_count = 7;
10414
10415    // For long-running operations, total duration of the operation
10416    // while the app was in the foreground (only for trusted requests)
10417    optional int64 trusted_foreground_duration_millis = 8;
10418
10419    // For long-running operations, total duration of the operation
10420    // while the app was in the background (only for trusted requests)
10421    optional int64 trusted_background_duration_millis = 9;
10422
10423    // Whether AppOps is guarded by Runtime permission
10424    optional bool is_runtime_permission = 10;
10425}
10426
10427/**
10428 * Historical app ops data per package and attribution tag.
10429 */
10430message AttributedAppOps {
10431    // Uid of the package requesting the op
10432    optional int32 uid = 1 [(is_uid) = true];
10433
10434    // Name of the package performing the op
10435    optional string package_name = 2;
10436
10437    // tag; provided by developer when accessing related API, limited at 50 chars by API.
10438    // Attributions must be provided through manifest using <attribution> tag available in R and
10439    // above.
10440    optional string tag = 3;
10441
10442    // operation id
10443    optional android.app.AppOpEnum op = 4 [default = APP_OP_NONE];
10444
10445    // The number of times the op was granted while the app was in the
10446    // foreground (only for trusted requests)
10447    optional int64 trusted_foreground_granted_count = 5;
10448
10449    // The number of times the op was granted while the app was in the
10450    // background (only for trusted requests)
10451    optional int64 trusted_background_granted_count = 6;
10452
10453    // The number of times the op was rejected while the app was in the
10454    // foreground (only for trusted requests)
10455    optional int64 trusted_foreground_rejected_count = 7;
10456
10457    // The number of times the op was rejected while the app was in the
10458    // background (only for trusted requests)
10459    optional int64 trusted_background_rejected_count = 8;
10460
10461    // For long-running operations, total duration of the operation
10462    // while the app was in the foreground (only for trusted requests)
10463    optional int64 trusted_foreground_duration_millis = 9;
10464
10465    // For long-running operations, total duration of the operation
10466    // while the app was in the background (only for trusted requests)
10467    optional int64 trusted_background_duration_millis = 10;
10468
10469    // Whether AppOps is guarded by Runtime permission
10470    optional bool is_runtime_permission = 11;
10471
10472    // Sampling rate used on device, from 0 to 100
10473    optional int32 sampling_rate = 12;
10474}
10475
10476/**
10477 * Location Manager API Usage information(e.g. API under usage,
10478 * API call's parameters).
10479 * Logged from:
10480 *  frameworks/base/services/core/java/com/android/server/LocationManagerService.java
10481 */
10482message LocationManagerApiUsageReported {
10483
10484    // Indicating if usage starts or usage ends.
10485    optional android.stats.location.UsageState state = 1;
10486
10487    // LocationManagerService's API in use.
10488    // We can identify which API from LocationManager is
10489    // invoking current LMS API by the combination of
10490    // API parameter(e.g. is_listener_null, is_intent_null,
10491    // is_location_request_null)
10492    optional android.stats.location.LocationManagerServiceApi api_in_use = 2;
10493
10494    // Name of the package calling the API.
10495    optional string calling_package_name = 3;
10496
10497    // Type of the location provider.
10498    optional android.stats.location.ProviderType provider = 4;
10499
10500    // Quality of the location request
10501    optional android.stats.location.LocationRequestQuality quality = 5;
10502
10503    // The desired interval for active location updates, in milliseconds.
10504    // Bucketized to reduce cardinality.
10505    optional android.stats.location.LocationRequestIntervalBucket bucketized_interval = 6;
10506
10507    // Minimum distance between location updates, in meters.
10508    // Bucketized to reduce cardinality.
10509    optional android.stats.location.SmallestDisplacementBucket
10510            bucketized_smallest_displacement = 7;
10511
10512    // The number of location updates.
10513    optional int64 num_updates = 8;
10514
10515    // The request expiration time, in millisecond since boot.
10516    // Bucketized to reduce cardinality.
10517    optional android.stats.location.ExpirationBucket
10518            bucketized_expire_in = 9;
10519
10520    // Type of Callback passed in for this API.
10521    optional android.stats.location.CallbackType callback_type = 10;
10522
10523    // The radius of the central point of the alert
10524    // region, in meters. Only for API REQUEST_GEOFENCE.
10525    // Bucketized to reduce cardinality.
10526    optional android.stats.location.GeofenceRadiusBucket bucketized_radius = 11;
10527
10528    // Activity Importance of API caller.
10529    // Categorized to 3 types that are interesting from location's perspective.
10530    optional android.stats.location.ActivityImportance activiy_importance = 12;
10531
10532    // Attribution tag passed to this API.
10533    optional string attribution_tag = 13;
10534}
10535
10536/**
10537 * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
10538 */
10539message ReviewPermissionsFragmentResultReported {
10540    // unique value identifying a permission group change. A permission group change might result
10541    // in multiple of these atoms
10542    optional int64 change_id = 1;
10543
10544    // UID of package the permission belongs to
10545    optional int32 uid = 2 [(is_uid) = true];
10546
10547    // Name of package the permission belongs to
10548    optional string package_name = 3;
10549
10550    // The permission to be granted
10551    optional string permission_name = 4;
10552
10553    // The result of the permission grant
10554    optional bool permission_granted = 5;
10555}
10556
10557/**
10558* Information about results of permission upgrade by RuntimePermissionsUpgradeController
10559* Logged from: RuntimePermissionUpdgradeController
10560*/
10561message RuntimePermissionsUpgradeResult {
10562    // Permission granted as result of upgrade
10563    optional string permission_name = 1;
10564
10565    // UID of package granted permission
10566    optional int32 uid = 2 [(is_uid) = true];
10567
10568    // Name of package granted permission
10569    optional string package_name = 3;
10570}
10571
10572/**
10573* Information about a buttons presented in GrantPermissionsActivty and choice made by user
10574*/
10575message GrantPermissionsActivityButtonActions {
10576    // Permission granted as result of upgrade
10577    optional string permission_group_name = 1;
10578
10579    // UID of package granted permission
10580    optional int32 uid = 2 [(is_uid) = true];
10581
10582    // Name of package requesting permission
10583    optional string package_name = 3;
10584
10585    // Buttons presented in the dialog - bit flags, bit numbers are in accordance with
10586    // LABEL_ constants in GrantPermissionActivity.java
10587    optional int32 buttons_presented = 4;
10588
10589    // Button clicked by user - same as bit flags in buttons_presented with only single bit set
10590    optional int32 button_clicked = 5;
10591
10592    // id which identifies single session of user interacting with permission controller
10593    optional int64 session_id = 6;
10594
10595    // Target SDK of the package
10596    optional int32 target_sdk = 7;
10597
10598    // Selected precision of the location permission - bit flags indicate which
10599    // locations were chosen
10600    optional int32 selected_precision = 8;
10601}
10602
10603/**
10604 * Information about LocationAccessCheck notification presented to user
10605 */
10606message LocationAccessCheckNotificationAction {
10607
10608    // id which identifies single session of user interacting with permission controller
10609    optional int64 session_id = 1;
10610
10611    // Uid of package for which location access check is presented
10612    optional int32 package_uid = 2;
10613
10614    // Name of package for which location access check is presented
10615    optional string package_name = 3;
10616
10617    enum Result {
10618        UNDEFINED = 0;
10619        // notification was presented to the user
10620        NOTIFICATION_PRESENTED = 1;
10621        // notification was declined by the user
10622        NOTIFICATION_DECLINED = 2;
10623        // notification was clicked by the user
10624        NOTIFICATION_CLICKED = 3;
10625    }
10626
10627    // View / interaction recorded
10628    optional Result result = 4;
10629}
10630
10631/**
10632 * Information about a permission grant or revoke made by user inside AppPermissionFragment
10633 */
10634message AppPermissionFragmentActionReported {
10635    // id which identifies single session of user interacting with permission controller
10636    optional int64 session_id = 1;
10637
10638    // unique value identifying a permission group change. A permission group change might result
10639    // in multiple of these atoms
10640    optional int64 change_id = 2;
10641
10642    // UID of package the permission belongs to
10643    optional int32 uid = 3 [(is_uid) = true];
10644
10645    // Name of package the permission belongs to
10646    optional string package_name = 4;
10647
10648    // The permission to be granted
10649    optional string permission_name = 5;
10650
10651    // The result of the permission grant
10652    optional bool permission_granted = 6;
10653
10654    // State of Permission Flags after grant as per android.content.pm.PermissionFlags
10655    optional int32 permission_flags = 7;
10656
10657    enum Button {
10658        UNDEFINED = 0;
10659        // Allow button
10660        ALLOW = 1;
10661        // Deny button
10662        DENY = 2;
10663        // Ask every time button
10664        ASK_EVERY_TIME = 3;
10665        // Allow all the time button
10666        ALLOW_ALWAYS = 4;
10667        // Allow only while using the app button
10668        ALLOW_FOREGROUND = 5;
10669        // Same is Deny button but shown in while in use dialog
10670        DENY_FOREGROUND = 6;
10671        // Switch button set to ON for location accuracy
10672        GRANT_FINE_LOCATION = 7;
10673        // Switch button set to OFF for location accuracy
10674        REVOKE_FINE_LOCATION = 8;
10675    }
10676
10677    // Button pressed in the dialog
10678    optional Button button_pressed = 8;
10679}
10680
10681/**
10682* Information about a AppPermissionFragment viewed by user
10683*/
10684message AppPermissionFragmentViewed {
10685    // id which identifies single session of user interacting with permission controller
10686    optional int64 session_id = 1;
10687
10688    // UID of package for which permissions are viewed
10689    optional int32 uid = 2 [(is_uid) = true];
10690
10691    // Name of package for which permissions are viewed
10692    optional string package_name = 3;
10693
10694    // Permission group viewed
10695    optional string permission_group_name = 4;
10696}
10697
10698/**
10699* Information about a AppPermissionGroupsFragment viewed by user. Fragment has been renamed, but
10700* the log retains the old fragment name.
10701*/
10702message AppPermissionsFragmentViewed {
10703    // id which identifies single session of user interacting with permission controller
10704    optional int64 session_id = 1;
10705
10706    // id which identifies single view as every view might have several logging records
10707    // with different package information attached
10708    optional int64 view_id = 2;
10709
10710    // Permission group viewed
10711    optional string permission_group_name = 3;
10712
10713    // UID of package for which permissions are viewed
10714    optional int32 uid = 4 [(is_uid) = true];
10715
10716    // Name of package for which permissions are viewed
10717    optional string package_name = 5;
10718
10719    // Category in which permission is included
10720    enum Category {
10721      UNDEFINED = 0;
10722      ALLOWED = 1;
10723      ALLOWED_FOREGROUND = 2;
10724      DENIED = 3;
10725    }
10726    optional Category category = 6;
10727}
10728/**
10729* Information about a PermissionAppsFragment viewed by user.
10730* Logged from ui/handheld/PermissionAppsFragment.java
10731*/
10732message PermissionAppsFragmentViewed {
10733    // id which identifies single session of user interacting with permission controller
10734    optional int64 session_id = 1;
10735
10736    // id which identifies single view as every view might have several logging records
10737    // with different package information attached
10738    optional int64 view_id = 2;
10739
10740    // Permission group viewed
10741    optional string permission_group_name = 3;
10742
10743    // UID of package for which permissions are viewed
10744    optional int32 uid = 4 [(is_uid) = true];
10745
10746    // Name of package for which permissions are viewed
10747    optional string package_name = 5;
10748
10749    // Category in which app is included
10750    enum Category {
10751        UNDEFINED = 0;
10752        ALLOWED = 1;
10753        ALLOWED_FOREGROUND = 2;
10754        DENIED = 3;
10755    }
10756    optional Category category = 6;
10757}
10758
10759/**
10760* Log that the Auto Revoke notification has been clicked
10761* Logged from ui/ManagePermissionsActivity
10762*/
10763message AutoRevokeNotificationClicked {
10764    // id which identifies single session of user interacting with permission controller
10765    optional int64 session_id = 1;
10766}
10767
10768/**
10769* Log that an app has been displayed on the auto revoke page, and lists one permission that was
10770* auto revoked for it.
10771* Logged from ui/handheld/AutoRevokeFragment
10772*/
10773message AutoRevokeFragmentAppViewed {
10774    // id which identifies single session of user interacting with permission controller
10775    optional int64 session_id = 1;
10776
10777    // UID of package for which permissions are viewed
10778    optional int32 uid = 2 [(is_uid) = true];
10779
10780    // Name of package for which permissions are viewed
10781    optional string package_name = 3;
10782
10783    // The name of a permission group that has been revoked
10784    optional string permission_group_name = 4;
10785
10786    // The age of the app- more than three months old, or more than six months
10787    enum Age {
10788        UNDEFINED = 0;
10789        NEWER_BUCKET = 1;
10790        OLDER_BUCKET = 2;
10791    }
10792
10793    // How long the app has been unused. Currently, newer bucket is 3 months, older is 6 months
10794    optional Age age = 5;
10795}
10796
10797/**
10798* Log that the user has interacted with an app on the auto revoke fragment
10799* Logged from ui/handheld/AutoRevokeFragment
10800*/
10801message AutoRevokedAppInteraction {
10802    // id which identifies single session of user interacting with permission controller
10803    optional int64 session_id = 1;
10804
10805    // UID of package for which permissions are viewed
10806    optional int32 uid = 2 [(is_uid) = true];
10807
10808    // Name of package for which permissions are viewed
10809    optional string package_name = 3;
10810
10811    enum Action {
10812        UNDEFINED = 0;
10813        REMOVE = 1;
10814        OPEN = 2;
10815        APP_INFO = 3;
10816        PERMISSIONS = 4;
10817        REMOVE_IN_SETTINGS = 5;
10818        OPEN_IN_SETTINGS = 6;
10819    }
10820
10821    // The action the user took to interact with the app
10822    optional Action action = 4;
10823}
10824
10825/**
10826* Log that the AppPermissionGroupsFragment has been interacted with for the possible purposes of
10827* auto revoke, or that the auto revoke switch has been changed
10828* Logged from ui/handheld/AppPermissionGroupsFragment
10829 */
10830message AppPermissionGroupsFragmentAutoRevokeAction {
10831    // id which identifies single session of user interacting with permission controller
10832    optional int64 session_id = 1;
10833
10834    // UID of package for which permissions are viewed
10835    optional int32 uid = 2 [(is_uid) = true];
10836
10837    // Name of package for which permissions are viewed
10838    optional string package_name = 3;
10839
10840    enum Action {
10841        UNDEFINED = 0;
10842        OPENED_FOR_AUTO_REVOKE = 1;
10843        OPENED_FROM_INTENT = 2;
10844        SWITCH_ENABLED = 3;
10845        SWITCH_DISABLED = 4;
10846    }
10847
10848    // The action the user took to interact with the fragment
10849    optional Action action = 4;
10850}
10851
10852/**
10853 * Logs when there is a smart selection related event.
10854 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10855 * Logged from: TextClassifierEventLogger.java
10856 */
10857message TextSelectionEvent {
10858    // A session ID.
10859    optional string session_id = 1;
10860
10861    // Event type of this event.
10862    optional android.stats.textclassifier.EventType event_type = 2;
10863
10864    // Name of the annotator model that is involved in this event.
10865    optional string model_name = 3;
10866
10867    // Type of widget that was involved in triggering this event.
10868    optional android.stats.textclassifier.WidgetType widget_type = 4;
10869
10870    // Index of this event in a session.
10871    optional int32 event_index = 5;
10872
10873    // Entity type that is involved.
10874    optional string entity_type = 6;
10875
10876    // Relative word index of the start of the selection.
10877    optional int32 relative_word_start_index = 7;
10878
10879    // Relative word (exclusive) index of the end of the selection.
10880    optional int32 relative_word_end_index = 8;
10881
10882    // Relative word index of the start of the smart selection.
10883    optional int32 relative_suggested_word_start_index = 9;
10884
10885    // Relative word (exclusive) index of the end of the smart selection.
10886    optional int32 relative_suggested_word_end_index = 10;
10887
10888    // Name of source package.
10889    optional string package_name = 11;
10890
10891    // Name of the LangID model that is involved in this event.
10892    optional string langid_model_name = 12;
10893}
10894
10895/**
10896 * Logs when there is a smart linkify related event.
10897 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10898 * Logged from: TextClassifierEventLogger.java
10899 */
10900message TextLinkifyEvent {
10901    // A session ID.
10902    optional string session_id = 1;
10903
10904    // Event type of this event.
10905    optional android.stats.textclassifier.EventType event_type = 2;
10906
10907    // Name of the annotator model that is involved in this event.
10908    optional string model_name = 3;
10909
10910    // Type of widget that was involved in triggering this event.
10911    optional android.stats.textclassifier.WidgetType widget_type = 4;
10912
10913    // Index of this event in a session.
10914    optional int32 event_index = 5;
10915
10916    // Entity type that is involved.
10917    optional string entity_type = 6;
10918
10919    // Number of links detected.
10920    optional int32 num_links = 7;
10921
10922    // The total length of all links.
10923    optional int32 linked_text_length = 8;
10924
10925    // Length of input text.
10926    optional int32 text_length = 9;
10927
10928    // Time spent on generating links in ms.
10929    optional int64 latency_millis = 10;
10930
10931    // Name of source package.
10932    optional string package_name = 11;
10933
10934    // Name of the LangID model that is involved in this event.
10935    optional string langid_model_name = 12;
10936}
10937
10938/**
10939 * Logs when there is a conversation actions related event.
10940 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10941 * Logged from: TextClassifierEventLogger.java
10942 */
10943message ConversationActionsEvent {
10944    // A session ID.
10945    optional string session_id = 1;
10946
10947    // Event type of this event.
10948    optional android.stats.textclassifier.EventType event_type = 2;
10949
10950    // Name of the actions model that is involved in this event.
10951    optional string model_name = 3;
10952
10953    // Type of widget that was involved in triggering this event.
10954    optional android.stats.textclassifier.WidgetType widget_type = 4;
10955
10956    // The first entity type that is involved.
10957    optional string first_entity_type = 5;
10958
10959    // The second entity type that is involved.
10960    optional string second_entity_type = 6;
10961
10962    // The third entity type that is involved.
10963    optional string third_entity_type = 7;
10964
10965    // The score of the first entity type.
10966    optional float score = 8;
10967
10968    // Name of source package.
10969    optional string package_name = 9;
10970
10971    // Name of the annotator model that is involved in this event.
10972    optional string annotator_model_name = 10;
10973
10974    // Name of the LangID model that is involved in this event.
10975    optional string langid_model_name = 11;
10976}
10977
10978/**
10979 * Logs when there is a language detection related event.
10980 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10981 * Logged from: TextClassifierEventLogger.java
10982 */
10983message LanguageDetectionEvent {
10984    // A session ID.
10985    optional string session_id = 1;
10986
10987    // Event type of this event.
10988    optional android.stats.textclassifier.EventType event_type = 2;
10989
10990    // Name of the language detection model that is involved in this event.
10991    optional string model_name = 3;
10992
10993    // Type of widget that was involved in triggering this event.
10994    optional android.stats.textclassifier.WidgetType widget_type = 4;
10995
10996    // Detected language.
10997    optional string language_tag = 5;
10998
10999    // Score of the detected language.
11000    optional float score = 6;
11001
11002    // Position of this action.
11003    optional int32 action_index = 7;
11004
11005    // Name of source package.
11006    optional string package_name = 8;
11007}
11008
11009/**
11010 * Information about an OTA update attempt by update_engine.
11011 * Logged from platform/system/update_engine/metrics_reporter_android.cc
11012 */
11013message UpdateEngineUpdateAttemptReported {
11014    // The number of attempts for the update engine to apply a given payload.
11015    optional int32 attempt_number = 1;
11016
11017    optional android.stats.otaupdate.PayloadType payload_type = 2;
11018
11019    // The total time in minutes for the update engine to apply a given payload.
11020    // The time is calculated by calling clock_gettime() / CLOCK_BOOTTIME; and
11021    // it's increased when the system is sleeping.
11022    optional int32 duration_boottime_in_minutes = 3;
11023
11024    // The total time in minutes for the update engine to apply a given payload.
11025    // The time is calculated by calling clock_gettime() / CLOCK_MONOTONIC_RAW;
11026    // and it's not increased when the system is sleeping.
11027    optional int32 duration_monotonic_in_minutes = 4;
11028
11029    // The size of the payload in MiBs.
11030    optional int32 payload_size_mib = 5;
11031
11032    // The attempt result reported by the update engine for an OTA update.
11033    optional android.stats.otaupdate.AttemptResult attempt_result = 6;
11034
11035    // The error code reported by the update engine after an OTA update attempt
11036    // on A/B devices.
11037    optional android.stats.otaupdate.ErrorCode error_code = 7;
11038
11039    // The build fingerprint of the source system. The value is read from a
11040    // system property when the device takes the update. e.g.
11041    // Android/aosp_sailfish/sailfish:10/QP1A.190425.004/5507117:userdebug/test-keys
11042    optional string source_fingerprint = 8;
11043
11044    // Size of super partition.
11045    optional int64 super_partition_size_bytes = 9;
11046
11047    // Size of current slot within the super partition.
11048    optional int64 slot_size_bytes = 10;
11049
11050    // Free space available in the super partition.
11051    optional int64 super_free_space_bytes = 11;
11052
11053    // Whether the device enables Virtual A/B compression.
11054    optional bool vab_compression_enabled = 12;
11055
11056    // Whether this update attempt uses Virtual A/B compression.
11057    optional bool vab_compression_used = 13;
11058}
11059
11060/**
11061 * Information about all the attempts the device make before finishing the
11062 * successful update.
11063 * Logged from platform/system/update_engine/metrics_reporter_android.cc
11064 */
11065message UpdateEngineSuccessfulUpdateReported {
11066    // The number of attempts for the update engine to apply the payload for a
11067    // successful update.
11068    optional int32 attempt_count = 1;
11069
11070    optional android.stats.otaupdate.PayloadType payload_type = 2;
11071
11072    optional int32 payload_size_mib = 3;
11073
11074    // The total number of bytes downloaded by update_engine since the last
11075    // successful update.
11076    optional int32 total_bytes_downloaded_mib = 4;
11077
11078    // The ratio in percentage of the over-downloaded bytes compared to the
11079    // total bytes needed to successfully install the update. e.g. 200 if we
11080    // download 200MiB in total for a 100MiB package.
11081    optional int32 download_overhead_percentage = 5;
11082
11083    // The total time in minutes for the update engine to apply the payload for a
11084    // successful update.
11085    optional int32 total_duration_minutes = 6;
11086
11087    // The number of reboot of the device during a successful update.
11088    optional int32 reboot_count = 7;
11089
11090    // Whether on device verity computation is enabled
11091    optional bool fec_enabled = 8;
11092
11093    // Whether on device hash tree computation is enabled
11094    optional bool hash_tree_enabled = 9;
11095
11096}
11097
11098/**
11099 * Reported when a client requests to prepare for resume on reboot.
11100 *
11101 * Logged from:
11102 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
11103 */
11104message RebootEscrowPreparationReported {
11105  enum Result {
11106    ROR_NEED_PREPARATION = 0;
11107    ROR_SKIP_PREPARATION_AND_NOTIFY = 1;
11108    ROR_SKIP_PREPARATION_NOT_NOTIFY = 2;
11109  }
11110
11111  // The uid of the client who requests ror.
11112  optional int32 requesting_uid = 1 [(is_uid) = true];
11113
11114  optional Result result = 2;
11115
11116  // The number of clients who has requested ror, including the current caller.
11117  optional int32 requested_client_count = 3;
11118}
11119
11120/**
11121 * Reported when the lock screen knowledge factor is captured, while there are clients of
11122 * resume on reboot to notify.
11123 *
11124 * Logged from:
11125 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
11126 */
11127message RebootEscrowLskfCaptureReported {
11128  // The uid of the client to notify about the Lskf capture.
11129  optional int32 uid_to_notify = 1 [(is_uid) = true];
11130
11131  // The total number of clients who have requested ror.
11132  optional int32 requested_client_count = 2;
11133
11134  // The duration between RoR request - current LSKF capture event.
11135  optional int32 duration_ror_requested_to_lskf_captured_seconds = 3;
11136}
11137
11138/* Reported when a client (e.g. gmscore) requests to reboot with Resume on Reboot.
11139 *
11140 * Logged from:
11141 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
11142 */
11143message RebootEscrowRebootReported {
11144  optional int32 error_code = 1;
11145
11146  // The uid of clients who requested the reboot
11147  optional int32 request_uid = 2 [(is_uid) = true];
11148
11149  // All clients that have prepared for RoR before this reboot
11150  optional int32 prepared_clients_count = 3;
11151
11152  // The RoR request count for the client who requests reboot.
11153  optional int32 request_count = 4;
11154
11155  // Whether the reboot request assumes a slot switch on a/b devices.
11156  optional bool slot_switch = 5;
11157
11158  // True if the DeviceConfig shows the device is using server based RoR.
11159  optional bool server_based = 6;
11160
11161  // The duration between last LSKF captured - reboot requests
11162  optional int32 duration_lskf_captured_to_reboot_seconds = 7;
11163
11164  // The count of LSKF captured since preparation
11165  optional int32 lskf_captured_counts = 8;
11166}
11167
11168/**
11169 * Logs stats for AppSearch function calls
11170 */
11171message AppSearchCallStatsReported {
11172    // The sampling interval for this specific type of stats
11173    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11174    optional int32 sampling_interval = 1;
11175
11176    // # of previous skipped sample for this specific type of stats
11177    // We can't push atoms too closely, so some samples might be skipped
11178    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11179    // For example, the true count of an event could be estimated as:
11180    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11181    optional int32 num_skipped_sample = 2;
11182
11183    // Package UID of the application.
11184    optional int32 uid = 3 [(is_uid) = true];
11185
11186    // Hash of the database name within AppSearch
11187    optional int32 database = 4;
11188
11189    // The status code for the call or internal state.
11190    // Needs to be sync with AppSearchResult#ResultCode in
11191    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11192    optional int32 status_code = 5;
11193
11194    // Overall time used for the end-to-end function call in AppSearch.
11195    // It doesn't include binder latency
11196    optional int32 total_latency_millis = 6;
11197
11198    // Type of the function call value is in sync with
11199    // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/CallStats.java
11200    optional int32 call_type = 7;
11201
11202    // Estimated binder latency (estimated as single-trip time * 2)
11203    optional int32 estimated_binder_latency_millis = 8;
11204
11205    // Number of operations succeeded for batch operations.
11206    optional int32 num_operations_succeeded = 9;
11207
11208    // Number of operations failed for batch operations.
11209    optional int32 num_operations_failed = 10;
11210}
11211
11212/**
11213 * Logs detailed stats for putting a single document in AppSearch
11214 */
11215message AppSearchPutDocumentStatsReported {
11216    // The sampling interval for this specific type of stats
11217    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11218    optional int32 sampling_interval = 1;
11219
11220    // # of previous skipped sample for this specific type of stats
11221    // We can't push atoms too closely, so some samples might be skipped
11222    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11223    // For example, the true count of an event could be estimated as:
11224    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11225    optional int32 num_skipped_sample = 2;
11226
11227    // Package UID of the application.
11228    optional int32 uid = 3 [(is_uid) = true];
11229
11230    // Hash of the database name within AppSearch
11231    optional int32 database = 4;
11232
11233    // Needs to be sync with AppSearchResult#ResultCode in
11234    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11235    optional int32 status_code = 5;
11236
11237    // Overall time used for a put_document
11238    optional int32 total_latency_millis = 6;
11239
11240    // Time used to generate a document proto from a Bundle.
11241    optional int32 generate_document_proto_latency_millis = 7;
11242
11243    // Time used to rewrite types and namespaces in the document.
11244    optional int32 rewrite_document_types_latency_millis = 8;
11245
11246    // Overall time used for the native function call.
11247    optional int32 native_latency_millis = 9;
11248
11249    // Time used to store the document.
11250    optional int32 native_document_store_latency_millis = 10;
11251
11252    // Time used to index the document. It doesn't include the time to
11253    // merge indices.
11254    optional int32 native_index_latency_millis = 11;
11255
11256    // Time used to merge the indices.
11257    optional int32 native_index_merge_latency_millis = 12;
11258
11259    // Document size in bytes.
11260    optional int32 native_document_size_bytes = 13;
11261
11262    // Number of tokens added to the index.
11263    optional int32 native_num_tokens_indexed = 14;
11264
11265    // Whether the max number of tokens exceeded.
11266    optional bool native_exceeded_max_num_tokens = 15;
11267}
11268
11269/**
11270 * Logs detailed stats for AppSearch Initialize
11271 */
11272message AppSearchInitializeStatsReported {
11273    // The sampling interval for this specific type of stats
11274    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11275    optional int32 sampling_interval = 1;
11276
11277    // # of previous skipped sample for this specific type of stats
11278    // We can't push atoms too closely, so some samples might be skipped
11279    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11280    // For example, the true count of an event could be estimated as:
11281    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11282    optional int32 num_skipped_sample = 2;
11283
11284    // Package UID of the application.
11285    optional int32 uid = 3 [(is_uid) = true];
11286
11287    // Initialize status code
11288    // Needs to be sync with AppSearchResult#ResultCode in
11289    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11290    optional int32 status_code = 4;
11291
11292    // Overall time used for initialization, not including binder latency.
11293    optional int32 total_latency_millis = 5;
11294
11295    // Whether the initialize() detects desyncs.
11296    // Desync happens if we lose the visibility doc.
11297    optional bool has_desync = 6;
11298
11299    // Time used to read and process the schema and namespaces.
11300    optional int32 prepare_schema_and_namespaces_latency_millis = 7;
11301
11302    // Time used to read and process the visibility file.
11303    optional int32 prepare_visibility_file_latency_millis = 8;
11304
11305    // Overall time used for the native function call.
11306    optional int32 native_latency_millis = 9;
11307
11308    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
11309    optional int32 native_document_store_recovery_cause = 10;
11310
11311    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
11312    optional int32 native_index_restoration_cause = 11;
11313
11314    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
11315    optional int32 native_schema_store_recovery_cause = 12;
11316
11317    // Time used to recover the document store.
11318    optional int32 native_document_store_recovery_latency_millis = 13;
11319
11320    // Time used to restore the index.
11321    optional int32 native_index_restoration_latency_millis = 14;
11322
11323    // Time used to recover the schema store.
11324    optional int32 native_schema_store_recovery_latency_millis = 15;
11325
11326    // Needs to be sync with DocumentStoreDataStatus in google3/third_party/icing/proto/logging.proto
11327    optional int32 native_document_store_data_status = 16;
11328
11329    // Number of documents currently in document store. Those may
11330    // include alive, deleted, and expired documents.
11331    optional int32 native_num_documents = 17;
11332
11333    // Number of schema types currently in the schema store.
11334    optional int32 native_num_schema_types = 18;
11335
11336    // Whether we had to reset the index, losing all data, during initialization.
11337    optional bool has_reset = 19;
11338
11339    // The status code of the reset operation if has_reset is true.
11340    // Needs to be sync with AppSearchResult#ResultCode in
11341    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11342    optional int32 reset_status_code = 20;
11343}
11344
11345/**
11346 * Logs detailed stats for querying in AppSearch
11347 */
11348message AppSearchQueryStatsReported {
11349    // The sampling interval for this specific type of stats
11350    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11351    optional int32 sampling_interval = 1;
11352
11353    // # of previous skipped sample for this specific type of stats
11354    // We can't push atoms too closely, so some samples might be skipped
11355    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11356    // For example, the true count of an event could be estimated as:
11357    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11358    optional int32 num_skipped_sample = 2;
11359
11360    // Package UID of the application.
11361    optional int32 uid = 3 [(is_uid) = true];
11362
11363    // Hash of the database name within AppSearch
11364    optional int32 database = 4;
11365
11366    // Needs to be sync with AppSearchResult#ResultCode in
11367    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11368    optional int32 status_code = 5;
11369
11370    // Overall time used for query including estimated binder latency
11371    optional int32 total_latency_millis = 6;
11372
11373    // Time used to rewrite the search spec.
11374    optional int32 rewrite_search_spec_latency_millis = 7;
11375
11376    // Time used to rewrite the search results.
11377    optional int32 rewrite_search_result_latency_millis = 8;
11378
11379    // Whether it is a global query.
11380    // Needs to be sync with QueryStats#VisibilityScope in
11381    // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/QueryStats.java
11382    optional int32 visibility_scope = 9;
11383
11384    // Overall time used for the native function call.
11385    optional int32 native_latency_millis = 10;
11386
11387    // Number of terms in the query string.
11388    optional int32 native_num_terms = 11;
11389
11390    // Length of the query string.
11391    optional int32 native_query_length = 12;
11392
11393    // Number of namespaces filtered.
11394    optional int32 native_num_namespaces_filtered = 13;
11395
11396    // Number of schema types filtered.
11397    optional int32 native_num_schema_types_filtered = 14;
11398
11399    // The requested number of results in one page.
11400    optional int32 native_requested_page_size = 15;
11401
11402    // The actual number of results returned in the current page.
11403    optional int32 native_num_results_returned_current_page = 16;
11404
11405    // Whether the function call is querying the first page. If it's
11406    // not, Icing will fetch the results from cache so that some steps
11407    // may be skipped.
11408    optional bool native_is_first_page = 17;
11409
11410    // Time used to parse the query, including 2 parts: tokenizing and
11411    // transforming tokens into an iterator tree.
11412    optional int32 native_parse_query_latency_millis = 18;
11413
11414    // Strategy of scoring and ranking.
11415    // Needs to be sync with RankingStrategy.Code in google3/third_party/icing/proto/scoring.proto
11416    optional int32 native_ranking_strategy = 19;
11417
11418    // Number of documents scored.
11419    optional int32 native_num_documents_scored = 20;
11420
11421    // Time used to score the raw results.
11422    optional int32 native_scoring_latency_millis = 21;
11423
11424    // Time used to rank the scored results.
11425    optional int32 native_ranking_latency_millis = 22;
11426
11427    // Time used to fetch the document protos. Note that it includes the
11428    // time to snippet if "native_num_results_with_snippets" is NOT zero.
11429    optional int32 native_document_retrieval_latency_millis = 23;
11430
11431    // How many snippets are calculated.
11432    optional int32 native_num_results_with_snippets = 24;
11433}
11434
11435/**
11436 * Logs detailed stats for remove in AppSearch
11437 */
11438message AppSearchRemoveStatsReported {
11439    // The sampling interval for this specific type of stats
11440    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11441    optional int32 sampling_interval = 1;
11442
11443    // # of previous skipped sample for this specific type of stats
11444    // We can't push atoms too closely, so some samples might be skipped
11445    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11446    // For example, the true count of an event could be estimated as:
11447    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11448    optional int32 num_previous_skipped_sample = 2;
11449
11450    // Package UID of the application.
11451    optional int32 uid = 3 [(is_uid) = true];
11452
11453    // Hash of the database name within AppSearch
11454    optional int32 database = 4;
11455
11456    // Needs to be sync with AppSearchResult#ResultCode in
11457    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11458    optional int32 status_code = 5;
11459
11460    // Overall time used for remove including the binder latency
11461    optional int32 total_latency_millis = 6;
11462
11463    // Overall time used for the native function call.
11464    optional int32 native_latency_millis = 7;
11465
11466    // Used to indicate what kind of delete(namespace, schemaType etc) calls deleteByQuery here.
11467    // Needs to be sync with external/icing/proto/icing/proto/logging.proto#DeleteStatsProto
11468    optional int32 native_delete_type = 8;
11469
11470    // Number of documents deleted by this call.
11471    optional int32 native_num_documents_deleted = 9;
11472}
11473
11474/**
11475 * Logs detailed stats for optimization in AppSearch.
11476 *
11477 * stats pushed from:
11478 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
11479 *
11480 * Next tag: 14
11481 */
11482message AppSearchOptimizeStatsReported {
11483    // The sampling interval for this specific type of stats
11484    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11485    optional int32 sampling_interval = 1;
11486
11487    // # of previous skipped sample for this specific type of stats
11488    // We can't push atoms too closely, so some samples might be skipped
11489    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11490    // For example, the true count of an event could be estimated as:
11491    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11492    optional int32 num_previous_skipped_sample = 2;
11493
11494    // Needs to be sync with AppSearchResult#ResultCode in
11495    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11496    optional int32 status_code = 3;
11497
11498    // Overall time used for remove including the binder latency
11499    optional int32 total_latency_millis = 4;
11500
11501    // Overall time used for the native function call.
11502    optional int32 native_latency_millis = 5;
11503
11504    // Time used to optimize the document store in millis.
11505    optional int32 native_document_store_optimize_latency_millis = 6;
11506
11507    // Time used to restore the index in millis.
11508    optional int32 native_index_restoration_latency_millis = 7;
11509
11510    // Number of documents before the optimization.
11511    optional int32 native_num_original_documents = 8;
11512
11513    // Number of documents deleted during the optimization.
11514    optional int32 native_num_deleted_documents = 9;
11515
11516    // Number of documents expired during the optimization.
11517    optional int32 native_num_expired_documents = 10;
11518
11519    // Size of storage in bytes before the optimization.
11520    optional int64 native_storage_size_before_bytes = 11;
11521
11522    // Size of storage in bytes after the optimization.
11523    optional int64 native_storage_size_after_bytes = 12;
11524
11525    // The amount of time in millis since the last optimization ran.
11526    optional int64 native_time_since_last_optimize_millis = 13;
11527}
11528
11529// Reports information in external/icing/proto/icing/proto/storage.proto#DocumentStorageInfoProto
11530// Next tag: 15
11531message AppSearchDocumentStorageInfo {
11532    // Total number of alive documents.
11533    optional int32 num_alive_documents = 1;
11534
11535    // Total number of deleted documents.
11536    optional int32 num_deleted_documents = 2;
11537
11538    // Total number of expired documents.
11539    optional int32 num_expired_documents = 3;
11540
11541    // Total size of the document store in bytes. Will be set to -1 if an IO error
11542    // is encountered while calculating this field.
11543    optional int64 document_store_size_bytes = 4;
11544
11545    // Total size of the ground truth in bytes. The ground truth may
11546    // include deleted or expired documents. Will be set to -1 if an IO error is
11547    // encountered while calculating this field.
11548    optional int64 document_log_size_bytes = 5;
11549
11550    // Size of the key mapper in bytes. Will be set to -1 if an IO error is
11551    // encountered while calculating this field.
11552    optional int64 key_mapper_size_bytes = 6;
11553
11554    // Size of the document id mapper in bytes. Will be set to -1 if an IO error
11555    // is encountered while calculating this field.
11556    optional int64 document_id_mapper_size_bytes = 7;
11557
11558    // Size of the score cache in bytes. Will be set to -1 if an IO error is
11559    // encountered while calculating this field.
11560    optional int64 score_cache_size_bytes = 8;
11561
11562    // Size of the filter cache in bytes. Will be set to -1 if an IO error is
11563    // encountered while calculating this field.
11564    optional int64 filter_cache_size_bytes = 9;
11565
11566    // Size of the corpus mapper in bytes. Will be set to -1 if an IO error is
11567    // encountered while calculating this field.
11568    optional int64 corpus_mapper_size_bytes = 10;
11569
11570    // Size of the corpus score cache in bytes. Will be set to -1 if an IO error
11571    // is encountered while calculating this field.
11572    optional int64 corpus_score_cache_size_bytes = 11;
11573
11574    // Size of the namespace id mapper in bytes. Will be set to -1 if an IO error
11575    // is encountered while calculating this field.
11576    optional int64 namespace_id_mapper_size_bytes = 12;
11577
11578    // Number of namespaces seen from the current documents.
11579    optional int32 num_namespaces = 13;
11580
11581    // Storage information of each namespace is not included due to that it has string field.
11582
11583    reserved 14;
11584}
11585
11586// Reports information in external/icing/proto/icing/proto/storage.proto#SchemaStoreStorageInfoProto
11587// Next tag: 5
11588message AppSearchSchemaStoreStorageInfo {
11589    // Size of the schema store in bytes. Will be set to -1 if an IO error is
11590    // encountered while calculating this field.
11591    optional int64 schema_store_size_bytes = 1;
11592
11593    // Total number of schema types.
11594    optional int32 num_schema_types = 2;
11595
11596    // Total number of all sections across all types
11597    optional int32 num_total_sections = 3;
11598
11599    // Total number of types at the current section limit.
11600    optional int32 num_schema_types_sections_exhausted = 4;
11601}
11602
11603// Reports information in external/icing/proto/icing/proto/storage.proto#IndexStorageInfoProto
11604// Next tag: 9
11605message AppSearchIndexStorageInfo {
11606    // Total size of the index in bytes. Will be set to -1 if an IO error is
11607    // encountered while calculating this field.
11608    optional int64 index_size_bytes = 1;
11609
11610    // Size of the lite index lexicon in bytes. Will be set to -1 if an IO error
11611    // is encountered while calculating this field.
11612    optional int64 lite_index_lexicon_size_bytes = 2;
11613
11614    // Size of the lite index hit buffer in bytes. Will be set to -1 if an IO
11615    // error is encountered while calculating this field.
11616    optional int64 lite_index_hit_buffer_size_bytes = 3;
11617
11618    // Size of the main index lexicon in bytes. Will be set to -1 if an IO error
11619    // is encountered while calculating this field.
11620    optional int64 main_index_lexicon_size_bytes = 4;
11621
11622    // Size of the main index storage in bytes. Will be set to -1 if an IO error
11623    // is encountered while calculating this field.
11624    optional int64 main_index_storage_size_bytes = 5;
11625
11626    // Size of one main index block in bytes.
11627    optional int64 main_index_block_size_bytes = 6;
11628
11629    // Number of main index blocks.
11630    optional int32 num_blocks = 7;
11631
11632    // Percentage of the main index blocks that are free, assuming
11633    // allocated blocks are fully used.
11634    optional float min_free_fraction = 8;
11635}
11636
11637/**
11638 * Pulls information about storage information per user from AppSearch
11639 *
11640 * Pulled from:
11641 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
11642 *
11643 * Next tag: 6
11644 */
11645message AppSearchStorageInfo {
11646    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
11647    // This is mainly used as a dimension for the metric, but it can also tell us if
11648    // the StorageInfo is for a primary user or secondary user.
11649    optional int32 user = 1;
11650
11651    // Total size of Icing’s storage in bytes. Will be set to -1 if an IO error is
11652    // encountered while calculating this field.
11653    optional int64 total_storage_size_bytes = 2;
11654
11655    // Storage information of the document store.
11656    optional AppSearchDocumentStorageInfo document_storage_info = 3
11657        [(android.os.statsd.log_mode) = MODE_BYTES];
11658
11659    // Storage information of the schema store.
11660    optional AppSearchSchemaStoreStorageInfo schema_store_storage_info = 4
11661        [(android.os.statsd.log_mode) = MODE_BYTES];
11662
11663    // Storage information of the index.
11664    optional AppSearchIndexStorageInfo index_storage_info = 5
11665        [(android.os.statsd.log_mode) = MODE_BYTES];
11666}
11667
11668/**
11669 * Reported when the RebootEscrow HAL has attempted to recover the escrowed
11670 * key to indicate whether it was successful or not.
11671 *
11672 * Logged from:
11673 *   frameworks/base/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
11674 */
11675message RebootEscrowRecoveryReported {
11676    // Type of the resume on reboot backend provider.
11677    enum ServiceType {
11678        UNKNOWN = 0;
11679        HAL = 1;
11680        SERVER_BASED = 2;
11681    }
11682
11683    // Whether the vbmeta digest of the current slot matches a precomputed value before reboot.
11684    enum VbmetaDigestStatus {
11685        MATCH_EXPECTED_SLOT = 0;
11686        MATCH_FALLBACK_SLOT = 1;
11687        MISMATCH = 2;
11688    }
11689
11690    optional bool successful = 1;
11691    // The error code for escrow data recovery failure
11692    optional int32 error_code = 2;
11693
11694    optional ServiceType type = 3;
11695
11696    // Number of retries to unwrap the escrow key asynchronously.
11697    optional int32 get_escrow_key_retry_count = 4;
11698
11699    // The duration between storing of reboot escrow key ->
11700    // use of reboot escrow key to unlock CE after reboot
11701    optional int32 duration_escrow_key_storage_to_unlock_seconds = 5;
11702
11703    optional VbmetaDigestStatus vbmeta_digest_status = 6;
11704
11705    // The duration between boot complete -> CE unlock
11706    optional int32 duration_boot_complete_to_unlock_seconds = 7;
11707}
11708
11709/**
11710 * Global display pipeline metrics reported by SurfaceFlinger.
11711 * Metrics exist beginning in Android 11.
11712 * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
11713 * That proto must be updated if this atom is updated.
11714 *
11715 * Pulled from:
11716 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
11717 */
11718message SurfaceflingerStatsGlobalInfo {
11719    // Aggregated refresh rate buckets that layers were presenting at. Buckets
11720    // are defined in SurfaceFlinger and are tracked per device.
11721    // Introduced in Android 12.
11722    // This is intended to be used as a dimenstion in collecting per-refresh rate
11723    // jank statistics.
11724    optional int32 display_refresh_rate_bucket = 18;
11725    // Aggregated render rate buckets that layers were overridden to run at.
11726    // Buckets are defined in SurfaceFlinger and are tracked per device.
11727    // Introduced in Android 12.
11728    // This is intended to be used as a dimension in collecting per-render rate
11729    // jank statistics.
11730    optional int32 render_rate_bucket = 21;
11731    // Total number of frames presented during the tracing period
11732    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11733    // using render_rate_bucket as a dimension.
11734    optional int64 total_frames = 1;
11735    // Total number of frames missed
11736    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11737    // using render_rate_bucket as a dimension.
11738    optional int64 missed_frames = 2;
11739    // Total number of frames that fell back to client composition
11740    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11741    // using render_rate_bucket as a dimension.
11742    optional int64 client_composition_frames = 3;
11743    // Total time the display was turned on
11744    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11745    // using render_rate_bucket as a dimension.
11746    optional int64 display_on_millis = 4;
11747    // Total time that was spent performing animations.
11748    // This is derived from the present-to-present layer histogram.
11749    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11750    // using render_rate_bucket as a dimension.
11751    optional int64 animation_millis = 5;
11752    // Total number of event connections tracked by SurfaceFlinger at the time
11753    // of this pull. If this number grows prohibitively large, then this can
11754    // cause jank due to resource contention.
11755    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11756    // using render_rate_bucket as a dimension.
11757    optional int32 event_connection_count = 6;
11758    // Set of timings measured from when SurfaceFlinger began compositing a
11759    // frame, until the frame was requested to be presented to the display. This
11760    // measures SurfaceFlinger's total CPU walltime on the critical path per
11761    // frame.
11762    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11763    // using render_rate_bucket as a dimension.
11764    optional FrameTimingHistogram frame_duration = 7
11765        [(android.os.statsd.log_mode) = MODE_BYTES];
11766    // Set of timings measured from when SurfaceFlinger first began using the
11767    // GPU to composite a frame, until the GPU has finished compositing that
11768    // frame. This measures the total additional time SurfaceFlinger needed to
11769    // perform due to falling back into GPU composition.
11770    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11771    // using render_rate_bucket as a dimension.
11772    optional FrameTimingHistogram render_engine_timing = 8
11773        [(android.os.statsd.log_mode) = MODE_BYTES];
11774    // Number of frames where SF saw a frame, based on its frame timeline.
11775    // Frame timelines may include transactions without updating buffer contents.
11776    // Introduced in Android 12.
11777    optional int32 total_timeline_frames = 9;
11778    // Number of frames where SF saw a janky frame.
11779    // Introduced in Android 12.
11780    optional int32 total_janky_frames = 10;
11781    // Number of janky frames where SF spent a long time on the CPU.
11782    // Introduced in Android 12.
11783    optional int32 total_janky_frames_with_long_cpu = 11;
11784    // Number of janky frames where SF spent a long time on the GPU.
11785    // Introduced in Android 12.
11786    optional int32 total_janky_frames_with_long_gpu = 12;
11787    // Number of janky frames where SF missed the frame deadline, but there
11788    // was not an attributed reason (e.g., maybe HWC missed?)
11789    // Introduced in Android 12.
11790    optional int32 total_janky_frames_sf_unattributed = 13;
11791    // Number of janky frames where the app missed the frame deadline, but
11792    // there was not an attributed reason
11793    // Introduced in Android 12.
11794    optional int32 total_janky_frames_app_unattributed = 14;
11795    // Number of janky frames that were caused because of scheduling errors in
11796    // SF that resulted in early present (e.g., SF sending a buffer to the
11797    // composition engine earlier than expected, resulting in a present that is
11798    // one vsync early)
11799    // Introduced in Android 12.
11800    optional int32 total_janky_frames_sf_scheduling = 15;
11801    // Number of frames that were classified as jank because of possible drift in
11802    // vsync predictions.
11803    // Introduced in Android 12.
11804    optional int32 total_jank_frames_sf_prediction_error = 16;
11805    // Number of janky frames where the app was in a buffer stuffed state (more
11806    // than one buffer ready to be presented at the same vsync). Usually caused
11807    // when the first frame is unusually long, the following frames enter into a
11808    // stuffed state.
11809    // Introduced in Android 12.
11810    optional int32 total_jank_frames_app_buffer_stuffing = 17;
11811    // Buckets of timings in ms by which SurfaceFlinger's deadline was missed
11812    // while latching and presenting frames.
11813    // Introduced in Android 12.
11814    optional FrameTimingHistogram sf_deadline_misses = 19
11815        [(android.os.statsd.log_mode) = MODE_BYTES];
11816    // Buckets of timings in ms by which the Vsync prediction drifted, when
11817    // compared to the actual hardware vsync.
11818    // Introduced in Android 12.
11819    optional FrameTimingHistogram sf_prediction_errors = 20
11820        [(android.os.statsd.log_mode) = MODE_BYTES];
11821
11822    // Next ID: 22
11823}
11824
11825/**
11826 * Per-layer display pipeline metrics reported by SurfaceFlinger.
11827 * Metrics exist beginning in Android 11.
11828 * The number of layers uploaded may be restricted due to size limitations.
11829 * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
11830 * That proto must be updated if this atom is updated.
11831 *
11832 * Pulled from:
11833 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
11834 */
11835message SurfaceflingerStatsLayerInfo {
11836    // UID of the application who submitted this layer for presentation
11837    // This is intended to be used as a dimension for surfacing rendering
11838    // statistics to applications.
11839    // Introduced in Android 12.
11840    optional int32 uid = 12 [(is_uid) = true];
11841    // Refresh rate bucket that the layer was presenting at. Buckets are
11842    // defined in SurfaceFlinger and are tracked per device.
11843    // Introduced in Android 12.
11844    // This is intended to be used as a dimension in collecting per-refresh rate
11845    // jank statistics
11846    optional int32 display_refresh_rate_bucket = 22;
11847    // Render rate bucket that the layer was submitting frames at. Buckets are
11848    // defined in SurfaceFlinger and are tracked per device.
11849    // Introduced in Android 12.
11850    // This is intended to be used as a dimension in collecting per-render rate
11851    // jank statistics.
11852    optional int32 render_rate_bucket = 23;
11853
11854    // Game modes are used only for integrating with GameManager.
11855    enum GameMode {
11856         GAME_MODE_UNSPECIFIED = 0;
11857         GAME_MODE_UNSUPPORTED = 1;
11858         GAME_MODE_STANDARD = 2;
11859         GAME_MODE_PERFORMANCE = 3;
11860         GAME_MODE_BATTERY = 4;
11861    }
11862
11863    // Game mode that the layer was running at. Used to track user engagement
11864    // in different modes. The modes are defined in GameManager.java
11865    // All non-game layers will have this field set to UNSUPPORTED.
11866    // Introduced in Android 12
11867    // This is intended to be used as a dimension in collecting per-game mode
11868    // fps and frame related metrics.
11869    optional GameMode game_mode = 26;
11870    // The layer for this set of metrics
11871    // In many scenarios the package name is included in the layer name, e.g.,
11872    // layers created by Window Manager. But this is not a guarantee - in the
11873    // general case layer names are arbitrary debug names.
11874    optional string layer_name = 1;
11875    // Total number of frames presented
11876    optional int64 total_frames = 2;
11877    // Total number of dropped frames while latching a buffer for this layer.
11878    optional int64 dropped_frames = 3;
11879    // Set of timings measured between successive presentation timestamps.
11880    optional FrameTimingHistogram present_to_present = 4
11881        [(android.os.statsd.log_mode) = MODE_BYTES];
11882    // Set of timings measured from when an app queued a buffer for
11883    // presentation, until the buffer was actually presented to the
11884    // display.
11885    optional FrameTimingHistogram post_to_present = 5
11886        [(android.os.statsd.log_mode) = MODE_BYTES];
11887    // Set of timings measured from when a buffer is ready to be presented,
11888    // until the buffer was actually presented to the display.
11889    optional FrameTimingHistogram acquire_to_present = 6
11890        [(android.os.statsd.log_mode) = MODE_BYTES];
11891    // Set of timings measured from when a buffer was latched by
11892    // SurfaceFlinger, until the buffer was presented to the display
11893    optional FrameTimingHistogram latch_to_present = 7
11894        [(android.os.statsd.log_mode) = MODE_BYTES];
11895    // Set of timings measured from the desired presentation to the actual
11896    // presentation time
11897    optional FrameTimingHistogram desired_to_present = 8
11898        [(android.os.statsd.log_mode) = MODE_BYTES];
11899    // Set of timings measured from when an app queued a buffer for
11900    // presentation, until the buffer was ready to be presented.
11901    optional FrameTimingHistogram post_to_acquire = 9
11902        [(android.os.statsd.log_mode) = MODE_BYTES];
11903    // Frames missed latch because the acquire fence didn't fire
11904    optional int64 late_acquire_frames = 10;
11905    // Frames latched early because the desired present time was bad
11906    optional int64 bad_desired_present_frames = 11;
11907    // Number of frames where SF saw a frame, based on its frame timeline.
11908    // Frame timelines may include transactions without updating buffer contents.
11909    // Introduced in Android 12.
11910    optional int32 total_timeline_frames = 13;
11911    // Number of frames where SF saw a janky frame.
11912    // Introduced in Android 12.
11913    optional int32 total_janky_frames = 14;
11914    // Number of janky frames where SF spent a long time on the CPU.
11915    // Introduced in Android 12.
11916    optional int32 total_janky_frames_with_long_cpu = 15;
11917    // Number of janky frames where SF spent a long time on the GPU.
11918    // Introduced in Android 12.
11919    optional int32 total_janky_frames_with_long_gpu = 16;
11920    // Number of janky frames where SF missed the frame deadline, but there
11921    // was not an attributed reason (e.g., maybe HWC missed?)
11922    // Introduced in Android 12.
11923    optional int32 total_janky_frames_sf_unattributed = 17;
11924    // Number of janky frames where the app missed the frame deadline, but
11925    // there was not an attributed reason
11926    // Introduced in Android 12.
11927    optional int32 total_janky_frames_app_unattributed = 18;
11928    // Number of janky frames that were caused because of scheduling errors in
11929    // SF that resulted in early present (e.g., SF sending a buffer to the
11930    // composition engine earlier than expected, resulting in a present that is
11931    // one vsync early)
11932    // Introduced in Android 12.
11933    optional int32 total_janky_frames_sf_scheduling = 19;
11934    // Number of frames that were classified as jank because of possible drift in
11935    // vsync predictions.
11936    // Introduced in Android 12.
11937    optional int32 total_jank_frames_sf_prediction_error = 20;
11938    // Number of janky frames where the app was in a buffer stuffed state (more
11939    // than one buffer ready to be presented at the same vsync). Usually caused
11940    // when the first frame is unusually long, the following frames enter into a
11941    // stuffed state.
11942    // Introduced in Android 12.
11943    optional int32 total_jank_frames_app_buffer_stuffing = 21;
11944
11945    /**
11946     * Encapsulates the FrameRateVote information sent by the application while
11947     * calling setFrameRate.
11948     * Metrics exist beginning in Android 12.
11949     */
11950    message SetFrameRateVote {
11951        // The desired frame rate the application wishes to run on.
11952        optional float frame_rate = 1;
11953
11954        enum FrameRateCompatibility {
11955            FRAME_RATE_UNDEFINED = 0;
11956            FRAME_RATE_DEFAULT = 1;
11957            FRAME_RATE_EXACT_OR_MULTIPLE = 2;
11958        }
11959
11960        // Specifies how to interpret the frame rate associated with the layer.
11961        // Defined in Layer.h
11962        optional FrameRateCompatibility frame_rate_compatibility = 2;
11963
11964        enum Seamlessness {
11965            SEAMLESS_UNDEFINED = 0;
11966            SEAMLESS_SHOULD_BE_SEAMLESS = 1;
11967            SEAMLESS_NOT_REQUIRED = 2;
11968        }
11969        // Indicates whether seamless refresh rate switch is required or not.
11970        optional Seamlessness seamlessness = 3;
11971    }
11972
11973    // The last frame rate vote set by the application.
11974    // Introduced in Android 12.
11975    optional SetFrameRateVote set_frame_rate_vote = 24
11976        [(android.os.statsd.log_mode) = MODE_BYTES];
11977    // Buckets of timings in ms by which the app deadline was missed while
11978    // submitting work for a frame.
11979    // Introduced in Android 12.
11980    optional FrameTimingHistogram app_deadline_misses = 25
11981        [(android.os.statsd.log_mode) = MODE_BYTES];
11982
11983    // Next ID: 27
11984}
11985
11986/**
11987 * Histogram of frame counts bucketed by time in milliseconds.
11988 * Because of size limitations, we hard-cap the number of buckets, with
11989 * buckets for corresponding to larger milliseconds being less precise.
11990 */
11991message FrameTimingHistogram {
11992    // Timings in milliseconds that describes a set of histogram buckets
11993    repeated int32 time_millis_buckets = 1;
11994    // Number of frames that match to each time_millis, i.e. the bucket
11995    // contents
11996    // It's required that len(time_millis) == len(frame_count)
11997    repeated int64 frame_counts = 2;
11998}
11999
12000/**
12001 * Janky event as reported by SurfaceFlinger.
12002 * This event is intended to be consumed by a Perfetto subscriber for
12003 * automated trace collection.
12004 *
12005 * Logged from:
12006 *    frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
12007 */
12008message DisplayJankReported {
12009    // Informational field for how long the janky event lasted in milliseconds
12010    optional int64 event_duration_millis = 1;
12011    // Number of frame deadlines missed, where SurfaceFlinger failed to update
12012    // the display on time.
12013    optional int32 present_deadlines_missed = 2;
12014}
12015
12016message CameraStreamProto {
12017    // The stream width (in pixels)
12018    optional int32 width = 1;
12019    // The stream height (in pixels)
12020    optional int32 height = 2;
12021    // The format of the stream
12022    optional int32 format = 3;
12023    // The dataspace of the stream
12024    optional int32 data_space = 4;
12025    // The usage flag of the stream
12026    optional int64 usage = 5;
12027
12028    // The number of requests for this stream
12029    optional int64 request_count = 6;
12030    // The number of buffer error for this stream
12031    optional int64 error_count = 7;
12032    // The capture latency of first request for this stream
12033    optional int32 first_capture_latency_millis = 8;
12034
12035    // The maximum number of hal buffers
12036    optional int32 max_hal_buffers = 9;
12037    // The maximum number of app buffers
12038    optional int32 max_app_buffers = 10;
12039
12040    // Type of stream histogram
12041    // 1: Capture latency: bin size in milliseconds
12042    enum HistogramType {
12043        UNKNOWN = 0;
12044        CAPTURE_LATENCY = 1;
12045    }
12046    optional HistogramType histogram_type = 11;
12047    // The boundary values between histogram bins
12048    // Expected number of fields: 9
12049    repeated float histogram_bins = 12;
12050    // The frame counts for each histogram bins
12051    // Expected number of fields: 10
12052    repeated int64 histogram_counts = 13;
12053}
12054
12055/**
12056 * Information about camera facing and API level usage.
12057 * Logged from:
12058 *   frameworks/base/services/core/java/com/android/server/camera/CameraServiceProxy.java
12059 */
12060message CameraActionEvent {
12061    // Camera session duration in milliseconds if action is SESSION.
12062    // 0 if action is OPEN or CLOSE.
12063    optional int64 duration_millis = 1;
12064
12065    // Camera API level used.
12066    // 1 for camera1 API, and 2 for camera2 API.
12067    optional int32 api_level = 2;
12068
12069    // Name of client package
12070    optional string package_name = 3;
12071
12072    // Camera facing
12073    enum Facing {
12074        UNKNOWN = 0;
12075        BACK = 1;
12076        FRONT = 2;
12077        EXTERNAL = 3;
12078    }
12079    optional Facing facing = 4;
12080
12081    // Camera ID
12082    optional string camera_id = 5;
12083
12084    // Camera action type
12085    enum Action {
12086        UNKNOWN_ACTION = 0;
12087        OPEN = 1;
12088        CLOSE = 2;
12089        SESSION = 3;
12090    }
12091    optional Action action = 6;
12092
12093    // Whether the client is accessing camera using ndk
12094    optional bool is_ndk = 7;
12095
12096    // Action OPEN: Open latency
12097    // Action CLOSE: Close latency
12098    // Action SESSION: Camera session creation duration.
12099    //                 If this entry is reusing an existing session, the value is -1.
12100    optional int32 latency_millis = 8;
12101
12102    // session type: 0 for normal mode, 1 for constrained high speed mode
12103    optional int32 operating_mode = 9;
12104
12105    // If actioh is SESSION: number of internal reconfigurations
12106    // Else: 0
12107    optional int32 internal_reconfig = 10;
12108
12109    // Number of requests for this capture session. Only applicable to SESSION
12110    // action.
12111    optional int64 request_count = 11;
12112    // Number of result errors. Only applicable to SESSION action.
12113    optional int64 result_error_count = 12;
12114    // Whether the device runs into error state.
12115    optional bool device_error = 13;
12116
12117    // If action is SESSION: Stream states
12118    // Else: stream_count = 0
12119    optional int32 stream_count = 14;
12120    optional CameraStreamProto stream_1 = 15 [(log_mode) = MODE_BYTES];
12121    optional CameraStreamProto stream_2 = 16 [(log_mode) = MODE_BYTES];
12122    optional CameraStreamProto stream_3 = 17 [(log_mode) = MODE_BYTES];
12123    optional CameraStreamProto stream_4 = 18 [(log_mode) = MODE_BYTES];
12124    optional CameraStreamProto stream_5 = 19 [(log_mode) = MODE_BYTES];
12125}
12126
12127/**
12128 * Logs when a compatibility change is affecting an app.
12129 *
12130 * Logged from:
12131 *   frameworks/base/core/java/android/app/AppCompatCallbacks.java and
12132 *   frameworks/base/services/core/java/com/android/server/compat/PlatformCompat.java
12133 */
12134message AppCompatibilityChangeReported {
12135    // The UID of the app being affected by the compatibilty change.
12136    optional int32 uid = 1 [(is_uid) = true];
12137
12138    // The ID of the change affecting the app.
12139    optional int64 change_id = 2;
12140
12141    enum State {
12142        UNKNOWN_STATE = 0;
12143        ENABLED = 1;
12144        DISABLED = 2;
12145        LOGGED = 3;
12146    }
12147
12148    // The state of the change - if logged from gating whether it was enabled or disabled, or just
12149    // logged otherwise.
12150    optional State state = 3;
12151
12152    enum Source {
12153        UNKNOWN_SOURCE = 0;
12154        APP_PROCESS = 1;
12155        SYSTEM_SERVER = 2;
12156    }
12157
12158    // Where it was logged from.
12159    optional Source source = 4;
12160
12161}
12162
12163/**
12164 * Logged from
12165 *     external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
12166 *     external/perfetto/src/tracing/service/tracing_service_impl.cc
12167 */
12168message PerfettoUploaded {
12169    // TODO(lalitm): many of the atoms below should be renamed to have a
12170    // "PERFETTO_CMD" prefix to make clear they are specific to perfetto_cmd.
12171    // This will be done after the server side is ready for this change.
12172    // Next id: 48.
12173    enum Event {
12174        PERFETTO_UNDEFINED = 0;
12175
12176        // Checkpoints inside perfetto_cmd before tracing is finished.
12177        PERFETTO_TRACE_BEGIN = 1;
12178        PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
12179        PERFETTO_ON_CONNECT = 3;
12180
12181        // Guardrails inside perfetto_cmd before tracing is finished.
12182        PERFETTO_ON_TIMEOUT = 16;
12183        PERFETTO_CMD_USER_BUILD_TRACING_NOT_ALLOWED = 43;
12184        PERFETTO_CMD_FAILED_TO_INIT_GUARDRAIL_STATE = 44;
12185        PERFETTO_CMD_INVALID_GUARDRAIL_STATE = 45;
12186        PERFETTO_CMD_HIT_UPLOAD_LIMIT = 46;
12187
12188        // Checkpoints inside traced.
12189        PERFETTO_TRACED_ENABLE_TRACING = 37;
12190        PERFETTO_TRACED_START_TRACING = 38;
12191        PERFETTO_TRACED_DISABLE_TRACING = 39;
12192        PERFETTO_TRACED_NOTIFY_TRACING_DISABLED = 40;
12193
12194        // Trigger checkpoints inside traced.
12195        // These atoms are special because, along with the UUID,
12196        // they log the trigger name.
12197        PERFETTO_TRACED_TRIGGER_START_TRACING = 41;
12198        PERFETTO_TRACED_TRIGGER_STOP_TRACING = 42;
12199
12200        // Guardrails inside traced.
12201        PERFETTO_TRACED_ENABLE_TRACING_EXISTING_TRACE_SESSION = 18;
12202        PERFETTO_TRACED_ENABLE_TRACING_TOO_LONG_TRACE = 19;
12203        PERFETTO_TRACED_ENABLE_TRACING_INVALID_TRIGGER_TIMEOUT = 20;
12204        PERFETTO_TRACED_ENABLE_TRACING_DURATION_WITH_TRIGGER = 21;
12205        PERFETTO_TRACED_ENABLE_TRACING_STOP_TRACING_WRITE_INTO_FILE = 22;
12206        PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_TRIGGER_NAME = 23;
12207        PERFETTO_TRACED_ENABLE_TRACING_INVALID_DEFERRED_START = 24;
12208        PERFETTO_TRACED_ENABLE_TRACING_INVALID_BUFFER_SIZE = 25;
12209        PERFETTO_TRACED_ENABLE_TRACING_BUFFER_SIZE_TOO_LARGE = 26;
12210        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_BUFFERS = 27;
12211        PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_SESSION_NAME = 28;
12212        PERFETTO_TRACED_ENABLE_TRACING_SESSION_NAME_TOO_RECENT = 29;
12213        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_SESSIONS_FOR_UID = 30;
12214        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_CONCURRENT_SESSIONS = 31;
12215        PERFETTO_TRACED_ENABLE_TRACING_INVALID_FD_OUTPUT_FILE = 32;
12216        PERFETTO_TRACED_ENABLE_TRACING_FAILED_TO_CREATE_FILE = 33;
12217        PERFETTO_TRACED_ENABLE_TRACING_OOM = 34;
12218        PERFETTO_TRACED_ENABLE_TRACING_UNKNOWN_ERROR = 35;
12219        PERFETTO_TRACED_START_TRACING_INVALID_SESSION_STATE = 36;
12220        PERFETTO_TRACED_ENABLE_TRACING_INVALID_FILTER = 47;
12221
12222        // Checkpoints inside perfetto_cmd after tracing has finished.
12223        PERFETTO_ON_TRACING_DISABLED = 4;
12224        PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
12225        PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
12226        PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
12227
12228        // Guardrails inside perfetto_cmd after tracing has finished.
12229        PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
12230
12231        // Deprecated as "success" is misleading; it simply means we were
12232        // able to communicate with incidentd. Will be removed once
12233        // incidentd is properly instrumented.
12234        PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9 [deprecated = true];
12235
12236        // Deprecated as has the potential to be too spammy. Will be
12237        // replaced with a whole new atom proto which uses a count metric
12238        // instead of the event metric used for this proto.
12239        PERFETTO_TRIGGER_BEGIN = 12 [deprecated = true];
12240        PERFETTO_TRIGGER_SUCCESS = 13 [deprecated = true];
12241        PERFETTO_TRIGGER_FAILURE = 14  [deprecated = true];
12242
12243        // Deprecated as too coarse grained to be useful. Will be replaced
12244        // with better broken down atoms as we do with traced.
12245        PERFETTO_HIT_GUARDRAILS = 15 [deprecated = true];
12246
12247        // Contained status of Dropbox uploads. Removed as Perfetto no
12248        // longer supports uploading traces using Dropbox.
12249        reserved 5, 6, 7;
12250    }
12251
12252    // Which stage of the pipeline we are reporting from.
12253    optional Event event = 1;
12254
12255    // UUID matching the one set inside the SystemInfo trace packet.
12256    optional int64 trace_uuid_lsb = 2;
12257    optional int64 trace_uuid_msb = 3;
12258
12259    // For trigger checkpoints inside traced, contains the trigger name
12260    // associated with this trace UUID.
12261    optional string trigger_name = 4;
12262}
12263
12264/**
12265 * Logged from
12266 *     external/perfetto/src/tracing/service/tracing_service_impl.cc
12267 */
12268message PerfettoTrigger {
12269    enum Event {
12270        PERFETTO_UNDEFINED = 0;
12271
12272        PERFETTO_CMD_TRIGGER = 1;
12273        PERFETTO_CMD_TRIGGER_FAIL = 2;
12274
12275        PERFETTO_TRIGGER_PERFETTO_TRIGGER = 3;
12276        PERFETTO_TRIGGER_PERFETTO_TRIGGER_FAIL = 4;
12277
12278        PERFETTO_TRACED_LIMIT_PROBABILITY = 5;
12279        PERFETTO_TRACED_LIMIT_MAX_PER_24_H = 6;
12280
12281        PERFETTO_PROBES_PRODUCER_TRIGGER = 7;
12282        PERFETTO_PROBES_PRODUCER_TRIGGER_FAIL = 8;
12283    }
12284
12285    // The event which fired.
12286    optional Event event = 1;
12287
12288    // The name of the trigger which fired.
12289    optional string trigger_name = 2;
12290}
12291
12292/**
12293 * Pulls client metrics on data transferred via Vehicle Maps Service.
12294 * Metrics are keyed by uid + layer.
12295 *
12296 * Pulled from:
12297 *   packages/services/Car/service/src/com/android/car/stats/CarStatsService.java
12298 */
12299message VmsClientStats {
12300    // UID of the VMS client app
12301    optional int32 uid = 1 [(is_uid) = true];
12302
12303    // VMS layer definition
12304    optional int32 layer_type = 2;
12305    optional int32 layer_channel = 3;
12306    optional int32 layer_version = 4;
12307
12308    // Bytes and packets sent by the client for the layer
12309    optional int64 tx_bytes = 5;
12310    optional int64 tx_packets = 6;
12311
12312    // Bytes and packets received by the client for the layer
12313    optional int64 rx_bytes = 7;
12314    optional int64 rx_packets = 8;
12315
12316    // Bytes and packets dropped due to client error
12317    optional int64 dropped_bytes = 9;
12318    optional int64 dropped_packets = 10;
12319}
12320
12321/**
12322 * State of a all permission requested by a package - sampled
12323 * Pulled from: StatsCompanionService.java with data obtained from PackageManager API
12324*/
12325message DangerousPermissionStateSampled {
12326    // Name of the permission
12327    optional string permission_name = 1;
12328
12329    // Uid of the package
12330    optional int32 uid = 2 [(is_uid) = true];
12331
12332    // If the permission is granted to the uid
12333    optional bool is_granted = 3;
12334
12335    // Permission flags as per android.content.pm.PermissionFlags
12336    optional int32 permission_flags = 4;
12337
12338    // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
12339    optional int32 protection_flags = 5;
12340}
12341
12342/**
12343 * HWUI stats for a given app.
12344 */
12345message GraphicsStats {
12346    // The package name of the app
12347    optional string package_name = 1;
12348
12349    // The version code of the app
12350    optional int64 version_code = 2;
12351
12352    // The start & end timestamps in UTC as
12353    // milliseconds since January 1, 1970
12354    // Compatible with java.util.Date#setTime()
12355    optional int64 start_millis = 3;
12356
12357    optional int64 end_millis = 4;
12358
12359    // HWUI renders pipeline type: GL (1) or Vulkan (2).
12360    enum PipelineType {
12361        UNKNOWN = 0;
12362        GL = 1;
12363        VULKAN = 2;
12364    }
12365
12366    // HWUI renders pipeline type: GL or Vulkan.
12367    optional PipelineType pipeline = 5;
12368
12369    // Distinct frame count.
12370    optional int32 total_frames = 6;
12371
12372    // Number of "missed vsync" events.
12373    optional int32 missed_vsync_count = 7;
12374
12375    // Number of frames in triple-buffering scenario (high input latency)
12376    optional int32 high_input_latency_count = 8;
12377
12378    // Number of "slow UI thread" events.
12379    optional int32 slow_ui_thread_count = 9;
12380
12381    // Number of "slow bitmap upload" events.
12382    optional int32 slow_bitmap_upload_count = 10;
12383
12384    // Number of "slow draw" events.
12385    optional int32 slow_draw_count = 11;
12386
12387    // Number of frames that missed their deadline (aka, visibly janked)
12388    optional int32 missed_deadline_count = 12;
12389
12390    // The frame time histogram for the package
12391    optional FrameTimingHistogram cpu_histogram = 13
12392    [(android.os.statsd.log_mode) = MODE_BYTES];
12393
12394    // The gpu frame time histogram for the package
12395    optional FrameTimingHistogram gpu_histogram = 14
12396    [(android.os.statsd.log_mode) = MODE_BYTES];
12397
12398    // UI mainline module version.
12399    optional int64 version_ui_module = 15;
12400
12401    // If true, these are HWUI stats for up to a 24h period for a given app from today.
12402    // If false, these are HWUI stats for a 24h period for a given app from the last complete
12403    // day (yesterday). Stats from yesterday stay constant, while stats from today may change as
12404    // more apps are running / rendering.
12405    optional bool is_today = 16;
12406}
12407
12408/**
12409 * Message related to dangerous (runtime) app ops access
12410 */
12411message RuntimeAppOpAccess {
12412    // Uid of the package accessing app op
12413    optional int32 uid = 1 [(is_uid) = true];
12414
12415    // Name of the package accessing app op
12416    optional string package_name = 2;
12417
12418    // deprecated - set to empty string
12419    optional string op_deprecated = 3 [deprecated = true];
12420
12421    // attribution_tag; provided by developer when accessing related API, limited at 50 chars by
12422    // API. Attributions must be provided through manifest using <attribution> tag available in R
12423    // and above.
12424    optional string attribution_tag = 4;
12425
12426    // message related to app op access, limited to 600 chars by API
12427    optional string message = 5;
12428
12429    enum SamplingStrategy {
12430        DEFAULT = 0;
12431        UNIFORM = 1;
12432        RARELY_USED = 2;
12433        BOOT_TIME_SAMPLING = 3;
12434        UNIFORM_OPS = 4;
12435    }
12436
12437    // sampling strategy used to collect this message
12438    optional SamplingStrategy sampling_strategy = 6;
12439
12440    // operation id
12441    optional android.app.AppOpEnum op = 7 [default = APP_OP_NONE];
12442}
12443
12444/*
12445 * Logs userspace reboot outcome and duration.
12446 *
12447 * Logged from:
12448 *   frameworks/base/core/java/com/android/server/BootReceiver.java
12449 */
12450message UserspaceRebootReported {
12451    // Possible outcomes of userspace reboot.
12452    enum Outcome {
12453        // Default value in case platform failed to determine the outcome.
12454        OUTCOME_UNKNOWN = 0;
12455        // Userspace reboot succeeded (i.e. boot completed without a fall back to hard reboot).
12456        SUCCESS = 1;
12457        // Userspace reboot shutdown sequence was aborted.
12458        FAILED_SHUTDOWN_SEQUENCE_ABORTED = 2;
12459        // Remounting userdata into checkpointing mode failed.
12460        FAILED_USERDATA_REMOUNT = 3;
12461        // Device didn't finish booting before timeout and userspace reboot watchdog issued a hard
12462        // reboot.
12463        FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED = 4;
12464    }
12465    // Outcome of userspace reboot. Always set.
12466    optional Outcome outcome = 1;
12467    // Duration of userspace reboot in case it has a successful outcome.
12468    // Duration is measured as time between userspace reboot was initiated and until boot completed
12469    // (e.g. sys.boot_completed=1).
12470    optional int64 duration_millis = 2;
12471    // State of primary user's (user0) credential encryption storage.
12472    enum UserEncryptionState {
12473        // Default value.
12474        USER_ENCRYPTION_STATE_UNKNOWN = 0;
12475        // Credential encrypted storage is unlocked.
12476        UNLOCKED = 1;
12477        // Credential encrypted storage is locked.
12478        LOCKED = 2;
12479    }
12480    // State of primary user's encryption storage at the moment boot completed. Always set.
12481    optional UserEncryptionState user_encryption_state = 3;
12482}
12483
12484/*
12485 * Logs integrity check information during each install.
12486 *
12487 * Logged from:
12488 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
12489 */
12490message IntegrityCheckResultReported {
12491    optional string package_name = 1;
12492    optional string app_certificate_hash = 2;
12493    optional int64 version_code = 3;
12494    optional string installer_package_name = 4;
12495    enum Response {
12496        UNKNOWN = 0;
12497        ALLOWED = 1;
12498        REJECTED = 2;
12499        FORCE_ALLOWED = 3;
12500    }
12501    optional Response response = 5;
12502    // An estimate on the cause of the response. This will only be populated for
12503    // REJECTED and FORCE_ALLOWED
12504    optional bool caused_by_app_cert_rule = 6;
12505    optional bool caused_by_installer_rule = 7;
12506}
12507
12508/**
12509 * Logs the information about the rules and the provider whenever rules are
12510 * pushed into AppIntegrityManager.
12511 *
12512 * Logged from:
12513 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
12514 */
12515message IntegrityRulesPushed {
12516    optional bool success = 1;
12517    // Package name of the app that pushed the rules.
12518    optional string rule_provider = 2;
12519    // Version string of arbitrary format provided by the rule provider to
12520    // identify the rules.
12521    optional string rule_version = 3;
12522}
12523
12524/**
12525 * Logs when a cell broadcast message is received on the device.
12526 *
12527 * Logged from Cell Broadcast module and platform:
12528 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
12529 *   packages/apps/CellBroadcastReceiver/
12530 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/CellBroadcastServiceManager.java
12531 */
12532message CellBroadcastMessageReported {
12533    // The type of Cell Broadcast message
12534    enum CbType {
12535        UNKNOWN_TYPE = 0;
12536        GSM = 1;
12537        CDMA = 2;
12538        CDMA_SPC = 3;
12539    }
12540
12541    // The parts of the cell broadcast message pipeline
12542    enum ReportSource {
12543        UNKNOWN_SOURCE = 0;
12544        FRAMEWORK = 1;
12545        CB_SERVICE = 2;
12546        CB_RECEIVER_APP = 3;
12547    }
12548
12549    // GSM, CDMA, CDMA-SCP
12550    optional CbType type = 1;
12551
12552    // The source of the report
12553    optional ReportSource source = 2;
12554}
12555
12556/**
12557 * Logs when a cell broadcast message is filtered out, or otherwise intentionally not sent to CBR.
12558 *
12559 * Logged from CellBroadcastService module:
12560 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
12561 */
12562message CellBroadcastMessageFiltered {
12563    enum FilterReason {
12564        NOT_FILTERED = 0;
12565        DUPLICATE_MESSAGE = 1;
12566        GEOFENCED_MESSAGE = 2;
12567        AREA_INFO_MESSAGE = 3;
12568        DISABLED_BY_OEM = 4;
12569    }
12570
12571    // GSM, CDMA, CDMA-SCP
12572    optional CellBroadcastMessageReported.CbType type = 1;
12573
12574    // The source of the report
12575    optional FilterReason filter = 2;
12576}
12577
12578/**
12579 * Logs when an error occurs while handling a cell broadcast message;
12580 *
12581 * Logged from CellBroadcastService module:
12582 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
12583 */
12584message CellBroadcastMessageError {
12585    // The type of error raised when trying to handle a cell broadcast message
12586    enum ErrorType {
12587        UNKNOWN_TYPE = 0;
12588        CDMA_DECODING_ERROR = 1;
12589        CDMA_SCP_EMPTY = 2;
12590        CDMA_SCP_HANDLING_ERROR = 3;
12591        GSM_INVALID_HEADER_LENGTH = 4;
12592        GSM_UNSUPPORTED_HEADER_MESSAGE_TYPE = 5;
12593        GSM_UNSUPPORTED_HEADER_DATA_CODING_SCHEME = 6;
12594        GSM_INVALID_PDU = 7;
12595        GSM_INVALID_GEO_FENCING_DATA = 8;
12596        GSM_UMTS_INVALID_WAC = 9;
12597        FAILED_TO_INSERT_TO_DB = 10;
12598        UNEXPECTED_GEOMETRY_FROM_FWK = 11;
12599        UNEXPECTED_GSM_MESSAGE_TYPE_FROM_FWK = 12;
12600        UNEXPECTED_CDMA_MESSAGE_TYPE_FROM_FWK = 13;
12601        UNEXPECTED_CDMA_SCP_MESSAGE_TYPE_FROM_FWK = 14;
12602        NO_CONNECTION_TO_CB_SERVICE = 15;
12603    }
12604
12605    // What kind of error occurred
12606    optional ErrorType type = 1;
12607
12608    // Exception message (or log message) associated with the error (max 1000 chars)
12609    optional string exception_message = 2;
12610}
12611
12612/**
12613 * Logs when a TV Input Service Session changes tune state
12614 * This is atom ID 327.
12615 *
12616 * Logged from:
12617 *   frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
12618 */
12619message TifTuneStateChanged {
12620
12621    // Tv Input Service uid, TV Player uid
12622    repeated AttributionNode attribution_node = 1 [
12623        (state_field_option).primary_field_first_uid = true
12624    ];
12625    optional android.stats.tv.TifTuneState state = 2 [
12626        (state_field_option).exclusive_state = true,
12627        (state_field_option).default_state_value = 0,
12628        (state_field_option).nested = false
12629    ];
12630    // This a globally unique 128 bit random number created by TvInputManagerService when
12631    // android.media.tv.TvInputManager#createSession is called.
12632    // It is has no device or user association.
12633    // See android.media.tv.TvInputService.onCreateSession(java.lang.String, java.lang.String)
12634    // WARNING: Any changes to this field should be carefully reviewed for privacy.
12635    //          Inspect the code at
12636    //          framework/base/cmds/statsd/src/atoms.proto
12637    //               TifTuneState
12638    //          frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
12639    //              logTuneStateChanged
12640    //              BinderService.createSession
12641    //              SessionState.sessionId
12642    optional string tif_session_id = 3 [(state_field_option).primary_field = true];
12643    optional android.stats.tv.TifInputType type = 4;
12644    // The id of this TV Input, only unique to a given TV Input Service.
12645    // This is specifically NOT android.media.tv.TvInputInfo.getId()
12646    // which is a string that contains the package name of its TvInputService.
12647    optional int32 input_id = 5  [(state_field_option).primary_field = true];
12648    // The HDMI port id
12649    // Only valid when type == HDMI
12650    optional int32 hdmi_port = 6  [(state_field_option).primary_field = true];
12651}
12652
12653/**
12654 * Logs when a tune occurs through device's Frontend.
12655 * This is atom ID 276.
12656 *
12657 * Logged from:
12658 *   frameworks/base/media/java/android/media/tv/tuner/Tuner.java
12659 */
12660message TvTunerStateChanged {
12661    enum State {
12662        UNKNOWN = 0;
12663        TUNING = 1; // Signal is tuned
12664        LOCKED = 2;    // the signal is locked
12665        NOT_LOCKED = 3; // the signal isn’t locked.
12666        SIGNAL_LOST = 4; // the signal was locked, but is lost now.
12667        SCANNING = 5; // the signal is scanned
12668        SCAN_STOPPED = 6; // the scan is stopped.
12669    }
12670    // The uid of the application that sent this custom atom.
12671    optional int32 uid = 1 [(is_uid) = true];
12672    //  new state
12673    optional State state = 2;
12674}
12675
12676/**
12677 * Logs the status of a dvr playback or record.
12678 * This is atom ID 279.
12679 *
12680 * Logged from:
12681 *   frameworks/base/media/java/android/media/tv/tuner/dvr
12682 */
12683message TvTunerDvrStatus {
12684    enum Type {
12685        UNKNOWN_TYPE = 0;
12686        PLAYBACK = 1; // is a playback
12687        RECORD = 2; // is a record
12688    }
12689    enum State {
12690        UNKNOWN_STATE = 0;
12691        STARTED = 1; // DVR is started
12692        STOPPED = 2; // DVR is stopped
12693    }
12694    // The uid of the application that sent this custom atom.
12695    optional int32 uid = 1 [(is_uid) = true];
12696    // DVR type
12697    optional Type type = 2;
12698    //  DVR state
12699    optional State state = 3;
12700    //  Identify the segment of a record or playback
12701    optional int32 segment_id = 4;
12702    // indicate how many overflow or underflow happened between started to stopped
12703    optional int32 overflow_underflow_count = 5;
12704}
12705
12706/**
12707 * Logs when a cas session opened through MediaCas.
12708 * This is atom ID 280.
12709 *
12710 * Logged from:
12711 *   frameworks/base/media/java/android/media/MediaCas.java
12712 */
12713message TvCasSessionOpenStatus {
12714    enum State {
12715        UNKNOWN = 0;
12716        SUCCEEDED = 1; // indicate that the session is opened successfully.
12717        FAILED = 2; // indicate that the session isn’t opened successfully.
12718    }
12719    // The uid of the application that sent this custom atom.
12720    optional int32 uid = 1 [(is_uid) = true];
12721    //  Cas system Id
12722    optional int32 cas_system_id = 2;
12723    // State of the session
12724    optional State state = 3;
12725}
12726
12727/**
12728 * Logs for ContactsProvider general usage.
12729 * This is atom ID 301.
12730 *
12731 * Logged from:
12732 *   packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
12733 */
12734message ContactsProviderStatusReported {
12735    enum ApiType {
12736        UNKNOWN_API = 0;
12737        QUERY = 1;
12738        // INSERT includes insert and bulkInsert, and inserts triggered by applyBatch.
12739        INSERT = 2;
12740        // UPDATE and DELETE includes update/delete and the ones triggered by applyBatch.
12741        UPDATE = 3;
12742        DELETE = 4;
12743        CALL = 5;
12744    }
12745
12746    // Method called for ApiType.CALL
12747    enum MethodCall {
12748        UNKNOWN_METHOD = 0;
12749        ADD_SIM_ACCOUNTS = 1;
12750        REMOVE_SIM_ACCOUNTS = 2;
12751        GET_SIM_ACCOUNTS = 3;
12752    }
12753
12754    enum ResultType {
12755        UNKNOWN_RESULT = 0;
12756        SUCCESS = 1;
12757        FAIL = 2;
12758        ILLEGAL_ARGUMENT = 3;
12759        UNSUPPORTED_OPERATION = 4;
12760    }
12761
12762    enum CallerType {
12763        UNSPECIFIED_CALLER_TYPE = 0;
12764        CALLER_IS_SYNC_ADAPTER = 1;
12765        CALLER_IS_NOT_SYNC_ADAPTER = 2;
12766    }
12767
12768    enum TaskType {
12769        UNKNOWN_TASK = 0;
12770        DANGLING_CONTACTS_CLEANUP_TASK = 1;
12771    }
12772
12773    optional ApiType api_type = 1;
12774    // Defined in
12775    // packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
12776    optional int32 uri_type = 2;
12777    optional CallerType caller_type = 3;
12778    optional ResultType result_type = 4;
12779    optional int32 result_count = 5;
12780    optional int64 latency_micros = 6;
12781    optional TaskType task_type = 7;
12782    // Set when api_type == CALL
12783    optional MethodCall method_called = 8;
12784}
12785
12786/**
12787 * Logs when an app is frozen or unfrozen.
12788 *
12789 * Logged from:
12790 *   frameworks/base/services/core/java/com/android/server/am/CachedAppOptimizer.java
12791 */
12792message AppFreezeChanged {
12793    // The type of event.
12794    enum Action {
12795        UNKNOWN = 0;
12796        FREEZE_APP = 1;
12797        UNFREEZE_APP = 2;
12798    }
12799    optional Action action = 1;
12800
12801    // Pid of the process being frozen.
12802    optional int32 pid = 2;
12803
12804    // Name of the process being frozen.
12805    optional string process_name = 3;
12806
12807    // Time since last unfrozen.
12808    optional int64 time_unfrozen_millis = 4;
12809}
12810
12811/**
12812 * Pulls information for a single voice call.
12813 *
12814 * Each pull creates multiple atoms, one for each call. The sequence is randomized when pulled.
12815 *
12816 * Pulled from:
12817 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12818 */
12819message VoiceCallSession {
12820    // Bearer (IMS or CS) when the call started.
12821    optional android.telephony.CallBearerEnum bearer_at_start = 1;
12822
12823    // Bearer (IMS or CS) when the call ended.
12824    // The bearer may change during the call, e.g. due to SRVCC.
12825    optional android.telephony.CallBearerEnum bearer_at_end = 2;
12826
12827    // Direction of the call (incoming or outgoing).
12828    optional android.telephony.CallDirectionEnum direction = 3;
12829
12830    // Time spent setting up the call.
12831    optional android.telephony.CallSetupDurationEnum setup_duration = 4;
12832
12833    // Whether the call ended before the setup was completed.
12834    optional bool setup_failed = 5;
12835
12836    // IMS reason code or CS disconnect cause.
12837    // For IMS, see: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
12838    // For CS, see: frameworks/base/telephony/java/android/telephony/DisconnectCause.java
12839    optional int32 disconnect_reason_code = 6;
12840
12841    // IMS extra code or CS precise disconnect cause.
12842    // For IMS, this code is vendor-specific
12843    // For CS, see: frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java
12844    optional int32 disconnect_extra_code = 7;
12845
12846    // IMS extra message or CS vendor cause.
12847    optional string disconnect_extra_message = 8;
12848
12849    // Radio access technology (RAT) used when call started.
12850    optional android.telephony.NetworkTypeEnum rat_at_start = 9;
12851
12852    // Radio access technology (RAT) used when call terminated.
12853    optional android.telephony.NetworkTypeEnum rat_at_end = 10;
12854
12855    // Number of times RAT changed during the call.
12856    optional int64 rat_switch_count = 11;
12857
12858    // A bitmask of all codecs used during the call.
12859    // See: frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java
12860    optional int64 codec_bitmask = 12;
12861
12862    // Number of other calls going on during call setup, for the same SIM slot.
12863    optional int32 concurrent_call_count_at_start = 13;
12864
12865    // Number of other calls going on during call termination, for the same SIM slot.
12866    optional int32 concurrent_call_count_at_end = 14;
12867
12868    // Index of the SIM used, 0 for single-SIM devices.
12869    optional int32 sim_slot_index = 15;
12870
12871    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
12872    optional bool is_multi_sim = 16;
12873
12874    // Whether the call was made with an eSIM profile.
12875    optional bool is_esim = 17;
12876
12877    // Carrier ID of the SIM card.
12878    // See https://source.android.com/devices/tech/config/carrierid.
12879    optional int32 carrier_id = 18;
12880
12881    // Whether an SRVCC has been completed successfully for this call.
12882    optional bool srvcc_completed = 19;
12883
12884    // Number of SRVCC failures.
12885    optional int64 srvcc_failure_count = 20;
12886
12887    // Number of SRVCC cancellations.
12888    optional int64 srvcc_cancellation_count = 21;
12889
12890    // Whether the Real-Time Text (RTT) was ever used in the call (rather than whether RTT was
12891    // enabled in the dialer's settings).
12892    optional bool rtt_enabled = 22;
12893
12894    // Whether this was an emergency call.
12895    optional bool is_emergency = 23;
12896
12897    // Whether the call was performed while roaming.
12898    optional bool is_roaming = 24;
12899
12900    // A random number used as the dimension field to pull multiple atoms.
12901    optional int32 dimension = 25;
12902
12903    // Signal strength at the end of the call. This value is applicable to both cellular and WiFi.
12904    optional android.telephony.SignalStrengthEnum signal_strength_at_end = 26;
12905
12906    // Band at the end of the call. Value 0 is used if the band is unknown.
12907    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending on the RAT at
12908    // the end of the call.
12909    optional int32 band_at_end = 27;
12910
12911    // Time spent setting up the call in milliseconds.
12912    // The time is measured from dial to ringing for outgoing calls, and from answer to connected
12913    // for incoming calls.
12914    optional int32 setup_duration_millis = 28;
12915
12916    // Main codec quality. The codec quality was equal to or greater than this value for at least
12917    // 70% of the call.
12918    optional android.telephony.CodecQuality main_codec_quality = 29;
12919
12920    // Whether video was enabled at any point during the call.
12921    optional bool video_enabled = 30;
12922
12923    // Radio access technology (RAT) used when call is connected.
12924    optional android.telephony.NetworkTypeEnum rat_at_connected = 31;
12925
12926    // Whether the call was a conference call (applicable only for calls over IMS).
12927    optional bool is_multiparty = 32;
12928}
12929
12930/**
12931 * Pulls voice call radio access technology (RAT) usage.
12932 *
12933 * Each pull creates multiple atoms, one for each carrier/RAT, the order of which is irrelevant to
12934 * time. The atom will be skipped if not enough data is available.
12935 *
12936 * Pulled from:
12937 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12938 */
12939message VoiceCallRatUsage {
12940    // Carrier ID (https://source.android.com/devices/tech/config/carrierid).
12941    optional int32 carrier_id = 1;
12942
12943    // Radio access technology.
12944    optional android.telephony.NetworkTypeEnum rat = 2;
12945
12946    // Total duration that voice calls spent on this carrier and RAT, rounded to 5 minutes.
12947    optional int64 total_duration_seconds = 3;
12948
12949    // Total number of calls using this carrier and RAT.
12950    // A call is counted once even if it used the RAT multiple times.
12951    optional int64 call_count = 4;
12952}
12953
12954/**
12955 * Pulls amount of time spend in each cellular service state.
12956 *
12957 * Each pull creates multiple atoms, one for each SIM slot/carrier/RAT(including ENDC), the order of
12958 * which is irrelevant to time. If multi SIM settings changes during the period, durations will be
12959 * counted separately before and after the change. Airplane mode does not count towards durations.
12960 *
12961 * Pulled from:
12962 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12963 */
12964message CellularServiceState {
12965    // Radio access technology (RAT) for voice.
12966    // NETWORK_TYPE_UNKNOWN when the device is out of service.
12967    // NETWORK_TYPE_IWLAN when the device is using VoWiFi.
12968    optional android.telephony.NetworkTypeEnum voice_rat = 1;
12969
12970    // Radio access technology (RAT) for data.
12971    // NETWORK_TYPE_UNKNOWN when the device is out of service.
12972    // Only cellular RATs are valid and show where the device is camped.
12973    optional android.telephony.NetworkTypeEnum data_rat = 2;
12974
12975    // Whether the device was in roaming (domestic or international) for voice.
12976    optional android.telephony.RoamingTypeEnum voice_roaming_type = 3;
12977
12978    // Whether the device was in roaming (domestic or international) for data.
12979    optional android.telephony.RoamingTypeEnum data_roaming_type = 4;
12980
12981    // Whether the device is on LTE and has access to NR NSA, i.e. cell supports 5G (ENDC) and UE
12982    // registration (attach/TAU) indicates ENDC is not restricted.
12983    optional bool is_endc = 5;
12984
12985    // Index of the SIM used, 0 for single-SIM devices.
12986    optional int32 sim_slot_index = 6;
12987
12988    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
12989    optional bool is_multi_sim = 7;
12990
12991    // Carrier ID of the SIM card.
12992    // See https://source.android.com/devices/tech/config/carrierid.
12993    optional int32 carrier_id = 8;
12994
12995    // Total time spent in this service state, rounded to 5 minutes.
12996    optional int32 total_time_seconds = 9;
12997}
12998
12999/**
13000 * Pulls the number of times cellular data service state switches.
13001 *
13002 * Each pull creates multiple atoms, one for each RAT combination, the order of which is irrelevant
13003 * to time. Switches for different SIM slots, carrier IDs, or multi-SIM settings are counted
13004 * separately.
13005 *
13006 * Pulled from:
13007 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13008 */
13009message CellularDataServiceSwitch {
13010    // Cellular RAT of the DATA domain from where the switch occurred.
13011    optional android.telephony.NetworkTypeEnum rat_from = 1;
13012
13013    // Cellular RAT of the DATA domain to where the switch occurred.
13014    optional android.telephony.NetworkTypeEnum rat_to = 2;
13015
13016    // Index of the SIM used, 0 for single-SIM devices.
13017    optional int32 sim_slot_index = 3;
13018
13019    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
13020    optional bool is_multi_sim = 4;
13021
13022    // Carrier ID of the SIM card.
13023    // See https://source.android.com/devices/tech/config/carrierid.
13024    optional int32 carrier_id = 5;
13025
13026    // Number of switches from rat_from to rat_to.
13027    optional int32 switch_count = 6;
13028}
13029
13030/**
13031 * Pulls the number of active SIM slots and SIMs/eSIM profiles.
13032 *
13033 * Pulled from:
13034 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13035 */
13036message SimSlotState {
13037    // Number of active SIM slots (both physical and eSIM profiles) in the device.
13038    optional int32 active_slot_count = 1;
13039
13040    // Number of SIM cards (both physical and active eSIM profiles).
13041    // This number is always equal to or less than the number of active SIM slots.
13042    optional int32 sim_count = 2;
13043
13044    // Number of active eSIM profiles.
13045    // This number is always equal to or less than the number of SIMs.
13046    optional int32 esim_count = 3;
13047}
13048
13049/**
13050 * Pulls supported cellular radio access technologies.
13051 *
13052 * This atom reports the capabilities of the device, rather than the network it has access to.
13053 *
13054 * Pulled from:
13055 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13056 */
13057message SupportedRadioAccessFamily {
13058    // A bitmask of supported radio technologies.
13059    // See android.telephony.TelephonyManager.NetworkTypeBitMask.
13060    optional int64 network_type_bitmask = 1;
13061}
13062
13063/**
13064 * Pulls information about network requests.
13065 *
13066 * Pulled from:
13067 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13068 */
13069message TelephonyNetworkRequests {
13070    // Carrier ID of the SIM card.
13071    // See https://source.android.com/devices/tech/config/carrierid.
13072    optional int32 carrier_id = 1;
13073    // Number of times the enterprise capability was requested.
13074    optional int32 enterprise_request_count = 2;
13075    // Number of times the enterprise capability was released.
13076    optional int32 enterprise_release_count = 3;
13077}
13078
13079/**
13080 * Pulls information for a single incoming SMS.
13081 *
13082 * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
13083 *
13084 * Pulled from:
13085 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13086 */
13087message IncomingSms {
13088    // Format of the SMS (3GPP or 3GPP2).
13089    optional android.telephony.SmsFormatEnum sms_format = 1;
13090
13091    // Technology of the SMS (CS or IMS).
13092    optional android.telephony.SmsTechEnum sms_tech = 2;
13093
13094    // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
13095    optional android.telephony.NetworkTypeEnum rat = 3;
13096
13097    // Type the SMS.
13098    optional android.telephony.SmsTypeEnum sms_type = 4;
13099
13100    // Number of total parts.
13101    optional int32 total_parts = 5;
13102
13103    // Number of received parts (if smaller than total parts, the SMS was dropped).
13104    optional int32 received_parts = 6;
13105
13106    // Indicates if the incoming SMS was blocked.
13107    optional bool blocked = 7;
13108
13109    // Indicate a specific error handling the SMS
13110    optional android.telephony.SmsIncomingErrorEnum error = 8;
13111
13112    // Whether the SMS was received while roaming.
13113    optional bool is_roaming = 9;
13114
13115    // Index of the SIM used, 0 for single-SIM devices.
13116    optional int32 sim_slot_index = 10;
13117
13118    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
13119    optional bool is_multi_sim = 11;
13120
13121    // Whether the message was received with an eSIM profile.
13122    optional bool is_esim = 12;
13123
13124    // Carrier ID of the SIM card used for the SMS.
13125    // See https://source.android.com/devices/tech/config/carrierid.
13126    optional int32 carrier_id = 13;
13127
13128    // Random message ID.
13129    optional int64 message_id = 14;
13130}
13131
13132/**
13133 * Pulls information for a single outgoing SMS.
13134 *
13135 * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
13136 *
13137 * Pulled from:
13138 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13139 */
13140message OutgoingSms {
13141    // Format of the SMS (3GPP or 3GPP2).
13142    optional android.telephony.SmsFormatEnum sms_format = 1;
13143
13144    // Technology of the SMS (CS or IMS).
13145    optional android.telephony.SmsTechEnum sms_tech = 2;
13146
13147    // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
13148    optional android.telephony.NetworkTypeEnum rat = 3;
13149
13150    // Result of the SMS sending.
13151    optional android.telephony.SmsSendResultEnum send_result = 4;
13152
13153    // Error code
13154    // For IMS technology, see @SmsManager.Result in
13155    // http://cs/android/frameworks/base/telephony/java/android/telephony/SmsManager.java
13156    // For CS technology:
13157    //  - GSM format: see GsmSmsErrorCode (3GPP 27.005 clause 3.2.5)
13158    //  - CDMA format: see CdmaSmsErrorCode (3GPP2 N.S0005 (IS-41-C) Table 171)
13159    optional int32 error_code = 5;
13160
13161    // Whether the SMS was sent while roaming.
13162    optional bool is_roaming = 6;
13163
13164    // Whether the default SMS application generated the SMS (regardless of which application).
13165    optional bool is_from_default_app = 7;
13166
13167    // Index of the SIM used, 0 for single-SIM devices.
13168    optional int32 sim_slot_index = 8;
13169
13170    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
13171    optional bool is_multi_sim = 9;
13172
13173    // Whether the message was sent with an eSIM profile.
13174    optional bool is_esim = 10;
13175
13176    // Carrier ID of the SIM card used for the SMS.
13177    // See https://source.android.com/devices/tech/config/carrierid.
13178    optional int32 carrier_id = 11;
13179
13180    // Random message ID.
13181    optional int64 message_id = 12;
13182
13183    // Retry count: 0 for the first attempt and then increasing for each attempt.
13184    optional int32 retry_id = 13;
13185}
13186
13187/**
13188 * Logs information about usage of airplane mode.
13189 *
13190 * Logged from:
13191 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/AirplaneModeStats.java
13192 */
13193message AirplaneMode {
13194    // Status of airplane mode
13195    optional bool is_enabled = 1;
13196
13197    // When is_enabled is false, indicates if this was a very short airplane mode toggle
13198    // (i.e. airplane mode was disabled after less than 10 seconds from enablement).
13199    optional bool short_toggle = 2;
13200
13201    // Carrier ID of the SIM card.
13202    // See https://source.android.com/devices/tech/config/carrierid.
13203    optional int32 carrier_id = 3;
13204}
13205
13206/**
13207 * Logs information about modem restarts.
13208 *
13209 * Logged from:
13210 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/ModemRestartStats.java
13211 */
13212message ModemRestart {
13213    // Software version of the modem, as provided by android.os.Build.getRadioVersion().
13214    optional string baseband_version = 1;
13215
13216    // Reason of the modem restart, as provided in the modemReset indication of IRadio HAL.
13217    optional string reason = 2;
13218
13219    // Carrier ID of the first SIM card.
13220    // See https://source.android.com/devices/tech/config/carrierid.
13221    optional int32 carrier_id = 3;
13222}
13223
13224/**
13225 * Logs the SIM card details when the carrier ID match is not complete.
13226 *
13227 * The atom is pushed when a SIM card is initialized and the MCC/MNC is not present in the
13228 * carrier ID table, or the SIM card contains a GID1 value that is not present in the carrier ID
13229 * table. This atom is pushed only once for each type of SIM card.
13230 *
13231 * Logged from:
13232 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
13233 */
13234message CarrierIdMismatchReported {
13235    // Matched carrier ID. The value -1 is used if no match is found.
13236    optional int32 carrier_id = 1;
13237
13238    // MCC/MNC of the SIM card.
13239    optional string mcc_mnc = 2;
13240
13241    // Group identifier (level 1) of the SIM card.
13242    optional string gid1 = 3;
13243
13244    // SPN value of the SIM card.
13245    optional string spn = 4;
13246
13247    // First record of the PNN in the SIM card. This field is populated only if the SPN is missing
13248    // or empty.
13249    optional string pnn = 5;
13250}
13251
13252/**
13253 * Logs the version of the carrier ID matching table at first power up and when it is updated.
13254 *
13255 * Logged from:
13256 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
13257 */
13258message CarrierIdTableUpdated {
13259    // Version of the CarrierId matching table.
13260    optional int32 table_version = 1;
13261}
13262
13263/**
13264 * Pulls the version of the carrier ID matching table.
13265 *
13266 * Logged from:
13267 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13268 */
13269message CarrierIdTableVersion {
13270    // Version of the CarrierId matching table.
13271    optional int32 table_version = 1;
13272}
13273
13274/**
13275 * Pulls information for a single data call session
13276 *
13277 * Each pull creates multiple atoms, one for each data call session.
13278 * The sequence is randomized when pulled.
13279 *
13280 * Pulled from:
13281 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13282 */
13283message DataCallSession {
13284    // A random number to be used as dimension to capture multiple atoms
13285    optional int32 dimension = 1;
13286
13287    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
13288    optional bool is_multi_sim = 2;
13289
13290    // Whether the call was made with an eSIM profile.
13291    optional bool is_esim = 3;
13292
13293    // Data profile of this call (for what purpose this call was made)
13294    optional android.telephony.DataProfileEnum profile = 4 [deprecated = true];
13295
13296    // APN type bitmask of the APN used:
13297    // @ApnType in frameworks/base/telephony/java/android/telephony/Annotation.java.
13298    optional int32 apn_type_bitmask = 5;
13299
13300    // Carrier ID of the SIM
13301    // See https://source.android.com/devices/tech/config/carrierid.
13302    optional int32 carrier_id = 6;
13303
13304    // Whether the subscription is roaming
13305    optional bool is_roaming = 7;
13306
13307    // Data RAT when the call ended, can be IWLAN for IMS/MMS, otherwise should be WWAN PS RAT.
13308    // In the case that the connection hasn't ended yet, this field holds the current RAT.
13309    // In the case the call ended due to Out Of Service (OOS),
13310    // this field should be the last known RAT.
13311    optional android.telephony.NetworkTypeEnum rat_at_end = 8;
13312
13313    // Was the data call ended due to OOS
13314    optional bool oos_at_end = 9;
13315
13316    // Number of RAT switches during the data call
13317    optional int64 rat_switch_count = 10;
13318
13319    // Whether the call is on an opportunistic subscription
13320    optional bool is_opportunistic = 11;
13321
13322    // Packet data protocol used
13323    optional android.telephony.ApnProtocolEnum ip_type = 12;
13324
13325    // Whether the data call terminated before being established
13326    optional bool setup_failed = 13;
13327
13328    // Reason why the data call terminated, as in RIL_DataCallFailCause from ril.h
13329    optional int32 failure_cause = 14;
13330
13331    // Suggested retry back-off timer value from RIL
13332    optional int32 suggested_retry_millis = 15;
13333
13334    // Why the data call was deactivated
13335    // Set by telephony for MO deactivations (unrelated to failure_cause)
13336    optional android.telephony.DataDeactivateReasonEnum deactivate_reason = 16;
13337
13338    // Duration of the data call, rounded into the closest 5 minutes.
13339    optional int64 duration_minutes = 17;
13340
13341    // Whether the data call is still connected when the atom is collected.
13342    optional bool ongoing = 18;
13343
13344    // Band at the end of the data call. Value 0 is used if the band is unknown.
13345    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
13346    // on the RAT at the end of the data call.
13347    optional int32 band_at_end = 19;
13348}
13349
13350/**
13351 * Logs data stall recovery event
13352 *
13353 * Logged from:
13354 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
13355 */
13356message DataStallRecoveryReported {
13357    // Carrier ID of the SIM
13358    // See https://source.android.com/devices/tech/config/carrierid.
13359    optional int32 carrier_id = 1;
13360
13361    // Data RAT when the stall happened
13362    optional android.telephony.NetworkTypeEnum rat = 2;
13363
13364    // Signal strength when stall happened
13365    optional android.telephony.SignalStrengthEnum signal_strength = 3;
13366
13367    // Action taken to recover
13368    optional android.telephony.DataStallRecoveryActionEnum action = 4;
13369
13370    // Whether the subscription is opportunistic
13371    optional bool is_opportunistic = 5;
13372
13373    // Whether the device is in multi-SIM mode
13374    optional bool is_multi_sim = 6;
13375
13376    // Band used when the stall/recovery took place.
13377    // Value 0 is used if the band is unknown.
13378    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
13379    // on the RAT used at the time.
13380    optional int32 band = 7;
13381
13382    // Whether the data stall is recovered.
13383    optional bool recovered = 8;
13384
13385    // The elapsed time between start of the data stall and result of current action.
13386    optional int32 duration_millis = 9;
13387}
13388
13389/**
13390 * Pulls IMS registration terminations.
13391 *
13392 * Each pull generates multiple atoms, one for each termination condition happened during the day.
13393 *
13394 * Pulled from:
13395 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13396 */
13397message ImsRegistrationTermination {
13398    // Carrier ID of the SIM used for IMS registration.
13399    // See https://source.android.com/devices/tech/config/carrierid.
13400    optional int32 carrier_id = 1;
13401
13402    // Whether the device is in multi-SIM mode when the registration terminated.
13403    optional bool is_multi_sim = 2;
13404
13405    // Radio access technology (RAT) used by the registration when it terminated.
13406    // This can be IWLAN if IMS was registered over Wifi.
13407    optional android.telephony.NetworkTypeEnum rat_at_end = 3;
13408
13409    // Whether the IMS registration failed before it was established.
13410    optional bool setup_failed = 4;
13411
13412    // IMS reason code indicating the termination reason.
13413    // See: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
13414    optional int32 reason_code = 5;
13415
13416    // IMS extra code indicating the termination reason.
13417    optional int32 extra_code = 6;
13418
13419    // IMS extra message indicating the termination reason.
13420    // This string is truncated to 128 characters if its length exceeds the limit.
13421    optional string extra_message = 7;
13422
13423    // Total number of instances of registration termination that matches the above conditions.
13424    optional int32 count = 8;
13425}
13426
13427/**
13428 * Pulls IMS registration statistics.
13429 *
13430 * Each pull generates multiple atoms, one for each carrier, SIM slot, and radio access technology
13431 * (RAT) combination. Durations are aggregated from all registrations with matching criteria,
13432 * including ones that are currently active.
13433 *
13434 * Pulled from:
13435 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13436 */
13437message ImsRegistrationStats {
13438    // Carrier ID of the SIM used for IMS registration.
13439    // See https://source.android.com/devices/tech/config/carrierid.
13440    optional int32 carrier_id = 1;
13441
13442    // Index of the SIM used, 0 for single-SIM devices.
13443    optional int32 sim_slot_index = 2;
13444
13445    // Radio access technology (RAT) used by the registration.
13446    // This can be IWLAN if IMS was registered over Wifi.
13447    optional android.telephony.NetworkTypeEnum rat = 3;
13448
13449    // Total time IMS was registered (connected time), rounded to 5 minutes.
13450    optional int32 registered_seconds = 4;
13451
13452    // Durations that each feature (Voice, Video, UT, SMS) is capable (supported/enabled by the
13453    // network/device) and available (registered and ready to use).
13454    // All durations are rounded to 5 minutes and should be equal to or shorter than
13455    // registered_seconds.
13456    optional int32 voice_capable_seconds = 5;
13457    optional int32 voice_available_seconds = 6;
13458    optional int32 sms_capable_seconds = 7;
13459    optional int32 sms_available_seconds = 8;
13460    optional int32 video_capable_seconds = 9;
13461    optional int32 video_available_seconds = 10;
13462    optional int32 ut_capable_seconds = 11;
13463    optional int32 ut_available_seconds = 12;
13464}
13465
13466/*
13467 * Logs information related to PIN storage and automatic PIN operations.
13468 *
13469 * Logged from:
13470 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/PinStorage.java
13471 */
13472message PinStorageEvent {
13473    // The type of event.
13474    enum Event {
13475        UNKNOWN = 0;
13476        // The PIN was verified automatically successfully.
13477        PIN_VERIFICATION_SUCCESS = 1;
13478        // The PIN was verified automatically unsuccessfully.
13479        PIN_VERIFICATION_FAILURE = 2;
13480        // The PIN(s) was cached, but discarded after reboot (e.g. SIM not present after reboot).
13481        CACHED_PIN_DISCARDED = 3;
13482        // The PIN(s) was stored to be used after unattended reboot.
13483        PIN_STORED_FOR_VERIFICATION = 4;
13484        // The PIN(s) is not available for storage and will be required after unattended reboot.
13485        PIN_REQUIRED_AFTER_REBOOT = 5;
13486        // The PIN was not verified automatically because the SIM card did not match.
13487        PIN_VERIFICATION_SKIPPED_SIM_CARD_MISMATCH = 6;
13488        // The available PINs after reboot does not match the number of stored PINs before reboot.
13489        PIN_COUNT_NOT_MATCHING_AFTER_REBOOT = 7;
13490        // Error while decrypting the PIN
13491        PIN_DECRYPTION_ERROR = 8;
13492        // Error while encrypting the PIN
13493        PIN_ENCRYPTION_ERROR = 9;
13494    }
13495    optional Event event = 1;
13496
13497    // Number of PINs stored or discarded.
13498    optional int32 number_of_pins = 2;
13499
13500    // The caller package name
13501    optional string package_name = 3;
13502}
13503
13504/**
13505 * Logs flip to screen off events.
13506 *
13507 * Logged from:
13508 *   frameworks/opt/telephony/src/java/com/android/server/power/FaceDownDetector.java
13509 */
13510message FaceDownReported {
13511    enum Response{
13512        UNKNOWN = 1;
13513        // The phone was flipped before the screen turns off.
13514        UNFLIP = 2;
13515        // User interacts with the screen after a face down is detected.
13516        USER_INTERACTION = 3;
13517        // A flip leads to screen turning off. This is the expected outcome.
13518        SCREEN_OFF = 4;
13519    }
13520
13521    // Logs the action that occurs from a flip event, whether by user or system
13522    // action.
13523    optional Response face_down_response = 1;
13524
13525    // After a flip is detected, how long until a system or user action occurs.
13526    optional int64 millis_since_flip = 2;
13527
13528    // Difference between the flip time and when the timeout would otherwise
13529    // occur.
13530    optional int64 millis_until_normal_timeout = 3;
13531
13532    // How quickly the user turns the screen back on after a flip event.
13533    // A low value may indicate a false negative. Logged only when Response is
13534    // SCREEN_OFF.
13535    optional int64 millis_until_next_screen_on = 4;
13536}
13537
13538/**
13539 * Logs timeout extended events which occur from consecutive undims.
13540 *
13541 * Logged from:
13542 *   frameworks/opt/telephony/src/java/com/android/server/power/ScreenUndimDetector.java
13543 */
13544message TimeoutAutoExtendedReported {
13545    enum Outcome {
13546        UNKNOWN = 0;
13547        POWER_BUTTON = 1;
13548        TIMEOUT = 2;
13549    }
13550
13551    // Logs the action that occurs after timeout is extended from undim.
13552    optional Outcome outcome = 1;
13553    // Time from timeout extension to the outcome.
13554    optional int64 time_to_outcome_millis = 2;
13555    // Time of first interaction after undim if an interaction occurs.
13556    // -1 if no interaction occurs before screen turns off.
13557    optional int64 time_to_first_interaction_millis = 3;
13558}
13559
13560/**
13561 * Logs gnss stats from location service provider
13562 *
13563 * Pulled from:
13564 *  frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
13565 */
13566message GnssStats {
13567    // Number of location reports since boot
13568    optional int64 location_reports = 1;
13569
13570    // Total pulled reports of Location failures since boot
13571    optional int64 location_failure_reports = 2;
13572
13573    // Number of time to first fix reports since boot
13574    optional int64 time_to_first_fix_reports = 3;
13575
13576    // Total pulled reported time to first fix (in milli-seconds) since boot
13577    optional int64 time_to_first_fix_millis = 4;
13578
13579    // Number of position accuracy reports since boot
13580    optional int64 position_accuracy_reports = 5;
13581
13582    // Total pulled reported position accuracy (in meters) since boot
13583    optional int64 position_accuracy_meters = 6;
13584
13585    // Number of top 4 average CN0 reports since boot
13586    optional int64 top_four_average_cn0_reports = 7;
13587
13588    // Total pulled reported of top 4 average CN0 (dB-mHz) since boot
13589    optional int64 top_four_average_cn0_db_mhz = 8;
13590
13591    // Number of l5 top 4 average CN0 reports since boot
13592    optional int64 l5_top_four_average_cn0_reports = 9;
13593
13594    // Total pulled reported of l5 top 4 average CN0 (dB-mHz) since boot
13595    optional int64 l5_top_four_average_cn0_db_mhz = 10;
13596
13597    // Total number of sv status messages reports since boot
13598    optional int64 sv_status_reports = 11;
13599
13600    // Total number of sv status messages reports, where sv is used in fix since boot
13601    optional int64 sv_status_reports_used_in_fix = 12;
13602
13603    // Total number of L5 sv status messages reports since boot
13604    optional int64 l5_sv_status_reports = 13;
13605
13606    // Total number of L5 sv status messages reports, where sv is used in fix since boot
13607    optional int64 l5_sv_status_reports_used_in_fix = 14;
13608}
13609
13610/**
13611 * Logs power usage data from GNSS subsystem.
13612 *
13613 * Logged from:
13614 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
13615 */
13616message GnssPowerStats {
13617    // Relative precision of the alignment of the reported power stats measurement.
13618    optional int64 elapsed_realtime_uncertainty_nanos = 1;
13619
13620    // Total GNSS energy consumption in micro-joules (or micro Watt-seconds).
13621    optional int64 total_energy_micro_joule = 2;
13622
13623    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13624    // tracking signals of a single frequency band.
13625    optional int64 singleband_tracking_mode_energy_micro_joule = 3;
13626
13627    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13628    // tracking signals of multiple frequency bands.
13629    optional int64 multiband_tracking_mode_energy_micro_joule = 4;
13630
13631    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13632    // acquiring signals of a single frequency band.
13633    optional int64 singleband_acquisition_mode_energy_micro_joule = 5;
13634
13635    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13636    // acquiring signals of multiple frequency bands.
13637    optional int64 multiband_acquisition_mode_energy_micro_joule = 6;
13638
13639    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13640    // operating in each of the vendor-specific power modes. (Index 0)
13641    optional int64 vendor_specific_power_modes_energy_micro_joule_0 = 7;
13642
13643    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13644    // operating in each of the vendor-specific power modes. (Index 1)
13645    optional int64 vendor_specific_power_modes_energy_micro_joule_1 = 8;
13646
13647    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13648    // operating in each of the vendor-specific power modes. (Index 2)
13649    optional int64 vendor_specific_power_modes_energy_micro_joule_2 = 9;
13650
13651    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13652    // operating in each of the vendor-specific power modes. (Index 3)
13653    optional int64 vendor_specific_power_modes_energy_micro_joule_3 = 10;
13654
13655    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13656    // operating in each of the vendor-specific power modes. (Index 4)
13657    optional int64 vendor_specific_power_modes_energy_micro_joule_4 = 11;
13658
13659    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13660    // operating in each of the vendor-specific power modes. (Index 5)
13661    optional int64 vendor_specific_power_modes_energy_micro_joule_5 = 12;
13662
13663    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13664    // operating in each of the vendor-specific power modes. (Index 6)
13665    optional int64 vendor_specific_power_modes_energy_micro_joule_6 = 13;
13666
13667    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13668    // operating in each of the vendor-specific power modes. (Index 7)
13669    optional int64 vendor_specific_power_modes_energy_micro_joule_7 = 14;
13670
13671    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13672    // operating in each of the vendor-specific power modes. (Index 8)
13673    optional int64 vendor_specific_power_modes_energy_micro_joule_8 = 15;
13674
13675    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13676    // operating in each of the vendor-specific power modes. (Index 9)
13677    optional int64 vendor_specific_power_modes_energy_micro_joule_9 = 16;
13678}
13679
13680/**
13681 * Logs when an app is moved to a different standby bucket.
13682 *
13683 * Logged from:
13684 *   frameworks/base/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
13685 */
13686message AppStandbyBucketChanged {
13687    optional string package_name = 1;
13688
13689    // Should be 0, 10, 11, 12, etc. where 0 is the owner. See UserHandle for more documentation.
13690    optional int32 user_id = 2;
13691
13692    // These enum values match the constants defined in UsageStatsManager.java.
13693    enum Bucket {
13694        BUCKET_UNKNOWN = 0;
13695        BUCKET_EXEMPTED = 5;
13696        BUCKET_ACTIVE = 10;
13697        BUCKET_WORKING_SET = 20;
13698        BUCKET_FREQUENT = 30;
13699        BUCKET_RARE = 40;
13700        BUCKET_RESTRICTED = 45;
13701        BUCKET_NEVER = 50;
13702    }
13703    optional Bucket bucket = 3;
13704
13705    enum MainReason {
13706        MAIN_UNKNOWN = 0;
13707        MAIN_DEFAULT = 0x0100;
13708        MAIN_TIMEOUT = 0x0200;
13709        MAIN_USAGE = 0x0300;
13710        MAIN_FORCED_BY_USER = 0x0400;
13711        MAIN_PREDICTED = 0x0500;
13712        MAIN_FORCED_BY_SYSTEM = 0x0600;
13713    }
13714    optional MainReason main_reason = 4;
13715
13716    // A more detailed reason for the standby bucket change. The sub reason name is dependent on
13717    // the main reason. Values are one of the REASON_SUB_XXX constants defined in
13718    // UsageStatsManager.java.
13719    optional int32 sub_reason = 5;
13720}
13721
13722/**
13723* Reports a started sharesheet transaction.
13724*
13725* Logged from:
13726*   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java
13727*/
13728message SharesheetStarted {
13729    // The event_id (as for UiEventReported).
13730    optional int32 event_id = 1;
13731    // The calling app's package name.
13732    optional string package_name = 2;
13733    // An identifier to tie together multiple logs relating to the same share event
13734    optional int32 instance_id = 3;
13735    // The mime type of the share
13736    optional string mime_type = 4;
13737    // The number of direct targets the calling app is providing that will be shown.
13738    optional int32 num_app_provided_direct_targets = 5;
13739    // The number of app targets the calling app is providing that will be shown.
13740    optional int32 num_app_provided_app_targets = 6;
13741    // True if the share originates from the workprofile
13742    optional bool is_workprofile = 7;
13743
13744    enum SharesheetPreviewType {  // Constants from ChooserActivity.java
13745        CONTENT_PREVIEW_TYPE_UNKNOWN = 0;  // Default for proto 2 / 3 compatibility.
13746        CONTENT_PREVIEW_IMAGE = 1;  // The preview shown in the sharesheet is an image.
13747        CONTENT_PREVIEW_FILE = 2;  // The preview shown in the sharesheet is a file.
13748        CONTENT_PREVIEW_TEXT = 3;  // The preview shown in the sharesheet is text.
13749    }
13750    // How the sharesheet preview is presented.
13751    optional SharesheetPreviewType preview_type = 8;
13752
13753    enum ResolverActivityIntent { // Intents handled by ResolverActivity.java
13754        INTENT_DEFAULT = 0;
13755        INTENT_ACTION_VIEW = 1;
13756        INTENT_ACTION_EDIT = 2;
13757        INTENT_ACTION_SEND = 3;
13758        INTENT_ACTION_SENDTO = 4;
13759        INTENT_ACTION_SEND_MULTIPLE = 5;
13760        INTENT_ACTION_IMAGE_CAPTURE = 6;
13761        INTENT_ACTION_MAIN = 7;
13762    }
13763    // The intent being processed (only SEND and SEND_MULTIPLE are system sharesheet)
13764    optional ResolverActivityIntent intent_type = 9;
13765}
13766
13767/**
13768 * Reports a ranking selection event.
13769 *
13770 * Logged from:
13771 *   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java (sharesheet)
13772 */
13773message RankingSelected {
13774    // The event_id (as for UiEventReported).
13775    optional int32 event_id = 1;
13776    // The relevant app's package name (can be source or picked package).
13777    optional string package_name = 2;
13778    // An identifier to tie together multiple logs relating to the same share event.
13779    optional int32 instance_id = 3;
13780    // Which of the ranked targets got picked, default starting position 0.
13781    optional int32 position_picked = 4;
13782}
13783
13784/**
13785 * Logs when TvSettings UI is interacted at.
13786 *
13787 * Logged from: packages/apps/TvSettings
13788 */
13789message TvSettingsUIInteracted {
13790
13791    /** The UI action category */
13792    optional android.app.tvsettings.Action action = 1;
13793
13794    /** The ID of the entry that the users actioned on */
13795    optional android.app.tvsettings.ItemId item_id = 2;
13796}
13797
13798/**
13799 * Logs information about a package installation using package installer V2 APIs.
13800 *
13801 * Logged from:
13802 *      frameworks/base/services/core/java/com/android/server/pm/PackageInstallerSession.java
13803 */
13804message PackageInstallerV2Reported {
13805    // Whether this installation uses Incremental File System
13806    optional bool is_incremental = 1;
13807    // Name of the package that is intended to be installed
13808    optional string package_name = 2;
13809    // The duration between when the install was requested to when the install has completed
13810    optional int64 duration_millis = 3;
13811    // Installation result in final integer, which are SystemApi's.
13812    // Return_code 1 indicates success.
13813    // For full list, see frameworks/base/core/java/android/content/pm/PackageManager.java
13814    optional int32 return_code  = 4;
13815    // Total size of the APKs installed for this package
13816    optional int64 apks_size_bytes = 5;
13817    // UID of the package. -1 if the installation failed.
13818    optional int32 uid = 6 [(is_uid) = true];
13819}
13820
13821/**
13822 * Logs settings provider values.
13823 *
13824 * Use DeviceConfig.getProperties to get a list Setting key, query the data from content provider,
13825 * then write the value to proto.
13826 *
13827 */
13828message SettingSnapshot {
13829
13830    // Setting key
13831    optional string name = 1;
13832
13833    enum SettingsValueType {
13834        NOTASSIGNED = 0;
13835        ASSIGNED_BOOL_TYPE = 1;
13836        ASSIGNED_INT_TYPE = 2;
13837        ASSIGNED_FLOAT_TYPE = 3;
13838        ASSIGNED_STRING_TYPE = 4;
13839    };
13840    // Setting value type
13841    optional SettingsValueType type = 2;
13842
13843    optional bool bool_value = 3;
13844
13845    optional int32 int_value = 4;
13846
13847    optional float float_value = 5;
13848
13849    optional string str_value = 6;
13850
13851    // Android user index. 0 for primary user, 10, 11 for secondary or profile user
13852    optional int32 user_id = 7;
13853}
13854
13855/**
13856 * An event logged to indicate that a user journey is about to be performed. This atom includes
13857 * relevant information about the users involved in the journey. A UserLifecycleEventOccurred event
13858 * will immediately follow this atom which will describe the event(s) and its state.
13859 *
13860 * Logged from:
13861 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
13862 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
13863 */
13864message UserLifecycleJourneyReported {
13865    // An identifier to track a chain of user lifecycle events occurring (referenced in the
13866    // UserLifecycleEventOccurred atom)
13867    optional int64 session_id = 1;
13868
13869    // Indicates what type of user journey this session is related to
13870    enum Journey {
13871        UNKNOWN = 0; // Undefined user lifecycle journey
13872        USER_SWITCH_UI = 1; // A user switch journey where a UI is shown
13873        USER_SWITCH_FG = 2; // A user switch journey without a UI shown
13874        USER_START = 3; // A user start journey
13875        USER_CREATE = 4; // A user creation journey
13876    }
13877    optional Journey journey = 2;
13878    // Which user the journey is originating from - could be -1 for certain phases (eg USER_CREATE)
13879    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
13880    optional int32 origin_user = 3;
13881    // Which user the journey is targeting
13882    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
13883    optional int32 target_user = 4;
13884
13885    // What is the user type of the target user
13886    // These should be in sync with USER_TYPE_* flags defined in UserManager.java
13887    enum UserType {
13888        TYPE_UNKNOWN = 0;
13889        FULL_SYSTEM = 1;
13890        FULL_SECONDARY = 2;
13891        FULL_GUEST = 3;
13892        FULL_DEMO = 4;
13893        FULL_RESTRICTED = 5;
13894        PROFILE_MANAGED = 6;
13895        SYSTEM_HEADLESS = 7;
13896        PROFILE_CLONE = 8;
13897    }
13898    optional UserType user_type = 5;
13899    // What are the flags attached to the target user
13900    optional int32 user_flags = 6;
13901}
13902
13903/**
13904 * An event logged when a specific user lifecycle event is performed. These events should be
13905 * correlated with a UserLifecycleJourneyReported atom via the session_id.
13906 * Note: journeys can span over multiple events, hence some events may share a single session id.
13907 *
13908 * Logged from:
13909 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
13910 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
13911 */
13912message UserLifecycleEventOccurred {
13913    // An id which links back to user details (reported in the UserLifecycleJourneyReported atom)
13914    optional int64 session_id = 1;
13915    // The target user for this event (same as target_user in the UserLifecycleJourneyReported atom)
13916    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
13917    optional int32 user_id = 2;
13918
13919    enum Event {
13920        UNKNOWN = 0; // Indicates that the associated user journey timed-out or resulted in an error
13921        SWITCH_USER = 1; // Indicates that this is a user switch event
13922        START_USER = 2; // Indicates that this is a user start event
13923        CREATE_USER = 3; // Indicates that this is a user create event
13924        USER_RUNNING_LOCKED = 4; // Indicates that user is running in locked state
13925        UNLOCKING_USER = 5; // Indicates that this is a user unlocking event
13926        UNLOCKED_USER = 6; // Indicates that this is a user unlocked event
13927    }
13928    optional Event event = 3;
13929
13930    enum State {
13931        NONE = 0; // Indicates the associated event has no start/end defined
13932        BEGIN = 1;
13933        FINISH = 2;
13934    }
13935    optional State state = 4; // Represents the state of an event (beginning/ending)
13936}
13937
13938/**
13939 * Logs when accessibility shortcut clicked.
13940 *
13941 * Logged from:
13942 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
13943 */
13944message AccessibilityShortcutReported {
13945    // The accessibility feature(including installed a11y service, framework a11y feature,
13946    // and installed a11y activity) package name that is assigned to the accessibility shortcut.
13947    optional string package_name = 1;
13948
13949    // The definition of the accessibility shortcut.
13950    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
13951    optional android.stats.accessibility.ShortcutType shortcut_type = 2;
13952
13953    // The definition of the service status.
13954    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
13955    optional android.stats.accessibility.ServiceStatus service_status = 3;
13956}
13957
13958/**
13959 * Logs when accessibility service status changed.
13960 *
13961 * Logged from:
13962 *   packages/apps/Settings/src/com/android/settings/accessibility
13963 */
13964message AccessibilityServiceReported {
13965    // The accessibility service package name.
13966    optional string package_name = 1;
13967
13968    // The definition of the service status.
13969    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
13970    optional android.stats.accessibility.ServiceStatus service_status = 2;
13971}
13972
13973/**
13974 * Logs when accessibility floating menu changed its position by user.
13975 *
13976 * Logged from:
13977 *   frameworks/base/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu
13978 */
13979message AccessibilityFloatingMenuUIChanged {
13980    // Normalized screen position of the accessibility floating menu. The range is between 0 and 1.
13981    optional float normalized_x_position = 1;
13982    optional float normalized_y_position = 2;
13983
13984    enum Orientation {
13985        UNKNOWN = 0;
13986        PORTRAIT = 1;
13987        LANDSCAPE = 2;
13988    }
13989    // Orientation of the device when accessibility floating menu changed.
13990    optional Orientation orientation = 3;
13991}
13992
13993/**
13994 * Pulls accessibility shortcuts status.
13995 *
13996 * Pulled from:
13997 *   StatsPullAtomService
13998 */
13999message AccessibilityShortcutStats {
14000    // The definition of the accessibility software shortcut.
14001    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
14002    optional android.stats.accessibility.ShortcutType software_shortcut_type = 1;
14003    // Number of accessibility services in accessibility software shortcut.
14004    optional int32 software_shortcut_service_num = 2;
14005
14006    // The definition of the accessibility hardware shortcut.
14007    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
14008    optional android.stats.accessibility.ShortcutType hardware_shortcut_type = 3;
14009    // Number of accessibility services in accessibility hardware shortcut.
14010    optional int32 hardware_shortcut_service_num = 4;
14011
14012    // The definition of the accessibility gesture shortcut.
14013    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
14014    optional android.stats.accessibility.ShortcutType gesture_shortcut_type = 5;
14015    // Number of accessibility services in accessibility gesture shortcut.
14016    optional int32 gesture_shortcut_service_num = 6;
14017}
14018
14019/**
14020 * Pulls accessibility floating menu status.
14021 *
14022 * Pulled from:
14023 *   StatsPullAtomService
14024 */
14025message AccessibilityFloatingMenuStats {
14026    // Size of the accessibility floating menu.
14027    optional int32 size = 1;
14028    // Icon shape of the accessibility floating menu.
14029    optional int32 icon_type = 2;
14030    // Whether the accessibility floating menu is enable auto fade ability.
14031    optional bool fade_enabled = 3;
14032    // Opacity of the accessibility floating menu. The range is between 0 and 1.
14033    optional float opacity = 4;
14034}
14035
14036/**
14037 * Logs when display wake up.
14038 *
14039 * Logged from:
14040 *   services/core/java/com/android/server/power/Notifier.java
14041 */
14042
14043message DisplayWakeReported {
14044    // Wake_up_reason code
14045    // If LOWORD(wake_up_reason) = 0
14046    //     reference to HIWORD(wake_up_reason) PowerManager.WAKE_REASON_XXX
14047    //     else reference wake_up_reason to
14048    //     services/core/java/com/android/server/power/Notifier.java#onWakeUp
14049    optional int32 wake_up_reason = 1;
14050}
14051
14052/**
14053 * Logs app usage events.
14054 */
14055message AppUsageEventOccurred {
14056    optional int32 uid = 1 [(is_uid) = true];
14057    optional string package_name = 2;
14058    optional string class_name = 3;
14059
14060    enum EventType {
14061        NONE = 0;
14062        MOVE_TO_FOREGROUND = 1;
14063        MOVE_TO_BACKGROUND = 2;
14064    }
14065    optional EventType event_type = 4;
14066}
14067
14068/*
14069 * Quality metrics logged when EVS cameras are active.
14070 *
14071 * Logged from:
14072 *  packages/services/Car/evs/manager/1.1/Enumerator.cpp
14073 */
14074message EvsUsageStatsReported {
14075
14076    // Camera identifier to distinguish the source camera device.  This is not
14077    // globally unique and therefore cannot be used to identify the user and/or
14078    // the device.
14079    optional int32 device_id = 1;
14080
14081    // Peak number of clients during the service
14082    optional int32 peak_num_clients = 2;
14083
14084    // Number of erroneous events during the service
14085    optional int32 num_errors = 3;
14086
14087    // Round trip latency of the very first frame
14088    optional int64 first_latency_millis = 4;
14089
14090    // Average frame round trip latency
14091    optional float avg_latency_millis = 5;
14092
14093    // Peak frame round trip latency
14094    optional int64 peak_latency_millis = 6;
14095
14096    // Total number of frames received
14097    optional int64 total_frames = 7;
14098
14099    // Number of frames ignored
14100    optional int64 ignored_frames = 8;
14101
14102    // Number of dropped frames to synchronize camera devices
14103    optional int64 dropped_frames_to_sync = 9;
14104
14105    // The duration of the service
14106    optional int64 duration_millis = 10;
14107}
14108
14109/**
14110 * Logs audio power usage stats.
14111 *
14112 * Pushed from:
14113 *  frameworks/av/services/mediametrics/AudioPowerUsage.cpp
14114 */
14115message AudioPowerUsageDataReported {
14116    /**
14117     * Device used for input/output
14118     *
14119     * All audio devices please refer to below file:
14120     * system/media/audio/include/system/audio-base.h
14121     *
14122     * Define our own enum values because we don't report all audio devices.
14123     * Currently, we only report built-in audio devices such as handset, speaker,
14124     * built-in mics, common audio devices such as wired headset, usb headset
14125     * and bluetooth devices.
14126     */
14127    enum AudioDevice {
14128        OUTPUT_EARPIECE         = 0x1; // handset
14129        OUTPUT_SPEAKER          = 0x2; // dual speaker
14130        OUTPUT_WIRED_HEADSET    = 0x4; // 3.5mm headset
14131        OUTPUT_USB_HEADSET      = 0x8; // usb headset
14132        OUTPUT_BLUETOOTH_SCO    = 0x10; // bluetooth sco
14133        OUTPUT_BLUETOOTH_A2DP   = 0x20; // a2dp
14134        OUTPUT_SPEAKER_SAFE     = 0x40; // bottom speaker
14135
14136        INPUT_DEVICE_BIT        = 0x40000000; // non-negative positive int32.
14137        INPUT_BUILTIN_MIC       = 0x40000001; // buildin mic
14138        INPUT_BUILTIN_BACK_MIC  = 0x40000002; // buildin back mic
14139        INPUT_WIRED_HEADSET_MIC = 0x40000004; // 3.5mm headset mic
14140        INPUT_USB_HEADSET_MIC   = 0x40000008; // usb headset mic
14141        INPUT_BLUETOOTH_SCO     = 0x40000010; // bluetooth sco mic
14142    }
14143    optional AudioDevice audio_device = 1;
14144
14145    // Duration of the audio in seconds
14146    optional int32 duration_secs = 2;
14147
14148    // Average volume (0 ... 1.0)
14149    optional float average_volume = 3;
14150
14151    enum AudioType {
14152        UNKNOWN_TYPE = 0;
14153        VOICE_CALL_TYPE = 1; // voice call
14154        VOIP_CALL_TYPE = 2; // voip call, including uplink and downlink
14155        MEDIA_TYPE = 3; // music and system sound
14156        RINGTONE_NOTIFICATION_TYPE = 4; // ringtone and notification
14157        ALARM_TYPE = 5; // alarm type
14158        // record type
14159        CAMCORDER_TYPE = 6; // camcorder
14160        RECORD_TYPE = 7;  // other recording
14161    }
14162    optional AudioType type = 4;
14163}
14164
14165/**
14166  * Pulls bytes transferred over WiFi and mobile networks sliced by uid, is_metered, and tag.
14167  *
14168  * Pulled from:
14169  *   StatsPullAtomService, which uses NetworkStatsService to query NetworkStats.
14170  */
14171message BytesTransferByTagAndMetered {
14172    optional int32 uid = 1 [(is_uid) = true];
14173
14174    optional bool is_metered = 2;
14175
14176    optional int32 tag = 3;
14177
14178    optional int64 rx_bytes = 4;
14179
14180    optional int64 rx_packets = 5;
14181
14182    optional int64 tx_bytes = 6;
14183
14184    optional int64 tx_packets = 7;
14185}
14186
14187/*
14188 * Logs when the Media Output Switcher finishes a media switch operation.
14189 *
14190 * Logged from:
14191 *  packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputMetricLogger.java
14192 */
14193message MediaOutputOpSwitchReported {
14194    // Source medium type before switching.
14195    optional android.app.settings.mediaoutput.MediumType source = 1;
14196
14197    // Target medium type after switching.
14198    optional android.app.settings.mediaoutput.MediumType target = 2;
14199
14200    // The result of switching.
14201    optional android.app.settings.mediaoutput.SwitchResult result = 3;
14202
14203    // The detail code of a switching result.
14204    optional android.app.settings.mediaoutput.SubResult subresult = 4;
14205
14206    /*
14207     * The package name of a pre-installed app, whose media session is being switched.
14208     */
14209    optional string media_session_package_name = 5;
14210
14211    // The amount of available wired devices when a switching is being performed.
14212    optional int32 available_wired_device_count = 6;
14213
14214    // The amount of available Bluetooth devices a switching is being performed.
14215    optional int32 available_bt_device_count = 7;
14216
14217    // The amount of available remote devices when a switching is being performed.
14218    optional int32 available_remote_device_count = 8;
14219
14220    // The amount of applied devices within a remote dynamic group after a switching is done.
14221    optional int32 applied_device_count_within_remote_group = 9;
14222}
14223
14224/**
14225 * Logs when the Assistant is invoked.
14226 *
14227 * Logged from:
14228 *   frameworks/base/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
14229 */
14230message AssistantInvocationReported {
14231
14232    // The event_id (as for UiEventReported).
14233    optional int32 event_id = 1;
14234
14235    // The registered Assistant's uid and package (as for UiEventReported).
14236    optional int32 uid = 2 [(is_uid) = true];
14237    optional string package_name = 3;
14238
14239    // An identifier used to disambiguate which logs refer to a particular invocation of the
14240    // Assistant  (as for UiEventReported).
14241    optional int32 instance_id = 4;
14242
14243    // The state of the device at the time of invocation.
14244    enum DeviceState {
14245        UNKNOWN_DEVICE_STATE = 0;
14246        AOD1 = 1;
14247        AOD2 = 2;
14248        BOUNCER = 3;
14249        UNLOCKED_LOCKSCREEN = 4;
14250        LAUNCHER_HOME = 5;
14251        LAUNCHER_OVERVIEW = 6;
14252        LAUNCHER_ALL_APPS = 7;
14253        APP_DEFAULT = 8;
14254        APP_IMMERSIVE = 9;
14255        APP_FULLSCREEN = 10;
14256    }
14257    optional DeviceState device_state = 5;
14258
14259    // Whether the Assistant handles were showing at the time of invocation.
14260    optional bool assistant_handles_showing = 6;
14261}
14262
14263/**
14264 * Logs when an AudioRecord finishes running on an audio device
14265 *
14266 * Logged from:
14267 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
14268 */
14269message MediametricsAudioRecordDeviceUsageReported {
14270    // The devices connected to this AudioRecord.
14271    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
14272    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14273    // See audio_device_t in system/media/audio/include/system/audio-base.h
14274    optional string devices = 1;
14275
14276    // The name of the remote device attached to the device, typically available for USB or BT.
14277    // This may be empty for a fixed device, or separated by "|" if more than one.
14278    optional string device_names = 2;
14279
14280    // The amount of time spent in the device as measured by the active track in AudioFlinger.
14281    optional int64 device_time_nanos = 3;
14282
14283    // The audio data format used for encoding.
14284    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
14285    optional string encoding = 4;
14286
14287    // The client-server buffer framecount.
14288    // The framecount is generally between 960 - 48000 for PCM encoding.
14289    // The framecount represents raw buffer size in bytes for non-PCM encoding.
14290    optional int32 frame_count = 5;
14291
14292    // The number of audio intervals (contiguous, continuous playbacks).
14293    optional int32 interval_count = 6;
14294
14295    // The sample rate of the AudioRecord.
14296    // A number generally between 8000-96000 (frames per second).
14297    optional int32 sample_rate = 7;
14298
14299    // The audio input flags used to construct the AudioRecord.
14300    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
14301    optional string flags = 8;
14302
14303    // The santized package name of the audio client associated with the AudioRecord.
14304    // See getSanitizedPackageNameAndVersionCode() in
14305    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
14306    optional string package_name = 9;
14307
14308    // The selected device id (nonzero if a non-default device is selected)
14309    optional int32 selected_device_id = 10;
14310
14311    // The caller of the AudioRecord.
14312    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14313    optional string caller = 11;
14314
14315    // The audio source for AudioRecord.
14316    // An enumeration from system/media/audio/include/system/audio-base.h audio_source_t
14317    optional string source = 12;
14318
14319    // Android S
14320    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
14321    // An empty string means no session id is set.
14322    optional string log_session_id = 13;
14323}
14324
14325/**
14326 * Logs when an AudioThread finishes running on an audio device
14327 *
14328 * Logged from:
14329 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
14330 */
14331message MediametricsAudioThreadDeviceUsageReported {
14332    // The devices connected to this audio thread.
14333    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
14334    // (for record threads):
14335    // See lookup<INPUT_DEVICE> in frameworks/av/services/mediametrics/AudioTypes.cpp
14336    // (for playback threads):
14337    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14338    // See audio_device_t in system/media/audio/include/system/audio-base.h
14339    optional string devices = 1;
14340
14341    // The name of the remote device attached to the device, typically available for USB or BT.
14342    // This may be empty for a fixed device, or separated by "|" if more than one.
14343    optional string device_names = 2;
14344
14345    // The amount of time spent in the device as measured by the active track in AudioFlinger.
14346    optional int64 device_time_nanos = 3;
14347
14348    // The audio data format used for encoding.
14349    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
14350    optional string encoding = 4;
14351
14352    // The framecount of the buffer delivered to (or from) the HAL.
14353    // The framecount is generally ~960 for PCM encoding.
14354    // The framecount represents raw buffer size in bytes for non-PCM encoding.
14355    optional int32 frame_count = 5;
14356
14357    // The number of audio intervals (contiguous, continuous playbacks).
14358    optional int32 interval_count = 6;
14359
14360    // The sample rate of the audio thread.
14361    // A number generally between 8000-96000 (frames per second).
14362    optional int32 sample_rate = 7;
14363
14364    // The audio flags used to construct the thread
14365    // (for record threads):
14366    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
14367    // (for playback threads):
14368    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
14369    optional string flags = 8;
14370
14371    // The number of underruns encountered for a playback thread or the
14372    // number of overruns encountered for a capture thread.
14373    optional int32 xruns = 9;
14374
14375    // The type of thread
14376    // A thread type enumeration from
14377    // frameworks/av/mediametrics/services/Translate.h
14378    optional string type = 10;
14379}
14380
14381/**
14382 * Logs when an AudioTrack finishes running on an audio device
14383 *
14384 * Logged from:
14385 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
14386 */
14387message MediametricsAudioTrackDeviceUsageReported {
14388    // The output devices connected to this AudioTrack.
14389    // A string OR of various output device categories, e.g. "DEVICE1|DEVICE2".
14390    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14391    // See audio_device_t in system/media/audio/include/system/audio-base.h
14392    optional string devices = 1;
14393
14394    // The name of the remote device attached to the device, typically available for USB or BT.
14395    // This may be empty for a fixed device, or separated by "|" if more than one.
14396    optional string device_names = 2;
14397
14398    // The amount of time spent in the device as measured by the active track in AudioFlinger.
14399    optional int64 device_time_nanos = 3;
14400
14401    // The audio data format used for encoding.
14402    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
14403    optional string encoding = 4;
14404
14405    // The client-server buffer framecount.
14406    // The framecount is generally between 960 - 48000 for PCM encoding.
14407    // The framecount represents raw buffer size in bytes for non-PCM encoding.
14408    // A static track (see traits) may have a very large framecount.
14409    optional int32 frame_count = 5;
14410
14411    // The number of audio intervals (contiguous, continuous playbacks).
14412    optional int32 interval_count = 6;
14413
14414    // The sample rate of the AudioTrack.
14415    // A number generally between 8000-96000 (frames per second).
14416    optional int32 sample_rate = 7;
14417
14418    // The audio flags used to construct the AudioTrack.
14419    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
14420    optional string flags = 8;
14421
14422    // The number of underruns encountered.
14423    optional int32 xruns = 9;
14424
14425    // The santized package name of the audio client associated with the AudioTrack.
14426    // See getSanitizedPackageNameAndVersionCode() in
14427    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
14428    optional string package_name = 10;
14429
14430    // The latency of the last sample in the buffer in milliseconds.
14431    optional float device_latency_millis = 11;
14432
14433    // The startup time in milliseconds from start() to sample played.
14434    optional float device_startup_millis = 12;
14435
14436    // The average volume of the track on the device [ 0.f - 1.f ]
14437    optional float device_volume = 13;
14438
14439    // The selected device id (nonzero if a non-default device is selected)
14440    optional int32 selected_device_id = 14;
14441
14442    // The stream_type category for the AudioTrack.
14443    // An enumeration from system/media/audio/include/system/audio-base.h audio_stream_type_t
14444    optional string stream_type = 15;
14445
14446    // The usage for the AudioTrack.
14447    // An enumeration from system/media/audio/include/system/audio-base.h audio_usage_t
14448    optional string usage = 16;
14449
14450    // The content type of the AudioTrack.
14451    // An enumeration from system/media/audio/include/system/audio-base.h audio_content_type_t
14452    optional string content_type = 17;
14453
14454    // The caller of the AudioTrack.
14455    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14456    optional string caller = 18;
14457
14458    // The traits of the AudioTrack.
14459    // A string OR of different traits, may be empty string.
14460    // Only "static" is supported for R.
14461    // See lookup<TRACK_TRAITS>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14462    optional string traits = 19;
14463
14464    // Android S
14465    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
14466    // An empty string means no session id is set.
14467    optional string log_session_id = 20;
14468}
14469
14470/**
14471 * Logs the status of an audio device connection attempt.
14472 *
14473 * Logged from:
14474 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
14475 */
14476message MediametricsAudioDeviceConnectionReported {
14477    // The input devices represented by this report.
14478    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
14479    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14480    // See audio_device_t in system/media/audio/include/system/audio-base.h
14481    optional string input_devices = 1;
14482
14483    // The output devices represented by this report.
14484    // A string OR of various output device categories.
14485    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14486    // See audio_device_t in system/media/audio/include/system/audio-base.h
14487    optional string output_devices = 2;
14488
14489    // The name of the remote device attached to the device, typically available for USB or BT.
14490    // This may be empty for a fixed device, or separated by "|" if more than one.
14491    optional string device_names = 3;
14492
14493    // The result of the audio device connection.
14494    // 0 indicates success: connection verified.
14495    // 1 indicates unknown: connection not verified or not known if diverted properly.
14496    // Other values indicate specific status.
14497    // See DeviceConnectionResult in frameworks/av/services/mediametrics/AudioTypes.h
14498    optional int32 result = 4;
14499
14500    // Average milliseconds of time to connect
14501    optional float time_to_connect_millis = 5;
14502
14503    // Number of connections if aggregated statistics, otherwise 1.
14504    optional int32 connection_count = 6;
14505}
14506
14507/**
14508 * Logs: i) creation of different types of cryptographic keys in the keystore,
14509 * ii) operations performed using the keys,
14510 * iii) attestation of the keys
14511 * Logged from: system/security/keystore/key_event_log_handler.cpp
14512 */
14513message KeystoreKeyEventReported {
14514
14515    enum Algorithm {
14516        /** Asymmetric algorithms. */
14517        RSA = 1;
14518        // 2 removed, do not reuse.
14519        EC = 3;
14520        /** Block cipher algorithms */
14521        AES = 32;
14522        TRIPLE_DES = 33;
14523        /** MAC algorithms */
14524        HMAC = 128;
14525    };
14526    /** Algorithm associated with the key */
14527    optional Algorithm algorithm = 1;
14528
14529    /** Size of the key */
14530    optional int32 key_size = 2;
14531
14532    enum KeyOrigin {
14533        /** Generated in keymaster.  Should not exist outside the TEE. */
14534        GENERATED = 0;
14535        /** Derived inside keymaster.  Likely exists off-device. */
14536        DERIVED = 1;
14537        /** Imported into keymaster.  Existed as cleartext in Android. */
14538        IMPORTED = 2;
14539        /** Keymaster did not record origin. */
14540        UNKNOWN = 3;
14541        /** Securely imported into Keymaster. */
14542        SECURELY_IMPORTED = 4;
14543    };
14544    /* Logs whether the key was generated, imported, securely imported, or derived.*/
14545    optional KeyOrigin key_origin = 3;
14546
14547    enum HardwareAuthenticatorType {
14548        NONE = 0;
14549        PASSWORD = 1;
14550        FINGERPRINT = 2;
14551        // Additional entries must be powers of 2.
14552    };
14553    /**
14554     * What auth types does this key require? If none,
14555     * then no auth required.
14556     */
14557    optional HardwareAuthenticatorType user_auth_type = 4;
14558
14559    /**
14560     * If user authentication is required, is the requirement time based? If it
14561     * is not time based then this field will not be used and the key is per
14562     * operation. Per operation keys must be user authenticated on each usage.
14563     */
14564    optional int32 user_auth_key_timeout_secs = 5;
14565
14566    /**
14567     * padding mode, digest, block_mode and purpose should ideally be repeated
14568     * fields. However, since statsd does not support repeated fields in
14569     * pushed atoms, they are represented using bitmaps.
14570     */
14571
14572    /** Track which padding mode is being used.*/
14573    optional int32 padding_mode_bitmap = 6;
14574
14575    /** Track which digest is being used. */
14576    optional int32 digest_bitmap = 7;
14577
14578    /** Track what block mode is being used (for encryption). */
14579    optional int32 block_mode_bitmap = 8;
14580
14581    /** Track what purpose is this key serving. */
14582    optional int32 purpose_bitmap = 9;
14583
14584    enum EcCurve {
14585        P_224 = 0;
14586        P_256 = 1;
14587        P_384 = 2;
14588        P_521 = 3;
14589    };
14590    /** Which ec curve was selected if elliptic curve cryptography is in use **/
14591    optional EcCurve ec_curve = 10;
14592
14593    enum KeyBlobUsageRequirements {
14594        STANDALONE = 0;
14595        REQUIRES_FILE_SYSTEM = 1;
14596    };
14597    /** Standalone or is a file system required */
14598    optional KeyBlobUsageRequirements key_blob_usage_reqs = 11;
14599
14600    enum Type {
14601        key_operation = 0;
14602        key_creation = 1;
14603        key_attestation = 2;
14604    }
14605    /** Key creation event, operation event or attestation event? */
14606    optional Type type = 12;
14607
14608    /** Was the key creation, operation, or attestation successful? */
14609    optional bool was_successful = 13;
14610
14611    /** Response code or error code */
14612    optional int32 error_code = 14;
14613}
14614
14615/**
14616 * Logs: key creation events with Algorithm, Origin, Error and Attestation info.
14617 * Logged from: system/security/keystore2/metrics.rs
14618 */
14619message Keystore2KeyCreationWithGeneralInfo {
14620
14621    // Algorithm associated with the key
14622    optional android.system.security.keystore2.Algorithm algorithm = 1;
14623
14624    // Size of the key, based on the algorithm used.
14625    optional int32 key_size = 2;
14626
14627    enum EcCurve {
14628        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14629        EC_CURVE_UNSPECIFIED = 0;
14630        P_224 = 1;
14631        P_256 = 2;
14632        P_384 = 3;
14633        P_521 = 4;
14634    };
14635    // Which ec curve was selected if elliptic curve cryptography is in use
14636    optional EcCurve ec_curve = 3;
14637
14638    enum KeyOrigin {
14639        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14640        ORIGIN_UNSPECIFIED = 0;
14641        // Generated in keymaster.  Should not exist outside the TEE.
14642        GENERATED = 1;
14643        // Derived inside keymaster.  Likely exists off-device.
14644        DERIVED = 2;
14645        // Imported into keymaster.  Existed as cleartext in Android.
14646        IMPORTED = 3;
14647        // Previously used for another purpose that is now obsolete.
14648        RESERVED = 4;
14649        // Securely imported into Keymaster.
14650        SECURELY_IMPORTED = 5;
14651    };
14652    // Logs whether the key was generated, imported, securely imported, or derived.
14653    optional KeyOrigin key_origin = 4;
14654
14655    /**
14656     * Response code (system/hardware/interfaces/keystore2/aidl/../ResponseCode.aidl)
14657     * or
14658     * error code (hardware/interfaces/security/keymint/aidl/../ErrorCode.aidl)
14659     */
14660    optional int32 error_code = 5;
14661
14662    // Indicates whether key attestation is requested in creation
14663    optional bool attestation_requested = 6;
14664
14665    // Count of a particular combination of field values of this atom
14666    optional int32 count = 7;
14667}
14668
14669/**
14670 * Logs: key creation events with authentication info.
14671 * Logged from: system/security/keystore2/metrics.rs
14672 */
14673message Keystore2KeyCreationWithAuthInfo {
14674
14675    enum HardwareAuthenticatorType {
14676        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14677        AUTH_TYPE_UNSPECIFIED = 0;
14678        NONE = 1;
14679        PASSWORD = 2;
14680        FINGERPRINT = 3;
14681        ANY = 5;
14682    };
14683    /**
14684     * What auth types does this key require? If none,
14685     * then no auth required.
14686     */
14687    optional HardwareAuthenticatorType user_auth_type = 1;
14688
14689    /**
14690     * If user authentication is required, is the requirement time based? If it
14691     * is time based then this field indicates the base 10 logarithm of time out in seconds.
14692     * Logarithm is taken in order to reduce the cardinaltiy.
14693     */
14694    optional int32 log_auth_timeout_seconds = 2;
14695
14696    // Security level of the Keymint instance which creates the key.
14697    optional android.system.security.keystore2.SecurityLevelEnum security_level = 3;
14698
14699    // Count of a particular combination of field values of this atom
14700    optional int32 count = 4;
14701}
14702
14703/**
14704 * Logs: key creation events with purpose and modes info.
14705 * Logged from: system/security/keystore2/metrics.rs
14706 */
14707message Keystore2KeyCreationWithPurposeAndModesInfo {
14708    // Algorithm associated with the key
14709    optional android.system.security.keystore2.Algorithm algorithm = 1;
14710
14711	/**
14712     * Track which purpose is being used.
14713     * Bitmap composition is given by KeyPurposeBitPosition enum
14714     * defined in system/security/keystore2/metrics.rs.
14715     */
14716    optional int32 purpose_bitmap = 2;
14717
14718    /**
14719     * Track which padding mode is being used.
14720     * Bitmap composition is given by PaddingModeBitPosition enum
14721     * defined in system/security/keystore2/metrics.rs.
14722     */
14723    optional int32 padding_mode_bitmap = 3;
14724
14725    /**
14726     * Track which digest is being used.
14727     * Bitmap composition is given by DigestBitPosition enum
14728     * defined in system/security/keystore2/metrics.rs.
14729     */
14730    optional int32 digest_bitmap = 4;
14731
14732    /**
14733     * Track which block mode is being used.
14734     * Bitmap composition is given by BlockModeBitPosition enum
14735     * defined in system/security/keystore2/metrics.rs.
14736     */
14737    optional int32 block_mode_bitmap = 5;
14738
14739    // Count of a particular combination of field values of this atom
14740    optional int32 count = 6;
14741}
14742
14743/**
14744 * Logs the atom id of the atoms associated with key creation/operation events, that have reached
14745 * the maximum storage limit allocated for different atom objects of that atom,
14746 * in keystore in-memory store.
14747 *
14748 * Size of the storage bucket for each atom is limited considering their expected cardinaltity.
14749 * This limit may exceed if the dimensions of the atoms take a large number of unexpected
14750 * combinations. This atom is used to track such cases.
14751 */
14752message Keystore2AtomWithOverflow {
14753
14754    // Atom id as defined in atoms.proto
14755    optional int32 atom_id = 1;
14756
14757    // Count of the objects of this atom type that have overflowed.
14758    optional int32 count = 2;
14759}
14760
14761/**
14762 * Logs: key operations events with purpose and modes info.
14763 * Logged from: system/security/keystore2/metrics.rs
14764 */
14765message Keystore2KeyOperationWithPurposeAndModesInfo {
14766
14767    enum KeyPurpose {
14768        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14769        KEY_PURPOSE_UNSPECIFIED = 0;
14770
14771        // Usable with RSA, 3DES and AES keys.
14772        ENCRYPT = 1;
14773
14774        // Usable with RSA, 3DES and AES keys.
14775        DECRYPT = 2;
14776
14777        // Usable with RSA, EC and HMAC keys.
14778        SIGN = 3;
14779
14780        // Usable with RSA, EC and HMAC keys.
14781        VERIFY = 4;
14782
14783        // 5 is reserved
14784        // Usable with RSA keys.
14785        WRAP_KEY = 6;
14786
14787        // Key Agreement, usable with EC keys.
14788        AGREE_KEY = 7;
14789
14790        // Usable as an attestation signing key.
14791        ATTEST_KEY = 8;
14792    }
14793    // Purpose of the key operation
14794    optional KeyPurpose purpose = 1;
14795
14796    /**
14797     * Track which padding mode is being used.
14798     * Bitmap composition is given by PaddingModeBitPosition enum
14799     * defined in system/security/keystore2/metrics.rs.
14800     */
14801    optional int32 padding_mode_bitmap = 2;
14802
14803    /**
14804     * Track which digest is being used.
14805     * Bitmap composition is given by DigestBitPosition enum
14806     * defined in system/security/keystore2/metrics.rs.
14807     */
14808    optional int32 digest_bitmap = 3;
14809
14810    /**
14811     * Track which block mode is being used.
14812     * Bitmap composition is given by BlockModeBitPosition enum
14813     * defined in system/security/keystore2/metrics.rs.
14814     */
14815    optional int32 block_mode_bitmap = 4;
14816
14817    // Count of a particular combination of field values of this atom
14818    optional int32 count = 5;
14819}
14820
14821/**
14822 * Logs key operations events with outcome, error_code, security level and whether the key is
14823 * upgraded during the operation.
14824 * Logged from: system/security/keystore2/metrics.rs
14825 */
14826message Keystore2KeyOperationWithGeneralInfo {
14827
14828    enum Outcome {
14829        OUTCOME_UNSPECIFIED = 0;
14830        DROPPED = 1;
14831        SUCCESS = 2;
14832        ABORT = 3;
14833        PRUNED = 4;
14834        ERROR = 5;
14835    }
14836    // Outcome of the operation
14837    optional Outcome outcome = 1;
14838
14839    // Response code or error code in case of error outcome
14840    optional int32 error_code = 2;
14841
14842    // Indicates whether the key was upgraded during the operation
14843    optional bool key_upgraded = 3;
14844
14845    // Security level of the Keymint instance which performs the operation.
14846    optional android.system.security.keystore2.SecurityLevelEnum security_level = 4;
14847
14848    // Count of a particular combination of field values of this atom
14849    optional int32 count = 5;
14850}
14851
14852/**
14853 * Logs: Keystore 2 storage statistics.
14854 * Logged from: system/security/keystore2
14855 */
14856message Keystore2StorageStats {
14857    enum Storage {
14858       STORAGE_UNSPECIFIED = 0;
14859       KEY_ENTRY = 1;
14860       KEY_ENTRY_ID_INDEX = 2;
14861       KEY_ENTRY_DOMAIN_NAMESPACE_INDEX = 3;
14862       BLOB_ENTRY = 4;
14863       BLOB_ENTRY_KEY_ENTRY_ID_INDEX = 5;
14864       KEY_PARAMETER = 6;
14865       KEY_PARAMETER_KEY_ENTRY_ID_INDEX = 7;
14866       KEY_METADATA = 8;
14867       KEY_METADATA_KEY_ENTRY_ID_INDEX = 9;
14868       GRANT = 10;
14869       AUTH_TOKEN = 11;
14870       BLOB_METADATA = 12;
14871       BLOB_METADATA_BLOB_ENTRY_ID_INDEX =13;
14872       METADATA = 14;
14873       DATABASE = 15;
14874       LEGACY_STORAGE = 16;
14875    }
14876    // Type of the storage (database table or legacy storage) of which the size is reported.
14877    optional Storage storage_type = 1;
14878    // Storage size in bytes
14879    optional int64 size = 2;
14880    // Unused space, in bytes. The total storage size may be larger, indicating
14881    // inefficiencies in the packing of data in the database.
14882    optional int64 unused_size = 3;
14883}
14884
14885/**
14886 * Logs Remote Key Provisioning (RKP) related error events.
14887 * Logged from: system/security/keystore2
14888 */
14889message RkpErrorStats {
14890
14891    enum RkpError {
14892        RKP_ERROR_UNSPECIFIED = 0;
14893        // The key pool is out of keys.
14894        OUT_OF_KEYS = 1;
14895        // Falling back to factory provisioned keys during hybrid mode.
14896        FALL_BACK_DURING_HYBRID = 2;
14897    }
14898    // Type of the error event
14899    optional RkpError rkp_error = 1;
14900
14901    // Count of a particular error occurred.
14902    optional int32 count = 2;
14903}
14904
14905/**
14906 * Logs: Status of the attestation key pool related to
14907 * Remote Key Provisioning (RKP).
14908 * Logged from: system/security/keystore2
14909 */
14910message RkpPoolStats {
14911    /**
14912     * Security level of the Keymint instance associated with the
14913     * attestation pool status.
14914     */
14915    optional android.system.security.keystore2.SecurityLevelEnum security_level = 1;
14916
14917    /**
14918     * The number of signed attestation certificate chains which are
14919     * expired.
14920     */
14921    optional int32 expiring = 2;
14922
14923    /**
14924     * The number of signed attestation certificate chains which have
14925     * not yet been assigned to an app.
14926     */
14927    optional int32 unassigned = 3;
14928
14929    /**
14930     * The number of signed attestation keys.
14931     */
14932    optional int32 attested = 4;
14933
14934    /**
14935     * The total number of attestation keys.
14936     */
14937    optional int32 total = 5;
14938
14939}
14940
14941/**
14942 * Logs: Number of keystore2 crashes per-boot cycle.
14943 * Logged from: system/security/keystore2
14944 */
14945message Keystore2CrashStats {
14946    optional int32 count_of_crash_events = 1;
14947}
14948
14949// Blob Committer stats
14950// Keep in sync between:
14951//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14952//     frameworks/base/cmds/statsd/src/atoms.proto
14953message BlobCommitterProto {
14954    // Committer app's uid
14955    optional int32 uid = 1 [(is_uid) = true];
14956
14957    // Unix epoch timestamp of the commit in milliseconds
14958    optional int64 commit_timestamp_millis = 2;
14959
14960    // Flags of what access types the committer has set for the Blob
14961    optional int32 access_mode = 3;
14962
14963    // Number of packages that have been whitelisted for ACCESS_TYPE_WHITELIST
14964    optional int32 num_whitelisted_package = 4;
14965}
14966
14967// Blob Leasee stats
14968// Keep in sync between:
14969//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14970//     frameworks/base/cmds/statsd/src/atoms.proto
14971message BlobLeaseeProto {
14972    // Leasee app's uid
14973    optional int32 uid = 1 [(is_uid) = true];
14974
14975    // Unix epoch timestamp for lease expiration in milliseconds
14976    optional int64 lease_expiry_timestamp_millis = 2;
14977}
14978
14979// List of Blob Committers
14980// Keep in sync between:
14981//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14982//     frameworks/base/cmds/statsd/src/atoms.proto
14983message BlobCommitterListProto {
14984    repeated BlobCommitterProto committer = 1;
14985}
14986
14987// List of Blob Leasees
14988// Keep in sync between:
14989//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14990//     frameworks/base/cmds/statsd/src/atoms.proto
14991message BlobLeaseeListProto {
14992    repeated BlobLeaseeProto leasee = 1;
14993}
14994
14995/**
14996 * Logs the current state of a Blob committed with BlobStoreManager
14997 *
14998 * Pulled from:
14999 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
15000 */
15001message BlobInfo {
15002    // Id of the Blob
15003    optional int64 blob_id = 1;
15004
15005    // Size of the Blob data
15006    optional int64 size = 2;
15007
15008    // Unix epoch timestamp of the Blob's expiration in milliseconds
15009    optional int64 expiry_timestamp_millis = 3;
15010
15011    // List of committers of this Blob
15012    optional BlobCommitterListProto committers = 4 [(log_mode) = MODE_BYTES];
15013
15014    // List of leasees of this Blob
15015    optional BlobLeaseeListProto leasees = 5 [(log_mode) = MODE_BYTES];
15016}
15017
15018/**
15019 * Logs when the HDMI CEC active source changes.
15020 *
15021 * Logged from:
15022 *   frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
15023 */
15024message HdmiCecActiveSourceChanged {
15025    // The logical address of the active source.
15026    optional android.stats.hdmi.LogicalAddress active_source_logical_address = 1;
15027
15028    // The physical address of the active source. Consists of four hexadecimal nibbles.
15029    // Examples: 0x1234, 0x0000 (root device). 0xFFFF represents an unknown or invalid address.
15030    // See section 8.7 in the HDMI 1.4b spec for details.
15031    optional int32 active_source_physical_address = 2;
15032
15033    // The relationship between this device and the active source.
15034    optional android.stats.hdmi.PathRelationship local_relationship = 3;
15035}
15036
15037/**
15038 * Logs when an HDMI CEC message is sent or received.
15039 *
15040 * Logged from:
15041 *   frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
15042 */
15043message HdmiCecMessageReported {
15044    // The calling uid of the application that caused this atom to be written.
15045    optional int32 uid = 1 [(is_uid) = true];
15046
15047    // Whether a HDMI CEC message is sent from this device, to this device, or neither.
15048    optional android.stats.hdmi.MessageDirection direction = 2;
15049
15050    // The HDMI CEC logical address of the initiator.
15051    optional android.stats.hdmi.LogicalAddress initiator_logical_address = 3;
15052
15053    // The HDMI CEC logical address of the destination.
15054    optional android.stats.hdmi.LogicalAddress destination_logical_address = 4;
15055
15056    // The opcode of the message. Ranges from 0x00 to 0xFF.
15057    // For all values, see section "CEC 15 Message Descriptions" in the HDMI CEC 1.4b spec.
15058    optional int32 opcode = 5;
15059
15060    // The result of attempting to send the message on its final retransmission attempt.
15061    // Only applicable to outgoing messages; set to SEND_MESSAGE_RESULT_UNKNOWN otherwise.
15062    optional android.stats.hdmi.SendMessageResult send_message_result = 6;
15063
15064    // Fields specific to <User Control Pressed> messages
15065
15066    // The user control command that was received.
15067    optional android.stats.hdmi.UserControlPressedCommand user_control_pressed_command = 7;
15068
15069    // Fields specific to <Feature Abort> messages
15070
15071    // The opcode of the message that was feature aborted.
15072    // Set to 0x100 when unknown or not applicable.
15073    optional int32 feature_abort_opcode = 8;
15074
15075    // The reason for the feature abort.
15076    optional android.stats.hdmi.FeatureAbortReason feature_abort_reason = 9;
15077}
15078
15079/**
15080 * Logs when an auto rotate event occurs while smart auto rotate is enabled.
15081 */
15082message AutoRotateReported {
15083    enum Orientation {
15084        UNKNOWN = 0;
15085        DEPRECATED = 1;
15086        ROTATION_0 = 2;
15087        ROTATION_90 = 3;
15088        ROTATION_180 = 4;
15089        ROTATION_270 = 5;
15090        DISABLED = 6;
15091        UNAVAILABLE = 7;
15092        FAILURE = 8;
15093    }
15094
15095    // Orientation of the device when a rotation was detected.
15096    optional Orientation current_orientation = 1;
15097    // The orientation of the phone after rotation before going through the recommendation service.
15098    optional Orientation proposed_orientation = 2;
15099    // Orientation recommended by the smart autorotate service component outside of the platform. It
15100    // may or may not match the proposed_orientation. Can be disabled or unavailable if the
15101    // recommendation service is disabled or unavailable. Will be unknown if the service failed.
15102    optional Orientation recommended_orientation = 3;
15103    // Time taken to calculate the rotation recommendation.
15104    optional int64 recommendation_process_duration_millis = 4;
15105}
15106
15107/**
15108 * Logs when sensors only autorotate is triggered. Associated event can be a rotation preindication,
15109 * actual event or a "data ready to be pulled" indication. More info: go/autorotate-logging.
15110 *
15111 * Logged from:
15112 *    platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
15113 */
15114
15115message DeviceRotated {
15116  // Timestamp of the event in millis. We log the timestamp explicitly since
15117  // data logging will follow the event logging and all these
15118  // will be joined with other logs such as rotation button clicked.
15119  optional int64 timestamp_millis = 1;
15120  // Device orientation
15121  optional android.stats.wm.Orientation proposed_orientation = 2;
15122
15123  enum RotationEventType{
15124    UNKNOWN = 0;
15125    // An early indication of device might be rotated.
15126    PREINDICATION = 1;
15127    // Device rotation is detected.
15128    ACTUAL_EVENT = 2;
15129    // Device rotated and the data associated with it is ready to be pulled.
15130    // This happens after the ACTUAL_EVENT since some data after the event is
15131    // also useful.
15132    DATA_READY = 3;
15133  }
15134  optional RotationEventType rotation_event_type = 3;
15135}
15136
15137/**
15138 * Records the raw sensor data published by the device orientation debug sensor. The pull will be
15139 * configured to be conditioned on the {@code DeviceRotated} atom.
15140 *
15141 * Logged from:
15142 *     platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
15143 */
15144message DeviceRotatedData {
15145  // All the sensor data and timestamps used to calculate the orientation
15146  optional DeviceRotatedSensorData snapshot = 1 [(log_mode) = MODE_BYTES];
15147  // Resulting orientation
15148  optional android.stats.wm.Orientation proposed_orientation = 2;
15149}
15150
15151message DeviceRotatedSensorData {
15152  optional DeviceRotatedSensorHeader header = 1 [(log_mode) = MODE_BYTES];
15153  repeated DeviceRotatedSensorSample sample = 2 [(log_mode) = MODE_BYTES];
15154}
15155
15156message DeviceRotatedSensorHeader {
15157  optional int64 timestamp_base_millis = 1;
15158}
15159
15160message DeviceRotatedSensorSample{
15161  optional int32 timestamp_offset_millis = 1;
15162  enum SensorType {
15163    UNKNOWN = 0;
15164    ACCEL = 1;
15165    GYRO = 2;
15166  }
15167  optional SensorType sensor_type = 2;
15168  optional float x_value = 3;
15169  optional float y_value = 4;
15170  optional float z_value = 5;
15171}
15172
15173/**
15174  * Pushes TLS handshake counters from Conscrypt.
15175  * Pulled from:
15176  *   external/conscrypt/common/src/main/java/org/conscrypt/ConscryptEngineSocket.java
15177  *   external/conscrypt/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java
15178  */
15179message TlsHandshakeReported {
15180    optional bool success = 1;
15181
15182    optional android.stats.tls.Protocol protocol = 2;
15183
15184    optional android.stats.tls.CipherSuite cipher_suite = 3;
15185
15186    optional int32 handshake_duration_millis = 4;
15187}
15188
15189/**
15190 * Logs when a TextClassifier API is invoked.
15191 *
15192 * See frameworks/base/core/java/android/view/textclassifier/TextClassifier.java
15193 * Logged from: external/libtextclassifier/java/
15194 */
15195message TextClassifierApiUsageReported {
15196    enum ApiType {
15197        UNKNOWN_API = 0;
15198        SUGGEST_SELECTION = 1;
15199        CLASSIFY_TEXT = 2;
15200        GENERATE_LINKS = 3;
15201        DETECT_LANGUAGES = 4;
15202        SUGGEST_CONVERSATION_ACTIONS = 5;
15203    }
15204    optional ApiType api_type = 1;
15205
15206    enum ResultType {
15207        UNKNOWN_RESULT = 0;
15208        SUCCESS = 1;
15209        FAIL = 2;
15210    }
15211    optional ResultType result_type = 2;
15212    optional int64 latency_millis = 3;
15213    optional string session_id = 4;
15214}
15215
15216/**
15217 * Logs the current state of an application/process before it is killed.
15218 *
15219 * Keep in sync with proto file at
15220 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15221 *
15222 * Pushed from:
15223 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15224 */
15225message CarWatchdogKillStatsReported {
15226    // Linux process uid for the package.
15227    optional int32 uid = 1 [(is_uid) = true];
15228
15229    // State of the uid when it was killed.
15230    enum UidState {
15231        UNKNOWN_UID_STATE = 0;
15232        BACKGROUND_MODE = 1;
15233        FOREGROUND_MODE = 2;
15234    }
15235    optional UidState uid_state = 2;
15236
15237    // System state indicating whether the system was in normal mode or garage mode.
15238    enum SystemState {
15239        UNKNOWN_SYSTEM_STATE = 0;
15240        USER_INTERACTION_MODE = 1;
15241        USER_NO_INTERACTION_MODE = 2;
15242        GARAGE_MODE = 3;
15243    }
15244    optional SystemState system_state = 3;
15245
15246    // Reason for killing the application.
15247    // Keep in sync with proto file at packages/services/Car/cpp/watchdog/proto
15248    enum KillReason {
15249        UNKNOWN_KILL_REASON = 0;
15250        KILLED_ON_ANR = 1;
15251        KILLED_ON_IO_OVERUSE = 2;
15252        KILLED_ON_MEMORY_OVERUSE = 3;
15253    }
15254    optional KillReason kill_reason = 4;
15255
15256    // Stats of the processes owned by the application when the application was killed.
15257    // The process stack traces are not collected when the application was killed due to IO_OVERUSE.
15258    optional CarWatchdogProcessStats process_stats = 5 [(log_mode) = MODE_BYTES];
15259
15260    // The application's I/O overuse stats logged only when the kill reason is KILLED_ON_IO_OVERUSE.
15261    optional CarWatchdogIoOveruseStats io_overuse_stats = 6 [(log_mode) = MODE_BYTES];
15262}
15263
15264/**
15265 * Logs the I/O overuse stats for an application on detecting I/O overuse.
15266 *
15267 * Keep in sync with proto file at
15268 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15269 *
15270 * Pushed from:
15271 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15272 */
15273message CarWatchdogIoOveruseStatsReported {
15274    // Linux process uid for the package.
15275    optional int32 uid = 1 [(is_uid) = true];
15276
15277    // The application's I/O overuse stats.
15278    optional CarWatchdogIoOveruseStats io_overuse_stats = 2 [(log_mode) = MODE_BYTES];
15279}
15280
15281/**
15282 * Logs I/O overuse stats for a package.
15283 *
15284 * Keep in sync with proto file at
15285 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15286 *
15287 * Logged from:
15288 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15289 */
15290message CarWatchdogIoOveruseStats {
15291    enum Period {
15292        UNKNOWN_PERIOD = 0;
15293        DAILY = 1;
15294        WEEKLY = 2;
15295    }
15296
15297    // Threshold and usage stats period.
15298    optional Period period = 1;
15299
15300    // Threshold in-terms of write bytes defined for the package.
15301    optional CarWatchdogPerStateBytes threshold = 2;
15302
15303    // Number of write bytes in each state for the specified period.
15304    optional CarWatchdogPerStateBytes written_bytes = 3;
15305
15306    // Application or service uptime during the aforementioned period.
15307    optional uint64 uptime_millis = 4;
15308};
15309
15310/**
15311 * Logs bytes attributed to each application and system states.
15312 *
15313 * Keep in sync with proto file at
15314 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15315 *
15316 * Logged from:
15317 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15318 */
15319message CarWatchdogPerStateBytes {
15320    // Number of bytes attributed to the application foreground.
15321    optional int64 foreground_bytes = 1;
15322
15323    // Number of bytes attributed to the application background.
15324    optional int64 background_bytes = 2;
15325
15326    // Number of bytes attributed to the garage mode.
15327    optional int64 garage_mode_bytes = 3;
15328}
15329
15330/**
15331 * Logs each CarWatchdogProcessStat in CarWatchdogProcessStats.
15332 *
15333 * Keep in sync with proto file at
15334 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15335 *
15336 * Logged from:
15337 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15338 */
15339message CarWatchdogProcessStats {
15340    // Records the stats of the processes owned by an application.
15341    repeated CarWatchdogProcessStat process_stat = 1;
15342}
15343
15344/**
15345 * Logs a process's stats.
15346 *
15347 * Keep in sync with proto file at
15348 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15349 *
15350 * Logged from:
15351 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15352 */
15353message CarWatchdogProcessStat {
15354    // Command name of the process.
15355    optional string process_name = 1;
15356
15357    // Process uptime.
15358    optional uint64 uptime_millis = 2;
15359
15360    // Number of major page faults caused by the process and its children.
15361    optional uint64 major_page_faults = 3;
15362
15363    // Peak virtual memory size in kb.
15364    optional uint64 vm_peak_kb = 4;
15365
15366    // Virtual memory size in kb.
15367    optional uint64 vm_size_kb = 5;
15368
15369    // Peak resident set size (high water mark) in kb.
15370    optional uint64 vm_hwm_kb = 6;
15371
15372    // Resident set size in kb.
15373    optional uint64 vm_rss_kb = 7;
15374}
15375
15376/**
15377 * Logs total I/O usage summary for all applications and services running in the system.
15378 *
15379 * Keep in sync with proto file at
15380 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15381 *
15382 * Pulled from:
15383 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15384 */
15385message CarWatchdogSystemIoUsageSummary {
15386    // I/O usage summary for the system.
15387    optional CarWatchdogIoUsageSummary io_usage_summary = 1 [(log_mode) = MODE_BYTES];
15388}
15389
15390/**
15391 * Logs I/O usage summary for an UID.
15392 *
15393 * Keep in sync with proto file at
15394 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15395 *
15396 * Pulled from:
15397 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15398 */
15399message CarWatchdogUidIoUsageSummary {
15400    // UID of the application/service whose usage summary are recorded.
15401    optional int32 uid = 1 [(is_uid) = true];
15402
15403    // I/O usage summary for the UID.
15404    optional CarWatchdogIoUsageSummary io_usage_summary = 2 [(log_mode) = MODE_BYTES];
15405}
15406
15407/**
15408 * Logs I/O usage summary for a time period.
15409 *
15410 * Keep in sync with proto file at
15411 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15412 *
15413 * Pulled from:
15414 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15415 */
15416message CarWatchdogIoUsageSummary {
15417    // Summary event time period.
15418    optional CarWatchdogEventTimePeriod event_time_period = 1;
15419
15420    // Daily I/O usage summary for the period. Logs summary entries only for days with I/O usage.
15421    // The entries are ordered beginning from the event_time_period.start_time_millis.
15422    repeated CarWatchdogDailyIoUsageSummary daily_io_usage_summary = 2;
15423}
15424
15425/**
15426 * Logs a car watchdog event's time period.
15427 *
15428 * Keep in sync with proto file at
15429 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15430 *
15431 * Pulled from:
15432 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15433 */
15434message CarWatchdogEventTimePeriod {
15435    enum Period {
15436        UNKNOWN_PERIOD = 0;
15437        WEEKLY = 1;
15438        BIWEEKLY = 2;
15439        MONTHLY = 3;
15440    }
15441
15442    // Start time of the event in milliseconds since epoch.
15443    optional uint64 start_time_millis = 1;
15444
15445    // Period for the event.
15446    optional Period period = 2;
15447}
15448
15449/**
15450 * Logs daily I/O usage summary.
15451 *
15452 * Keep in sync with proto file at
15453 * packages/services/Car/service/src/com/android/car/watchdog/proto/atoms.proto
15454 *
15455 * Pulled from:
15456 *  packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
15457 */
15458message CarWatchdogDailyIoUsageSummary {
15459    // Total bytes written to disk during a day.
15460    optional CarWatchdogPerStateBytes written_bytes = 1;
15461
15462    // Total uptime for the system or service or application during a day.
15463    optional uint64 uptime_millis = 2;
15464
15465    // Total disk I/O overuses during a day.
15466    optional int32 overuse_count = 3;
15467}
15468
15469/*
15470 * pushes Media playback information.
15471 * Logged from
15472 *  frameworks/base/services/core/java/com/android/server/media/metrics/
15473 *      MediaMetricsManagerService.java
15474 */
15475message MediametricsPlaybackReported {
15476    optional int32 uid = 1 [(is_uid) = true];
15477
15478    // Randomly generated log session ID. A Base64 encoded hex string representing a
15479    // 128-bit integer.
15480    optional string log_session_id = 2;
15481    // The total length of the media in milliseconds. 0 for live contents.
15482    optional int64 media_duration_millis = 3;
15483    // Network, device, or mixed.
15484    optional android.stats.mediametrics.StreamSourceType stream_source = 4;
15485    // Stream type. DASH, HLS, etc
15486    optional android.stats.mediametrics.StreamType stream_type = 5;
15487    // Live, VOD, others
15488    optional android.stats.mediametrics.PlaybackType playback_type = 6;
15489    // DRM type
15490    optional android.stats.mediametrics.DrmType drm_type = 7;
15491    // Main, AD, others
15492    optional android.stats.mediametrics.ContentType content_type = 8;
15493    // Player name. E.g. ExoPlayer
15494    optional string player_name = 9;
15495    // Player version. E.g. 1.10.3e
15496    optional string player_version = 10;
15497    // Player related experiment IDs
15498    optional Experiments experiment_ids = 11 [(log_mode) = MODE_BYTES];
15499    // Number of frames played. Dropped frames included. -1 means unknown.
15500    optional int32 video_frames_played = 12;
15501    // Number of frames dropped. -1 means unknown.
15502    optional int32 video_frames_dropped = 13;
15503    // Number of audio underruns. -1 means unknown.
15504    optional int32 audio_underrun_count = 14;
15505    // Total number of bytes read from the network
15506    optional int64 network_bytes_read = 15;
15507    // Total number of bytes read from on-device sources
15508    optional int64 local_bytes_read = 16;
15509    // Total transfer spent reading from the network in ms.
15510    // For parallel requests, the overlapping time intervals are counted only once.
15511    optional int64 network_transfer_duration_millis = 17;
15512    // A session ID generated from DRM to distinguish different DRM sessions.
15513    optional string drm_session_id = 18;
15514}
15515
15516message MediaNetworkInfoChanged {
15517    // Randomly generated log session ID. A Base64 encoded hex string representing a
15518    // 128-bit integer.
15519    optional string log_session_id = 1;
15520    //  New network type
15521    optional android.stats.mediametrics.NetworkType type = 2;
15522    //  Network Start time, relative to playback creation time in millisecond.
15523    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15524    optional int64 time_since_playback_created_millis = 3;
15525}
15526
15527message MediaPlaybackStateChanged {
15528    // Randomly generated log session ID. A Base64 encoded hex string representing a
15529    // 128-bit integer.
15530    optional string log_session_id = 1;
15531    //  New playback state
15532    optional android.stats.mediametrics.PlaybackState playback_state = 2;
15533    //  State change time, relative to playback creation time in millisecond.
15534    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15535    optional int64 time_since_playback_created_millis = 3;
15536}
15537
15538message MediaPlaybackErrorReported {
15539    // Randomly generated log session ID. A Base64 encoded hex string representing a
15540    // 128-bit integer.
15541    optional string log_session_id = 1;
15542    //  A shortened call stack of the error
15543    optional string exception_stack = 2;
15544    //  Error code
15545    optional android.stats.mediametrics.PlaybackErrorCode error_code = 3;
15546    //  Sub-code of error type specified by the error code.
15547    optional int32 sub_error_code = 4;
15548    //  Error time, relative to playback creation time in millisecond.
15549    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15550    optional int64 time_since_playback_created_millis = 5;
15551}
15552
15553message MediaPlaybackTrackChanged {
15554    // Randomly generated log session ID. A Base64 encoded hex string representing a
15555    // 128-bit integer.
15556    optional string log_session_id = 1;
15557    //  The track is on or off after the change
15558    optional android.stats.mediametrics.TrackState state = 2;
15559    //  The reason of the track change
15560    optional android.stats.mediametrics.TrackChangeReason reason = 3;
15561    //  The MIME type of the container. E.g. video/mp4
15562    optional string container_mime_type = 4;
15563    //  The sample MIME type of the track. E.g. video/avc
15564    optional string sample_mime_type = 5;
15565
15566    //  Codec name
15567    optional string codec_name = 6;
15568    //  Bits per second. 0 means unknown.
15569    optional int32 bitrate = 7;
15570
15571    //  Track change time, relative to playback creation time in millisecond.
15572    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15573    optional int64 time_since_playback_created_millis = 8;
15574
15575    //  Track type. Audio, Video, Text
15576    optional android.stats.mediametrics.TrackType type = 9;
15577    //  2-letter ISO 639-1 language code.
15578    optional string language = 10;
15579    //  IETF BCP 47 optional language region subtag based on a two-letter country code
15580    optional string language_region = 11;
15581    //  Number of channels
15582    optional int32 channel_count = 12;
15583    //  Samples per second
15584    optional int32 sample_rate = 13;
15585    //  The width of the video in pixels.
15586    optional int32 width = 14;
15587    //  The height of the video in pixels.
15588    optional int32 height = 15;
15589    //  Video frame rate in frames per second.
15590    optional float video_frame_rate = 16;
15591}
15592
15593message Experiments {
15594    // Experiment IDs sent by the player.
15595    repeated int64 experiments = 1;
15596}
15597
15598/**
15599 * Logs when a Wifi network scan happens.
15600 *
15601 * Logged from:
15602 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
15603 */
15604message WifiScanReported {
15605    enum Type {
15606        TYPE_UNKNOWN = 0;
15607
15608        // Single scan.
15609        TYPE_SINGLE = 1;
15610
15611        // Background scan (deprecated, should not happen).
15612        TYPE_BACKGROUND = 2;
15613    }
15614
15615    enum Result {
15616        RESULT_UNKNOWN = 0;
15617
15618        // Failed to start scan.
15619        RESULT_FAILED_TO_START = 1;
15620
15621        // The HAL reported a scan failure after the scan was started.
15622        RESULT_FAILED_TO_SCAN = 2;
15623
15624        // Scan succeeded.
15625        RESULT_SUCCESS = 3;
15626    }
15627
15628    enum Source {
15629        SOURCE_UNKNOWN = 0;
15630
15631        // No work source set - not possible to determine the origin.
15632        SOURCE_NO_WORK_SOURCE = 1;
15633
15634        // The Wifi stack.
15635        SOURCE_WIFI_STACK = 2;
15636
15637        // GMS on behalf of some other app.
15638        SOURCE_GMS = 3;
15639
15640        // Settings app.
15641        SOURCE_SETTINGS_APP = 4;
15642
15643        // Other app directly.
15644        SOURCE_OTHER_APP = 5;
15645    }
15646
15647    enum Importance {
15648        IMPORTANCE_UNKNOWN = 0;
15649
15650        // Foreground app. Corresponds to the value of
15651        // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND or less.
15652        IMPORTANCE_FOREGROUND = 1;
15653
15654        // Foreground service. Corresponds to the value of
15655        // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE
15656        IMPORTANCE_FOREGROUND_SERVICE = 2;
15657
15658        // Everything else.
15659        IMPORTANCE_BACKGROUND = 3;
15660    }
15661
15662    // Scan type
15663    optional Type type = 1;
15664
15665    // Outcome: success/failure
15666    optional Result result = 2;
15667
15668    // What initiated a scan.
15669    optional Source source = 3;
15670
15671    // Process importance of the initiator.
15672    // This is only available for non-system calls.
15673    optional Importance importance = 4;
15674
15675    // Time taken for the scan.
15676    optional int32 scan_duration_millis = 5;
15677
15678    // Count of found networks.
15679    optional int32 count_networks_found = 6;
15680}
15681
15682/**
15683 * Logs when a Wifi PNO (Preferred Network Offload) scan happens.
15684 *
15685 * Logged from:
15686 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
15687 */
15688message WifiPnoScanReported {
15689    enum State {
15690        UNKNOWN = 0;
15691
15692        // Scan started.
15693        STARTED = 1;
15694
15695        // Scan failed to start (e.g. bad request, unsupported by hardware, etc).
15696        FAILED_TO_START = 2;
15697
15698        // Scan completed and a network was found.
15699        // Note - due to implementation constraints, nothing is reported when a scan completes but
15700        // doesn't find any networks.
15701        FINISHED_NETWORKS_FOUND = 3;
15702
15703        // Scan failed.
15704        FAILED = 4;
15705    }
15706
15707    optional State state = 1;
15708}
15709
15710/**
15711 * Logs when the entitlement configuration of an IMS service is queried/updated.
15712 *
15713 * Logged from: ImsServiceEntitlement app
15714 */
15715message ImsServiceEntitlementUpdated {
15716    // The purpose of entitlement query/update
15717    enum Purpose {
15718        UNKNOWN_PURPOSE = 0;
15719
15720        // Initial service activation in foreground
15721        ACTIVATION = 1;
15722
15723        // Updating service configuration in foreground
15724        UPDATE = 2;
15725
15726        // Background polling for querying service entitlement
15727        POLLING = 3;
15728    }
15729
15730    // The IMS services
15731    enum ServiceType {
15732        UNKNOWN_SERVICE = 0;
15733        VOWIFI = 1;
15734        VOLTE = 2;
15735        SMSOIP = 3;
15736    }
15737
15738    // The result of activation
15739    enum AppResult {
15740        UNKNOWN_RESULT = 0;
15741        ENABLED = 1;
15742        DISABLED = 2;
15743        INCOMPATIBLE = 3;
15744        PROVISIONING = 4;
15745        SUCCESSFUL = 5;
15746        FAILED = 6;
15747        CANCELED = 7;
15748        TIMEOUT = 8;
15749        UNEXPECTED_RESULT = 9;
15750    }
15751
15752    // The Android carrier ID for the carrier providing the IMS service.
15753    // This may not be the actual carrier of the device, e.g. a MVNO
15754    // may use the IMS service of its MNO.
15755    optional int64 carrier_id = 1;
15756
15757    // The Android carrier ID of the actual carrier.
15758    // E.g. a MVNO may use its MNO's IMS service. In this case,
15759    // actual_carrier_id is the MVNO and carrier_id is the MNO.
15760    optional int64 actual_carrier_id = 2;
15761
15762    // The purpose of this query/update.
15763    optional Purpose purpose = 3;
15764
15765    // Which IMS service's entitlement status were queried/updated.
15766    optional ServiceType service_type = 4;
15767
15768    // Result of this query/update.
15769    optional AppResult app_result = 5;
15770
15771    // How long (in milliseconds) this query/update took.
15772    optional int64 duration_millis = 6;
15773}
15774
15775// Indicates which compile filter was used for the package being loaded in an ART session.
15776enum ArtCompileFilter {
15777    ART_COMPILATION_FILTER_ERROR = 1;
15778    ART_COMPILATION_FILTER_UNKNOWN = 2;
15779    ART_COMPILATION_FILTER_ASSUMED_VERIFIED = 3;
15780    ART_COMPILATION_FILTER_EXTRACT = 4;
15781    ART_COMPILATION_FILTER_VERIFY = 5;
15782    ART_COMPILATION_FILTER_QUICKEN = 6;
15783    ART_COMPILATION_FILTER_SPACE_PROFILE = 7;
15784    ART_COMPILATION_FILTER_SPACE = 8;
15785    ART_COMPILATION_FILTER_SPEED_PROFILE = 9;
15786    ART_COMPILATION_FILTER_SPEED = 10;
15787    ART_COMPILATION_FILTER_EVERYTHING_PROFILE = 11;
15788    ART_COMPILATION_FILTER_EVERYTHING = 12;
15789    ART_COMPILATION_FILTER_FAKE_RUN_FROM_APK = 13;
15790    ART_COMPILATION_FILTER_FAKE_RUN_FROM_APK_FALLBACK = 14;
15791    ART_COMPILATION_FILTER_FAKE_RUN_FROM_VDEX_FALLBACK = 15;
15792}
15793
15794enum ArtCompilationReason {
15795    ART_COMPILATION_REASON_ERROR = 1;
15796    ART_COMPILATION_REASON_UNKNOWN = 2;
15797    ART_COMPILATION_REASON_FIRST_BOOT = 3;
15798    ART_COMPILATION_REASON_BOOT = 4;
15799    ART_COMPILATION_REASON_INSTALL = 5;
15800    ART_COMPILATION_REASON_BG_DEXOPT = 6;
15801    ART_COMPILATION_REASON_AB_OTA = 7;
15802    ART_COMPILATION_REASON_INACTIVE = 8;
15803    ART_COMPILATION_REASON_SHARED = 9;
15804    ART_COMPILATION_REASON_INSTALL_WITH_DEX_METADATA = 10;
15805    ART_COMPILATION_REASON_POST_BOOT = 11;
15806    ART_COMPILATION_REASON_INSTALL_FAST = 12;
15807    ART_COMPILATION_REASON_INSTALL_BULK = 13;
15808    ART_COMPILATION_REASON_INSTALL_BULK_SECONDARY = 14;
15809    ART_COMPILATION_REASON_INSTALL_BULK_DOWNGRADED = 15;
15810    ART_COMPILATION_REASON_INSTALL_BULK_SECONDARY_DOWNGRADED = 16;
15811    ART_COMPILATION_REASON_BOOT_AFTER_OTA = 17;
15812    ART_COMPILATION_REASON_PREBUILT = 18;
15813    ART_COMPILATION_REASON_CMDLINE = 19;
15814}
15815
15816// Indicates which kind of measurement ART is reporting.
15817//
15818// Where it makes sense, the datum ID ends with the type of datum (counter or histogram) and the
15819// units.
15820// Note: Histograms are not yet reported by statsd.
15821enum ArtDatumId {
15822    ART_DATUM_INVALID = 0;
15823    ART_DATUM_GC_WORLD_STOP_TIME_AVG_MICROS = 1;
15824    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_TIME_HISTO_MILLIS = 2;
15825    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_COUNT = 3;
15826    ART_DATUM_GC_FULL_HEAP_COLLECTION_TIME_HISTO_MILLIS = 4;
15827    ART_DATUM_GC_FULL_HEAP_COLLECTION_COUNT = 5;
15828    ART_DATUM_JIT_METHOD_COMPILE_TIME_MICROS = 6;
15829    ART_DATUM_AOT_COMPILE_TIME = 7;
15830    ART_DATUM_CLASS_VERIFICATION_TIME_COUNTER_MICROS = 8;
15831    ART_DATUM_CLASS_LOADING_TIME_COUNTER_MICROS = 9;
15832
15833    // Metrics IDs for dex2oat.
15834    ART_DATUM_DEX2OAT_RESULT_CODE = 10;
15835    ART_DATUM_DEX2OAT_DEX_CODE_COUNTER_BYTES = 11;
15836    ART_DATUM_DEX2OAT_TOTAL_TIME_COUNTER_MILLIS = 12;
15837    ART_DATUM_DEX2OAT_VERIFY_DEX_FILE_TIME_COUNTER_MILLIS = 13;
15838    ART_DATUM_DEX2OAT_FAST_VERIFY_TIME_COUNTER_MILLIS = 14;
15839    ART_DATUM_DEX2OAT_RESOLVE_METHODS_AND_FIELDS_TIME_COUNTER_MILLIS = 15;
15840
15841    ART_DATUM_CLASS_VERIFICATION_COUNT = 16;
15842    ART_DATUM_GC_TOTAL_BYTES_ALLOCATED = 17;
15843    ART_DATUM_GC_TOTAL_METADATA_SIZE_BYTES = 18 [deprecated=true];
15844    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_THROUGHPUT_HISTO_MB_PER_SEC = 19;
15845    ART_DATUM_GC_FULL_HEAP_COLLECTION_THROUGHPUT_HISTO_MB_PER_SEC = 20;
15846    ART_DATUM_JIT_METHOD_COMPILE_COUNT = 21;
15847    ART_DATUM_GC_YOUNG_GENERATION_TRACING_THROUGHPUT_HISTO_MB_PER_SEC = 22;
15848    ART_DATUM_GC_FULL_HEAP_TRACING_THROUGHPUT_HISTO_MB_PER_SEC = 23;
15849    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_THROUGHPUT_AVG_MB_PER_SEC = 24;
15850    ART_DATUM_GC_FULL_HEAP_COLLECTION_THROUGHPUT_AVG_MB_PER_SEC = 25;
15851    ART_DATUM_GC_YOUNG_GENERATION_TRACING_THROUGHPUT_AVG_MB_PER_SEC = 26;
15852    ART_DATUM_GC_FULL_HEAP_TRACING_THROUGHPUT_AVG_MB_PER_SEC = 27;
15853    ART_DATUM_GC_TOTAL_COLLECTION_TIME_MS = 28;
15854}
15855
15856// Indicates what class of thread the reported values apply to.
15857enum ArtThreadType {
15858    ART_THREAD_MAIN = 1;
15859    ART_THREAD_BACKGROUND = 2;
15860}
15861
15862// Indicates the type of dex metadata.
15863enum ArtDexMetadataType {
15864  ART_DEX_METADATA_TYPE_UNKNOWN = 0;
15865  ART_DEX_METADATA_TYPE_PROFILE = 1;
15866  ART_DEX_METADATA_TYPE_VDEX = 2;
15867  ART_DEX_METADATA_TYPE_PROFILE_AND_VDEX = 3;
15868  ART_DEX_METADATA_TYPE_NONE = 4;
15869  ART_DEX_METADATA_TYPE_ERROR = 5;
15870}
15871
15872// Indicates the type of the apk.
15873enum ArtApkType {
15874    ART_APK_TYPE_UNKNOWN = 0;
15875    ART_APK_TYPE_BASE = 1;
15876    ART_APK_TYPE_SPLIT = 2;
15877}
15878
15879// Indicates the ISA.
15880enum ArtIsa {
15881    ART_ISA_UNKNOWN = 0;
15882    ART_ISA_ARM = 1;
15883    ART_ISA_ARM64 = 2;
15884    ART_ISA_X86 = 3;
15885    ART_ISA_X86_64 = 4;
15886    ART_ISA_MIPS = 5;
15887    ART_ISA_MIPS64 = 6;
15888}
15889
15890message ArtDatumReported {
15891    // The session ID is used to correlate this report with others from the same ART instance.
15892    optional int64 session_id = 1;
15893
15894    // The UID of the app that ART is running on behalf of.
15895    optional int32 uid = 2 [(is_uid) = true];
15896
15897    // What compiler filter the APK or DEX file was compiled with.
15898    optional ArtCompileFilter compile_filter = 3;
15899
15900    // Why the package was compiled the way it was.
15901    optional ArtCompilationReason compilation_reason = 4;
15902
15903    // The number of milliseconds since the ART runtime instance was started.
15904    optional int64 timestamp_millis = 5;
15905
15906    // What kind of thread (UI or background) this metric corresponds to.
15907    optional ArtThreadType thread_type = 6;
15908
15909    // Which counter this is that is being reported.
15910    optional ArtDatumId kind = 7;
15911
15912    // The value of the counter.
15913    optional int64 value = 8;
15914
15915    // The type of dex metadata
15916    optional ArtDexMetadataType dex_metadata_type = 9;
15917
15918    // The type of the APK file.
15919    optional ArtApkType apk_type = 10;
15920
15921    // The ISA of the device.
15922    optional ArtIsa isa = 11;
15923}
15924
15925/**
15926 * Logged when a SIM-specific settings restore was attempted.
15927 *
15928 * Logged from:
15929 *    packages/providers/TelephonyProvider/src/com/android/providers/telephony/TelephonyProvider.java
15930 */
15931message SimSpecificSettingsRestored {
15932    optional android.telephony.SimSpecfifcSettingsRestoreResult result = 1;
15933
15934    // Indicates which restore flow was followed.
15935    optional android.telephony.SimSpecificSettingsRestoreCase restored_from_suw = 2;
15936
15937    // Indicates which criteria was used to match the inserted SIM to backed up
15938    // SIM. Only relevant when result is SUCCESS
15939    optional android.telephony.SimSpecificSettingsRestoreMatchingCriteria matching_criteria = 3;
15940}
15941
15942/**
15943 * The latency of Binder calls broken down by calling API and method name.
15944 * This is different from BinderCalls as it collects a histogram of the
15945 * latencies (to get more detailed data) not just the count, sum, and maximum.
15946 *
15947 * Logged from:
15948 * frameworks/base/core/java/com/android/internal/os/BinderLatencyObserver.java
15949 */
15950message BinderLatencyReported {
15951    message Dims {
15952        enum ProcessSource {
15953            UNKNOWN_PROCESS_SOURCE = 0;
15954            SYSTEM_SERVER = 1;
15955            TELEPHONY = 2;
15956            BLUETOOTH = 3;
15957        }
15958        enum ServiceClassName {
15959            UNKNOWN_CLASS = 0;
15960        }
15961        enum ServiceMethodName {
15962            UNKNOWN_METHOD = 0;
15963        }
15964
15965        // Required.
15966        optional ProcessSource process_source = 1;
15967
15968        // The class name of the API making the call to Binder. Enum value
15969        // is preferred as uses much less data to store.
15970        // This field does not contain PII.
15971        oneof service_class {
15972            ServiceClassName service_class_name_as_enum = 2;
15973            string service_class_name = 3;
15974        }
15975
15976        // Method name of the API call. It can also be a transaction code if we
15977        // cannot resolve it to a name. See Binder#getTransactionName. Enum value
15978        // is preferred as uses much less data to store.
15979        // This field does not contain PII.
15980        oneof service_method {
15981            ServiceMethodName service_method_name_as_enum = 4;
15982            string service_method_name = 5;
15983        }
15984    }
15985
15986    message ApiStats {
15987        // required.
15988        optional Dims dims = 1;
15989
15990        // Indicates the first bucket that had any data. Allows omitting any empty
15991        // buckets at the start of the bucket list and thus save on data size.
15992        optional int32 first_bucket_index = 2;
15993        // Stores the count of samples for each bucket. The number of buckets and
15994        // their sizes are controlled server side with a flag.
15995        repeated int32 buckets = 3;
15996    }
15997
15998    message RepeatedApiStats {
15999        repeated ApiStats api_stats = 1;
16000    }
16001
16002    // The binder latency data broken down by the dimensions specified above.
16003    // The message wrapper is used for the repeated field as top level repeated
16004    // fields are not allowed.
16005    // MODE_BYTES is used as nested messages are not allowed otherwise.
16006    // Required.
16007    optional RepeatedApiStats repeated_api_stats = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
16008
16009    // The fraction of samples that are recorded in the histogram.
16010    // Required.
16011    optional float sampling_rate = 2;
16012
16013    // Indicates how many shards the APIs are divided in - e.g. for 3 every
16014    // 3rd API will be included in the data for this shard.
16015    // Required.
16016    optional int32 sharding_modulo = 3;
16017
16018    // Params for histogram buckets.
16019    // The number of buckets the histogram should have.
16020    optional int32 bucket_count = 4;
16021
16022    // The size (upper bound) of the first bucket (used to avoid creating an
16023    // excessive amount of small buckets). E.g. for first_bucket_size of 5, the
16024    // first bucket will be [0, 5) and the second will be [5, 5 * scaleFactor).
16025    optional int32 first_bucket_size = 5;
16026
16027    // The rate in which each consecutive bucket increases (before rounding).
16028    // Implemented in: com.android.internal.os.BinderLatencyBuckets.
16029    optional float scale_factor = 6;
16030}
16031
16032/**
16033 * Log audio device types that are used for input/output.
16034 * Next Tag: 2
16035 */
16036message AudioDevice {
16037    // See audio_devices_t in system/media/audio/include/system/audio-hal-enums.h
16038    repeated int32 type = 1;
16039}
16040
16041/**
16042 * Track information about AAudio Stream
16043 * Logged from
16044 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
16045 */
16046message MediametricsAAudioStreamReported {
16047    // The implementation of aaudio.
16048    enum CallerPath {
16049        CALLER_PATH_UNKNOWN = 0;
16050        CALLER_PATH_LEGACY = 1;
16051        CALLER_PATH_MMAP = 2;
16052    }
16053    optional CallerPath path = 1;
16054
16055    // The direction of the stream.
16056    // See aaudio_direction_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
16057    // The Direction values are different from aaudio_direction_t to avoid having 0 at the first
16058    // value since first value will be used as default value.
16059    // See lookup<AAUDIO_DIRECTION> in frameworks/av/services/mediametrics/AudioTypes.cpp
16060    // for conversion from aaudio_direction_t to Direction.
16061    enum Direction {
16062        // The direction is unknown.
16063        DIRECTION_UNKNOWN = 0;
16064        // Audio data will travel out of the device.
16065        DIRECTION_OUTPUT = 1;
16066        // Audio data will travel into the device.
16067        DIRECTION_INPUT = 2;
16068    }
16069    optional Direction direction = 2;
16070
16071    // The amount read or written in one shot by the Mixer or DSP.
16072    optional int32 frames_per_burst = 3;
16073    // The number of frames that the buffer is used.
16074    optional int32 buffer_size = 4;
16075    // The allocated number of frames for the buffer.
16076    optional int32 buffer_capacity = 5;
16077    // The channel count of the aaudio stream.
16078    optional int32 channel_count = 6;
16079    // Total frames transferred (written or read)
16080    optional int64 total_frames_transferred = 7;
16081
16082    // The performance mode.
16083    // See aaudio_performance_mode_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
16084    enum PerformanceMode {
16085        // The performance mode is unknown.
16086        PERFORMANCE_MODE_UNKNOWN = 0;
16087        // No particular performance mode needs. Default.
16088        PERFORMANCE_MODE_NONE = 10;
16089        // Extending battery life is more important than low latency.
16090        PERFORMANCE_MODE_POWER_SAVING = 11;
16091        // Reducing latency is more important than battery life.
16092        PERFORMANCE_MODE_LOW_LATENCY = 12;
16093    }
16094    // The performance mode requested by the applications.
16095    optional PerformanceMode perf_mode_requested = 8;
16096    // The actual performance mode used by aaudio.
16097    optional PerformanceMode perf_mode_actual = 9;
16098
16099    // The mode requested for sharing the device
16100    // See aaudio_sharing_mode_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
16101    // The SharingMode values are different from aaudio_direction_t to avoid having 0 at the first
16102    // value since first value will be used as default value.
16103    // See lookup<AAUDIO_SHARING_MODE> in frameworks/av/services/mediametrics/AudioTypes.cpp
16104    // for conversion from aaudio_sharing_mode_t to SharingMode.
16105    enum SharingMode {
16106        // The sharing mode is unknown
16107        SHARING_MODE_UNKNOWN = 0;
16108        // This will be the only stream using a particular source or sink.
16109        SHARING_MODE_EXCLUSIVE = 1;
16110        // Multiple application will be mixed by the AAudio server.
16111        SHARING_MODE_SHARED = 2;
16112    }
16113    optional SharingMode sharing = 10;
16114
16115    // Approximate number of glitches.
16116    // Underrun on output stream. Overrun on input stream.
16117    optional int32 xrun_count = 11;
16118    // Devices that are used by the aaudio stream.
16119    optional AudioDevice types = 12 [(log_mode) = MODE_BYTES];
16120
16121    // Format request by the applications
16122    optional int32 format_app = 13;
16123    // Format processed by the framework
16124    optional int32 format_device = 14;
16125
16126    // Android S metric log session id, a Base64Url encoded string representing a 128-bit integer.
16127    optional string log_session_id = 15;
16128
16129    // The sample rate of the aaudio stream.
16130    optional int32 sample_rate = 16;
16131
16132    // The content type of the aaudio stream.
16133    // An enumeration from system/media/audio/include/system/audio-hal-enums.h audio_content_type_t
16134    enum ContentType {
16135        CONTENT_TYPE_UNKNOWN = 0;
16136        CONTENT_TYPE_SPEECH = 1;
16137        CONTENT_TYPE_MUSIC = 2;
16138        CONTENT_TYPE_MOVIE = 3;
16139        CONTENT_TYPE_SONIFICATION = 4;
16140        CONTENT_TYPE_INVALID = -1;
16141    }
16142    optional ContentType content_type = 17;
16143
16144    // The mode of sharing the device requested by the client.
16145    optional SharingMode sharing_requested = 18;
16146}
16147
16148/**
16149 * Logs media transcoding session ended events.
16150 *
16151 * Logged from:
16152 *   frameworks/av/media/libmediatranscoding/TranscoderWrapper.cpp
16153 */
16154message MediaTranscodingSessionEnded {
16155
16156    enum Reason {
16157        UNKNOWN = 0;       // Unused.
16158        FINISHED = 1;      // Transcoding session finished successfully.
16159        ERROR = 2;         // Transcoding session returned error while running.
16160        PAUSED = 3;        // Transcoding session was paused, potentially failed.
16161        CANCELLED = 4;     // Transcoding session was cancelled.
16162        START_FAILED = 5;  // Transcoding session failed to start.
16163        RESUME_FAILED = 6; // Transcoding session failed to resume.
16164        CREATE_FAILED = 7; // Transcoder instance failed to crate.
16165        CONFIG_SRC_FAILED = 8;    // Configure source failed.
16166        CONFIG_DST_FAILED = 9;    // Configure destination failed.
16167        CONFIG_TRACK_FAILED = 10; // Configure track failed.
16168        OPEN_SRC_FD_FAILED = 11;  // Open source fd failed.
16169        OPEN_DST_FD_FAILED = 12;  // Open destination fd failed.
16170        NO_TRACKS = 13;  // No tracks in source file.
16171    }
16172
16173    // Reason for logging the atom.
16174    optional Reason reason = 1;
16175
16176    // UID of client connecting to media transcoding service.
16177    optional int32 calling_uid = 2 [(is_uid) = true];
16178
16179    // Transcode session status flag (media_status_t).
16180    optional int32 transcode_status = 3;
16181
16182    // Transcode speed as framerate, if status is success.
16183    optional int32 transcode_fps = 4;
16184
16185    // Source video dimensions.
16186    optional int32 src_width = 5;
16187    optional int32 src_height = 6;
16188
16189    // Source video codec information.
16190    optional string src_codec_type = 7;
16191    optional int32 src_profile = 8;
16192    optional int32 src_level = 9;
16193
16194    // Source video framerate.
16195    optional int32 src_fps = 10;
16196
16197    // Source video duration.
16198    optional int32 src_duration_millis = 11;
16199
16200    // Whether source video is HDR.
16201    optional bool src_is_hdr = 12;
16202
16203    // Destination video dimensions.
16204    optional int32 dst_width = 13;
16205    optional int32 dst_height = 14;
16206
16207    // Destination video codec information.
16208    optional string dst_codec_type = 15;
16209
16210    // Whether destination video is HDR.
16211    optional bool dst_is_hdr = 16;
16212}
16213
16214/** Logs information about an unattended reboot that took place. This is logged
16215 *  after the next boot, when the device is first unlocked.
16216 *
16217 * Logged from:
16218 *   packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
16219 */
16220message UnattendedRebootOccurred {
16221
16222    // Time between the reboot readiness state checks starting, and the device
16223    // becoming reboot-ready.
16224    optional int64 time_until_reboot_ready_millis= 1;
16225
16226    // Time taken for the device to be unlocked (i.e. for the keyguard to be
16227    // gone) after an unattended reboot took place.
16228    optional int64 time_until_first_unlock_millis = 2;
16229
16230    // Number of times the reboot was blocked by the device being interactive.
16231    optional int32 times_blocked_by_interactivity = 3;
16232
16233    // Number of times the reboot was blocked by a callback registered by a
16234    // subsystem or a privileged app.
16235    optional int32 times_blocked_by_subsystems = 4;
16236
16237    // Number of times the reboot was blocked by background app activity.
16238    optional int32 times_blocked_by_app_activity = 5;
16239
16240    // Time until next user interaction with the device.
16241    optional int64 time_until_next_interaction_ms = 6;
16242}
16243
16244
16245/**
16246 * Logs information about an app uid or registered system component that has
16247 * been blocking the device from being reboot-ready for a long time.
16248 *
16249 * Logged from:
16250 *   packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
16251 */
16252message LongRebootBlockingReported {
16253
16254    enum RebootBlockReason {
16255        SYSTEM_COMPONENT = 1;
16256        APP_UID = 2;
16257    }
16258
16259    // The reason why the reboot has been blocked. This is either a system
16260    // component that has registered a callback, or an app UID running in the
16261    // background.
16262    optional RebootBlockReason reboot_block_reason = 1;
16263
16264    // Only one of the following two fields should be set, depending on the
16265    // RebootBlockReason.
16266
16267    // The name supplied by a system component when it registered a callback
16268    // to block the reboot.
16269    optional string component_name = 2;
16270
16271    // The uid of an app that is running in the background.
16272    optional int32 uid = 3;
16273}
16274
16275/**
16276 * Logs the magnification activated mode and its duration of the usage
16277 * when the magnification is disabled.
16278 *
16279 * Logged from:
16280 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
16281 */
16282message MagnificationUsageReported {
16283    // The definition of the magnification mode.
16284    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
16285    optional android.stats.accessibility.MagnificationMode activated_mode = 1;
16286
16287    // The duration of this magnification mode activation in milliseconds
16288    optional int64 duration_millis = 2;
16289}
16290
16291/**
16292 * Logs the magnification activated mode when IME dialog shows on the screen.
16293 *
16294 * Logged from:
16295 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
16296 */
16297message MagnificationModeWithImeOnReported {
16298    // The definition of the magnification mode.
16299    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
16300    optional android.stats.accessibility.MagnificationMode activated_mode = 1;
16301}
16302
16303/*
16304 * Reports a device controls user interaction
16305 *
16306 * Logged from:
16307 *   frameworks/base/packages/SystemUI/src/com/android/systemui/controls/ControlsMetricsLoggerImpl.kt
16308 */
16309message DeviceControlChanged {
16310    // The event_id
16311    optional int32 event_id = 1;
16312    // An identifier to tie together multiple logs relating to the same controls session
16313    optional int32 instance_id = 2;
16314    // The type of device the user has interacted with (android.service.controls.DeviceTypes)
16315    optional int32 device_type = 3;
16316    // The service app uid.
16317    optional int32 uid = 4 [(is_uid) = true];
16318    // Is the device locked while the action started
16319    optional bool is_locked = 5;
16320}
16321
16322/**
16323 * This metric is collected at the end of playback
16324 * as a pulled atom.
16325 *
16326 *   DrmHal::cleanup() {
16327 *     // ...
16328 *     reportFrameworkMetrics(reportPluginMetrics());
16329 *     // ...
16330 *   }
16331 * This proto should be kept in-sync with
16332 * frameworks/av/drm/libmediadrm/protos/metrics.proto.
16333 */
16334message DrmFrameworkMetrics {
16335
16336    // Attributes are associated with a recorded value. E.g. A counter may
16337    // represent a count of an operation returning a specific error code. The
16338    // error code will be an attribute.
16339    message Attributes {
16340        // Reserved for compatibility with logging proto.
16341        reserved 2 to 13;
16342
16343        // A general purpose error code where 0 means OK.
16344        optional int32 error_code = 1;
16345
16346        // Defined at ::android::hardware::drm::V1_0::KeyStatusType;
16347        optional uint32 key_status_type = 14;
16348
16349        // Defined at ::android::hardware::drm::V1_0::EventType;
16350        optional uint32 event_type = 15;
16351    }
16352
16353    // The Counter message is used to store a count value with an associated
16354    // Attribute.
16355    message Counter {
16356        optional uint64 count = 1;
16357        // Represents the attributes associated with this counter instance.
16358        optional Attributes attributes = 2;
16359    }
16360
16361    // The DistributionMetric is meant to capture the moments of a normally
16362    // distributed (or approximately normal) value.
16363    message DistributionMetric {
16364        optional float min = 1;
16365        optional float max = 2;
16366        optional float mean = 3;
16367        optional double variance = 4;
16368        optional uint64 operation_count = 5;
16369
16370        // Represents the attributes associated with this distribution metric
16371        // instance.
16372        optional Attributes attributes = 6;
16373    }
16374
16375    message SessionLifetime {
16376        // Start time of the session in milliseconds since epoch.
16377        optional uint64 start_time_millis = 1;
16378        // End time of the session in milliseconds since epoch.
16379        optional uint64 end_time_millis = 2;
16380    }
16381
16382    // The count of open session operations. Each instance has a specific error
16383    // code associated with it.
16384    repeated Counter open_session_counter = 1;
16385
16386    // The count of close session operations. Each instance has a specific error
16387    // code associated with it.
16388    repeated Counter close_session_counter = 2;
16389
16390    // Count and execution time of getKeyRequest calls.
16391    repeated DistributionMetric get_key_request_time_us = 3;
16392
16393    // Count and execution time of provideKeyResponse calls.
16394    repeated DistributionMetric provide_key_response_time_us = 4;
16395
16396    // Count of getProvisionRequest calls.
16397    repeated Counter get_provisioning_request_counter = 5;
16398
16399    // Count of provideProvisionResponse calls.
16400    repeated Counter provide_provisioning_response_counter = 6;
16401
16402    // Count of key status events broken out by status type.
16403    repeated Counter key_status_change_counter = 7;
16404
16405    // Count of events broken out by event type
16406    repeated Counter event_callback_counter = 8;
16407
16408    // Count getPropertyByteArray calls to retrieve the device unique id.
16409    repeated Counter get_device_unique_id_counter = 9;
16410
16411    message SessionLifetimeEntry {
16412        optional string session_id = 1;
16413        optional SessionLifetime session_lifetime = 2;
16414    }
16415    // Session ids to lifetime (start and end time) map.
16416    // Session ids are strings of hex-encoded byte arrays.
16417    // This field is equivalent to the map<string, SessionLifetime>
16418    // field in frameworks/av/drm/libmediadrm/protos/metrics.proto.
16419    repeated SessionLifetimeEntry session_lifetimes = 10;
16420}
16421
16422/**
16423 * The metric is collected at the end of playback
16424 * as a pulled atom MediaDrmActivityInfo.
16425 *
16426 * The framework_metrics is defined in
16427 * frameworks/av/drm/libmediadrm/protos/metrics.proto.
16428 *
16429 * The format of vendor_metrics is  MediaDrm plugin dependent.
16430 *
16431 *   DrmHal::cleanup() {
16432 *     // ...
16433 *     reportFrameworkMetrics(reportPluginMetrics());
16434 *     // ...
16435 *   }
16436 *
16437 * This pulled atom is then collected in
16438 * frameworks/av/services/mediametrics/MediaMetricsService.cpp.
16439 */
16440message MediaDrmActivityInfo {
16441    optional string package_name = 1;
16442    optional int64 package_version_code = 2;
16443
16444    // vendor+description tell about which DRM plugin is in use on this device
16445    optional string vendor = 3;
16446    optional string description = 4;
16447
16448    optional DrmFrameworkMetrics framework_metrics = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
16449    optional bytes vendor_metrics = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
16450}
16451
16452/*
16453 * Logged when hardware based user-configurable device state changes.
16454 *
16455 * Logged from:
16456 *     frameworks/base/services/core/java/com/android/server/devicestate/DeviceStateManagerService.java
16457 */
16458message DeviceStateChanged {
16459    optional int32 new_device_state = 1
16460            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
16461    optional bool boot_state = 2;
16462}
16463
16464/*
16465 * An obfuscated, canonical form time zone suggestion for metrics use.
16466 *
16467 * The suggestion's time zone IDs (which relate to location) are obfuscated by
16468 * mapping them to an ordinal. When the ordinal is assigned consistently across
16469 * several objects (i.e. so the same time zone ID is always mapped to the same
16470 * ordinal), this allows comparisons between those objects. For example, we can
16471 * answer "did these two suggestions agree?", "does the suggestion match the
16472 * device's current time zone?", without leaking knowledge of location. Ordinals
16473 * are also significantly more compact than full IANA TZDB IDs, albeit highly
16474 * unstable and of limited use.
16475 */
16476message MetricsTimeZoneSuggestion {
16477    enum Type {
16478        UNKNOWN = 0;
16479        CERTAIN = 1;
16480        UNCERTAIN = 2;
16481    }
16482    optional Type type = 1;
16483
16484    // The ordinals for time zone(s) in the suggestion. Always empty for
16485    // UNCERTAIN, and can be empty for CERTAIN, for example when the device is in
16486    // a disputed area / on an ocean.
16487    repeated int32 time_zone_ordinals = 2;
16488}
16489
16490/*
16491 * Logs a snapshot of time zone detector state.
16492 *
16493 * Logged from:
16494 * frameworks/base/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
16495 */
16496message TimeZoneDetectorState {
16497
16498    // True if telephony-based time zone detection is supported on the device.
16499    optional bool telephony_supported = 1;
16500
16501    // True if geo-based time zone detection is supported on the device.
16502    optional bool geo_supported = 2;
16503
16504    // The current user's master location setting value.
16505    optional bool location_enabled = 3;
16506
16507    // The current user's auto time zone detection enabled setting value.
16508    optional bool auto_detection_setting = 4;
16509
16510    // The current user's geo detection enabled setting.
16511    optional bool geo_detection_setting = 5;
16512
16513    enum DetectionMode {
16514        UNKNOWN = 0;
16515        MANUAL = 1;
16516        TELEPHONY = 2;
16517        GEO = 3;
16518    }
16519
16520    // The functional / behavioral state for how time zones are currently determined on the device.
16521    // Avoids needing to duplicate the logic used.
16522    optional DetectionMode detection_mode = 6;
16523
16524    // The device's current time zone ordinal (see MetricsTimeZoneSuggestion).
16525    optional int32 device_time_zone_ordinal = 7;
16526
16527    // The latest suggestion received from the user, e.g. via SettingsUI (non-persistent).
16528    optional MetricsTimeZoneSuggestion latest_manual_suggestion = 8
16529            [(log_mode) = MODE_BYTES];
16530
16531    // The latest telephony-derived suggestion (non-persistent).
16532    optional MetricsTimeZoneSuggestion latest_telephony_suggestion = 9
16533            [(log_mode) = MODE_BYTES];
16534
16535    // The latest geo-derived suggestion (non-persistent).
16536    optional MetricsTimeZoneSuggestion latest_geo_suggestion = 10
16537            [(log_mode) = MODE_BYTES];
16538}
16539
16540/*
16541 * Logs information about an individual location time zone provider's state.
16542 *
16543 * Logged from:
16544 * frameworks/base/services/core/java/com/android/server/location/timezone/ControllerImpl.java
16545 */
16546message LocationTimeZoneProviderStateChanged {
16547    // The index of the provider (primary = 0, secondary = 1)
16548    optional int32 provider_index = 1;
16549
16550    enum State {
16551        // A placeholder for unknown values.
16552        UNKNOWN = 0;
16553
16554        // The provider is initializing.
16555        INITIALIZING = 1;
16556
16557        // The provider is certain of the time zone.
16558        CERTAIN = 2;
16559
16560        // The provider is uncertain of the time zone.
16561        UNCERTAIN = 3;
16562
16563        // The provider has been stopped.
16564        STOPPED = 4;
16565
16566        // The provider has failed.
16567        PERM_FAILED = 5;
16568
16569        // The provider has been destroyed.
16570        DESTROYED = 6;
16571    }
16572
16573    // The state of the provider.
16574    optional State state = 2;
16575}
16576
16577/*
16578 * Reports fdtrack state change.
16579 *
16580 * Logged from:
16581 *   frameworks/base/services/java/com/android/server/SystemServer.java
16582 */
16583message FdtrackEventOccurred {
16584    enum FdtrackEventType {
16585      DISABLED = 1;
16586      ENABLED = 2;
16587
16588      // Aborting because we're above the abort threshold.
16589      ABORTING = 3;
16590    }
16591
16592    optional FdtrackEventType event = 1;
16593    optional int32 fd_count = 2;
16594}
16595
16596/**
16597 * Pushed when delivering a batch of alarms.
16598 *
16599 * Logged from:
16600 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
16601 */
16602message AlarmBatchDelivered {
16603    optional int32 num_alarms = 1;
16604    optional int32 wakeups = 2;
16605}
16606
16607/**
16608 * Pushed when an app schedules an alarm.
16609 *
16610 * Logged from:
16611 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
16612 */
16613message AlarmScheduled {
16614    optional int32 calling_uid = 1 [(is_uid) = true];
16615
16616    optional bool is_exact = 2;
16617    optional bool is_wakeup = 3;
16618    optional bool is_allow_while_idle = 4;
16619    optional bool is_alarm_clock = 5;
16620    optional bool is_repeating = 6;
16621
16622    enum ReasonCode {
16623        NOT_APPLICABLE = 0;
16624        PERMISSION = 1;
16625        ALLOW_LIST = 2;
16626        CHANGE_DISABLED = 3;
16627    }
16628    optional ReasonCode exact_alarm_allowed_reason = 7;
16629    optional bool is_rtc = 8;
16630    // The state of the callingUid, from frameworks/proto_logging/stats/enums/app/enums.proto.
16631    optional android.app.ProcessStateEnum calling_process_state = 9;
16632}
16633
16634/**
16635 * Logs statistics about pending alarms.
16636 *
16637 * Pulled from:
16638 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
16639 */
16640message PendingAlarmInfo {
16641    optional int32 num_total = 1;
16642    optional int32 num_exact = 2;
16643    optional int32 num_wakeup = 3;
16644    optional int32 num_allow_while_idle = 4;
16645    optional int32 num_prioritized = 5;
16646    optional int32 num_foreground_service = 6;
16647    optional int32 num_activity = 7;
16648    optional int32 num_service = 8;
16649    optional int32 num_listener = 9;
16650    optional int32 num_indefinite_future = 10;
16651    optional int32 num_repeating = 11;
16652    optional int32 num_alarm_clock = 12;
16653    optional int32 num_rtc = 13;
16654}
16655
16656/*
16657 * Logs information about on-device refresh of ART AOT artifacts for boot classpath extensions
16658 * and system_server.
16659 *
16660 * Logged from:
16661 *   art/odrefresh/odrefresh.cc
16662 */
16663message OdrefreshReported {
16664    optional int64 art_apex_version = 1;
16665
16666    enum Trigger {
16667        // A placeholder for unknown values.
16668        TRIGGER_UNKNOWN = 0;
16669
16670        // ART apex version has changed since time artifacts were generated.
16671        TRIGGER_APEX_VERSION_MISMATCH = 1;
16672
16673        // Dex files on the boot classpath or system_server classpath have changed.
16674        TRIGGER_DEX_FILES_CHANGED = 2;
16675
16676        // Missing artifacts.
16677        TRIGGER_MISSING_ARTIFACTS = 3;
16678    }
16679
16680    optional Trigger trigger = 2;
16681
16682    enum Stage {
16683        // A placeholder for unknown values.
16684        STAGE_UNKNOWN = 0;
16685
16686        // Checking stage.
16687        STAGE_CHECK = 10;
16688
16689        // Preparation for compilation.
16690        STAGE_PREPARATION = 20;
16691
16692        // Compilation of primary boot classpath extensions.
16693        STAGE_PRIMARY_BOOT_CLASSPATH = 30;
16694
16695        // Compilation of secondary boot classpath extensions.
16696        STAGE_SECONDARY_BOOT_CLASSPATH = 40;
16697
16698        // Compilation of system_server classpath.
16699        STAGE_SYSTEM_SERVER_CLASSPATH = 50;
16700
16701        // All stages completed.
16702        STAGE_COMPLETE = 60;
16703    }
16704
16705    optional Stage stage_reached = 3;
16706
16707    enum Status {
16708        // A placeholder for unknown values.
16709        STATUS_UNKNOWN = 0;
16710
16711        // OK, no problems encountered.
16712        STATUS_OK = 1;
16713
16714        // Insufficient space.
16715        STATUS_NO_SPACE = 2;
16716
16717        // Storage operation failed.
16718        STATUS_IO_ERROR = 3;
16719
16720        // Dex2oat reported an error.
16721        STATUS_DEX2OAT_ERROR = 4;
16722
16723        // Time limit exceeded.
16724        STATUS_TIME_LIMIT_EXCEEDED = 5;
16725
16726        // Failure creating staging area.
16727        STATUS_STAGING_FAILED = 6;
16728
16729        // Installation of artifacts failed.
16730        STATUS_INSTALL_FAILED = 7;
16731    }
16732
16733    optional Status status = 4;
16734
16735    // Compilation time iof primary boot classpath extensions.
16736    optional int32 primary_bcp_compilation_seconds = 5;
16737
16738    // Compilation time of secondary boot classpath extensions.
16739    optional int32 secondary_bcp_compilation_seconds = 6;
16740
16741    // Compilation time of system_server classpath.
16742    optional int32 system_server_compilation_seconds = 7;
16743
16744    // Cache space at start of update.
16745    optional int32 cache_space_free_start_mib = 8;
16746
16747    // Cache space at end of update.
16748    optional int32 cache_space_free_end_mib = 9;
16749};
16750
16751/*
16752 * Logged when a package's user-level hibernation state changes.
16753 * Logged from:
16754 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
16755 */
16756 message UserLevelHibernationStateChanged {
16757    // Name of the package that had its hibernation state change.
16758    optional string package_name = 1;
16759
16760    // Android user id to which this event belongs. This can only be 0, 10, 11 and so on.
16761    optional int32 user_id = 2;
16762
16763    // New hibernation state. True if hibernating, false otherwise
16764    optional bool is_hibernating = 3;
16765}
16766
16767/*
16768 * Pull atom for the number of hibernated packages on the device for the given user.
16769 * Logged from:
16770 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
16771 */
16772message UserLevelHibernatedApps {
16773    // Total number of apps hibernated for the user
16774    optional int32 hibernated_app_count = 1;
16775
16776    // Android user id of the queried user which can only be 0, 10, 11 and so on.
16777    optional int32 user_id = 2;
16778}
16779
16780/**
16781 * Pull atom for total number of globally hibernated packages on the device and the storage savings
16782 * from these apps being hibernated.
16783 * Logged from:
16784 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
16785 */
16786message GlobalHibernatedApps {
16787    // Total number of apps in global hibernation
16788    optional int32 hibernated_app_count = 1;
16789
16790    // Cumulative storage savings from apps being hibernated
16791    optional int64 storage_saved_mb = 2;
16792}
16793
16794/*
16795 * Report the event of app process kills.
16796 * Logged from:
16797 *   frameworks/base/services/core/java/com/android/server/am/AppExitInfoTracker.java
16798 */
16799message AppProcessDied {
16800    // Uid of the package of the dying process
16801    optional int32 uid = 1 [(is_uid) = true];
16802
16803    // Name of the dying process, it'll be omitted if the process name and package name are the same
16804    optional string process_name = 2;
16805
16806    // The reason code of why the process dies
16807    optional android.app.AppExitReasonCode reason = 3;
16808
16809    // The supplemental reason code of why the process dies
16810    optional android.app.AppExitSubReasonCode sub_reason = 4;
16811
16812    // The importance of the process when it dies
16813    optional android.app.Importance importance = 5;
16814
16815    // The last known PSS (in kB) of the process before it dies, could be 0.
16816    optional int32 pss = 6;
16817
16818    // The last known RSS (in kB) of the process before it dies, could be 0.
16819    optional int32 rss = 7;
16820}
16821
16822/**
16823 * Logs input event statistics.
16824 * Pulls the statistics.
16825 *
16826 * Logged from:
16827 *   frameworks/native/services/inputflinger
16828 */
16829message InputEventLatencySketch {
16830    /**
16831     * The 'bytes' field is the serialized KLL sketch. It is to be deserialized into an object of
16832     * KLL proto, which would then be converted into a KLL sketch. The KLL sketch is a histogram
16833     * of the data.
16834     *
16835     * The goal of this data is to identify the bottlenecks in processing of input events.
16836     * All sketches measure durations in a streaming fashion.
16837     * The units are "hundreds of microseconds", or 0.1 ms. They are chosen like this in order
16838     * to reduce the occupied space.
16839     * The start and end points for each value are described in the comments.
16840     *
16841     * We distinguish between 'DOWN' event latency (when the pointer first goes down), and 'MOVE'
16842     * event latency, which characterizes the scrolling experience.
16843     */
16844
16845    // -------------------------- DOWN event sketches ------ START ---------------------------------
16846    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16847    // End: the event was read in userspace (in EventHub)
16848    optional bytes event_to_read_100micros_down_sketch = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
16849    // Start: the event was read in EventHub
16850    // End: the event was send to the app via the InputChannel (written to the socket)
16851    optional bytes read_to_deliver_100micros_down_sketch = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
16852    // Start: the input event was sent to the app
16853    // End: the app consumed the input event
16854    optional bytes deliver_to_consume_100micros_down_sketch = 3 [(android.os.statsd.log_mode) = MODE_BYTES];
16855    // Start: the app consumed the event
16856    // End: the app's 'finishInputEvent' call was received in inputflinger
16857    // The end point can also be called "the app finished processing input event"
16858    optional bytes consume_to_finish_100micros_down_sketch = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
16859    // Start: the app consumed the input event
16860    // End: the app produced a buffer
16861    optional bytes consume_to_gpu_complete_100micros_down_sketch = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
16862    // Start: the app produced a buffer
16863    // End: the frame was shown on the display
16864    optional bytes gpu_complete_to_present_100micros_down_sketch = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
16865    // The end-to-end touch latency
16866    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16867    // End: the frame was presented on the display
16868    optional bytes end_to_end_100micros_down_sketch = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
16869    // -------------------------- DOWN event sketches ------ END -----------------------------------
16870
16871    // -------------------------- MOVE event sketches ------ START ---------------------------------
16872    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16873    // End: the event was read in userspace (in EventHub)
16874    optional bytes event_to_read_100micros_move_sketch = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
16875    // Start: the event was read in EventHub
16876    // End: the event was send to the app via the InputChannel (written to the socket)
16877    optional bytes read_to_deliver_100micros_move_sketch = 9 [(android.os.statsd.log_mode) = MODE_BYTES];
16878    // Start: the input event was sent to the app
16879    // End: the app consumed the input event
16880    optional bytes deliver_to_consume_100micros_move_sketch = 10 [(android.os.statsd.log_mode) = MODE_BYTES];
16881    // Start: the app consumed the event
16882    // End: the app's 'finishInputEvent' call was received in inputflinger
16883    // The end point can also be called "the app finished processing input event"
16884    optional bytes consume_to_finish_100micros_move_sketch = 11 [(android.os.statsd.log_mode) = MODE_BYTES];
16885    // Start: the app consumed the input event
16886    // End: the app produced a buffer
16887    optional bytes consume_to_gpu_complete_100micros_move_sketch = 12 [(android.os.statsd.log_mode) = MODE_BYTES];
16888    // Start: the app produced a buffer
16889    // End: the frame was shown on the display
16890    optional bytes gpu_complete_to_present_100micros_move_sketch = 13 [(android.os.statsd.log_mode) = MODE_BYTES];
16891    // The end-to-end touch latency
16892    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16893    // End: the frame was presented on the display
16894    optional bytes end_to_end_100micros_move_sketch = 14 [(android.os.statsd.log_mode) = MODE_BYTES];
16895    // -------------------------- MOVE event sketches ------ END -----------------------------------
16896}
16897
16898// Each pull creates multiple atoms. One for each incremental package.
16899message InstalledIncrementalPackage {
16900    optional int32 uid = 1 [(is_uid) = true];
16901}
16902
16903/**
16904 * Memory management statistics pulled atom based on /proc/vmstat.
16905 * Logged from StatsPullAtomService.
16906 */
16907message VmStat {
16908    optional int32 oom_kill_count = 1;
16909}
16910
16911/**
16912* Log that the user has interacted with an app on the permission usage
16913* fragment.
16914* Logged from permission/debug/PermissionUsageV2Frament.kt
16915*/
16916message PermissionUsageFragmentInteraction {
16917    // id which identifies single session of user interacting with permission hub
16918    optional int64 session_id = 1;
16919
16920    enum Action {
16921        UNDEFINED = 0;
16922        OPEN = 1;
16923        LOCATION_ACCESS_TIMELINE_VIEWED = 2;
16924        CAMERA_ACCESS_TIMELINE_VIEWED = 3;
16925        MICROPHONE_ACCESS_TIMELINE_VIEWED = 4;
16926        SHOW_SYSTEM_CLICKED = 5;
16927        SEE_OTHER_PERMISSIONS_CLICKED = 6;
16928    }
16929
16930    // The action the user took to interact with the fragment
16931    optional Action action = 2;
16932}
16933
16934/**
16935* Log that the user has clicked on .
16936* Logged from permission/debug/PermissionDetailsFragment.kt
16937*/
16938message PermissionDetailsInteraction {
16939    // id which identifies single session of user interacting with permission details fragment.
16940    optional int64 session_id = 1;
16941
16942    // The name of a permission group whose details are viewed.
16943    optional string permission_group_name = 2;
16944
16945    enum Action {
16946        UNDEFINED = 0;
16947        SHOW_SYSTEM_CLICKED = 1;
16948        INFO_ICON_CLICKED = 2;
16949    }
16950
16951    // Package name for which the info icon was clicked.
16952    optional string package_name = 3;
16953
16954    // The action the user took to interact with the fragment
16955    optional Action action = 4;
16956}
16957
16958/**
16959* Log that the user has toggled the sensor privacy.
16960*/
16961message PrivacySensorToggleInteraction {
16962
16963    enum Sensor {
16964        SENSOR_UNKNOWN = 0;
16965        MICROPHONE = 1;
16966        CAMERA = 2;
16967
16968    }
16969
16970    // Sensor for which sensor privacy was toggled.
16971    optional Sensor sensor = 1;
16972
16973    enum Action {
16974        ACTION_UNKNOWN = 0;
16975        TOGGLE_ON = 1;
16976        TOGGLE_OFF = 2;
16977    }
16978
16979    // Action taken on sensor.
16980    optional Action action = 2;
16981
16982    enum Source {
16983        SOURCE_UNKNOWN = 0;
16984        DIALOG = 1;
16985        SETTINGS = 2;
16986        QS_TILE = 3;
16987    }
16988
16989    // Source for the toggling.
16990    optional Source source = 3;
16991
16992    // Amount of time a user spent in the previous sensor privacy state in minutes.
16993    optional int64 time_in_previous_state_in_mins = 4;
16994}
16995
16996message PrivacyToggleDialogInteraction {
16997
16998    enum Action {
16999        ACTION_UNKNOWN = 0;
17000        ENABLE = 1;
17001        CANCEL = 2;
17002    }
17003
17004    // Action taken on the toggle dialog.
17005    optional Action action = 1;
17006
17007    // Name of the package for which the dialog was shown.
17008    optional string package_name = 2;
17009}
17010
17011/**
17012 * Stats about each feature tag that was included in the registration.
17013 *
17014 * Logged from:
17015 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17016 */
17017message ImsRegistrationFeatureTagStats {
17018    // the carrier id associated with this SIP delegate
17019    // Used as a dimension
17020    optional int32 carrier_id = 1;
17021
17022    // The slot id associated with this SIP delegate
17023    // Used as a dimension
17024    optional int32 slot_id = 2;
17025
17026    // The name of the feature tag
17027    // used as a dimension
17028    optional android.telephony.ImsFeatureTag feature_tag_name = 3;
17029
17030    // The underlying radio technology type associated with the feature tag
17031    // used as a dimension
17032    // See the ImsRegistrationImplBase#REGISTRATION_TECH*
17033    optional int32 registration_tech = 4;
17034
17035    // The time this feature tag was registered, rounded to 5 minutes
17036    optional int32 registered_seconds = 5;
17037}
17038
17039/**
17040 * Stats about the messaging client interacting with telephony
17041 *
17042 * Logged from:
17043 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17044 */
17045message RcsClientProvisioningStats {
17046    enum EventType {
17047        EVENT_TYPE_UNSPECIFIED = 0;
17048        // The client sent its client params to the ACS service.
17049        CLIENT_PARAMS_SENT = 1;
17050        // The client has manually triggered reconfiguration
17051        TRIGGER_RCS_RECONFIGURATION = 2;
17052        // Default messaging application changed.
17053        DMA_CHANGED = 3;
17054    }
17055    // Carrier ID of the SIM used for IMS registration.
17056    // See https://source.android.com/devices/tech/config/carrierid.
17057    // Used as a dimension
17058    optional int32 carrier_id = 1;
17059
17060    // Index of the SIM used, 0 for single-SIM devices.
17061    // Used as a dimension
17062    optional int32 slot_id = 2;
17063
17064    // Used as a dimension
17065    optional EventType event = 3;
17066
17067    // The number of times this event has occurred.
17068    optional int32 count = 4;
17069}
17070
17071/**
17072 * Stats about the RCS provisioning via ACS
17073 *
17074 * Logged from:
17075 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17076 */
17077message RcsAcsProvisioningStats {
17078    enum ResponseType {
17079        RESPONSE_TYPE_UNSPECIFIED = 0;
17080        // a provisioning request resulted in an error.
17081        ERROR = 1;
17082        // a provisioning request succeeded and provided an xml
17083        PROVISIONING_XML = 2;
17084        // a provisioning request has resulted in a "pre-provisioning" xml, which
17085        // means RCS is not provisioned and requires the user to intervene.
17086        PRE_PROVISIONING_XML = 3;
17087    }
17088
17089    // Carrier ID of the SIM used for IMS registration.
17090    // See https://source.android.com/devices/tech/config/carrierid.
17091    // Used as a dimension
17092    optional int32 carrier_id = 1;
17093
17094    // Index of the SIM used, 0 for single-SIM devices.
17095    // Used as a dimension
17096    optional int32 slot_id = 2;
17097
17098    // The response code of provisioning if the provisioning resulted in
17099    // ResponseType.ERROR
17100    // Used as a dimension
17101    optional int32 response_code = 3;
17102
17103    // used as a dimension.
17104    optional ResponseType response_type = 4;
17105
17106    // Does the provisioning XML have single registration provisioned.
17107    // Populated if response_type is ResponseType.PROVISIONING_XML
17108    // used as a dimension
17109    optional bool is_single_registration_enabled = 5;
17110
17111    // The number of times this event has occurred.
17112    optional int32 count = 6;
17113
17114    // The amount of time in seconds that the device was in this state in total, rounded 5 minutes
17115    optional int32 state_timer_sec = 7;
17116}
17117
17118/**
17119 * Metrics surrounding the lifetime of a SIP delegate created by applications.
17120 *
17121 * Logged from:
17122 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17123 */
17124message SipDelegateStats {
17125    // The random number identifier with this SIP delegate
17126    optional int32 dimension = 1;
17127
17128    // The carrier id associated with this SIP delegate
17129    optional int32 carrier_id = 2;
17130
17131    // The slot id associated with this SIP delegate
17132    optional int32 slot_id = 3;
17133
17134    // The total uptime of this delegate, rounded 5 minutes
17135    optional int32 uptime_seconds = 4;
17136
17137    // The reason why this SIP delegate was destroyed.
17138    // See the SipDelegateManager#SIP_DELEGATE_DESTROY_REASON*
17139    optional int32 destroy_reason = 5;
17140}
17141
17142/**
17143 * Tracks each feature tag associated with the SipDelegates that are currently active.
17144 *
17145 * Logged from:
17146 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17147 */
17148message SipTransportFeatureTagStats {
17149    // the carrier id associated with this SIP delegate
17150    // Used as a dimension
17151    optional int32 carrier_id = 1;
17152
17153    // The slot id associated with this SIP delegate
17154    // Used as a dimension
17155    optional int32 slot_id = 2;
17156
17157    // The name of the feature tag
17158    // used as a dimension
17159    optional android.telephony.ImsFeatureTag feature_tag_name = 3;
17160
17161    // The reason why this feature tag was denied on the SIP Transport
17162    // used as a dimension
17163    // Use SIP transport denied reason.
17164    // See the SipDelegateManager#DENIED_REASON*
17165    optional int32 sip_transport_denied_reason = 4;
17166
17167    // The reason why this feature tag was associated with the SIP Transport but not
17168    // marked as deregistered.
17169    // used as a dimension
17170    // Use SIP transport deregistered reason.
17171    // See the DelegateRegistrationState#DEREGISTERING_REASON*
17172    optional int32 sip_transport_deregistered_reason = 5;
17173
17174    // the time this feature tag was in this state, rounded 5 minutes
17175    optional int32 associated_seconds = 6;
17176}
17177
17178/**
17179 * Tracks each SIP message and the response from either the app or network.
17180 *
17181 * Logged from:
17182 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17183 */
17184message SipMessageResponse {
17185    enum Direction {
17186        UNKNOWN = 0;
17187        INCOMING = 1;
17188        OUTGOING = 2;
17189    }
17190    // the carrier id associated with this SIP delegate
17191    // Used as a dimension
17192    optional int32 carrier_id = 1;
17193
17194    // The slot id associated with this SIP delegate
17195    // Used as a dimension
17196    optional int32 slot_id = 2;
17197
17198    // The SIP message method type (INVITE, MESSAGE, etc...)
17199    // used as a dimension
17200    optional android.telephony.SipRequestMethodType sip_message_method = 3;
17201
17202    // The SIP message response code, used if this is a response to a request.
17203    // used as a dimension.
17204    optional int32 sip_message_response = 4;
17205
17206    // The SIP message direction
17207    // used as a dimension
17208    optional Direction sip_message_direction = 5;
17209
17210    // The response from the SIP stack to sending/receiving the message
17211    // used as a dimension
17212    // See the SipDelegateManager#MESSAGE_FAILURE_REASON*
17213    optional int32 message_error = 6;
17214
17215    // The number of messages that fit this criteria.
17216    optional int32 count = 7;
17217}
17218
17219/**
17220 * Tracks SIP sessions managed by the SIP transport.
17221 *
17222 * Logged from:
17223 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17224 */
17225message SipTransportSession {
17226    enum Direction {
17227        UNKNOWN = 0;
17228        INCOMING = 1;
17229        OUTGOING = 2;
17230    }
17231    // the carrier id associated with this SIP delegate
17232    // Used as a dimension
17233    optional int32 carrier_id = 1;
17234
17235    // The slot id associated with this SIP delegate
17236    // Used as a dimension
17237    optional int32 slot_id = 2;
17238
17239    // The SIP message method that started the session (INVITE, SUBSCRIBE, etc...)
17240    // used as a dimension
17241    optional android.telephony.SipRequestMethodType session_method = 3;
17242
17243    // The SIP message direction
17244    // used as a dimension
17245    optional Direction sip_message_direction = 4;
17246
17247    // The response from the SIP stack or network.
17248    // used as a dimension.
17249    optional int32 sip_response = 5;
17250
17251    // The number of these sessions counted
17252    optional int32 session_count = 6;
17253
17254    // The number of sessions that were started properly and did not require
17255    // the SIP transport to forcefully close them.
17256    optional int32 ended_gracefully_count = 7;
17257}
17258
17259/**
17260 * Used to determine if there were dedicated bearers set up for a specific listener.
17261 * If not, this indicates that there may have been a network issue in the dedicated bearer setup.
17262 *
17263 * Logged from:
17264 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17265 */
17266message ImsDedicatedBearerListenerEvent {
17267    // Carrier ID of the SIM used for IMS registration.
17268    // See https://source.android.com/devices/tech/config/carrierid.
17269    // Used as a dimension
17270    optional int32 carrier_id = 1;
17271
17272    // Index of the SIM used, 0 for single-SIM devices.
17273    // Used as a dimension
17274    optional int32 slot_id = 2;
17275
17276    // Radio access technology (RAT) used by the registration when it terminated.
17277    // The value is either 4G or 5G.
17278    // Used as a dimension
17279    optional android.telephony.NetworkTypeEnum rat_at_end = 3;
17280
17281    // QoS class identifier.
17282    // dimension
17283    optional int32 qci = 4;
17284
17285    // True if there was a dedicated bearer established for this listener.
17286    // dimension
17287    optional bool dedicated_bearer_established = 5;
17288
17289    // The count of listeners with this result.
17290    optional int32 event_count = 6;
17291}
17292
17293/**
17294 * Logs information related to ims dedicated bearer which fulfills required qos and provides guaranteed service.
17295 *
17296 * Logged from:
17297 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17298 */
17299message ImsDedicatedBearerEvent {
17300    enum State {
17301        STATE_UNSPECIFIED = 0;
17302        STATE_ADDED = 1;
17303        STATE_MODIFIED = 2;
17304        STATE_DELETED = 3;
17305    }
17306    // Carrier ID of the SIM used for IMS registration.
17307    // See https://source.android.com/devices/tech/config/carrierid.
17308    // Used as a dimension
17309    optional int32 carrier_id = 1;
17310
17311    // Index of the SIM used, 0 for single-SIM devices.
17312    // Used as a dimension
17313    optional int32 slot_id = 2;
17314
17315    // Radio access technology (RAT) used by the registration when it terminated.
17316    // The value is either 4G or 5G.
17317    // Used as a dimension
17318    optional android.telephony.NetworkTypeEnum rat_at_end = 3;
17319
17320    // Qos class identifier.
17321    // Used as a dimension
17322    optional int32 qci = 4;
17323
17324    // Dedicated bearer state from the network.
17325    // Used as a dimension
17326    optional State bearer_state = 5;
17327
17328    // Whether location connection information is received.
17329    // Used as a dimension
17330    optional bool local_connection_info_received = 6;
17331
17332    // Whether remote connection information is received.
17333    // Used as a dimension
17334    optional bool remote_connection_info_received = 7;
17335
17336    // Whether or not the QoS indication had listeners.
17337    // Used as a dimension
17338    optional bool has_listeners = 8;
17339
17340    // The count that matches the above conditions.
17341    optional int32 count = 9;
17342}
17343
17344/**
17345 * Stats about each ServiceDescription that was included in the PIDF XML sent to the network during publish.
17346 *
17347 * Logged from:
17348 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17349 */
17350message ImsRegistrationServiceDescStats {
17351    // Describe Service IDs will be included PUBLISH
17352    // See RcsContactPresenceTuple.java
17353    enum ServiceId {
17354        SERVICE_ID_UNSPECIFIED = 0;
17355        SERVICE_ID_CUSTOM = 1;
17356        SERVICE_ID_MMTEL = 2;
17357        SERVICE_ID_CHAT_V1 = 3;
17358        SERVICE_ID_CHAT_V2 = 4;
17359        SERVICE_ID_FT = 5;
17360        SERVICE_ID_FT_OVER_SMS = 6;
17361        SERVICE_ID_GEO_PUSH = 7;
17362        SERVICE_ID_GEO_PUSH_VIA_SMS = 8;
17363        SERVICE_ID_CALL_COMPOSER = 9;
17364        SERVICE_ID_POST_CALL = 10;
17365        SERVICE_ID_SHARED_MAP = 11;
17366        SERVICE_ID_SHARED_SKETCH = 12;
17367        SERVICE_ID_CHATBOT = 13;
17368        SERVICE_ID_CHATBOT_STANDALONE = 14;
17369        SERVICE_ID_CHATBOT_ROLE = 15;
17370    }
17371
17372    // the carrier id associated with this SIP delegate
17373    // Used as a dimension
17374    optional int32 carrier_id = 1;
17375
17376    // The slot id associated with this SIP delegate
17377    // Used as a dimension
17378    optional int32 slot_id = 2;
17379
17380    // The service id portion of the ServiceDescription
17381    // used as a dimension
17382    optional ServiceId service_id_name = 3;
17383
17384    // The version portion of the ServiceDescription
17385    // used as a dimension
17386    optional float service_id_version = 4;
17387
17388    // The underlying radio technology type associated with the feature tag
17389    // used as a dimension
17390    // See the ImsRegistrationImplBase#REGISTRATION_TECH*
17391    optional int32 registration_tech = 5;
17392
17393    // the time this feature tag was registered, rounded 5 minutes
17394    optional int32 published_seconds = 6;
17395}
17396
17397/**
17398 * Stats related to UCE queries to the network
17399 *
17400 * Logged from:
17401 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17402 */
17403message UceEventStats {
17404    enum MessageType {
17405        MESSAGE_TYPE_UNSPECIFIED = 0;
17406        PUBLISH = 1;
17407        SUBSCRIBE = 2;
17408        INCOMING_OPTION = 3;
17409        OUTGOING_OPTION = 4;
17410    }
17411    enum CommandCode {
17412        SERVICE_UNKNOWN = 0;
17413        GENERIC_FAILURE = 1;
17414        INVALID_PARAM = 2;
17415        FETCH_ERROR = 3;
17416        REQUEST_TIMEOUT = 4;
17417        INSUFFICIENT_MEMORY = 5;
17418        LOST_NETWORK_CONNECTION = 6;
17419        NOT_SUPPORTED = 7;
17420        NOT_FOUND = 8;
17421        SERVICE_UNAVAILABLE = 9;
17422        NO_CHANGE = 10;
17423    }
17424    // Carrier ID of the SIM used for IMS registration.
17425    // See https://source.android.com/devices/tech/config/carrierid.
17426    // Used as a dimension
17427    optional int32 carrier_id = 1;
17428
17429    // Index of the SIM used, 0 for single-SIM devices.
17430    // Used as a dimension
17431    optional int32 slot_id = 2;
17432
17433    // Used to identify the message type.
17434    // Used as a dimension
17435    optional MessageType type = 3;
17436
17437    // Whether the UCE event is successfully finished. If false, the request to the
17438    // modem timed out and we sent a timeout error back to the requesting app.
17439    // Used as a dimension
17440    optional bool successful = 4;
17441
17442    // The command error code for the Uce event. Not populated if the modem
17443    // accepted the request and delivered a network_response.
17444    // Used as a dimension
17445    optional CommandCode command_code = 5;
17446
17447    // The network response code for the Uce event. Will not be populated if
17448    // command_code is present.
17449    // Used as a dimension
17450    optional int32 network_response = 6;
17451
17452    // The count that matches the above conditions;
17453    optional int32 count = 7;
17454}
17455
17456/**
17457 * Information related to a SIP NOTIFY event from modem.
17458 *
17459 * Logged from:
17460 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17461 */
17462message PresenceNotifyEvent {
17463    // See RFC3265 Section 3.2.4 for more information about these subscription states.
17464    enum TerminatedReason {
17465        REASON_UNSPECIFIED = 0;
17466        // Not spec defined, the network returned a custom code that is not spec defined.
17467        REASON_CUSTOM = 1;
17468        REASON_DEACTIVATED = 2;
17469        REASON_PROBATION = 3;
17470        REASON_REJECTED = 4;
17471        REASON_TIMEOUT = 5;
17472        REASON_GIVEUP = 6;
17473        REASON_NORESOURCE = 7;
17474    }
17475
17476    // Carrier ID of the SIM used for IMS registration.
17477    // See https://source.android.com/devices/tech/config/carrierid.
17478    // Used as a dimension
17479    optional int32 carrier_id = 1;
17480
17481    // Index of the SIM used, 0 for single-SIM devices.
17482    // Used as a dimension
17483    optional int32 slot_id = 2;
17484
17485    // The terminated reason associated with the subscription state.
17486    // Used as a dimension
17487    optional TerminatedReason reason = 3;
17488
17489    // Whether or not the NOTIFY received contained at least one body with PIDF
17490    // content before moving to the terminated state.
17491    // Used as a dimension
17492    optional bool content_body_received = 4;
17493
17494    // The count of PIDF info received that contained RCS caps.
17495    optional int32 rcs_caps_count = 5;
17496
17497    // The count of PIDF info received that contained MMTEL caps.
17498    optional int32 mmtel_caps_count = 6;
17499
17500    // The count of PIDF info received that contained no mmtel or RCS caps.
17501    optional int32 no_caps_count = 7;
17502
17503    // The count that matches the above conditions;
17504    optional int32 count = 8;
17505}
17506
17507/**
17508 * Tracks GBA requests from applications
17509 *
17510 * Logged from:
17511 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/RcsStats.java
17512 */
17513message GbaEvent {
17514    enum FailedReason {
17515        UNKNOWN = 0;
17516        FEATURE_NOT_SUPPORTED = 1;
17517        FEATURE_NOT_READY = 2;
17518        NETWORK_FAILURE = 3;
17519        INCORRECT_NAF_ID = 4;
17520        SECURITY_PROTOCOL_NOT_SUPPORTED = 5;
17521    }
17522    // Carrier ID of the SIM used for IMS registration.
17523    // See https://source.android.com/devices/tech/config/carrierid.
17524    // Used as a dimension
17525    optional int32 carrier_id = 1;
17526
17527    // Index of the SIM used, 0 for single-SIM devices.
17528    // Used as a dimension
17529    optional int32 slot_id = 2;
17530
17531    // Whether the GBA event is successful.
17532    // Used as a dimension
17533    optional bool successful = 3;
17534
17535    // Gba authentication failed reason.
17536    // Used as a dimension
17537    optional FailedReason failed_reason = 4;
17538
17539    // The count that matches the above conditions.
17540    optional int32 count = 5;
17541}
17542
17543