• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        KilledAppStatsReported killed_app_stats_reported = 319 [(module) = "carwatchdogd"];
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        IoOveruseStatsReported io_overuse_stats_reported = 369 [(module) = "carwatchdogd"];
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
582        // StatsdStats tracks platform atoms with ids upto 500.
583        // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
584    }
585
586    // Pulled events will start at field 10000.
587    // Next: 10118
588    oneof pulled {
589        WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
590        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
591        MobileBytesTransfer mobile_bytes_transfer =
592                10002 [(module) = "framework", (truncate_timestamp) = true];
593        MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg =
594                10003 [(module) = "framework", (truncate_timestamp) = true];
595        BluetoothBytesTransfer bluetooth_bytes_transfer = 10006 [(module) = "framework"];
596        KernelWakelock kernel_wakelock = 10004 [(module) = "framework"];
597        SubsystemSleepState subsystem_sleep_state = 10005 [(module) = "framework", (module) = "statsdtest"];
598        CpuTimePerUid cpu_time_per_uid = 10009 [(module) = "framework", (module) = "statsdtest"];
599        CpuTimePerUidFreq cpu_time_per_uid_freq =
600                10010 [(module) = "framework", (module) = "statsd"];
601        WifiActivityInfo wifi_activity_info = 10011 [(module) = "framework"];
602        ModemActivityInfo modem_activity_info = 10012 [(module) = "framework"];
603        BluetoothActivityInfo bluetooth_activity_info = 10007 [(module) = "framework"];
604        ProcessMemoryState process_memory_state = 10013 [(module) = "framework"];
605        SystemElapsedRealtime system_elapsed_realtime = 10014 [(module) = "framework"];
606        SystemUptime system_uptime = 10015 [(module) = "framework"];
607        CpuActiveTime cpu_active_time = 10016 [(module) = "framework", (module) = "statsdtest"];
608        CpuClusterTime cpu_cluster_time = 10017 [(module) = "framework"];
609        DiskSpace disk_space = 10018 [deprecated=true, (module) = "statsdtest"];
610        RemainingBatteryCapacity remaining_battery_capacity = 10019 [(module) = "framework"];
611        FullBatteryCapacity full_battery_capacity = 10020 [(module) = "framework"];
612        Temperature temperature = 10021 [(module) = "framework", (module) = "statsdtest"];
613        BinderCalls binder_calls = 10022 [(module) = "framework", (module) = "statsd"];
614        BinderCallsExceptions binder_calls_exceptions = 10023 [(module) = "framework"];
615        LooperStats looper_stats = 10024 [(module) = "framework", (module) = "statsd"];
616        DiskStats disk_stats = 10025 [(module) = "framework"];
617        DirectoryUsage directory_usage = 10026 [(module) = "framework"];
618        AppSize app_size = 10027 [(module) = "framework"];
619        CategorySize category_size = 10028 [(module) = "framework"];
620        ProcStats proc_stats = 10029 [(module) = "framework"];
621        BatteryVoltage battery_voltage = 10030 [(module) = "framework"];
622        NumFingerprintsEnrolled num_fingerprints_enrolled = 10031 [(module) = "framework"];
623        DiskIo disk_io = 10032 [(module) = "framework"];
624        PowerProfile power_profile = 10033 [(module) = "framework"];
625        ProcStatsPkgProc proc_stats_pkg_proc = 10034 [(module) = "framework"];
626        ProcessCpuTime process_cpu_time = 10035 [(module) = "framework"];
627        CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037 [(module) = "framework"];
628        OnDevicePowerMeasurement on_device_power_measurement = 10038 [(module) = "framework"];
629        DeviceCalculatedPowerUse device_calculated_power_use = 10039 [(module) = "framework"];
630        DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid =
631                10040 [(module) = "framework"];
632        DeviceCalculatedPowerBlameOther device_calculated_power_blame_other =
633                10041 [(module) = "framework"];
634        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042 [(module) = "framework"];
635        BatteryLevel battery_level = 10043 [(module) = "framework"];
636        BuildInformation build_information = 10044 [(module) = "framework"];
637        BatteryCycleCount battery_cycle_count = 10045 [(module) = "framework"];
638        DebugElapsedClock debug_elapsed_clock = 10046 [(module) = "framework"];
639        DebugFailingElapsedClock debug_failing_elapsed_clock = 10047 [(module) = "framework"];
640        NumFacesEnrolled num_faces_enrolled = 10048 [(module) = "framework"];
641        RoleHolder role_holder = 10049 [(module) = "framework"];
642        DangerousPermissionState dangerous_permission_state = 10050 [(module) = "framework"];
643        TrainInfo train_info = 10051 [(module) = "statsd"];
644        TimeZoneDataInfo time_zone_data_info = 10052 [(module) = "framework"];
645        ExternalStorageInfo external_storage_info = 10053 [(module) = "framework"];
646        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
647        GpuStatsAppInfo gpu_stats_app_info = 10055;
648        SystemIonHeapSize system_ion_heap_size = 10056 [deprecated = true, (module) = "framework"];
649        AppsOnExternalStorageInfo apps_on_external_storage_info = 10057 [(module) = "framework"];
650        FaceSettings face_settings = 10058 [(module) = "framework"];
651        CoolingDevice cooling_device = 10059 [(module) = "framework"];
652        AppOps app_ops = 10060 [(module) = "framework"];
653        ProcessSystemIonHeapSize process_system_ion_heap_size = 10061 [(module) = "framework"];
654        SurfaceflingerStatsGlobalInfo surfaceflinger_stats_global_info = 10062;
655        SurfaceflingerStatsLayerInfo surfaceflinger_stats_layer_info = 10063;
656        ProcessMemorySnapshot process_memory_snapshot = 10064 [(module) = "framework"];
657        VmsClientStats vms_client_stats = 10065 [(module) = "car"];
658        NotificationRemoteViews notification_remote_views = 10066 [(module) = "framework"];
659        DangerousPermissionStateSampled dangerous_permission_state_sampled =
660                10067 [(module) = "framework"];
661        GraphicsStats graphics_stats = 10068 [(module) = "hwui"];
662        RuntimeAppOpAccess runtime_app_op_access = 10069 [(module) = "framework"];
663        IonHeapSize ion_heap_size = 10070 [(module) = "framework"];
664        PackageNotificationPreferences package_notification_preferences =
665                10071 [(module) = "framework"];
666        PackageNotificationChannelPreferences package_notification_channel_preferences =
667                10072 [(module) = "framework"];
668        PackageNotificationChannelGroupPreferences package_notification_channel_group_preferences =
669                10073 [(module) = "framework"];
670        GnssStats gnss_stats = 10074 [(module) = "framework"];
671        AttributedAppOps attributed_app_ops = 10075 [(module) = "framework"];
672        VoiceCallSession voice_call_session = 10076 [(module) = "telephony"];
673        VoiceCallRatUsage voice_call_rat_usage = 10077 [(module) = "telephony"];
674        SimSlotState sim_slot_state = 10078 [(module) = "telephony"];
675        SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
676        SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
677        BlobInfo blob_info = 10081 [(module) = "framework"];
678        DataUsageBytesTransfer data_usage_bytes_transfer =
679                10082 [(module) = "framework", (truncate_timestamp) = true];
680        BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered =
681                10083 [(module) = "framework", (truncate_timestamp) = true];
682        DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"];
683        GeneralExternalStorageAccessStats general_external_storage_access_stats =
684            10085 [(module) = "mediaprovider"];
685        IncomingSms incoming_sms = 10086 [(module) = "telephony"];
686        OutgoingSms outgoing_sms = 10087 [(module) = "telephony"];
687        CarrierIdTableVersion carrier_id_table_version = 10088 [(module) = "telephony"];
688        DataCallSession data_call_session = 10089 [(module) = "telephony"];
689        CellularServiceState cellular_service_state = 10090 [(module) = "telephony"];
690        CellularDataServiceSwitch cellular_data_service_switch = 10091 [(module) = "telephony"];
691        SystemMemory system_memory = 10092 [(module) = "framework"];
692        ImsRegistrationTermination ims_registration_termination = 10093 [(module) = "telephony"];
693        ImsRegistrationStats ims_registration_stats = 10094 [(module) = "telephony"];
694        CpuTimePerClusterFreq cpu_time_per_cluster_freq = 10095 [(module) = "framework"];
695        CpuCyclesPerUidCluster cpu_cycles_per_uid_cluster = 10096 [(module) = "framework"];
696        DeviceRotatedData device_rotated_data = 10097 [(module) = "framework"];
697        CpuCyclesPerThreadGroupCluster cpu_cycles_per_thread_group_cluster = 10098 [(module) = "framework"];
698        MediaDrmActivityInfo media_drm_activity_info = 10099;
699        OemManagedBytesTransfer oem_managed_bytes_transfer = 10100 [(module) = "framework"];
700        GnssPowerStats gnss_power_stats = 10101 [(module) = "framework"];
701        TimeZoneDetectorState time_zone_detector_state = 10102 [(module) = "framework"];
702        Keystore2StorageStats keystore2_storage_stats = 10103 [(module) = "framework"];
703        RkpPoolStats rkp_pool_stats = 10104 [(module) = "framework"];
704        ProcessDmabufMemory process_dmabuf_memory = 10105 [(module) = "framework"];
705        PendingAlarmInfo pending_alarm_info = 10106 [(module) = "framework"];
706        UserLevelHibernatedApps user_level_hibernated_apps = 10107 [(module) = "framework"];
707        GlobalHibernatedApps global_hibernated_apps = 10109 [(module) = "framework"];
708        InputEventLatencySketch input_event_latency_sketch = 10110 [(module) = "input"];
709        BatteryUsageStatsBeforeReset battery_usage_stats_before_reset =
710            10111 [(module) = "framework"];
711        BatteryUsageStatsSinceReset battery_usage_stats_since_reset =
712            10112 [(module) = "framework"];
713        BatteryUsageStatsSinceResetUsingPowerProfileModel
714            battery_usage_stats_since_reset_using_power_profile_model =
715            10113 [(module) = "framework"];
716        InstalledIncrementalPackage installed_incremental_package = 10114 [(module) = "framework"];
717        TelephonyNetworkRequests telephony_network_requests = 10115 [(module) = "telephony"];
718        AppSearchStorageInfo app_search_storage_info = 10116 [(module) = "appsearch"];
719        VmStat vmstat = 10117 [(module) = "framework"];
720        Keystore2KeyCreationWithGeneralInfo keystore2_key_creation_with_general_info =
721                10118 [(module) = "framework"];
722        Keystore2KeyCreationWithAuthInfo keystore2_key_creation_with_auth_info =
723                10119 [(module) = "framework"];
724        Keystore2KeyCreationWithPurposeAndModesInfo
725                keystore2_key_creation_with_purpose_and_modes_info = 10120 [(module) = "framework"];
726        Keystore2AtomWithOverflow keystore2_atom_with_overflow = 10121 [(module) = "framework"];
727        Keystore2KeyOperationWithPurposeAndModesInfo
728                keystore2_key_operation_with_purpose_and_modes_info =
729                        10122 [(module) = "framework"];
730        Keystore2KeyOperationWithGeneralInfo keystore2_key_operation_with_general_info =
731                10123 [(module) = "framework"];
732        RkpErrorStats rkp_error_stats = 10124 [(module) = "framework"];
733        Keystore2CrashStats keystore2_crash_stats = 10125 [(module) = "framework"];
734    }
735
736    // DO NOT USE field numbers above 100,000 in AOSP.
737    // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
738    // Field numbers 200,000 and above are reserved for future use; do not use them at all.
739
740    reserved 10008, 10036;
741}
742
743/**
744 * This proto represents a node of an attribution chain.
745 * Note: All attribution chains are represented as a repeated field of type
746 * AttributionNode. It is understood that in such arrays, the order is that
747 * of calls, that is [A, B, C] if A calls B that calls C.
748 */
749message AttributionNode {
750    // The uid for a given element in the attribution chain.
751    optional int32 uid = 1;
752
753    // The (optional) string tag for an element in the attribution chain. If the
754    // element has no tag, it is encoded as an empty string.
755    optional string tag = 2;
756}
757
758message KeyValuePair {
759    optional int32 key = 1;
760    oneof value {
761        int32 value_int = 2;
762        int64 value_long = 3;
763        string value_str = 4;
764        float value_float = 5;
765    }
766}
767
768message KeyValuePairsAtom {
769    optional int32 uid = 1;
770    repeated KeyValuePair pairs = 2;
771}
772
773/*
774 * *****************************************************************************
775 * Below are all of the individual atoms that are logged by Android via statsd.
776 *
777 * RULES:
778 *   - The field ids for each atom must start at 1, and count upwards by 1.
779 *     Skipping field ids is not allowed.
780 *   - These form an API, so renaming, renumbering or removing fields is
781 *     not allowed between android releases.  (This is not currently enforced,
782 *     but there will be a tool to enforce this restriction).
783 *   - The types must be built-in protocol buffer types, namely, no sub-messages
784 *     are allowed (yet).  The bytes type is also not allowed.
785 *   - The CamelCase name of the message type should match the
786 *     underscore_separated name as defined in Atom.
787 *   - If an atom represents work that can be attributed to an app, there can
788 *     be exactly one AttributionChain field. It must be field number 1.
789 *   - A field that is a uid should be a string field, tagged with the [xxx]
790 *     annotation. The generated code on android will be represented by UIDs,
791 *     and those UIDs will be translated in xxx to those strings.
792 *
793 * CONVENTIONS:
794 *   - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
795 *   - If there is a UID, it goes first. Think in an object-oriented fashion.
796 * *****************************************************************************
797 */
798
799/**
800 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
801 * Logs when the Thermal service HAL notifies the throttling start/stop events.
802 *
803 * Logged from:
804 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
805 */
806message ThermalThrottlingStateChanged {
807    // The type of temperature being reported (CPU, GPU, SKIN, etc)
808    optional android.os.TemperatureTypeEnum sensor_type = 1;
809
810    // Throttling state, this field is DEPRECATED
811    enum State {
812        UNKNOWN = 0;
813        START = 1; // START indicated that throttling was triggered.
814        STOP = 2; // STOP indicates that throttling was cleared.
815    }
816    optional State state = 2;
817
818    optional float temperature = 3;
819}
820
821/**
822 * Track transcoding service usage
823 * Logged from:
824 *   packages/providers/MediaProvider/src/com/android/providers/media/TranscodeHelper.java
825 * Next Tag: 14
826 */
827message TranscodingData {
828    // Reason that leads to the type of access.
829    enum AccessReason {
830        UNKNOWN = 0;
831        SYSTEM_DEFAULT = 1; // Default option
832        SYSTEM_CONFIG = 2;  // Server-side/on-device config
833        APP_MANIFEST = 3;  // media_capabilites.xml
834        APP_COMPAT = 4;   // App compat framework
835        APP_EXTRA = 5;   // ApplicationMediaCapabilities API in open()
836    }
837
838    // Causes that leads to the failure of transcode.
839    enum FailureCause {
840        CAUSE_UNKNOWN = 0;
841        TRANSCODING_SERVICE_ERROR = 1;     // Error from transcoding service.
842        TRANSCODING_CLIENT_TIMEOUT = 2;    // Timeout from MediaProvider.
843        TRANSCODING_SESSION_CANCELED = 3; // MediaProvider cancels the transcode.
844    }
845
846    enum AccessType {
847        HEVC_WRITE = 1;
848        READ_DIRECT = 2;
849        READ_CACHE = 3;
850        READ_TRANSCODE = 4;
851        WRITE_CACHE = 5; // App trying to write to transcodeid avc file in cache, this is rare.
852        AVC_WRITE = 6;
853    }
854
855    enum Result {
856        SUCCESS = 0;
857        FAIL = 1;
858        UNDEFINED = 2;
859    }
860
861    optional string requestor_package = 1;
862    optional AccessType access_type = 2;
863    optional int64 file_size_bytes = 3;
864    optional Result transcode_result = 4;
865    optional int64 transcode_duration_millis = 5; // The duration of transcoding.
866    optional int64 file_duration_millis = 6; // The duration of the video file.
867    optional int64 file_framerate_fps = 7; // The framerate of the video file.
868    optional AccessReason access_reason = 8;
869    optional int64 width = 9;
870    optional int64 height = 10;
871    optional bool hit_anr = 11;
872    optional FailureCause failure_cause = 12;   // This field is valid only when fails.
873    optional int64 transcoding_service_error_code = 13; // Error code from transcoding service.
874}
875
876/**
877 * Logs when the screen state changes.
878 *
879 * Logged from:
880 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
881 */
882message ScreenStateChanged {
883    // New screen state, from frameworks/proto_logging/stats/enums/view/enums.proto.
884    optional android.view.DisplayStateEnum state = 1
885            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
886}
887
888/**
889 * Logs that the process state of the uid, as determined by ActivityManager
890 * (i.e. the highest process state of that uid's processes) has changed.
891 *
892 * Logged from:
893 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
894 */
895message UidProcessStateChanged {
896    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
897
898    // The state, from frameworks/proto_logging/stats/enums/app/enums.proto.
899    optional android.app.ProcessStateEnum state = 2
900            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
901}
902
903/**
904 * Logs process state change of a process, as per the activity manager.
905 *
906 * Logged from:
907 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
908 */
909message ProcessStateChanged {
910    optional int32 uid = 1;
911    optional string process_name = 2;
912    optional string package_name = 3;
913    // TODO: remove this when validation is done
914    optional int64 version = 5;
915    // The state, from frameworks/proto_logging/stats/enums/app/enums.proto.
916    optional android.app.ProcessStateEnum state = 4;
917}
918
919/**
920 * Logs when ActivityManagerService sleep state is changed.
921 *
922 * Logged from:
923 *   frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
924 */
925message ActivityManagerSleepStateChanged {
926    // TODO: import frameworks proto
927    enum State {
928        UNKNOWN = 0;
929        ASLEEP = 1;
930        AWAKE = 2;
931    }
932    optional State state = 1
933            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
934}
935
936/**
937 * Logs when system memory state changes.
938 *
939 * Logged from:
940 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
941 */
942message MemoryFactorStateChanged {
943    // TODO: import frameworks proto
944    enum State {
945        MEMORY_UNKNOWN = 0;
946        NORMAL = 1;     // normal.
947        MODERATE = 2;   // moderate memory pressure.
948        LOW = 3;        // low memory.
949        CRITICAL = 4;   // critical memory.
950
951    }
952    optional State factor = 1 [(state_field_option).exclusive_state = true];
953}
954
955/**
956 * Logs when app is using too much cpu, according to ActivityManagerService.
957 *
958 * Logged from:
959 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
960 */
961message ExcessiveCpuUsageReported {
962    optional int32 uid = 1;
963    optional string process_name = 2;
964    optional string package_name = 3;
965    // package version. TODO: remove this when validation is done
966    optional int64 version = 4;
967}
968
969/**
970 * Logs when a cached process is killed, along with its pss.
971 *
972 * Logged from:
973 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
974 */
975message CachedKillReported {
976    optional int32 uid = 1;
977    optional string process_name = 2;
978    optional string package_name = 3;
979    // TODO: remove this when validation is done
980    optional int64 version = 5;
981    optional int64 pss = 4;
982}
983
984/**
985 * Logs the change in wifi health.
986 *
987 * Logged from:
988 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiDataStall.java
989 */
990message WifiHealthStatReported {
991    enum Band {
992        UNKNOWN = 0;
993        // All of 2.4GHz band
994        BAND_2G = 1;
995        // Frequencies in the range of [5150, 5250) GHz
996        BAND_5G_LOW = 2;
997        // Frequencies in the range of [5250, 5725) GHz
998        BAND_5G_MIDDLE = 3;
999        // Frequencies in the range of [5725, 5850) GHz
1000        BAND_5G_HIGH = 4;
1001        // Frequencies in the range of [5925, 6425) GHz
1002        BAND_6G_LOW = 5;
1003        // Frequencies in the range of [6425, 6875) GHz
1004        BAND_6G_MIDDLE = 6;
1005        // Frequencies in the range of [6875, 7125) GHz
1006        BAND_6G_HIGH = 7;
1007    }
1008    // duration this stat is obtained over in milliseconds
1009    optional int32 duration_millis = 1;
1010    // whether wifi is classified as sufficient for the user's data traffic, determined
1011    // by whether the calculated throughput exceeds the average demand within |duration_millis|
1012    optional bool is_sufficient = 2;
1013    // whether cellular data is available
1014    optional bool is_cell_data_available = 3;
1015    // the Band bucket the connected network is on
1016    optional Band band = 4;
1017}
1018
1019/**
1020 * Logged when wifi detects a significant change in connection failure rate.
1021 *
1022 * Logged from: frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiHealthMonitor.java
1023 *
1024 */
1025message WifiFailureStatReported {
1026    enum AbnormalityType {
1027        UNKNOWN = 0;
1028        SIGNIFICANT_INCREASE = 1;
1029        SIGNIFICANT_DECREASE = 2;
1030        SIMPLY_HIGH = 3;
1031    }
1032    enum FailureType {
1033        FAILURE_UNKNOWN = 0;
1034        FAILURE_CONNECTION = 1;
1035        FAILURE_ASSOCIATION_REJECTION = 2;
1036        FAILURE_ASSOCIATION_TIMEOUT = 3;
1037        FAILURE_AUTHENTICATION = 4;
1038        FAILURE_NON_LOCAL_DISCONNECTION = 5;
1039        FAILURE_SHORT_CONNECTION_DUE_TO_NON_LOCAL_DISCONNECTION = 6;
1040    }
1041    // Reason for uploading this stat
1042    optional AbnormalityType abnormality_type = 1;
1043    // The particular type of failure
1044    optional FailureType failure_type = 2;
1045    // How many times we have encountered this combination of AbnormalityType and FailureType
1046    optional int32 failure_count = 3;
1047}
1048
1049/**
1050 * Logs whether a Wifi connection attempt was successful and reasons for failure if it wasn't.
1051 *
1052 * Logged from:
1053 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1054 */
1055message WifiConnectionResultReported {
1056    enum FailureCode {
1057        FAILURE_UNKNOWN = 0;
1058        FAILURE_ASSOCIATION_TIMEOUT = 1;
1059        FAILURE_ASSOCIATION_REJECTION = 2;
1060        FAILURE_AUTHENTICATION_GENERAL = 3;
1061        FAILURE_AUTHENTICATION_EAP = 4;
1062        FAILURE_DHCP = 5;
1063        FAILURE_NETWORK_DISCONNECTION = 6;
1064        FAILURE_ROAM_TIMEOUT = 7;
1065        FAILURE_WRONG_PASSWORD = 8;
1066    }
1067
1068    enum Trigger {
1069        UNKNOWN = 0;
1070        // Connection attempt was initiated manually.
1071        MANUAL = 1;
1072        // Automatic reconnection to the same network as connected previously.
1073        RECONNECT_SAME_NETWORK = 2;
1074        // Automatic reconnection to a saved network, but not the previous one.
1075        AUTOCONNECT_CONFIGURED_NETWORK = 3;
1076        // Automatic first connection attempt after device boot.
1077        AUTOCONNECT_BOOT = 4;
1078    }
1079
1080    // True represents a successful connection.
1081    optional bool connection_result = 1;
1082    // Reason for the connection failure.
1083    optional FailureCode failure_code = 2;
1084    // Scan RSSI before the connection attempt.
1085    optional int32 rssi = 3;
1086    // Time taken by this connection attempt.
1087    optional int32 connection_attempt_duration_millis = 4;
1088    // Band bucket the connected network is on.
1089    optional android.net.wifi.WifiBandBucket band = 5;
1090    // Authentication type.
1091    optional android.net.wifi.WifiAuthType auth_type = 6;
1092    // What triggered this connection attempt.
1093    optional Trigger trigger = 7;
1094    // Whether this network was used (successfully connected to) previously.
1095    optional bool network_used = 8;
1096    // Time taken from the last successful connection (or device boot if that's the first one).
1097    optional int32 time_since_last_connection_seconds = 9;
1098}
1099
1100/**
1101 * Logs when a Wifi connection drops.
1102 *
1103 * Logged from:
1104 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1105 */
1106message WifiDisconnectReported {
1107    enum FailureCode {
1108        UNKNOWN = 0;
1109
1110        // Wifi supplicant failure reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45).
1111        // See ISupplicantStaIfaceCallback.java:ReasonCode
1112        UNSPECIFIED = 1;
1113        PREV_AUTH_NOT_VALID = 2;
1114        DEAUTH_LEAVING = 3;
1115        DISASSOC_DUE_TO_INACTIVITY = 4;
1116        DISASSOC_AP_BUSY = 5;
1117        CLASS2_FRAME_FROM_NONAUTH_STA = 6;
1118        CLASS3_FRAME_FROM_NONASSOC_STA = 7;
1119        DISASSOC_STA_HAS_LEFT = 8;
1120        STA_REQ_ASSOC_WITHOUT_AUTH = 9;
1121        PWR_CAPABILITY_NOT_VALID = 10;
1122        SUPPORTED_CHANNEL_NOT_VALID = 11;
1123        BSS_TRANSITION_DISASSOC = 12;
1124        INVALID_IE = 13;
1125        MICHAEL_MIC_FAILURE = 14;
1126        FOURWAY_HANDSHAKE_TIMEOUT = 15;
1127        GROUP_KEY_UPDATE_TIMEOUT = 16;
1128        IE_IN_4WAY_DIFFERS = 17;
1129        GROUP_CIPHER_NOT_VALID = 18;
1130        PAIRWISE_CIPHER_NOT_VALID = 19;
1131        AKMP_NOT_VALID = 20;
1132        UNSUPPORTED_RSN_IE_VERSION = 21;
1133        INVALID_RSN_IE_CAPAB = 22;
1134        IEEE_802_1X_AUTH_FAILED = 23;
1135        CIPHER_SUITE_REJECTED = 24;
1136        TDLS_TEARDOWN_UNREACHABLE = 25;
1137        TDLS_TEARDOWN_UNSPECIFIED = 26;
1138        SSP_REQUESTED_DISASSOC = 27;
1139        NO_SSP_ROAMING_AGREEMENT = 28;
1140        BAD_CIPHER_OR_AKM = 29;
1141        NOT_AUTHORIZED_THIS_LOCATION = 30;
1142        SERVICE_CHANGE_PRECLUDES_TS = 31;
1143        UNSPECIFIED_QOS_REASON = 32;
1144        NOT_ENOUGH_BANDWIDTH = 33;
1145        DISASSOC_LOW_ACK = 34;
1146        EXCEEDED_TXOP = 35;
1147        STA_LEAVING = 36;
1148        END_TS_BA_DLS = 37;
1149        UNKNOWN_TS_BA = 38;
1150        TIMEOUT = 39;
1151        PEERKEY_MISMATCH = 45;
1152        AUTHORIZED_ACCESS_LIMIT_REACHED = 46;
1153        EXTERNAL_SERVICE_REQUIREMENTS = 47;
1154        INVALID_FT_ACTION_FRAME_COUNT = 48;
1155        INVALID_PMKID = 49;
1156        INVALID_MDE = 50;
1157        INVALID_FTE = 51;
1158        MESH_PEERING_CANCELLED = 52;
1159        MESH_MAX_PEERS = 53;
1160        MESH_CONFIG_POLICY_VIOLATION = 54;
1161        MESH_CLOSE_RCVD = 55;
1162        MESH_MAX_RETRIES = 56;
1163        MESH_CONFIRM_TIMEOUT = 57;
1164        MESH_INVALID_GTK = 58;
1165        MESH_INCONSISTENT_PARAMS = 59;
1166        MESH_INVALID_SECURITY_CAP = 60;
1167        MESH_PATH_ERROR_NO_PROXY_INFO = 61;
1168        MESH_PATH_ERROR_NO_FORWARDING_INFO = 62;
1169        MESH_PATH_ERROR_DEST_UNREACHABLE = 63;
1170        MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64;
1171        MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65;
1172        MESH_CHANNEL_SWITCH_UNSPECIFIED = 66;
1173
1174        // ClientModeImpl error codes
1175        // Defined in /frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1176        IFACE_DESTROYED = 10000;
1177        WIFI_DISABLED = 10001;
1178        SUPPLICANT_DISCONNECTED = 10002;
1179        CONNECTING_WATCHDOG_TIMER = 10003;
1180        ROAM_WATCHDOG_TIMER = 10004;
1181    }
1182
1183    // How long the session lasted from successful connection to disconnect.
1184    optional int32 connected_duration_seconds = 1;
1185
1186    // Reason for the disconnect.
1187    optional FailureCode failure_code = 2;
1188
1189    // Band bucket the connected network was on.
1190    optional android.net.wifi.WifiBandBucket band = 3;
1191
1192    // Authentication type.
1193    optional android.net.wifi.WifiAuthType auth_type = 4;
1194
1195    // Last seen RSSI before the disconnect.
1196    optional int32 last_rssi = 5;
1197
1198    // Last seen link speed before the disconnect.
1199    optional int32 last_link_speed = 6;
1200}
1201
1202/**
1203 * Logs when Wifi connection is established or dropped.
1204 *
1205 * Logged from:
1206 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
1207 */
1208message WifiConnectionStateChanged {
1209    optional bool is_connected = 1;
1210
1211    // Band bucket the connected network was on.
1212    // Filled for both connected and disconnected cases.
1213    optional android.net.wifi.WifiBandBucket band = 2;
1214
1215    // Authentication type.
1216    // Filled for both connected and disconnected cases.
1217    optional android.net.wifi.WifiAuthType auth_type = 3;
1218}
1219
1220/**
1221 * Logs when memory stats of a process is reported.
1222 *
1223 * Logged from:
1224 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
1225 */
1226message ProcessMemoryStatReported {
1227    optional int32 uid = 1;
1228    optional string process_name = 2;
1229    optional string package_name = 3;
1230    //TODO: remove this when validation is done
1231    optional int64 version = 9;
1232    optional int64 pss = 4;
1233    optional int64 uss = 5;
1234    optional int64 rss = 6;
1235    enum Type {
1236        ADD_PSS_INTERNAL_SINGLE = 0;
1237        ADD_PSS_INTERNAL_ALL_MEM = 1;
1238        ADD_PSS_INTERNAL_ALL_POLL = 2;
1239        ADD_PSS_EXTERNAL = 3;
1240        ADD_PSS_EXTERNAL_SLOW = 4;
1241    }
1242    optional Type type = 7;
1243    optional int64 duration_millis = 8;
1244}
1245
1246/**
1247 * Logs that a process started, finished, crashed, or ANRed.
1248 *
1249 * Logged from:
1250 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1251 */
1252message ProcessLifeCycleStateChanged {
1253    optional int32 uid = 1 [(is_uid) = true];
1254
1255    // The process name (usually same as the app name).
1256    optional string process_name = 2;
1257
1258    // What lifecycle state the process changed to.
1259    // This enum is specific to atoms.proto.
1260    enum State {
1261        FINISHED = 0;
1262        STARTED = 1;
1263        CRASHED = 2;
1264    }
1265    optional State state = 3;
1266}
1267
1268/**
1269 * Logs when the ble scan state changes.
1270 *
1271 * Logged from:
1272 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
1273 */
1274message BleScanStateChanged {
1275    repeated AttributionNode attribution_node = 1
1276            [(state_field_option).primary_field_first_uid = true];
1277
1278    enum State {
1279        OFF = 0;
1280        ON = 1;
1281        // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
1282        RESET = 2;
1283    }
1284    optional State state = 2 [
1285        (state_field_option).exclusive_state = true,
1286        (state_field_option).default_state_value = 0 /* State.OFF */,
1287        (state_field_option).trigger_state_reset_value = 2 /* State.RESET */,
1288        (state_field_option).nested = true
1289    ];
1290
1291    // Does the scan have a filter.
1292    optional bool is_filtered = 3 [(state_field_option).primary_field = true];
1293    // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
1294    optional bool is_first_match = 4 [(state_field_option).primary_field = true];
1295    // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
1296    optional bool is_opportunistic = 5 [(state_field_option).primary_field = true];
1297}
1298
1299/**
1300 * Logs reporting of a ble scan finding results.
1301 *
1302 * Logged from:
1303 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
1304 */
1305// TODO: Consider also tracking per-scanner-id.
1306message BleScanResultReceived {
1307    repeated AttributionNode attribution_node = 1;
1308
1309    // Number of ble scan results returned.
1310    optional int32 num_results = 2;
1311}
1312
1313/**
1314 * Logs when a sensor state changes.
1315 *
1316 * Logged from:
1317 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1318 */
1319message SensorStateChanged {
1320    repeated AttributionNode attribution_node = 1;
1321
1322    // The id (int) of the sensor.
1323    optional int32 sensor_id = 2;
1324
1325    enum State {
1326        OFF = 0;
1327        ON = 1;
1328    }
1329    optional State state = 3;
1330}
1331
1332/**
1333 * Logs when GPS state changes.
1334 *
1335 * Logged from:
1336 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1337 */
1338message GpsScanStateChanged {
1339    repeated AttributionNode attribution_node = 1;
1340
1341    enum State {
1342        OFF = 0;
1343        ON = 1;
1344    }
1345    optional State state = 2;
1346}
1347
1348/**
1349 * Logs when GPS signal quality.
1350 *
1351 * Logged from:
1352 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
1353 */
1354message GpsSignalQualityChanged {
1355    optional android.server.location.GpsSignalQualityEnum level = 1;
1356}
1357
1358
1359/**
1360 * Logs when a sync manager sync state changes.
1361 *
1362 * Logged from:
1363 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1364 */
1365message SyncStateChanged {
1366    repeated AttributionNode attribution_node = 1;
1367
1368    // Name of the sync (as named in the app). Can be chosen at run-time.
1369    optional string sync_name = 2;
1370
1371    enum State {
1372        OFF = 0;
1373        ON = 1;
1374    }
1375    optional State state = 3;
1376}
1377
1378/*
1379 * Deferred job stats.
1380 *
1381 * Logged from:
1382 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
1383*/
1384message DeferredJobStatsReported {
1385    repeated AttributionNode attribution_node = 1;
1386
1387    // Number of jobs deferred.
1388    optional int32 num_jobs_deferred = 2;
1389
1390    // Time since the last job runs.
1391    optional int64 time_since_last_job_millis = 3;
1392}
1393
1394/**
1395 * Logs when a job scheduler job state changes.
1396 *
1397 * Logged from:
1398 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1399 *
1400 * Next tag: 18
1401 */
1402message ScheduledJobStateChanged {
1403    repeated AttributionNode attribution_node = 1;
1404
1405    // Name of the job (as named in the app)
1406    optional string job_name = 2;
1407
1408    enum State {
1409        FINISHED = 0;
1410        STARTED = 1;
1411        SCHEDULED = 2;
1412    }
1413    optional State state = 3;
1414
1415    // The internal reason a job has stopped.
1416    // This is only applicable when the state is FINISHED.
1417    // The default value is INTERNAL_STOP_REASON_UNKNOWN.
1418    optional android.app.job.InternalStopReasonEnum internal_stop_reason = 4;
1419
1420    // The publicly returned reason onStopJob() was called.
1421    // This is only applicable when the state is FINISHED, but may be undefined if
1422    // JobService.onStopJob() was never called for the job.
1423    // The default value is STOP_REASON_UNDEFINED.
1424    optional android.app.job.StopReasonEnum public_stop_reason = 17;
1425
1426    // The standby bucket of the app that scheduled the job. These match the framework constants
1427    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
1428    // already assigned 0.
1429    enum Bucket {
1430        UNKNOWN = -1;
1431        ACTIVE = 0;
1432        WORKING_SET = 1;
1433        FREQUENT = 2;
1434        RARE = 3;
1435        NEVER = 4;
1436        RESTRICTED = 5;
1437    }
1438    optional Bucket standby_bucket = 5 [default = UNKNOWN];
1439
1440    // The job id (as assigned by the app).
1441    optional int32 job_id = 6;
1442
1443    // One flag for each of the API constraints defined by Jobscheduler. Does not include implcit
1444    // constraints as they are always assumed to be set.
1445    optional bool has_charging_constraint = 7;
1446    optional bool has_battery_not_low_constraint = 8;
1447    optional bool has_storage_not_low_constraint = 9;
1448    optional bool has_timing_delay_constraint = 10;
1449    optional bool has_deadline_constraint = 11;
1450    optional bool has_idle_constraint = 12;
1451    optional bool has_connectivity_constraint = 13;
1452    optional bool has_content_trigger_constraint = 14;
1453
1454    // True if the app has requested this run as an expedited job.
1455    optional bool is_requested_expedited_job = 15;
1456    // True if the job is running as an expedited job. Only valid for STARTED and FINISHED states.
1457    optional bool is_running_as_expedited_job = 16;
1458}
1459
1460/**
1461 * Logs when the audio state changes.
1462 *
1463 * Logged from:
1464 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1465 */
1466message AudioStateChanged {
1467    repeated AttributionNode attribution_node = 1;
1468
1469    enum State {
1470        OFF = 0;
1471        ON = 1;
1472        // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
1473        RESET = 2;
1474    }
1475    optional State state = 2;
1476}
1477
1478/**
1479 * Logs when the video codec state changes.
1480 *
1481 * Logged from:
1482 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1483 */
1484message MediaCodecStateChanged {
1485    repeated AttributionNode attribution_node = 1;
1486
1487    enum State {
1488        OFF = 0;
1489        ON = 1;
1490        // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
1491        RESET = 2;
1492    }
1493    optional State state = 2;
1494}
1495
1496/**
1497 * Logs when the flashlight state changes.
1498 *
1499 * Logged from:
1500 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1501 */
1502message FlashlightStateChanged {
1503    repeated AttributionNode attribution_node = 1;
1504
1505    enum State {
1506        OFF = 0;
1507        ON = 1;
1508        // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
1509        RESET = 2;
1510    }
1511    optional State state = 2;
1512}
1513
1514/**
1515 * Logs when the camera state changes.
1516 *
1517 * Logged from:
1518 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1519 */
1520message CameraStateChanged {
1521    repeated AttributionNode attribution_node = 1;
1522
1523    enum State {
1524        OFF = 0;
1525        ON = 1;
1526        // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
1527        RESET = 2;
1528    }
1529    optional State state = 2;
1530}
1531
1532/**
1533 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
1534 *
1535 * Logged from:
1536 *   TODO
1537 */
1538message WakelockStateChanged {
1539    repeated AttributionNode attribution_node = 1
1540            [(state_field_option).primary_field_first_uid = true];
1541
1542    // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
1543    // From frameworks/proto_logging/stats/enums/os/enums.proto.
1544    optional android.os.WakeLockLevelEnum type = 2 [(state_field_option).primary_field = true];
1545
1546    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
1547    optional string tag = 3 [(state_field_option).primary_field = true];
1548
1549    enum State {
1550        RELEASE = 0;
1551        ACQUIRE = 1;
1552        CHANGE_RELEASE = 2;
1553        CHANGE_ACQUIRE = 3;
1554    }
1555    optional State state = 4 [
1556        (state_field_option).exclusive_state = true,
1557        (state_field_option).default_state_value = 0,
1558        (state_field_option).nested = true
1559    ];
1560}
1561
1562/**
1563 * Logs when a partial wakelock is considered 'long' (over 1 min).
1564 *
1565 * Logged from:
1566 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1567 */
1568message LongPartialWakelockStateChanged {
1569    repeated AttributionNode attribution_node = 1;
1570
1571    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
1572    optional string tag = 2;
1573
1574    // TODO: I have no idea what this is.
1575    optional string history_tag = 3;
1576
1577    enum State {
1578        OFF = 0;
1579        ON = 1;
1580    }
1581    optional State state = 4;
1582}
1583
1584/**
1585 * Logs when the device is interactive, according to the PowerManager Notifier.
1586 *
1587 * Logged from:
1588 *   frameworks/base/services/core/java/com/android/server/power/Notifier.java
1589 */
1590message InteractiveStateChanged {
1591    enum State {
1592        OFF = 0;
1593        ON = 1;
1594    }
1595    optional State state = 1;
1596}
1597
1598/**
1599 * Logs Battery Saver state change.
1600 *
1601 * Logged from:
1602 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1603 */
1604message BatterySaverModeStateChanged {
1605    enum State {
1606        OFF = 0;
1607        ON = 1;
1608    }
1609    optional State state = 1
1610            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1611}
1612
1613/**
1614 * Logs Doze mode state change.
1615 *
1616 * Logged from:
1617 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1618 */
1619message DeviceIdleModeStateChanged {
1620    optional android.server.DeviceIdleModeEnum state = 1
1621            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1622}
1623
1624
1625/**
1626 * Logs state change of Doze mode including maintenance windows.
1627 *
1628 * Logged from:
1629 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1630 */
1631message DeviceIdlingModeStateChanged {
1632    optional android.server.DeviceIdleModeEnum state = 1
1633            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1634}
1635
1636/**
1637 * Logs screen brightness level.
1638 *
1639 * Logged from:
1640 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1641 */
1642message ScreenBrightnessChanged {
1643    // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
1644    optional int32 level = 1;
1645}
1646
1647/**
1648 * Logs battery level (percent full, from 0 to 100).
1649 *
1650 * Logged from:
1651 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1652 */
1653message BatteryLevelChanged {
1654    // Battery level. Should be in [0, 100].
1655    optional int32 battery_level = 1;
1656}
1657
1658/**
1659 * Logs change in charging status of the device.
1660 *
1661 * Logged from:
1662 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1663 */
1664message ChargingStateChanged {
1665    // State of the battery, from frameworks/proto_logging/stats/enums/os/enums.proto.
1666    optional android.os.BatteryStatusEnum state = 1
1667            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1668}
1669
1670/**
1671 * Logs whether the device is plugged in, and what power source it is using.
1672 *
1673 * Logged from:
1674 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1675 */
1676message PluggedStateChanged {
1677    // Whether the device is plugged in, from frameworks/proto_logging/stats/enums/os/enums.proto.
1678    optional android.os.BatteryPluggedStateEnum state = 1
1679            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1680}
1681
1682/**
1683 * Logs when an app's wakeup alarm fires.
1684 *
1685 * Logged from:
1686 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1687 */
1688message WakeupAlarmOccurred {
1689    repeated AttributionNode attribution_node = 1;
1690
1691    // Name of the wakeup alarm.
1692    optional string tag = 2;
1693
1694    // Name of source package (for historical reasons, since BatteryStats tracked it).
1695    optional string package_name = 3;
1696
1697    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
1698    optional AppStandbyBucketChanged.Bucket app_standby_bucket = 4;
1699}
1700
1701/**
1702 * Logs when an an app causes the mobile radio to change state.
1703 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
1704 *
1705 * Logged from:
1706 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1707 */
1708message MobileRadioPowerStateChanged {
1709    repeated AttributionNode attribution_node = 1;
1710
1711    // Power state, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
1712    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1713}
1714
1715/**
1716 * Logs when an an app causes the wifi radio to change state.
1717 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
1718 *
1719 * Logged from:
1720 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1721 */
1722message WifiRadioPowerStateChanged {
1723    repeated AttributionNode attribution_node = 1;
1724
1725    // Power state, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
1726    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1727}
1728
1729/**
1730 * Logs kernel wakeup reasons and aborts.
1731 *
1732 * Logged from:
1733 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1734 */
1735message KernelWakeupReported {
1736    // Name of the kernel wakeup reason (or abort).
1737    optional string wakeup_reason_name = 1;
1738
1739    // Duration (in microseconds) for the wake-up interrupt to be serviced.
1740    optional int64 duration_micros = 2;
1741}
1742
1743/**
1744 * Logs when Wifi is toggled on/off.
1745 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
1746 *
1747 * Logged from:
1748 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1749 */
1750message WifiEnabledStateChanged {
1751    enum State {
1752        OFF = 0;
1753        ON = 1;
1754    }
1755    optional State state = 1;
1756}
1757
1758/**
1759 * This atom is deprecated starting in R.
1760 *
1761 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
1762 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
1763 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
1764 *
1765 * Logged from:
1766 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1767 */
1768message WifiRunningStateChanged {
1769    repeated AttributionNode attribution_node = 1;
1770
1771    enum State {
1772        OFF = 0;
1773        ON = 1;
1774    }
1775    optional State state = 2;
1776}
1777
1778/**
1779 * Logs wifi locks held by an app.
1780 *
1781 * Logged from:
1782 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1783 */
1784message WifiLockStateChanged {
1785    repeated AttributionNode attribution_node = 1;
1786
1787    enum State {
1788        OFF = 0;
1789        ON = 1;
1790    }
1791    optional State state = 2;
1792
1793    // WifiLock type, from frameworks/proto_logging/stats/enums/wifi/enums.proto.
1794    optional android.net.wifi.WifiModeEnum mode = 3;
1795}
1796
1797/**
1798 * Logs wifi signal strength changes.
1799 *
1800 * Logged from:
1801 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
1802 */
1803message WifiSignalStrengthChanged {
1804    // Signal strength, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
1805    optional android.telephony.SignalStrengthEnum signal_strength = 1;
1806}
1807
1808/**
1809 * Logs wifi scans performed by an app.
1810 *
1811 * Logged from:
1812 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
1813 */
1814message WifiScanStateChanged {
1815    repeated AttributionNode attribution_node = 1;
1816
1817    enum State {
1818        OFF = 0;
1819        ON = 1;
1820    }
1821    optional State state = 2;
1822}
1823
1824/**
1825 * Logs wifi multicast locks held by an app
1826 *
1827 * Logged from:
1828 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
1829 */
1830message WifiMulticastLockStateChanged {
1831    repeated AttributionNode attribution_node = 1;
1832
1833    enum State {
1834        OFF = 0;
1835        ON = 1;
1836    }
1837    optional State state = 2;
1838
1839    optional string tag = 3;
1840}
1841
1842/**
1843 * Logs shutdown reason and duration on next boot.
1844 *
1845 * Logged from:
1846 *   frameworks/base/core/java/com/android/server/BootReceiver.java
1847 */
1848message ShutdownSequenceReported {
1849    // True if shutdown is for a reboot. Default: false if we do not know.
1850    optional bool reboot = 1;
1851
1852    // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
1853    optional string reason = 2;
1854
1855    // Beginning of shutdown time in ms using wall clock time since unix epoch.
1856    // Default: 0 if no start time received.
1857    optional int64 start_time_millis = 3;
1858
1859    // Duration of shutdown in ms. Default: 0 if no duration received.
1860    optional int64 duration_millis = 4;
1861}
1862
1863
1864/**
1865 * Logs boot reason and duration.
1866 *
1867 * Logged from:
1868 *   system/core/bootstat/bootstat.cpp
1869 */
1870message BootSequenceReported {
1871    // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
1872    // Default: "<EMPTY>" if not available.
1873    optional string bootloader_reason = 1;
1874
1875    // Reason for system boot. Eg. bootloader, reboot,userrequested
1876    // Default: "<EMPTY>" if not available.
1877    optional string system_reason = 2;
1878
1879    // End of boot time in ms from unix epoch using system wall clock.
1880    optional int64 end_time_millis = 3;
1881
1882    // Total boot duration in ms.
1883    optional int64 total_duration_millis = 4;
1884
1885    // Bootloader duration in ms.
1886    optional int64 bootloader_duration_millis = 5;
1887
1888    // Time since last boot in ms. Default: 0 if not available.
1889    optional int64 time_since_last_boot = 6;
1890}
1891
1892
1893/**
1894 * Logs call state and disconnect cause (if applicable).
1895 *
1896 * Logged from:
1897 *   packages/services/Telecomm/src/com/android/server/telecom/Call.java
1898 */
1899message CallStateChanged {
1900    // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1901    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto.
1902    optional android.telecom.CallStateEnum call_state = 1;
1903
1904    // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1905    // This value is only applicable when the call_state is DISCONNECTED, and
1906    // should always be UNKNOWN if the call_state is not DISCONNECTED.
1907    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto.
1908    optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1909
1910    // True if the call is self-managed, which are apps that use the
1911    // telecom infrastructure to make their own calls.
1912    optional bool self_managed = 3;
1913
1914    // True if call is external. External calls are calls on connected Wear
1915    // devices but show up in Telecom so the user can pull them onto the device.
1916    optional bool external_call = 4;
1917}
1918
1919/**
1920 * Logs keyguard state. The keyguard is the lock screen.
1921 *
1922 * Logged from:
1923 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1924 */
1925message KeyguardStateChanged {
1926    enum State {
1927        UNKNOWN = 0;
1928        // The keyguard is hidden when the phone is unlocked.
1929        HIDDEN = 1;
1930        // The keyguard is shown when the phone is locked (screen turns off).
1931        SHOWN= 2;
1932        // The keyguard is occluded when something is overlaying the keyguard.
1933        // Eg. Opening the camera while on the lock screen.
1934        OCCLUDED = 3;
1935    }
1936    optional State state = 1;
1937}
1938
1939/**
1940 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1941 * prompts the user to enter a password (pattern, pin, etc).
1942 *
1943 * Logged from:
1944 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1945 */
1946
1947message KeyguardBouncerStateChanged {
1948    enum State {
1949        UNKNOWN = 0;
1950        // Bouncer is hidden, either as a result of successfully entering the
1951        // password, screen timing out, or user going back to lock screen.
1952        HIDDEN = 1;
1953        // This is when the user is being prompted to enter the password.
1954        SHOWN = 2;
1955    }
1956    optional State state = 1;
1957}
1958
1959/**
1960 * Logs the result of entering a password into the keyguard bouncer.
1961 *
1962 * Logged from:
1963 *   frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1964 */
1965message KeyguardBouncerPasswordEntered {
1966    enum BouncerResult {
1967        UNKNOWN = 0;
1968        // The password entered was incorrect.
1969        FAILURE = 1;
1970        // The password entered was correct.
1971        SUCCESS = 2;
1972    }
1973    optional BouncerResult result = 1;
1974}
1975
1976/*
1977 * Logs changes to the configuration of the device. The configuration is defined
1978 * in frameworks/base/core/java/android/content/res/Configuration.java
1979 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1980 * Please go there to interpret the possible values each field can be.
1981 *
1982 * Logged from:
1983 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1984 */
1985message ResourceConfigurationChanged {
1986    // Bit mask of color capabilities of the screen.
1987    // Contains information about the color gamut and hdr mode of the screen.
1988    // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1989    optional int32 color_mode = 1;
1990
1991    // The target screen density being rendered to.
1992    // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1993    optional int32 density_dpi = 2;
1994
1995    // Current user preference for the scaling factor for fonts,
1996    // relative to the base density scaling.
1997    // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1998    optional float font_scale = 3;
1999
2000    // Flag indicating whether the hard keyboard is hidden.
2001    // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
2002    optional int32 hard_keyboard_hidden = 4;
2003
2004    // The type of keyboard attached to the device.
2005    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
2006    optional int32 keyboard = 5;
2007
2008    // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
2009    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
2010    optional int32 keyboard_hidden = 6;
2011
2012    // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
2013    // 0 if undefined.
2014    // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
2015    optional int32 mcc = 7;
2016
2017    // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
2018    // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
2019    // MNC_ZERO symbol defined in Configuration.java.
2020    // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
2021    optional int32 mnc = 8;
2022
2023    // The kind of navigation available on the device.
2024    // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
2025    optional int32 navigation = 9;
2026
2027    // Flag indicating whether the navigation is available.
2028    // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
2029    optional int32 navigation_hidden = 10;
2030
2031    // Overall orientation of the screen.
2032    // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
2033    optional int32 orientation = 11;
2034
2035    // The current height of the available screen space, in dp units.
2036    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
2037    optional int32 screen_height_dp = 12;
2038
2039    // Bit mask of overall layout of the screen.
2040    // Contains information about screen size, whether the screen is wider/taller
2041    // than normal, whether the screen layout is right-tl-left or left-to-right,
2042    // and whether the screen has a rounded shape.
2043    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
2044    optional int32 screen_layout = 13;
2045
2046    // Current width of the available screen space, in dp units.
2047    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
2048    optional int32 screen_width_dp = 14;
2049
2050    // The smallest screen size an application will see in normal operation.
2051    // This is the smallest value of both screenWidthDp and screenHeightDp
2052    // in portrait and landscape.
2053    // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
2054    optional int32 smallest_screen_width_dp = 15;
2055
2056    // The type of touch screen attached to the device.
2057    // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
2058    optional int32 touchscreen = 16;
2059
2060    // Bit mask of the ui mode.
2061    // Contains information about the overall ui mode of the device.
2062    // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
2063    // Also contains information about whether the device is in night mode.
2064    // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
2065    optional int32 ui_mode = 17;
2066}
2067
2068
2069/**
2070 * Logs changes in the connection state of the mobile radio.
2071 *
2072 * Logged from:
2073 *    frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
2074 */
2075message MobileConnectionStateChanged {
2076    // States are from the state machine DataConnection.java.
2077    enum State {
2078        UNKNOWN = 0;
2079        // The connection is inactive, or disconnected.
2080        INACTIVE = 1;
2081        // The connection is being activated, or connecting.
2082        ACTIVATING = 2;
2083        // The connection is active, or connected.
2084        ACTIVE = 3;
2085        // The connection is disconnecting.
2086        DISCONNECTING = 4;
2087        // The connection is disconnecting after creating a connection.
2088        DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
2089    }
2090    optional State state  = 1;
2091    // For multi-sim phones, this distinguishes between the sim cards.
2092    optional int32 sim_slot_index = 2;
2093    // Used to identify the connection. Starts at 0 and increments by 1 for
2094    // every new network created. Resets whenever the device reboots.
2095    optional int32 data_connection_id = 3;
2096    // A bitmask for the capabilities of this connection.
2097    // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
2098    // Default value (if we have no information): 0
2099    optional int64 capabilities = 4;
2100    // If this connection has internet.
2101    // This just checks if the DEFAULT bit of capabilities is set.
2102    optional bool has_internet = 5;
2103}
2104
2105/**
2106 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
2107 *
2108 * Logged from:
2109 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
2110 */
2111message MobileRadioTechnologyChanged {
2112    optional android.telephony.NetworkTypeEnum state = 1;
2113    // For multi-sim phones, this distinguishes between the sim cards.
2114    optional int32 sim_slot_index = 2;
2115}
2116
2117/**
2118 * Logs the VID and PID of any connected USB devices.
2119 *
2120 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
2121 *
2122 * Logged by Vendor.
2123 */
2124message UsbDeviceAttached {
2125    optional int32 vid = 1;
2126    optional int32 pid = 2;
2127    optional bool has_audio = 3;
2128    optional bool has_hid = 4;
2129    optional bool has_storage = 5;
2130    enum State {
2131        STATE_DISCONNECTED = 0;
2132        STATE_CONNECTED = 1;
2133    }
2134    optional State state = 6;
2135    optional int64 last_connect_duration_millis = 7;
2136}
2137
2138
2139/**
2140 * Logs when Bluetooth is enabled and disabled.
2141 *
2142 * Logged from:
2143 *   services/core/java/com/android/server/BluetoothManagerService.java
2144 */
2145message BluetoothEnabledStateChanged {
2146    repeated AttributionNode attribution_node = 1;
2147    // Whether or not bluetooth is enabled on the device.
2148    enum State {
2149        UNKNOWN = 0;
2150        ENABLED = 1;
2151        DISABLED = 2;
2152    }
2153    optional State state = 2;
2154    // The reason for being enabled/disabled.
2155    // Eg. Airplane mode, crash, application request.
2156    optional android.bluetooth.EnableDisableReasonEnum reason = 3;
2157    // If the reason is an application request, this will be the package name.
2158    optional string pkg_name = 4;
2159}
2160
2161/**
2162 * Logs when profiles on a Bluetooth device connects and disconnects.
2163 *
2164 * Logged from:
2165 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
2166 *
2167 * Next Tag: 6
2168 */
2169message BluetoothConnectionStateChanged {
2170    // The state of the connection.
2171    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
2172    optional android.bluetooth.ConnectionStateEnum state = 1;
2173    // An identifier that can be used to match connect and disconnect events.
2174    // Currently is last two bytes of a hash of a device level ID and
2175    // the mac address of the bluetooth device that is connected.
2176    // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
2177    optional int32 obfuscated_id = 2 [deprecated = true];
2178    // The profile that is connected. Eg. GATT, A2DP, HEADSET.
2179    // From android.bluetooth.BluetoothAdapter.java
2180    // Default: 0 when not used
2181    optional int32 bt_profile = 3;
2182    // An identifier that can be used to match events for this device.
2183    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2184    // Salt: Randomly generated 256 bit value
2185    // Hash algorithm: HMAC-SHA256
2186    // Size: 32 byte
2187    // Default: null or empty if the device identifier is not known
2188    optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
2189    // An identifier that can be used to match events for this device.
2190    // The incremental identifier is locally generated and guaranteed not derived
2191    // from any globally unique hardware id.
2192    // For paired devices, it stays consistent between Bluetooth toggling for the
2193    // same remote device.
2194    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2195    // session for the same remote device.
2196    // Default: 0 if the device's metric id is unknown.
2197    optional int32 metric_id = 5;
2198}
2199
2200/**
2201 * Logs when a Bluetooth device connects and disconnects over ACL
2202 *
2203 * Logged from:
2204 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
2205 *
2206 * Next Tag: 4
2207 */
2208message BluetoothAclConnectionStateChanged {
2209    // An identifier that can be used to match events for this device.
2210    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2211    // Salt: Randomly generated 256 bit value
2212    // Hash algorithm: HMAC-SHA256
2213    // Size: 32 byte
2214    // Default: null or empty if the device identifier is not known
2215    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2216    // The state of the connection.
2217    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
2218    optional android.bluetooth.ConnectionStateEnum state = 2;
2219    // An identifier that can be used to match events for this device.
2220    // The incremental identifier is locally generated and guaranteed not derived
2221    // from any globally unique hardware id.
2222    // For paired devices, it stays consistent between Bluetooth toggling for the
2223    // same remote device.
2224    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2225    // session for the same remote device.
2226    // Default: 0 if the device's metric id is unknown.
2227    optional int32 metric_id = 3;
2228}
2229
2230/**
2231 * Logs when a Bluetooth device connects and disconnects over SCO
2232 *
2233 * Logged from:
2234 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
2235 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
2236 *
2237 * Next Tag: 5
2238 */
2239message BluetoothScoConnectionStateChanged {
2240    // An identifier that can be used to match events for this device.
2241    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2242    // Salt: Randomly generated 256 bit value
2243    // Hash algorithm: HMAC-SHA256
2244    // Size: 32 byte
2245    // Default: null or empty if the device identifier is not known
2246    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2247    // The state of the connection.
2248    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
2249    optional android.bluetooth.ConnectionStateEnum state = 2;
2250    // Codec used for this SCO connection
2251    // Default: UNKNOWN
2252    optional android.bluetooth.hfp.ScoCodec codec = 3;
2253    // An identifier that can be used to match events for this device.
2254    // The incremental identifier is locally generated and guaranteed not derived
2255    // from any globally unique hardware id.
2256    // For paired devices, it stays consistent between Bluetooth toggling for the
2257    // same remote device.
2258    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2259    // session for the same remote device.
2260    // Default: 0 if the device's metric id is unknown.
2261    optional int32 metric_id = 4;
2262}
2263
2264/**
2265 * Logged when active device of a profile changes
2266 *
2267 * Logged from:
2268 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2269 *     packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetService.java
2270 *     packages/apps/Bluetooth/src/com/android/bluetooth/hearingaid/HearingAidService.java
2271 */
2272message BluetoothActiveDeviceChanged {
2273    // The profile whose active device has changed. Eg. A2DP, HEADSET, HEARING_AID
2274    // From android.bluetooth.BluetoothProfile
2275    optional int32 bt_profile = 1;
2276    // An identifier that can be used to match events for this new active device.
2277    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2278    // Salt: Randomly generated 256 bit value
2279    // Hash algorithm: HMAC-SHA256
2280    // Size: 32 byte
2281    // Default: null or empty if there is no active device for this profile
2282    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
2283    // An identifier that can be used to match events for this device.
2284    // The incremental identifier is locally generated and guaranteed not derived
2285    // from any globally unique hardware id.
2286    // For paired devices, it stays consistent between Bluetooth toggling for the
2287    // same remote device.
2288    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2289    // session for the same remote device.
2290    // Default: 0 if the device's metric id is unknown.
2291    optional int32 metric_id = 3;
2292}
2293
2294// Logs when there is an event affecting Bluetooth device's link layer connection.
2295// - This event is triggered when there is a related HCI command or event
2296// - Users of this metrics can deduce Bluetooth device's connection state from these events
2297// - HCI commands are logged before the command is sent, after receiving command status, and after
2298//   receiving command complete
2299// - HCI events are logged when they arrive
2300//
2301// Low level log from system/bt
2302//
2303// Bluetooth classic commands:
2304// - CMD_CREATE_CONNECTION
2305// - CMD_DISCONNECT
2306// - CMD_CREATE_CONNECTION_CANCEL
2307// - CMD_ACCEPT_CONNECTION_REQUEST
2308// - CMD_REJECT_CONNECTION_REQUEST
2309// - CMD_SETUP_ESCO_CONNECTION
2310// - CMD_ACCEPT_ESCO_CONNECTION
2311// - CMD_REJECT_ESCO_CONNECTION
2312// - CMD_ENH_SETUP_ESCO_CONNECTION
2313// - CMD_ENH_ACCEPT_ESCO_CONNECTION
2314//
2315// Bluetooth low energy commands:
2316// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
2317// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
2318// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
2319// - CMD_BLE_CLEAR_WHITE_LIST
2320// - CMD_BLE_ADD_WHITE_LIST
2321// - CMD_BLE_REMOVE_WHITE_LIST
2322//
2323// Bluetooth classic events:
2324// - EVT_CONNECTION_COMP
2325// - EVT_CONNECTION_REQUEST
2326// - EVT_DISCONNECTION_COMP
2327// - EVT_ESCO_CONNECTION_COMP
2328// - EVT_ESCO_CONNECTION_CHANGED
2329//
2330// Bluetooth low energy meta events:
2331// - BLE_EVT_CONN_COMPLETE_EVT
2332// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
2333//
2334// Next tag: 10
2335message BluetoothLinkLayerConnectionEvent {
2336    // An identifier that can be used to match events for this device.
2337    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2338    // Salt: Randomly generated 256 bit value
2339    // Hash algorithm: HMAC-SHA256
2340    // Size: 32 byte
2341    // Default: null or empty if the device identifier is not known
2342    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2343    // Connection handle of this connection if available
2344    // Range: 0x0000 - 0x0EFF (12 bits)
2345    // Default: 0xFFFF if the handle is unknown
2346    optional int32 connection_handle = 2;
2347    // Direction of the link
2348    // Default: DIRECTION_UNKNOWN
2349    optional android.bluetooth.DirectionEnum direction = 3;
2350    // Type of this link
2351    // Default: LINK_TYPE_UNKNOWN
2352    optional android.bluetooth.LinkTypeEnum type = 4;
2353
2354    // Reason metadata for this link layer connection event, rules for interpretation:
2355    // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
2356    //    EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
2357    // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
2358    //    set and valid, ignore hci_ble_event
2359
2360    // HCI command associated with this event
2361    // Default: CMD_UNKNOWN
2362    optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
2363    // HCI event associated with this event
2364    // Default: EVT_UNKNOWN
2365    optional android.bluetooth.hci.EventEnum hci_event = 6;
2366    // HCI BLE meta event associated with this event
2367    // Default: BLE_EVT_UNKNOWN
2368    optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
2369    // HCI command status code if this is triggerred by hci_cmd
2370    // Default: STATUS_UNKNOWN
2371    optional android.bluetooth.hci.StatusEnum cmd_status = 8;
2372    // HCI reason code associated with this event
2373    // Default: STATUS_UNKNOWN
2374    optional android.bluetooth.hci.StatusEnum reason_code = 9;
2375    // An identifier that can be used to match events for this device.
2376    // The incremental identifier is locally generated and guaranteed not derived
2377    // from any globally unique hardware id.
2378    // For paired devices, it stays consistent between Bluetooth toggling for the
2379    // same remote device.
2380    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2381    // session for the same remote device.
2382    // Default: 0 if the device's metric id is unknown.
2383    optional int32 metric_id = 10;
2384}
2385
2386/**
2387 * Logs when a module is rolled back by Watchdog.
2388 *
2389 * Logged from: Rollback Manager
2390 */
2391message WatchdogRollbackOccurred {
2392    enum RollbackType {
2393        UNKNOWN = 0;
2394        ROLLBACK_INITIATE = 1;
2395        ROLLBACK_SUCCESS = 2;
2396        ROLLBACK_FAILURE = 3;
2397        ROLLBACK_BOOT_TRIGGERED = 4;
2398    }
2399    optional RollbackType rollback_type = 1;
2400
2401    optional string package_name = 2;
2402
2403    optional int32 package_version_code = 3;
2404
2405    enum RollbackReasonType {
2406        REASON_UNKNOWN = 0;
2407        REASON_NATIVE_CRASH = 1;
2408        REASON_EXPLICIT_HEALTH_CHECK = 2;
2409        REASON_APP_CRASH = 3;
2410        REASON_APP_NOT_RESPONDING = 4;
2411        REASON_NATIVE_CRASH_DURING_BOOT = 5;
2412    }
2413    optional RollbackReasonType rollback_reason = 4;
2414
2415    // Set by RollbackPackageHealthObserver to be the package that is failing when a rollback
2416    // is initiated. Empty if the package is unknown.
2417    optional string failing_package_name = 5;
2418
2419    optional TrainExperimentIds experiment_ids = 6 [(log_mode) = MODE_BYTES];
2420}
2421
2422/**
2423 * Logs when there is a change in Bluetooth A2DP playback state
2424 *
2425 * Logged from:
2426 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2427 */
2428message BluetoothA2dpPlaybackStateChanged {
2429    // An identifier that can be used to match events for this device.
2430    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2431    // Salt: Randomly generated 256 bit value
2432    // Hash algorithm: HMAC-SHA256
2433    // Size: 32 byte
2434    // Default: null or empty if the device identifier is not known
2435    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2436    // Current playback state
2437    // Default: PLAYBACK_STATE_UNKNOWN
2438    optional android.bluetooth.a2dp.PlaybackStateEnum playback_state = 2;
2439    // Current audio coding mode
2440    // Default: AUDIO_CODING_MODE_UNKNOWN
2441    optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
2442    // An identifier that can be used to match events for this device.
2443    // The incremental identifier is locally generated and guaranteed not derived
2444    // from any globally unique hardware id.
2445    // For paired devices, it stays consistent between Bluetooth toggling for the
2446    // same remote device.
2447    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2448    // session for the same remote device.
2449    // Default: 0 if the device's metric id is unknown.
2450    optional int32 metric_id = 4;
2451}
2452
2453/**
2454 * Logs when there is a change in A2DP codec config for a particular remote device
2455 *
2456 * Logged from:
2457 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
2458 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2459 */
2460message BluetoothA2dpCodecConfigChanged {
2461    // An identifier that can be used to match events for this device.
2462    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2463    // Salt: Randomly generated 256 bit value
2464    // Hash algorithm: HMAC-SHA256
2465    // Size: 32 byte
2466    // Default: null or empty if the device identifier is not known
2467    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2468    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
2469    // Default SOURCE_CODEC_TYPE_INVALID
2470    optional int32 codec_type = 2;
2471    // Codec priroity, the higher the more preferred, -1 for disabled
2472    // Default: CODEC_PRIORITY_DEFAULT
2473    optional int32 codec_priority = 3;
2474    // Sample rate in Hz as defined by various SAMPLE_RATE_* constants in BluetoothCodecConfig
2475    // Default: SAMPLE_RATE_NONE
2476    optional int32 sample_rate = 4;
2477    // Bits per sample as defined by various BITS_PER_SAMPLE_* constants in BluetoothCodecConfig
2478    // Default: BITS_PER_SAMPLE_NONE
2479    optional int32 bits_per_sample = 5;
2480    // Channel mode as defined by various CHANNEL_MODE_* constants in BluetoothCodecConfig
2481    // Default: CHANNEL_MODE_NONE
2482    optional int32 channel_mode = 6;
2483    // Codec specific values
2484    // Default 0
2485    optional int64 codec_specific_1 = 7;
2486    optional int64 codec_specific_2 = 8;
2487    optional int64 codec_specific_3 = 9;
2488    optional int64 codec_specific_4 = 10;
2489    // An identifier that can be used to match events for this device.
2490    // The incremental identifier is locally generated and guaranteed not derived
2491    // from any globally unique hardware id.
2492    // For paired devices, it stays consistent between Bluetooth toggling for the
2493    // same remote device.
2494    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2495    // session for the same remote device.
2496    // Default: 0 if the device's metric id is unknown.
2497    optional int32 metric_id = 11;
2498}
2499
2500/**
2501 * Logs when there is a change in selectable A2DP codec capability for a paricular remote device
2502 * Each codec's capability is logged separately due to statsd restriction
2503 *
2504 * Logged from:
2505 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
2506 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2507 */
2508message BluetoothA2dpCodecCapabilityChanged {
2509    // An identifier that can be used to match events for this device.
2510    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2511    // Salt: Randomly generated 256 bit value
2512    // Hash algorithm: HMAC-SHA256
2513    // Size: 32 byte
2514    // Default: null or empty if the device identifier is not known
2515    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2516    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
2517    // Default SOURCE_CODEC_TYPE_INVALID
2518    optional int32 codec_type = 2;
2519    // Codec priroity, the higher the more preferred, -1 for disabled
2520    // Default: CODEC_PRIORITY_DEFAULT
2521    optional int32 codec_priority = 3;
2522    // A bit field of supported sample rates as defined by various SAMPLE_RATE_* constants
2523    // in BluetoothCodecConfig
2524    // Default: empty and SAMPLE_RATE_NONE for individual item
2525    optional int32 sample_rate = 4;
2526    // A bit field of supported bits per sample as defined by various BITS_PER_SAMPLE_* constants
2527    // in BluetoothCodecConfig
2528    // Default: empty and BITS_PER_SAMPLE_NONE for individual item
2529    optional int32 bits_per_sample = 5;
2530    // A bit field of supported channel mode as defined by various CHANNEL_MODE_* constants in
2531    // BluetoothCodecConfig
2532    // Default: empty and CHANNEL_MODE_NONE for individual item
2533    optional int32 channel_mode = 6;
2534    // Codec specific values
2535    // Default 0
2536    optional int64 codec_specific_1 = 7;
2537    optional int64 codec_specific_2 = 8;
2538    optional int64 codec_specific_3 = 9;
2539    optional int64 codec_specific_4 = 10;
2540    // An identifier that can be used to match events for this device.
2541    // The incremental identifier is locally generated and guaranteed not derived
2542    // from any globally unique hardware id.
2543    // For paired devices, it stays consistent between Bluetooth toggling for the
2544    // same remote device.
2545    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2546    // session for the same remote device.
2547    // Default: 0 if the device's metric id is unknown.
2548    optional int32 metric_id = 11;
2549}
2550
2551/**
2552 * Logs when A2DP failed to read from PCM source.
2553 * This typically happens when audio HAL cannot supply A2DP with data fast enough for encoding.
2554 *
2555 * Logged from:
2556 *     system/bt
2557 */
2558message BluetoothA2dpAudioUnderrunReported {
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    // Encoding interval in nanoseconds
2567    // Default: 0
2568    optional int64 encoding_interval_nanos = 2;
2569    // Number of bytes of PCM data that could not be read from the source
2570    // Default: 0
2571    optional int32 num_missing_pcm_bytes = 3;
2572    // An identifier that can be used to match events for this device.
2573    // The incremental identifier is locally generated and guaranteed not derived
2574    // from any globally unique hardware id.
2575    // For paired devices, it stays consistent between Bluetooth toggling for the
2576    // same remote device.
2577    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2578    // session for the same remote device.
2579    // Default: 0 if the device's metric id is unknown.
2580    optional int32 metric_id = 4;
2581}
2582
2583/**
2584 * Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit
2585 * buffer queue is full and we have to drop data
2586 *
2587 * Logged from:
2588 *     system/bt
2589 */
2590message BluetoothA2dpAudioOverrunReported {
2591    // An identifier that can be used to match events for this device.
2592    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2593    // Salt: Randomly generated 256 bit value
2594    // Hash algorithm: HMAC-SHA256
2595    // Size: 32 byte
2596    // Default: null or empty if the device identifier is not known
2597    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2598    // Encoding interval in nanoseconds
2599    // Default: 0
2600    optional int64 encoding_interval_nanos = 2;
2601    // Number of buffers dropped in this event
2602    // Each buffer is encoded in one encoding interval and consists of multiple encoded frames
2603    // Default: 0
2604    optional int32 num_dropped_buffers = 3;
2605    // Number of encoded buffers dropped in this event
2606    // Default 0
2607    optional int32 num_dropped_encoded_frames = 4;
2608    // Number of encoded bytes dropped in this event
2609    // Default: 0
2610    optional int32 num_dropped_encoded_bytes = 5;
2611    // An identifier that can be used to match events for this device.
2612    // The incremental identifier is locally generated and guaranteed not derived
2613    // from any globally unique hardware id.
2614    // For paired devices, it stays consistent between Bluetooth toggling for the
2615    // same remote device.
2616    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2617    // session for the same remote device.
2618    // Default: 0 if the device's metric id is unknown.
2619    optional int32 metric_id = 6;
2620}
2621
2622/**
2623 * Logs when we receive reports regarding a device's RSSI value
2624 *
2625 * Logged from:
2626 *     system/bt
2627 */
2628message BluetoothDeviceRssiReported {
2629    // An identifier that can be used to match events for this device.
2630    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2631    // Salt: Randomly generated 256 bit value
2632    // Hash algorithm: HMAC-SHA256
2633    // Size: 32 byte
2634    // Default: null or empty if the device identifier is not known
2635    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2636    // Connection handle of this connection if available
2637    // Range: 0x0000 - 0x0EFF (12 bits)
2638    // Default: 0xFFFF if the handle is unknown
2639    optional int32 connection_handle = 2;
2640    // HCI command status code if this is triggerred by hci_cmd
2641    // Default: STATUS_UNKNOWN
2642    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2643    // BR/EDR
2644    //   Range: -128 ≤ N ≤ 127 (signed integer)
2645    //   Units: dB
2646    // LE:
2647    //   Range: -127 to 20, 127 (signed integer)
2648    //   Units: dBm
2649    // Invalid when an out of range value is reported
2650    optional int32 rssi = 4;
2651    // An identifier that can be used to match events for this device.
2652    // The incremental identifier is locally generated and guaranteed not derived
2653    // from any globally unique hardware id.
2654    // For paired devices, it stays consistent between Bluetooth toggling for the
2655    // same remote device.
2656    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2657    // session for the same remote device.
2658    // Default: 0 if the device's metric id is unknown.
2659    optional int32 metric_id = 5;
2660}
2661
2662/**
2663 * Logs when we receive reports regarding how many consecutive failed contacts for a connection
2664 *
2665 * Logged from:
2666 *     system/bt
2667 */
2668message BluetoothDeviceFailedContactCounterReported {
2669    // An identifier that can be used to match events for this device.
2670    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2671    // Salt: Randomly generated 256 bit value
2672    // Hash algorithm: HMAC-SHA256
2673    // Size: 32 byte
2674    // Default: null or empty if the device identifier is not known
2675    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2676    // Connection handle of this connection if available
2677    // Range: 0x0000 - 0x0EFF (12 bits)
2678    // Default: 0xFFFF if the handle is unknown
2679    optional int32 connection_handle = 2;
2680    // HCI command status code if this is triggerred by hci_cmd
2681    // Default: STATUS_UNKNOWN
2682    optional android.bluetooth.hci.StatusEnum cmd_status = 3;
2683    // Number of consecutive failed contacts for a connection corresponding to the Handle
2684    // Range: uint16_t, 0-0xFFFF
2685    // Default: 0xFFFFF
2686    optional int32 failed_contact_counter = 4;
2687    // An identifier that can be used to match events for this device.
2688    // The incremental identifier is locally generated and guaranteed not derived
2689    // from any globally unique hardware id.
2690    // For paired devices, it stays consistent between Bluetooth toggling for the
2691    // same remote device.
2692    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2693    // session for the same remote device.
2694    // Default: 0 if the device's metric id is unknown.
2695    optional int32 metric_id = 5;
2696}
2697
2698/**
2699 * Logs when we receive reports regarding the tranmit power level used for a specific connection
2700 *
2701 * Logged from:
2702 *     system/bt
2703 */
2704message BluetoothDeviceTxPowerLevelReported {
2705    // An identifier that can be used to match events for this device.
2706    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2707    // Salt: Randomly generated 256 bit value
2708    // Hash algorithm: HMAC-SHA256
2709    // Size: 32 byte
2710    // Default: null or empty if the device identifier is not known
2711    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2712    // Connection handle of this connection if available
2713    // Range: 0x0000 - 0x0EFF (12 bits)
2714    // Default: 0xFFFF if the handle is unknown
2715    optional int32 connection_handle = 2;
2716    // HCI command status code if this is triggered by hci_cmd
2717    // Default: STATUS_UNKNOWN
2718    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2719    // Range: -30 ≤ N ≤ 20
2720    // Units: dBm
2721    // Invalid when an out of range value is reported
2722    optional int32 transmit_power_level = 4;
2723    // An identifier that can be used to match events for this device.
2724    // The incremental identifier is locally generated and guaranteed not derived
2725    // from any globally unique hardware id.
2726    // For paired devices, it stays consistent between Bluetooth toggling for the
2727    // same remote device.
2728    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2729    // session for the same remote device.
2730    // Default: 0 if the device's metric id is unknown.
2731    optional int32 metric_id = 5;
2732}
2733
2734/**
2735 * Logs when Bluetooth controller failed to reply with command status within a timeout period after
2736 * receiving an HCI command from the host
2737 *
2738 * Logged from: system/bt
2739 */
2740message BluetoothHciTimeoutReported {
2741    // HCI command associated with this event
2742    // Default: CMD_UNKNOWN
2743    optional android.bluetooth.hci.CommandEnum hci_command = 1;
2744}
2745
2746/**
2747 * Logs when we receive Bluetooth Link Quality Report event from the controller
2748 * See Android Bluetooth HCI specification for more details
2749 *
2750 * Note: all count and bytes field are counted since last event
2751 *
2752 * Logged from: system/bt
2753 */
2754message BluetoothQualityReportReported {
2755    // Quality report ID
2756    // Original type: uint8_t
2757    // Default: BQR_ID_UNKNOWN
2758    optional android.bluetooth.hci.BqrIdEnum quality_report_id = 1;
2759    // Packet type of the connection
2760    // Original type: uint8_t
2761    // Default: BQR_PACKET_TYPE_UNKNOWN
2762    optional android.bluetooth.hci.BqrPacketTypeEnum packet_types = 2;
2763    // Connection handle of the connection
2764    // Original type: uint16_t
2765    optional int32 connection_handle = 3;
2766    // Performing Role for the connection
2767    // Original type: uint8_t
2768    optional int32 connection_role = 4;
2769    // Current Transmit Power Level for the connection. This value is the same as the controller's
2770    // response to the HCI_Read_Transmit_Power_Level HCI command
2771    // Original type: uint8_t
2772    optional int32 tx_power_level = 5;
2773    // Received Signal Strength Indication (RSSI) value for the connection. This value is an
2774    // absolute receiver signal strength value
2775    // Original type: int8_t
2776    optional int32 rssi = 6;
2777    // Signal-to-Noise Ratio (SNR) value for the connection. It is the average SNR of all the
2778    // channels used by the link currently
2779    // Original type: uint8_t
2780    optional int32 snr = 7;
2781    // Indicates the number of unused channels in AFH_channel_map
2782    // Original type: uint8_t
2783    optional int32 unused_afh_channel_count = 8;
2784    // Indicates the number of the channels which are interfered and quality is bad but are still
2785    // selected for AFH
2786    // Original type: uint8_t
2787    optional int32 afh_select_unideal_channel_count = 9;
2788    // Current Link Supervision Timeout Setting
2789    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2790    // Original type: uint16_t
2791    optional int32 lsto = 10;
2792    // Piconet Clock for the specified Connection_Handle. This value is the same as the controller's
2793    // response to HCI_Read_Clock HCI command with the parameter "Which_Clock" of
2794    // 0x01 (Piconet Clock)
2795    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2796    // Original type: uint32_t
2797    optional int64 connection_piconet_clock = 11;
2798    // The count of retransmission
2799    // Original type: uint32_t
2800    optional int64 retransmission_count = 12;
2801    // The count of no RX
2802    // Original type: uint32_t
2803    optional int64 no_rx_count = 13;
2804    // The count of NAK (Negative Acknowledge)
2805    // Original type: uint32_t
2806    optional int64 nak_count = 14;
2807    // Controller timestamp of last TX ACK
2808    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2809    // Original type: uint32_t
2810    optional int64 last_tx_ack_timestamp = 15;
2811    // The count of Flow-off (STOP)
2812    // Original type: uint32_t
2813    optional int64 flow_off_count = 16;
2814    // Controller timestamp of last Flow-on (GO)
2815    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2816    // Original type: uint32_t
2817    optional int64 last_flow_on_timestamp = 17;
2818    // Buffer overflow count (how many bytes of TX data are dropped) since the last event
2819    // Original type: uint32_t
2820    optional int64 buffer_overflow_bytes = 18;
2821    // Buffer underflow count (in byte) since last event
2822    // Original type: uint32_t
2823    optional int64 buffer_underflow_bytes = 19;
2824}
2825
2826/**
2827 * Logs when a Bluetooth device's manufacturer information is learnt by the Bluetooth stack
2828 *
2829 * Notes:
2830 * - Each event can be partially filled as we might learn different pieces of device
2831 *   information at different time
2832 * - Multiple device info events can be combined to give more complete picture
2833 * - When multiple device info events tries to describe the same information, the
2834 *   later one wins
2835 *
2836 * Logged from:
2837 *     packages/apps/Bluetooth
2838 */
2839message BluetoothDeviceInfoReported {
2840    // An identifier that can be used to match events for this device.
2841    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2842    // Salt: Randomly generated 256 bit value
2843    // Hash algorithm: HMAC-SHA256
2844    // Size: 32 byte
2845    // Default: null or empty if the device identifier is not known
2846    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2847    // Where is this device info obtained from
2848    optional android.bluetooth.DeviceInfoSrcEnum source_type = 2;
2849    // Name of the data source
2850    // For EXTERNAL: package name of the data source
2851    // For INTERNAL: null for general case, component name otherwise
2852    optional string source_name = 3;
2853    // Name of the manufacturer of this device
2854    optional string manufacturer = 4;
2855    // Model of this device
2856    optional string model = 5;
2857    // Hardware version of this device
2858    optional string hardware_version = 6;
2859    // Software version of this device
2860    optional string software_version = 7;
2861    // An identifier that can be used to match events for this device.
2862    // The incremental identifier is locally generated and guaranteed not derived
2863    // from any globally unique hardware id.
2864    // For paired devices, it stays consistent between Bluetooth toggling for the
2865    // same remote device.
2866    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2867    // session for the same remote device.
2868    // Default: 0 if the device's metric id is unknown.
2869    optional int32 metric_id = 8;
2870}
2871
2872/**
2873 * Logs when we receive Bluetooth Read Remote Version Information Complete Event from the remote
2874 * device, as documented by the Bluetooth Core HCI specification
2875 * Reference: https://www.bluetooth.com/specifications/bluetooth-core-specification
2876 * Vol 2, Part E, Page 1118
2877 *
2878 * Logged from:
2879 *     system/bt
2880 */
2881message BluetoothRemoteVersionInfoReported {
2882    // Connection handle of the connection
2883    // Original type: uint16_t
2884    optional int32 connection_handle = 1;
2885    // HCI command status code
2886    // Default: STATUS_UNKNOWN
2887    optional android.bluetooth.hci.StatusEnum hci_status = 2;
2888    // 1 byte Version of current LMP in the remote controller
2889    optional int32 lmp_version = 3;
2890    // 2 bytes LMP manufacturer code of the remote controller
2891    // https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
2892    optional int32 lmp_manufacturer_code = 4;
2893    // 4 bytes subversion of the LMP in the remote controller
2894    optional int32 lmp_subversion = 5;
2895}
2896
2897/**
2898 * Logs when certain Bluetooth SDP attributes are discovered
2899 * Constant definitions are from:
2900 *     https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
2901 *
2902 * Current logged attributes:
2903 * - BluetoothProfileDescriptorList
2904 * - Supported Features Bitmask
2905 *
2906 * Logged from:
2907 *     system/bt
2908 */
2909message BluetoothSdpAttributeReported {
2910    // An identifier that can be used to match events for this device.
2911    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2912    // Salt: Randomly generated 256 bit value
2913    // Hash algorithm: HMAC-SHA256
2914    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2915    // Short form UUIDs used to identify Bluetooth protocols, profiles, and service classes
2916    // Original type: uint16_t
2917    optional int32 protocol_uuid = 2;
2918    // Short form UUIDs used to identify Bluetooth SDP attribute types
2919    // Original type: uint16_t
2920    optional int32 attribute_id = 3;
2921    // Attribute value for the particular attribute
2922    optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
2923    // An identifier that can be used to match events for this device.
2924    // The incremental identifier is locally generated and guaranteed not derived
2925    // from any globally unique hardware id.
2926    // For paired devices, it stays consistent between Bluetooth toggling for the
2927    // same remote device.
2928    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2929    // session for the same remote device.
2930    // Default: 0 if the device's metric id is unknown.
2931    optional int32 metric_id = 5;
2932}
2933
2934/**
2935 * Logs when bond state of a Bluetooth device changes
2936 *
2937 * Logged from:
2938 *     frameworks/base/core/java/android/bluetooth/BluetoothDevice.java
2939 *     packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2940 */
2941message BluetoothBondStateChanged {
2942    // An identifier that can be used to match events for this device.
2943    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2944    // Salt: Randomly generated 256 bit value
2945    // Hash algorithm: HMAC-SHA256
2946    // Size: 32 byte
2947    // Default: null or empty if the device identifier is not known
2948    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2949    // Preferred transport type to remote dual mode device
2950    // Default: TRANSPORT_AUTO means no preference
2951    optional android.bluetooth.TransportTypeEnum transport = 2;
2952    // The type of this Bluetooth device (Classic, LE, or Dual mode)
2953    // Default: UNKNOWN
2954    optional android.bluetooth.DeviceTypeEnum type = 3;
2955    // Current bond state (NONE, BONDING, BONDED)
2956    // Default: BOND_STATE_UNKNOWN
2957    optional android.bluetooth.BondStateEnum bond_state = 4;
2958    // Bonding sub state
2959    // Default: BOND_SUB_STATE_UNKNOWN
2960    optional android.bluetooth.BondSubStateEnum bonding_sub_state = 5;
2961    // Unbond Reason
2962    // Default: UNBOND_REASON_UNKNOWN
2963    optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
2964    // An identifier that can be used to match events for this device.
2965    // The incremental identifier is locally generated and guaranteed not derived
2966    // from any globally unique hardware id.
2967    // For paired devices, it stays consistent between Bluetooth toggling for the
2968    // same remote device.
2969    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2970    // session for the same remote device.
2971    // Default: 0 if the device's metric id is unknown.
2972    optional int32 metric_id = 7;
2973}
2974
2975/**
2976 * Logs there is an event related Bluetooth classic pairing
2977 *
2978 * Logged from:
2979 *     system/bt
2980 */
2981message BluetoothClassicPairingEventReported {
2982    // An identifier that can be used to match events for this device.
2983    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2984    // Salt: Randomly generated 256 bit value
2985    // Hash algorithm: HMAC-SHA256
2986    // Size: 32 byte
2987    // Default: null or empty if the device identifier is not known
2988    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2989    // Connection handle of this connection if available
2990    // Range: 0x0000 - 0x0EFF (12 bits)
2991    // Default: 0xFFFF if the handle is unknown
2992    optional int32 connection_handle = 2;
2993    // HCI command associated with this event
2994    // Default: CMD_UNKNOWN
2995    optional android.bluetooth.hci.CommandEnum hci_cmd = 3;
2996    // HCI event associated with this event
2997    // Default: EVT_UNKNOWN
2998    optional android.bluetooth.hci.EventEnum hci_event = 4;
2999    // HCI command status code if this is triggerred by hci_cmd
3000    // Default: STATUS_UNKNOWN
3001    optional android.bluetooth.hci.StatusEnum cmd_status = 5;
3002    // HCI reason code associated with this event
3003    // Default: STATUS_UNKNOWN
3004    optional android.bluetooth.hci.StatusEnum reason_code = 6;
3005    // A status value related to this specific event
3006    // Default: 0
3007    optional int64 event_value = 7;
3008    // An identifier that can be used to match events for this device.
3009    // The incremental identifier is locally generated and guaranteed not derived
3010    // from any globally unique hardware id.
3011    // For paired devices, it stays consistent between Bluetooth toggling for the
3012    // same remote device.
3013    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3014    // session for the same remote device.
3015    // Default: 0 if the device's metric id is unknown.
3016    optional int32 metric_id = 8;
3017}
3018
3019/**
3020 * Logs when there is an event related to Bluetooth Security Manager Protocol (SMP)
3021 *
3022 * Logged from:
3023 *     system/bt
3024 */
3025message BluetoothSmpPairingEventReported {
3026    // An identifier that can be used to match events for this device.
3027    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3028    // Salt: Randomly generated 256 bit value
3029    // Hash algorithm: HMAC-SHA256
3030    // Size: 32 byte
3031    // Default: null or empty if the device identifier is not known
3032    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3033    // SMP command sent or received over L2CAP
3034    // Default: CMD_UNKNOWN
3035    optional android.bluetooth.smp.CommandEnum smp_command = 2;
3036    // Whether this command is sent or received
3037    // Default: DIRECTION_UNKNOWN
3038    optional android.bluetooth.DirectionEnum direction = 3;
3039    // SMP failure reason code
3040    // Default: PAIRING_FAIL_REASON_DEFAULT
3041    optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
3042    // An identifier that can be used to match events for this device.
3043    // The incremental identifier is locally generated and guaranteed not derived
3044    // from any globally unique hardware id.
3045    // For paired devices, it stays consistent between Bluetooth toggling for the
3046    // same remote device.
3047    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3048    // session for the same remote device.
3049    // Default: 0 if the device's metric id is unknown.
3050    optional int32 metric_id = 5;
3051}
3052
3053/**
3054 * Logs when a Bluetooth socket’s connection state changed
3055 *
3056 * Logged from:
3057 *   system/bt
3058 */
3059message BluetoothSocketConnectionStateChanged {
3060    // An identifier that can be used to match events for this device.
3061    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3062    // Salt: Randomly generated 256 bit value
3063    // Hash algorithm: HMAC-SHA256
3064    // Size: 32 byte
3065    // Default: null or empty if this is a server listener socket
3066    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3067    // Temporary port of this socket for the current connection or session only
3068    // Default 0 when unknown or don't care
3069    optional int32 port = 2;
3070    // Socket type as mentioned in
3071    // frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
3072    // Default: SOCKET_TYPE_UNKNOWN
3073    optional android.bluetooth.SocketTypeEnum type = 3;
3074    // Socket connection state
3075    // Default: SOCKET_CONNECTION_STATE_UNKNOWN
3076    optional android.bluetooth.SocketConnectionstateEnum state = 4;
3077    // Number of bytes sent to remote device during this connection
3078    optional int64 tx_bytes = 5;
3079    // Number of bytes received from remote device during this connection
3080    optional int64 rx_bytes = 6;
3081    // Socket owner's UID
3082    optional int32 uid = 7 [(is_uid) = true];
3083    // Server port of this socket, if any. When both |server_port| and |port| fields are populated,
3084    // |port| must be spawned by |server_port|
3085    // Default 0 when unknown or don't care
3086    optional int32 server_port = 8;
3087    // Whether this is a server listener socket
3088    optional android.bluetooth.SocketRoleEnum is_server = 9;
3089    // An identifier that can be used to match events for this device.
3090    // The incremental identifier is locally generated and guaranteed not derived
3091    // from any globally unique hardware id.
3092    // For paired devices, it stays consistent between Bluetooth toggling for the
3093    // same remote device.
3094    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3095    // session for the same remote device.
3096    // Default: 0 if the device's metric id is unknown.
3097    optional int32 metric_id = 10;
3098}
3099
3100/**
3101 * Logs when Class of Device (CoD) value is learnt for a device during pairing or connection
3102 *
3103 * Logged from:
3104 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
3105 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
3106 *
3107 */
3108message BluetoothClassOfDeviceReported {
3109    // An identifier that can be used to match events for this device.
3110    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3111    // Salt: Randomly generated 256 bit value
3112    // Hash algorithm: HMAC-SHA256
3113    // Size: 32 byte
3114    // Default: null or empty if this is a server listener socket
3115    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
3116    // Class of Device (CoD) value including both Major, Minor device class and service class
3117    // Defined in: https://www.bluetooth.com/specifications/assigned-numbers/baseband
3118    // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
3119    // Default: 0
3120    optional int32 class_of_device = 2;
3121    // An identifier that can be used to match events for this device.
3122    // The incremental identifier is locally generated and guaranteed not derived
3123    // from any globally unique hardware id.
3124    // For paired devices, it stays consistent between Bluetooth toggling for the
3125    // same remote device.
3126    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3127    // session for the same remote device.
3128    // Default: 0 if the device's metric id is unknown.
3129    optional int32 metric_id = 3;
3130}
3131
3132/**
3133 * Logs when there is a crash in hardware abstraction layer (HAL)
3134 *
3135 * Logged from:
3136 *   system/bt
3137 *
3138 */
3139message BluetoothHALCrashReasonReported {
3140    // An identifier that can be used to match events for this device.
3141    // The incremental identifier is locally generated and guaranteed not derived
3142    // from any globally unique hardware id.
3143    // For paired devices, it stays consistent between Bluetooth toggling for the
3144    // same remote device.
3145    // For unpaired devices, it stays consistent within the same Bluetooth adapter
3146    // session for the same remote device.
3147    // Default: 0 if the device's metric id is unknown.
3148    optional int32 metric_id = 1;
3149    // An identifier that can be used to match events for this device.
3150    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
3151    // Salt: Randomly generated 256 bit value
3152    // Hash algorithm: HMAC-SHA256
3153    // Size: 32 byte
3154    // Default: null or empty if the device identifier is not known
3155    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
3156    // Bluetooth HAL crash reason error code.
3157    // Original type: uint8_t
3158    // Default: 0x00 (DEFAULT)
3159    optional int32 error_code = 3;
3160    // Bluetooth HAL crash reason vendor error code.
3161    // Original type: uint8_t
3162    // Default: 0x00 (DEFAULT)
3163    optional int32 vendor_error_code = 4;
3164}
3165
3166/* Logs input device information when input device is registered with Android device.
3167 * Reported at when a new input device is found by EventHub.
3168 *
3169 * Logged from:
3170 *   frameworks/native/services/inputflinger
3171 */
3172message InputDeviceRegistered {
3173    // The Input Device Name
3174    optional string name = 1;
3175    // The Input Device Vendor ID
3176    optional int32 vendor_id = 2;
3177    // The Input Device Product ID
3178    optional int32 product_id = 3;
3179    // The Input Device Version ID
3180    optional int32 version_id = 4;
3181    // The Input Device Bus ID
3182    optional int32 bus_id = 5;
3183    // The Input Device identifier generated from kernel device.
3184    // Hash algorithm: HMAC-SHA256
3185    optional string obfuscated_id = 6;
3186    // The Input Device Classes
3187    optional int32 device_classes = 7;
3188}
3189
3190/**
3191 * Logs when something is plugged into or removed from the USB-C connector.
3192 *
3193 * Logged from:
3194 *  UsbService
3195 */
3196message UsbConnectorStateChanged {
3197    enum State {
3198        STATE_DISCONNECTED = 0;
3199        STATE_CONNECTED = 1;
3200    }
3201    optional State state = 1
3202            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
3203    optional string id = 2 [(state_field_option).primary_field = true];
3204    // Last active session in ms.
3205    // 0 when the port is in connected state.
3206    optional int64 last_connect_duration_millis = 3;
3207}
3208
3209/**
3210 * Logs the reported speaker impedance.
3211 *
3212 * Logged from:
3213 *  Vendor audio implementation.
3214 */
3215message SpeakerImpedanceReported {
3216    optional int32 speaker_location = 1;
3217    optional int32 impedance = 2;
3218}
3219
3220/**
3221 * Logs the report of a failed hardware.
3222 *
3223 * Logged from:
3224 *  Vendor HALs.
3225 *
3226 */
3227message HardwareFailed {
3228    enum HardwareType {
3229        HARDWARE_FAILED_UNKNOWN = 0;
3230        HARDWARE_FAILED_MICROPHONE = 1;
3231        HARDWARE_FAILED_CODEC = 2;
3232        HARDWARE_FAILED_SPEAKER = 3;
3233        HARDWARE_FAILED_FINGERPRINT = 4;
3234    }
3235    optional HardwareType hardware_type = 1;
3236
3237   /**
3238    * hardware_location allows vendors to differentiate between multiple instances of
3239    * the same hardware_type.  The specific locations are vendor defined integers,
3240    * referring to board-specific numbering schemes.
3241    */
3242    optional int32 hardware_location = 2;
3243
3244    /**
3245     * failure_code is specific to the HardwareType of the failed hardware.
3246     * It should use one of the enum values defined below.
3247     */
3248    enum HardwareErrorCode {
3249        UNKNOWN = 0;
3250        COMPLETE = 1;
3251        SPEAKER_HIGH_Z = 2;
3252        SPEAKER_SHORT = 3;
3253        FINGERPRINT_SENSOR_BROKEN = 4;
3254        FINGERPRINT_TOO_MANY_DEAD_PIXELS = 5;
3255        DEGRADE = 6;
3256    }
3257    optional int32 failure_code = 3;
3258}
3259
3260/**
3261 * Log an event when the device has been physically dropped.
3262 * Reported from the /vendor partition.
3263 */
3264message PhysicalDropDetected {
3265    // Confidence that the event was actually a drop, 0 -> 100
3266    optional int32 confidence_pctg = 1;
3267    // Peak acceleration of the drop, in 1/1000s of a g.
3268    optional int32 accel_peak_thousandths_g = 2;
3269    // Duration of freefall in ms
3270    optional int32 freefall_time_millis = 3;
3271}
3272
3273/**
3274 * Log bucketed battery charge cycles.
3275 *
3276 * Each bucket represents cycles of the battery past
3277 * a given charge point.  For example, if 10 cycle buckets are
3278 * initialized, bucket 1 is the lowest 1/10th of the battery,
3279 * and bucket 10 is 100%.
3280 *
3281 * Logged from:
3282 * /sys/class/power_supply/bms/cycle_count, via Vendor.
3283 */
3284message ChargeCyclesReported {
3285    optional int32 cycle_bucket_1 = 1;
3286    optional int32 cycle_bucket_2 = 2;
3287    optional int32 cycle_bucket_3 = 3;
3288    optional int32 cycle_bucket_4 = 4;
3289    optional int32 cycle_bucket_5 = 5;
3290    optional int32 cycle_bucket_6 = 6;
3291    optional int32 cycle_bucket_7 = 7;
3292    optional int32 cycle_bucket_8 = 8;
3293    optional int32 cycle_bucket_9 = 9;
3294    optional int32 cycle_bucket_10 = 10;
3295}
3296
3297/**
3298 * Log battery health snapshot.
3299 *
3300 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
3301 * are snapshotted periodically over 24hrs.
3302 */
3303message BatteryHealthSnapshot {
3304    enum BatterySnapshotType {
3305        UNKNOWN = 0;
3306        MIN_TEMP = 1;         // Snapshot at min batt temp over 24hrs.
3307        MAX_TEMP = 2;         // Snapshot at max batt temp over 24hrs.
3308        MIN_RESISTANCE = 3;   // Snapshot at min batt resistance over 24hrs.
3309        MAX_RESISTANCE = 4;   // Snapshot at max batt resistance over 24hrs.
3310        MIN_VOLTAGE = 5;      // Snapshot at min batt voltage over 24hrs.
3311        MAX_VOLTAGE = 6;      // Snapshot at max batt voltage over 24hrs.
3312        MIN_CURRENT = 7;      // Snapshot at min batt current over 24hrs.
3313        MAX_CURRENT = 8;      // Snapshot at max batt current over 24hrs.
3314        MIN_BATT_LEVEL = 9;   // Snapshot at min battery level (SoC) over 24hrs.
3315        MAX_BATT_LEVEL = 10;  // Snapshot at max battery level (SoC) over 24hrs.
3316        AVG_RESISTANCE = 11;  // Snapshot at average battery resistance over 24hrs.
3317    }
3318    optional BatterySnapshotType type = 1;
3319    // Temperature, in 1/10ths of degree C.
3320    optional int32 temperature_deci_celsius = 2;
3321    // Voltage Battery Voltage, in microVolts.
3322    optional int32 voltage_micro_volt = 3;
3323    // Current Battery current, in microAmps.
3324    optional int32 current_micro_amps = 4;
3325    // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
3326    optional int32 open_circuit_micro_volt = 5;
3327    // Resistance Battery Resistance, in microOhms.
3328    optional int32 resistance_micro_ohm = 6;
3329    // Level Battery Level, as % of full.
3330    optional int32 level_percent = 7;
3331}
3332
3333/**
3334 * Log slow I/O operations on the primary storage.
3335 */
3336message SlowIo {
3337    // Classifications of IO Operations.
3338    enum IoOperation {
3339        UNKNOWN = 0;
3340        READ = 1;
3341        WRITE = 2;
3342        UNMAP = 3;
3343        SYNC = 4;
3344    }
3345    optional IoOperation operation = 1;
3346
3347    // The number of slow IO operations of this type over 24 hours.
3348    optional int32 count = 2;
3349}
3350
3351/**
3352 * Log battery caused shutdown with the last recorded voltage.
3353 */
3354message BatteryCausedShutdown {
3355    // The last recorded battery voltage prior to shutdown.
3356    optional int32 last_recorded_micro_volt = 1;
3357}
3358
3359/**
3360 * Logs when ThermalService receives throttling events.
3361 *
3362 * Logged from:
3363 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
3364 */
3365message ThermalThrottlingSeverityStateChanged {
3366    // The type of temperature being reported (CPU, GPU, SKIN, etc)
3367    optional android.os.TemperatureTypeEnum sensor_type = 1;
3368
3369    // The name of the temperature source. Eg. CPU0
3370    optional string sensor_name = 2;
3371
3372    // Temperature in tenths of a degree C.
3373    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
3374    optional int32 temperature_deci_celsius = 3;
3375
3376    // Relative severity of the throttling, see enum definition.
3377    optional android.os.ThrottlingSeverityEnum severity = 4;
3378}
3379
3380/**
3381 * Logs the duration of a davey (jank of >=700ms) when it occurs
3382 *
3383 * Logged from:
3384 *   frameworks/base/libs/hwui/JankTracker.cpp
3385 */
3386message DaveyOccurred {
3387    // The UID that logged this atom.
3388    optional int32 uid = 1 [(is_uid) = true];
3389
3390    // Amount of time it took to render the frame. Should be >=700ms.
3391    optional int64 jank_duration_millis = 2;
3392}
3393
3394/**
3395 * Logs phone signal strength changes.
3396 *
3397 * Logged from:
3398 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3399 */
3400message PhoneSignalStrengthChanged {
3401    // Signal strength, from frameworks/proto_logging/stats/enums/telephony/enums.proto.
3402    optional android.telephony.SignalStrengthEnum signal_strength = 1;
3403}
3404
3405
3406/**
3407 * Logs when the phone state, sim state or signal strength changes
3408 *
3409 * Logged from:
3410 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3411 */
3412message PhoneServiceStateChanged {
3413    optional android.telephony.ServiceStateEnum state = 1;
3414    optional android.telephony.SimStateEnum sim_state = 2;
3415    optional android.telephony.SignalStrengthEnum signal_strength = 3;
3416}
3417
3418/**
3419 * Logs when the phone becomes on or off.
3420 *
3421 * Logged from:
3422 *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
3423 */
3424message PhoneStateChanged {
3425    enum State {
3426        OFF = 0;
3427        ON = 1;
3428    }
3429    optional State state = 1;
3430}
3431
3432message BackGesture {
3433    enum BackType {
3434        DEFAULT_BACK_TYPE = 0;
3435        COMPLETED = 1;
3436        COMPLETED_REJECTED = 2; // successful because coming from rejected area
3437        INCOMPLETE_EXCLUDED = 3; // would have been successful but in the exclusion area
3438        INCOMPLETE = 4;  // Unsuccessful, for reasons other than below.
3439        INCOMPLETE_FAR_FROM_EDGE = 5;  // Unsuccessful, far from the edge.
3440        INCOMPLETE_MULTI_TOUCH = 6;  // Unsuccessful, multi touch.
3441        INCOMPLETE_LONG_PRESS = 7;  // Unsuccessful, long press.
3442        INCOMPLETE_VERTICAL_MOVE = 8;  // Unsuccessful, move vertically.
3443    }
3444    optional BackType type = 1;
3445
3446    optional int32 y_coordinate = 2 [deprecated = true]; // y coordinate for ACTION_DOWN event
3447    optional int32 start_x = 4;  // X coordinate for ACTION_DOWN event.
3448    optional int32 start_y = 5;  // Y coordinate for ACTION_DOWN event.
3449    optional int32 end_x = 6;   // X coordinate for ACTION_MOVE event.
3450    optional int32 end_y = 7;  // Y coordinate for ACTION_MOVE event.
3451    optional int32 left_boundary = 8;  // left edge width + left inset
3452    optional int32 right_boundary = 9;  // screen width - (right edge width + right inset)
3453    // The score between 0 and 1 which is the prediction output for the Back Gesture model.
3454    optional float ml_model_score = 10;
3455    optional string package_name = 11;  // The name of the top 100 most used package by all users.
3456
3457    enum WindowHorizontalLocation {
3458        DEFAULT_LOCATION = 0;
3459        LEFT = 1;
3460        RIGHT = 2;
3461    }
3462    optional WindowHorizontalLocation x_location = 3 [deprecated = true];
3463}
3464
3465message ExclusionRectStateChanged {
3466    optional string component_name = 1;    // if not available, simply packageName
3467    optional int32 requested_height = 2;   // px
3468    optional int32 rejected_height = 3;    // px
3469
3470    enum WindowHorizontalLocation {
3471        DEFAULT_LOCATION = 0;
3472        LEFT = 1;
3473        RIGHT = 2;
3474    }
3475    optional WindowHorizontalLocation x_location = 4;
3476    optional bool landscape = 5;
3477    optional bool splitscreen = 6;
3478    optional int32 duration_millis = 7;
3479}
3480
3481/**
3482 * Logs when IME is on.
3483 *
3484 * Logged from: /packages/SystemUI/src/com/android/systemui/
3485                statusbar/phone/NavigationBarView.java
3486 *
3487 */
3488message ImeTouchReported {
3489    optional int32 x_coordinate = 1;  // X coordinate for ACTION_DOWN event.
3490    optional int32 y_coordinate = 2;  // Y coordinate for ACTION_DOWN event.
3491}
3492
3493/**
3494 * Logs when Launcher (HomeScreen) UI has changed or was interacted.
3495 *
3496 * Logged from:
3497 *   packages/apps/Launcher3
3498 */
3499message LauncherUIChanged {
3500    optional android.stats.launcher.LauncherAction action = 1 [deprecated = true];
3501    optional android.stats.launcher.LauncherState src_state = 2;
3502    optional android.stats.launcher.LauncherState dst_state = 3;
3503    optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES, deprecated = true];
3504    optional bool is_swipe_up_enabled = 5 [deprecated = true];
3505
3506    // The event id (e.g., app launch, drag and drop, long press)
3507    optional int32 event_id = 6;
3508    // The event's source or target id (e.g., icon, task, button)
3509    optional int32 target_id = 7;
3510    // If the target needs to be tracked, use this id field
3511    optional int32 instance_id = 8;
3512    optional int32 uid = 9 [(is_uid) = true];
3513    optional string package_name = 10;
3514    optional string component_name = 11;
3515
3516    // (x, y) coordinate and the index information of the target on the container
3517    optional int32 grid_x = 12 [default = -1];
3518    optional int32 grid_y = 13 [default = -1];
3519    optional int32 page_id = 14 [default = -2];
3520
3521    // e.g., folder icon's (x, y) location and index information on the workspace
3522    optional int32 grid_x_parent = 15 [default = -1];
3523    optional int32 grid_y_parent = 16 [default = -1];
3524    optional int32 page_id_parent = 17 [default = -2];
3525
3526    // e.g., SEARCHBOX_ALLAPPS, FOLDER_WORKSPACE
3527    optional int32 hierarchy = 18;
3528
3529    optional bool is_work_profile = 19;
3530
3531    // Used to store the predicted rank of the target
3532    optional int32 rank = 20 [default = -1];
3533
3534    // e.g., folderLabelState can be captured in the following two fields
3535    optional int32 from_state = 21;
3536    optional int32 to_state = 22;
3537
3538    // e.g., autofilled or suggested texts that are not user entered
3539    optional string edittext = 23;
3540
3541    // e.g., number of contents inside a container (e.g., icons inside a folder)
3542    optional int32 cardinality = 24;
3543
3544    // Used to store features of the target (e.g. widget is reconfigurable, etc)
3545    optional int32 features = 25;
3546}
3547
3548message SmartSpaceCardReported {
3549    // Different SmartSpace cards.
3550    enum CardType {
3551        UNKNOWN_CARD = 0;
3552        COMMUTE = 1;
3553        CALENDAR = 2;
3554        FLIGHT = 3;
3555        WEATHER = 4;
3556        WEATHER_ALERT = 5;
3557        AT_A_STORE_SHOPPING_LIST = 6;
3558        AT_A_STORE_LOYALTY_CARD = 7;
3559        HEADPHONE_RESUME_MEDIA = 8;
3560        HEADPHONE_MEDIA_RECOMMENDATIONS = 9;
3561        TIMER = 10;
3562        STOPWATCH = 11;
3563        FITNESS_ACTIVITY = 12;
3564        UPCOMING_REMINDER = 13;
3565        UPCOMING_BEDTIME = 14;
3566        TIME_TO_LEAVE = 15;
3567        PACKAGE_DELIVERED = 16;
3568        TIPS = 17;
3569    }
3570
3571    // The surface that SmartSpace card is shown.
3572    enum DisplaySurface {
3573        DEFAULT_SURFACE = 0;
3574        HOMESCREEN = 1;
3575        LOCKSCREEN = 2;
3576        AOD = 3;
3577        SHADE = 4;
3578    }
3579
3580    // The event id (e.g., impression, click, longpress, dismiss)
3581    optional int32 event_id = 1;
3582    // Uniquely identifies a card. Should persist through updates.
3583    optional int32 instance_id = 2;
3584    // Uniquely identifies one of the possible types of the SmartSpace cards.
3585    optional CardType card_type = 3;
3586    // Location of the card when the event occurred.
3587    optional DisplaySurface display_surface = 4;
3588    // The position of the card in the carousel when the event occurred.
3589    optional int32 rank = 5;
3590    // The number of cards shown to the user.
3591    optional int32 cardinality = 6;
3592}
3593
3594/**
3595 * Used for snapshot of the HomeScreen UI elements
3596 *
3597 * Logged from:
3598 *   packages/apps/Launcher3
3599 */
3600message LauncherStaticLayout {
3601    // The event id (e.g., snapshot, drag and drop)
3602    optional int32 event_id = 1;
3603    // The event's source or target id (e.g., icon, shortcut, widget)
3604    optional int32 target_id = 2;
3605    // If the target needs to be tracked, use this id field
3606    optional int32 instance_id = 3;
3607    optional int32 uid = 4 [(is_uid) = true];
3608    optional string package_name = 5;
3609    optional string component_name = 6;
3610
3611    // (x, y) coordinate and the index information of the target on the container
3612    optional int32 grid_x = 7 [default = -1];
3613    optional int32 grid_y = 8 [default = -1];
3614    optional int32 page_id = 9 [default = -2];
3615
3616    // e.g., folder icon's (x, y) location and index information on the workspace
3617    // e.g., when used with widgets target, use these values for (span_x, span_y)
3618    optional int32 grid_x_parent = 10 [default = -1];
3619    optional int32 grid_y_parent = 11 [default = -1];
3620    optional int32 page_id_parent = 12 [default = -2];
3621
3622    // UNKNOWN = 0
3623    // HOTSEAT = 1
3624    // WORKSPACE = 2
3625    // FOLDER_HOTSEAT = 3
3626    // FOLDER_WORKSPACE = 4
3627    optional int32 hierarchy = 13;
3628
3629    optional bool is_work_profile = 14;
3630
3631    // e.g., PIN, WIDGET TRAY, APPS TRAY, PREDICTION
3632    optional int32 origin = 15;
3633
3634    // e.g., number of icons inside a folder
3635    optional int32 cardinality = 16;
3636
3637    // e.g., (x, y) span of the widget inside homescreen grid system
3638    optional int32 span_x = 17 [default = 1];
3639    optional int32 span_y = 18 [default = 1];
3640
3641    // Used to store features of the target (e.g. widget is reconfigurable, etc)
3642    optional int32 features = 19;
3643}
3644
3645/**
3646 * Logs when Wallpaper or ThemePicker UI has changed.
3647 *
3648 * Logged from:
3649 *   packages/apps/ThemePicker
3650 *   packages/apps/WallpaperPicker2
3651 */
3652message StyleUIChanged {
3653    optional android.stats.style.Action action = 1;
3654    optional int32 color_package_hash = 2;
3655    optional int32 font_package_hash  = 3;
3656    optional int32 shape_package_hash = 4;
3657    optional int32 clock_package_hash = 5;
3658    optional int32 launcher_grid = 6;
3659    optional int32 wallpaper_category_hash = 7;
3660    optional int32 wallpaper_id_hash = 8;
3661    optional int32 color_preference = 9;
3662    optional android.stats.style.LocationPreference location_preference = 10;
3663    optional android.stats.style.DatePreference date_preference = 11;
3664    optional android.stats.style.LaunchedPreference launched_preference = 12;
3665}
3666
3667/**
3668 * Logs when Settings UI has changed.
3669 *
3670 * Logged from:
3671 *   packages/apps/Settings
3672 */
3673message SettingsUIChanged {
3674    /**
3675     * Where this SettingsUIChange event comes from. For example, if
3676     * it's a PAGE_VISIBLE event, where the page is opened from.
3677     */
3678    optional android.app.settings.PageId attribution = 1;
3679
3680    /**
3681     * What the UI action is.
3682     */
3683    optional android.app.settings.Action action = 2;
3684
3685    /**
3686     * Where the action is happening
3687     */
3688    optional android.app.settings.PageId page_id = 3;
3689
3690    /**
3691     * What preference changed in this event.
3692     */
3693    optional string changed_preference_key = 4;
3694
3695    /**
3696     * The new value of the changed preference.
3697     */
3698    optional int64 changed_preference_int_value = 5;
3699}
3700
3701/**
3702 * Logs basic timing information about touch events.
3703 * Reported at most every 5 minutes while device is being interacted with.
3704 *
3705 * Logged from:
3706 *   frameworks/native/services/inputflinger
3707 */
3708message TouchEventReported {
3709    /**
3710     * The fields latency_{min|max|mean|stdev} represent minimum, maximum, mean,
3711     * and the standard deviation of the time spent processing touchscreen events
3712     * in the kernel and inputflinger. The units are microseconds.
3713     *
3714     * On supported devices, the starting point is taken during the hard interrupt inside the
3715     * kernel touch driver. On all other devices, the starting point is taken inside
3716     * the kernel's input event subsystem upon receipt of the input event.
3717     * The ending point is taken inside InputDispatcher, just after the input event
3718     * is sent to the app.
3719     */
3720    // Minimum value
3721    optional float latency_min_micros = 1;
3722    // Maximum value
3723    optional float latency_max_micros = 2;
3724    // Average value
3725    optional float latency_mean_micros = 3;
3726    // Standard deviation
3727    optional float latency_stdev_micros = 4;
3728    // Number of touch events (input_event) in this report
3729    optional int32 count = 5;
3730}
3731
3732/**
3733 * Logs slow input events.
3734 * The reports are rate-limited via a configurable server flag.
3735 *
3736 * Logged from:
3737 *   frameworks/native/services/inputflinger
3738 */
3739message SlowInputEventReported {
3740    /**
3741     * This is logged when a slow input event occurs. The threshold for what is considered a slow
3742     * event is applied to the 'end_to_end' latency number, and is configurable via a server flag.
3743     *
3744     * The goal of this data is to identify the bottlenecks in processing of input events.
3745     * All of the *_micros fields below are durations. The start and end points for each value
3746     * are described in the comments.
3747     */
3748    // Whether or not this is a DOWN event. If false, this is a MOVE event
3749    optional bool is_down = 1;
3750    // Start: the input event was created (touch events: the touch interrupt received in the driver)
3751    // End: the event was read in userspace (in EventHub)
3752    optional int32 event_to_read_micros = 2;
3753    // Start: the event was read in EventHub
3754    // End: the event was send to the app via the InputChannel (written to the socket)
3755    optional int32 read_to_deliver_micros = 3;
3756    // Start: the input event was sent to the app
3757    // End: the app consumed the input event
3758    optional int32 deliver_to_consume_micros = 4;
3759    // Start: the app consumed the event
3760    // End: the app's 'finishInputEvent' call was received in inputflinger
3761    // The end point can also be called "the app finished processing input event"
3762    optional int32 consume_to_finish_micros = 5;
3763    // Start: the app consumed the input event
3764    // End: the app produced a buffer
3765    optional int32 consume_to_gpu_complete_micros = 6;
3766    // Start: the app produced a buffer
3767    // End: the frame was shown on the display
3768    optional int32 gpu_complete_to_present_micros = 7;
3769    // The end-to-end touch latency
3770    // Start: the input event was created (touch events: the touch interrupt received in the driver)
3771    // End: the frame was presented on the display
3772    optional int32 end_to_end_micros = 8;
3773    // Since the last time this atom was reported, how many total events occurred?
3774    optional int32 num_events_since_last_report = 9;
3775    // Since the last time this atom was reported, how many slow events did not get reported
3776    // due to rate limiting?
3777    optional int32 num_skipped_slow_events_since_last_report = 10;
3778}
3779
3780/**
3781 * Logs gesture classification and timing information for touch events.
3782 *
3783 * Logged from:
3784 *   frameworks/base/core/java/android/view/GestureDetector.java
3785 *   frameworks/base/core/java/android/view/View.java
3786 */
3787message TouchGestureClassified {
3788    // The source of the classification (e.g. Java class name).
3789    optional string source = 1;
3790
3791    enum Classification {
3792        UNKNOWN_CLASSIFICATION = 0;
3793        SINGLE_TAP = 1;
3794        DOUBLE_TAP = 2;
3795        LONG_PRESS = 3;
3796        DEEP_PRESS = 4;
3797        SCROLL = 5;
3798    }
3799    // The classification of the gesture.
3800    optional Classification classification = 2;
3801
3802    // The interval from the start of a touch event stream until the
3803    // classification was made.
3804    optional int32 latency_millis = 3;
3805
3806    // The distance from the location of the first touch event to the
3807    // location of the touch event when the classification was made.
3808    optional float displacement_px = 4;
3809}
3810
3811/**
3812 * Logs that a setting was updated.
3813 * Logged from:
3814 *   frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
3815 * The tag and is_default allow resetting of settings to default values based on the specified
3816 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
3817 */
3818message SettingChanged {
3819    // The name of the setting.
3820    optional string setting = 1;
3821
3822    // The change being imposed on this setting. May represent a number, eg "3".
3823    optional string value = 2;
3824
3825    // The new value of this setting. For most settings, this is same as value. For some settings,
3826    // value is +X or -X where X represents an element in a set. For example, if the previous value
3827    // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
3828    // The +/- feature is currently only used for location_providers_allowed.
3829    optional string new_value = 3;
3830
3831    // The previous value of this setting.
3832    optional string prev_value = 4;
3833
3834    // The tag used with the is_default for resetting sets of settings. This is generally null.
3835    optional string tag = 5;
3836
3837    // True if this setting with tag should be resettable.
3838    optional bool is_default = 6;
3839
3840    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
3841    optional int32 user = 7;
3842
3843    enum ChangeReason {
3844        UPDATED = 1; // Updated can be an insertion or an update.
3845        DELETED = 2;
3846    }
3847    optional ChangeReason reason = 8;
3848}
3849
3850/**
3851 * Logs activity going to foreground or background
3852 *
3853 * Logged from:
3854  *   frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
3855 */
3856message ActivityForegroundStateChanged {
3857    optional int32 uid = 1 [(is_uid) = true];
3858    optional string pkg_name = 2;
3859    optional string class_name = 3;
3860
3861    enum State {
3862        BACKGROUND = 0;
3863        FOREGROUND = 1;
3864    }
3865    optional State state = 4;
3866}
3867
3868/**
3869 * Logs when a volume entered low Storage state.
3870 * Logged from:
3871 *      frameworks/base/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
3872 */
3873message LowStorageStateChanged {
3874    // Volume that ran out of storage.
3875    optional string volume_description = 1;
3876
3877    enum State {
3878        UNKNOWN = 0;
3879        OFF = 1;
3880        ON = 2;
3881    }
3882    optional State state = 2;
3883}
3884
3885/**
3886 * Logs when an app is downgraded.
3887 * Logged from:
3888 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
3889 */
3890message AppDowngraded {
3891    optional string package_name = 1;
3892    // Size of the package (all data) before being downgraded.
3893    optional int64 size_in_bytes_before = 2;
3894    // Size of the package (all data) after being downgraded.
3895    optional int64 size_in_bytes_after = 3;
3896
3897    optional bool aggressive = 4;
3898}
3899
3900/**
3901 * Logs when an app is optimized after being downgraded.
3902 * Logged from:
3903 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
3904 */
3905message AppOptimizedAfterDowngraded {
3906    optional string package_name = 1;
3907}
3908
3909/**
3910 * Logs whenever an app is installed on external storage.
3911 * Logged from:
3912        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
3913 */
3914message AppInstallOnExternalStorageReported {
3915    // The type of external storage.
3916    optional android.stats.storage.ExternalStorageType storage_type = 1;
3917    // The name of the package that is installed on the sd card.
3918    optional string package_name = 2;
3919}
3920
3921/**
3922 * Logs when an app crashes.
3923 * Logged from:
3924 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3925 */
3926message AppCrashOccurred {
3927    optional int32 uid = 1 [(is_uid) = true];
3928
3929    optional string event_type = 2;
3930
3931    // The name of the process.
3932    // system_server if it is not by an app
3933    optional string process_name = 3;
3934
3935    // The pid if available. -1 means not available.
3936    optional int32 pid = 4;
3937
3938    optional string package_name = 5;
3939
3940    enum InstantApp {
3941        UNAVAILABLE = 0;
3942        FALSE = 1;
3943        TRUE = 2;
3944    }
3945    optional InstantApp is_instant_app = 6;
3946
3947    enum ForegroundState {
3948        UNKNOWN = 0;
3949        BACKGROUND = 1;
3950        FOREGROUND = 2;
3951    }
3952    optional ForegroundState foreground_state = 7;
3953
3954    optional android.server.ErrorSource error_source = 8;
3955
3956    optional bool is_incremental = 9;
3957
3958    optional float loading_progress = 10;
3959
3960    optional int64 millis_since_oldest_pending_read = 11;
3961
3962    // Status code to represent the health of the file system backing storage, as defined in
3963    // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
3964    // Value -1 if the app is not installed on Incremental
3965    optional int32 storage_health_code = 12;
3966
3967    // Status code to represent the status of data loader, as defined in
3968    // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
3969    // Value -1 if the app is not installed on Incremental
3970    optional int32 data_loader_status_code = 13;
3971
3972    // Whether read logs collection is enabled
3973    optional bool read_logs_enabled = 14;
3974
3975    // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
3976    // -1 means the app is not installed on Incremental.
3977    optional int64 millis_since_last_data_loader_bind = 15;
3978
3979    // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
3980    optional int64 data_loader_bind_delay_millis = 16;
3981
3982    // Total count of delayed reads, as reported by Incremental File System.
3983    optional int32 total_delayed_reads = 17;
3984
3985    // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
3986    optional int32 total_failed_reads = 18;
3987
3988    // UID of the process that tried to read a page from the app but failed.
3989    // This shows whether the read was initiated by the system, the app itself, or some other apps.
3990    // -1 means there was no read error or the app is not installed on Incremental.
3991    optional int32 last_read_error_uid = 19;
3992
3993    // Duration since that last read failure.
3994    // -1 means there was no read error or the app is not installed on Incremental.
3995    optional int64 last_read_error_millis_since = 20;
3996
3997    // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
3998    // and other positive values for other errors. -1 means app is not installed on Incremental.
3999    optional int32 last_read_error_code = 21;
4000
4001    // Total duration of delayed reads in milliseconds
4002    optional int64 total_delayed_reads_duration_millis = 22;
4003}
4004
4005/**
4006 * Logs when a WTF (What a Terrible Failure) happened.
4007 * Logged from:
4008 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4009 */
4010message WTFOccurred {
4011    optional int32 uid = 1 [(is_uid) = true];
4012
4013    optional string tag = 2;
4014
4015    // The name of the process.
4016    // system_server if it is not by an app
4017    optional string process_name = 3;
4018
4019    // The pid if available. -1 means not available.
4020    optional int32 pid = 4;
4021
4022    optional android.server.ErrorSource error_source = 5;
4023}
4024
4025/**
4026 * Logs when system server reports low memory.
4027 * Logged from:
4028 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4029 */
4030message LowMemReported {
4031}
4032
4033/**
4034 * Logs when an app ANR (App Not Responding) occurs.
4035 * Logged from:
4036 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
4037 */
4038message ANROccurred {
4039    optional int32 uid = 1 [(is_uid) = true];
4040
4041    optional string process_name = 2;
4042
4043    optional string short_component_name = 3;
4044
4045    optional string reason = 4;
4046
4047    enum InstantApp {
4048        UNAVAILABLE = 0;
4049        FALSE = 1;
4050        TRUE = 2;
4051    }
4052    optional InstantApp is_instant_app = 5;
4053
4054    enum ForegroundState {
4055        UNKNOWN = 0;
4056        BACKGROUND = 1;
4057        FOREGROUND = 2;
4058    }
4059    optional ForegroundState foreground_state = 6;
4060
4061    optional android.server.ErrorSource error_source = 7;
4062
4063    optional string package_name = 8;
4064
4065    optional bool is_incremental = 9;
4066
4067    optional float loading_progress = 10;
4068
4069    optional int64 millis_since_oldest_pending_read = 11;
4070
4071    // Status code to represent the health of the file system backing storage, as defined in
4072    // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
4073    // Value -1 if the app is not installed on Incremental
4074    optional int32 storage_health_code = 12;
4075
4076    // Status code to represent the status of data loader, as defined in
4077    // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
4078    // Value -1 if the app is not installed on Incremental
4079    optional int32 data_loader_status_code = 13;
4080
4081    // Whether read logs collection is enabled
4082    optional bool read_logs_enabled = 14;
4083
4084    // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
4085    // -1 means the app is not installed on Incremental.
4086    optional int64 millis_since_last_data_loader_bind = 15;
4087
4088    // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
4089    optional int64 data_loader_bind_delay_millis = 16;
4090
4091    // Total count of delayed reads, as reported by Incremental File System.
4092    optional int32 total_delayed_reads = 17;
4093
4094    // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
4095    optional int32 total_failed_reads = 18;
4096
4097    // UID of the process that tried to read a page from the app but failed.
4098    // This shows whether the read was initiated by the system, the app itself, or some other apps.
4099    // -1 means there was no read error or the app is not installed on Incremental.
4100    optional int32 last_read_error_uid = 19;
4101
4102    // Duration since that last read failure.
4103    // -1 means there was no read error or the app is not installed on Incremental.
4104    optional int64 last_read_error_millis_since = 20;
4105
4106    // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
4107    // and other positive values for other errors. -1 means app is not installed on Incremental.
4108    optional int32 last_read_error_code = 21;
4109
4110    // Total duration of delayed reads in milliseconds
4111    optional int64 total_delayed_reads_duration_millis = 22;
4112}
4113
4114/**
4115 * Logs immediately after an app ANR (App Not Responding) occurs. In contrast, ANROccurred (the
4116 * atom above) logs some time (not necessarily immediately) after the ANR is detected.
4117 * Logged from:
4118 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
4119 */
4120message ANROccurredProcessingStarted {
4121  optional string process_name = 1;
4122}
4123
4124/**
4125 * Logs when the vibrator state changes.
4126 * Logged from:
4127 *      frameworks/base/services/core/java/com/android/server/VibratorService.java
4128 */
4129message VibratorStateChanged {
4130    repeated AttributionNode attribution_node = 1;
4131
4132    enum State {
4133        OFF = 0;
4134        ON = 1;
4135    }
4136    optional State state = 2;
4137
4138    // Duration (in milliseconds) requested to keep the vibrator on.
4139    // Only applicable for State == ON.
4140    optional int64 duration_millis = 3;
4141}
4142
4143/*
4144 * Allows other apps to push events into statsd.
4145 * Logged from:
4146 *      frameworks/base/core/java/android/util/StatsLog.java
4147 */
4148message AppBreadcrumbReported {
4149    // The uid of the application that sent this custom atom.
4150    optional int32 uid = 1 [(is_uid) = true];
4151
4152    // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
4153    optional int32 label = 2;
4154
4155    // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
4156    // predicates for the metrics).
4157    enum State {
4158        UNKNOWN = 0;
4159        UNSPECIFIED = 1;  // For events that are known to not represent START/STOP.
4160        STOP = 2;
4161        START = 3;
4162    }
4163    optional State state = 3;
4164}
4165
4166/**
4167 * Logs the wall-clock time when a significant wall-clock time shift occurs.
4168 * For example, this could be due to the user manually changing the time.
4169 *
4170 * Logged from:
4171 *   frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
4172 */
4173message WallClockTimeShifted {
4174    // New wall-clock time in milliseconds, according to System.currentTimeMillis().
4175    optional int64 wall_clock_timestamp_millis = 1;
4176}
4177
4178/**
4179 * Logs when statsd detects an anomaly.
4180 *
4181 * Logged from:
4182 *   frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
4183 */
4184message AnomalyDetected {
4185    // Uid that owns the config whose anomaly detection alert fired.
4186    optional int32 config_uid = 1 [(is_uid) = true];
4187
4188    // Id of the config whose anomaly detection alert fired.
4189    optional int64 config_id = 2;
4190
4191    // Id of the alert (i.e. name of the anomaly that was detected).
4192    optional int64 alert_id = 3;
4193}
4194
4195message AppStartOccurred {
4196    // The uid if available. -1 means not available.
4197    optional int32 uid = 1 [(is_uid) = true];
4198
4199    // The app package name.
4200    optional string pkg_name = 2;
4201
4202    enum TransitionType {
4203        UNKNOWN = 0;
4204        WARM = 1;
4205        HOT = 2;
4206        COLD = 3;
4207        RELAUNCH = 4;
4208    }
4209    // The transition type.
4210    optional TransitionType type = 3;
4211
4212    // The activity name.
4213    optional string activity_name = 4;
4214
4215    // The name of the calling app. Empty if not set.
4216    optional string calling_pkg_name = 5;
4217
4218    // Whether the app is an instant app.
4219    optional bool is_instant_app = 6;
4220
4221    // Device uptime when activity started. Deprecated: use activity_start_timestamp_millis instead.
4222    optional int64 activity_start_millis = 7 [deprecated = true];
4223
4224    optional android.app.AppTransitionReasonEnum reason = 8;
4225
4226    optional int32 transition_delay_millis = 9;
4227    // -1 if not set.
4228    optional int32 starting_window_delay_millis = 10;
4229    // -1 if not set.
4230    optional int32 bind_application_delay_millis = 11;
4231    optional int32 windows_drawn_delay_millis = 12;
4232
4233    // Empty if not set.
4234    optional string launch_token = 13;
4235
4236    // The reason why the package was optimized.
4237    optional int32 package_optimization_compilation_reason = 14;
4238
4239    // The compiler filter used when when the package was optimized.
4240    optional int32 package_optimization_compilation_filter = 15;
4241
4242    enum SourceType {
4243        UNAVAILABLE = 0;
4244        LAUNCHER = 1;
4245        NOTIFICATION = 2;
4246        LOCKSCREEN = 3;
4247        RECENTS_ANIMATION = 4;
4248    }
4249    // The type of the startup source.
4250    optional SourceType source_type = 16;
4251
4252    // The time from the startup source to the beginning of handling the startup event.
4253    // -1 means not available.
4254    optional int32 source_event_delay_millis = 17;
4255
4256    // Whether the app is hibernating when it started
4257    optional bool is_hibernating = 18;
4258
4259    // Whether the app is installed on Incremental File System.
4260    optional bool is_incremental = 19;
4261
4262    // Whether the app is still being streamed.
4263    optional bool is_loading = 20;
4264
4265    // The hash value of the activity name.
4266    optional int32 activity_name_hash = 21;
4267
4268    // The timestamp(SystemClock#elapsedRealtime()) when starting activity.
4269    optional int64 activity_start_timestamp_millis = 22;
4270}
4271
4272message AppStartCanceled {
4273    // The uid if available. -1 means not available.
4274    optional int32 uid = 1 [(is_uid) = true];
4275
4276    // The app package name.
4277    optional string pkg_name = 2;
4278
4279    enum TransitionType {
4280        UNKNOWN = 0;
4281        WARM = 1;
4282        HOT = 2;
4283        COLD = 3;
4284        RELAUNCH = 4;
4285    }
4286    // The transition type.
4287    optional TransitionType type = 3;
4288
4289    // The activity name.
4290    optional string activity_name = 4;
4291}
4292
4293message AppStartFullyDrawn {
4294    // The uid if available. -1 means not available.
4295    optional int32 uid = 1 [(is_uid) = true];
4296
4297    // The app package name.
4298    optional string pkg_name = 2;
4299
4300    enum TransitionType {
4301        UNKNOWN = 0;
4302        WITH_BUNDLE = 1;
4303        WITHOUT_BUNDLE = 2;
4304    }
4305    // The transition type.
4306    optional TransitionType type = 3;
4307
4308    // The activity name.
4309    optional string activity_name = 4;
4310
4311    optional bool transition_process_running = 5;
4312
4313    // App startup time (until call to Activity#reportFullyDrawn()).
4314    optional int64 app_startup_time_millis = 6;
4315
4316    // The reason why the package was optimized.
4317    optional int32 package_optimization_compilation_reason = 7;
4318
4319    // The compiler filter used when when the package was optimized.
4320    optional int32 package_optimization_compilation_filter = 8;
4321
4322    enum SourceType {
4323        UNAVAILABLE = 0;
4324        LAUNCHER = 1;
4325        NOTIFICATION = 2;
4326        LOCKSCREEN = 3;
4327    }
4328    // The type of the startup source.
4329    optional SourceType source_type = 9;
4330
4331    // The time from the startup source to the beginning of handling the startup event.
4332    // -1 means not available.
4333    optional int32 source_event_delay_millis = 10;
4334
4335    // Whether the app is installed on Incremental File System.
4336    optional bool is_incremental = 11;
4337
4338    // Whether the app is still being streamed.
4339    optional bool is_loading = 12;
4340
4341    // The hash value of the activity name.
4342    optional int32 activity_name_hash = 13;
4343}
4344
4345/**
4346 * Logs a picture-in-picture action
4347 * Logged from:
4348 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4349 *      frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4350 *      frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
4351 */
4352message PictureInPictureStateChanged {
4353    // -1 if it is not available
4354    optional int32 uid = 1 [(is_uid) = true];
4355
4356    optional string short_name = 2;
4357
4358    enum State {
4359        ENTERED = 1;
4360        EXPANDED_TO_FULL_SCREEN = 2;
4361        MINIMIZED = 3;
4362        DISMISSED = 4;
4363    }
4364    optional State state = 3;
4365}
4366
4367/**
4368 * Logs overlay action
4369 * Logged from:
4370 *     services/core/java/com/android/server/wm/Session.java
4371 */
4372message OverlayStateChanged {
4373    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
4374
4375    optional string package_name = 2 [(state_field_option).primary_field = true];
4376
4377    optional bool using_alert_window = 3;
4378
4379    enum State {
4380        ENTERED = 1;
4381        EXITED = 2;
4382    }
4383    optional State state = 4
4384            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
4385}
4386
4387/**
4388 * Logs foreground service starts and stops.
4389 * Note that this is not when a service starts or stops, but when it is
4390 * considered foreground.
4391 * Logged from
4392 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
4393 */
4394message ForegroundServiceStateChanged {
4395    optional int32 uid = 1 [(is_uid) = true];
4396    // package_name + "/" + class_name
4397    optional string short_name = 2;
4398
4399    enum State {
4400        ENTER = 1;
4401        EXIT = 2;
4402        DENIED = 3;
4403    }
4404    optional State state = 3;
4405
4406    // Whether the fgs is allowed while-in-use permissions, i.e. is considered 'in-use' to the user.
4407    // (If the fgs was started while the app wasn't TOP it usually will be denied these permissions)
4408    optional bool allow_while_in_use_permission = 4;
4409    // the reason why FGS is allowed or denied to start. The reason code is defined as
4410    // PowerExemptionManager#ReasonCode.
4411    optional int32 fgs_start_reason_code = 5;
4412    // FGS service's targetSdkVersion.
4413    optional int32 target_sdk_version = 6;
4414    // uid of the app that start/bind this service.
4415    optional int32 calling_uid = 7;
4416    // targetSdkVersion of the app that start/bind this service.
4417    optional int32 caller_target_sdk_version = 8;
4418    // uid of the app that set the temp-allowlist, INVALID_UID (-1) if not in any
4419    // temp-allowlist.
4420    optional int32 temp_allow_list_calling_uid = 9;
4421    // FGS notification was deferred.
4422    optional bool fgs_notification_deferred = 10;
4423    // FGS notification was shown before the FGS finishes, or it wasn't deferred in the first place.
4424    optional bool fgs_notification_shown = 11;
4425    // The duration from state ENTER to state EXIT. Only meaningful when the state is EXIT.
4426    optional int32 fgs_duration_ms = 12;
4427    // Number of times startForeground() is called on this service.
4428    optional int32 fgs_start_count = 13;
4429    // SHA-1 hashed short_name combined with ANDROID_ID.
4430    optional int32 short_name_hash = 14;
4431}
4432
4433/**
4434 * Logs the number of times a uid accesses a sensitive AppOp during a foreground service session.
4435 * A foreground service session is any continuous period during which the uid holds at least one
4436 * foreground service; the atom will be pushed when the uid no longer holds any foreground services.
4437 * Accesses initiated while the uid is in the TOP state are ignored.
4438 * Sessions with no attempted accesses are not logged.
4439 * Logged from
4440 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
4441 */
4442message ForegroundServiceAppOpSessionEnded {
4443    optional int32 uid = 1 [(is_uid) = true];
4444
4445    // The operation's name.
4446    // Only following four ops are logged
4447    // COARSE_LOCATION = 0
4448    // FINE_LOCATION = 1
4449    // CAMERA = 26
4450    // RECORD_AUDIO = 27
4451    optional android.app.AppOpEnum app_op_name = 2 [default = APP_OP_NONE];
4452
4453    // The uid's permission mode for accessing the AppOp during this fgs session.
4454    enum Mode {
4455        MODE_UNKNOWN = 0;
4456        MODE_ALLOWED = 1; // Always allowed
4457        MODE_IGNORED = 2; // Denied
4458        MODE_FOREGROUND = 3; // Allow-while-in-use (or allowed-one-time)
4459    }
4460    optional Mode app_op_mode = 3;
4461
4462    // Number of times this AppOp was requested and allowed.
4463    optional int32 count_ops_accepted = 4;
4464    // Number of times this AppOp was requested but denied.
4465    optional int32 count_ops_rejected = 5;
4466}
4467
4468/**
4469 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
4470 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
4471 * attributed back to the parent (host) uid. One example is Chrome.
4472 *
4473 * Logged from:
4474 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4475 */
4476message IsolatedUidChanged {
4477    // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
4478    // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
4479    // This field is ignored when event == REMOVED.
4480    optional int32 parent_uid = 1;
4481
4482    optional int32 isolated_uid = 2;
4483
4484    // We expect an isolated uid to be removed before if it's used for another parent uid.
4485    enum Event {
4486        REMOVED = 0;
4487        CREATED = 1;
4488    }
4489    optional Event event = 3;
4490}
4491
4492/*
4493 * Logs the reception of an incoming network packet causing the main system to wake up for
4494 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
4495 * and processed by WakeupController.cpp.
4496 */
4497message PacketWakeupOccurred {
4498    // The uid owning the socket into which the packet was delivered, or -1 if the packet was
4499    // delivered nowhere.
4500    optional int32 uid = 1 [(is_uid) = true];
4501    // The interface name on which the packet was received.
4502    optional string iface = 2;
4503    // The ethertype value of the packet.
4504    optional int32 ethertype = 3;
4505    // String representation of the destination MAC address of the packet.
4506    optional string destination_hardware_address = 4;
4507    // String representation of the source address of the packet if this was an IP packet.
4508    optional string source_ip = 5;
4509    // String representation of the destination address of the packet if this was an IP packet.
4510    optional string destination_ip = 6;
4511    // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
4512    // field if this was an IPv6 packet. The range of possible values is the same for both IP
4513    // families.
4514    optional int32 ip_next_header = 7;
4515    // The source port if this was a TCP or UDP packet.
4516    optional int32 source_port = 8;
4517    // The destination port if this was a TCP or UDP packet.
4518    optional int32 destination_port = 9;
4519}
4520
4521/*
4522 * Logs the memory stats for an app on startup.
4523 * Logged from:
4524 *     frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4525 */
4526message AppStartMemoryStateCaptured {
4527    // The uid if available. -1 means not available.
4528    optional int32 uid = 1 [(is_uid) = true];
4529
4530    // The process name.
4531    optional string process_name = 2;
4532
4533    // The activity name.
4534    optional string activity_name = 3;
4535
4536    // # of page-faults
4537    optional int64 page_fault = 4;
4538
4539    // # of major page-faults
4540    optional int64 page_major_fault = 5;
4541
4542    // RSS
4543    optional int64 rss_in_bytes = 6;
4544
4545    // CACHE
4546    optional int64 cache_in_bytes = 7;
4547
4548    // SWAP
4549    optional int64 swap_in_bytes = 8;
4550}
4551
4552/*
4553 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
4554 * for LMK event.
4555 * Logged from:
4556 *      system/core/lmkd/lmkd.c
4557 */
4558message LmkStateChanged {
4559    enum State {
4560        UNKNOWN = 0;
4561        START = 1;
4562        STOP = 2;
4563    }
4564    optional State state = 1;
4565}
4566
4567/*
4568 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
4569 * Logged from:
4570 *      system/core/lmkd/lmkd.c
4571 */
4572message LmkKillOccurred {
4573    enum Reason {
4574        UNKNOWN = 0;
4575        PRESSURE_AFTER_KILL = 1;
4576        NOT_RESPONDING = 2;
4577        LOW_SWAP_AND_THRASHING = 3;
4578        LOW_MEM_AND_SWAP = 4;
4579        LOW_MEM_AND_THRASHING = 5;
4580        DIRECT_RECL_AND_THRASHING = 6;
4581        LOW_MEM_AND_SWAP_UTIL = 7;
4582        LOW_FILECACHE_AFTER_THRASHING = 8;
4583    }
4584
4585    // The uid if available. -1 means not available.
4586    optional int32 uid = 1 [(is_uid) = true];
4587
4588    // The process name.
4589    optional string process_name = 2;
4590
4591    // oom adj score.
4592    optional int32 oom_adj_score = 3;
4593
4594    // # of page-faults
4595    optional int64 page_fault = 4;
4596
4597    // # of major page-faults
4598    optional int64 page_major_fault = 5;
4599
4600    // RSS
4601    optional int64 rss_in_bytes = 6;
4602
4603    // CACHE
4604    optional int64 cache_in_bytes = 7;
4605
4606    // SWAP
4607    optional int64 swap_in_bytes = 8;
4608
4609    // The elapsed real time of start of the process.
4610    optional int64 process_start_time_nanos = 9;
4611
4612    // Min oom adj score considered by lmkd.
4613    optional int32 min_oom_score = 10;
4614
4615    // Free physical memory on device at LMK time.
4616    optional int32 free_mem_kb = 11;
4617
4618    // Free swap on device at LMK time.
4619    optional int32 free_swap_kb = 12;
4620
4621    // What triggered the LMK event.
4622    optional Reason reason = 13;
4623
4624    // Current thrashing levels (workingset_refaults/filecache in %).
4625    optional int32 thrashing = 14;
4626
4627    // Max thrashing levels (workingset_refaults/filecache in %).
4628    optional int32 max_thrashing = 15;
4629}
4630
4631/*
4632 * Logs when the ActivityManagerService detects that an app died.
4633 *
4634 * Logged from:
4635 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4636 */
4637message AppDied {
4638    // timestamp(elapsedRealtime) of record creation
4639    optional uint64 timestamp_millis = 1 [(state_field_option).exclusive_state = true];
4640}
4641
4642/**
4643 * An atom for generic metrics logging. Available from Android Q.
4644 */
4645message GenericAtom {
4646    // The uid of the application that sent this custom atom.
4647    optional int32 uid = 1 [(is_uid) = true];
4648
4649    // An event_id indicates the type of event.
4650    optional android.stats.EventType event_id = 2;
4651}
4652
4653/**
4654 * Atom for simple logging of user interaction and impression events, such as "the user touched
4655 * this button" or "this dialog was displayed".
4656 * Keep the UI event stream clean: don't use for system or background events.
4657 * Log using the UiEventLogger wrapper - don't write with the StatsLog API directly.
4658 *
4659 * Logged from:
4660 *   frameworks/base/services/core/java/com/android/server/
4661 *   frameworks/base/packages/SystemUI/src/com/android/systemui/
4662 */
4663message UiEventReported {
4664    // The event_id.
4665    optional int32 event_id = 1;
4666    // The event's source or target uid and package, if applicable.
4667    // For example, the package posting a notification, or the destination package of a share.
4668    optional int32 uid = 2 [(is_uid) = true];
4669    optional string package_name = 3;
4670    // An identifier used to disambiguate which logs refer to a particular instance of some
4671    // UI element. Useful when there might be multiple instances simultaneously active.
4672    optional int32 instance_id = 4;
4673}
4674
4675/**
4676 * Reports a notification was created or updated.
4677 *
4678 * Logged from:
4679 *   frameworks/base/services/core/java/com/android/server/notification/
4680 */
4681message NotificationReported {
4682    // The event_id (as for UiEventReported).
4683    optional int32 event_id = 1;
4684    // The notifying app's uid and package.
4685    optional int32 uid = 2 [(is_uid) = true];
4686    optional string package_name = 3;
4687    // A small system-assigned identifier for the notification.
4688    // Locally probably-unique, but expect collisions across users and/or days.
4689    optional int32 instance_id = 4;
4690    optional int32 notification_id_hash = 5;  // Small hash of the app-assigned notif ID + tag
4691    optional int32 channel_id_hash = 6;  // Small hash of app-assigned channel ID
4692
4693    // Grouping information
4694    optional int32 group_id_hash = 7;  // Small hash of the group ID of the notification
4695    optional int32 group_instance_id = 8;  // Instance_id of the group-summary notification
4696    optional bool is_group_summary = 9;  // Tags the group-summary notification
4697
4698    // Attributes
4699    optional string category = 10;   // App-assigned notification category (API-defined strings)
4700    optional int32 style = 11;       // App-assigned notification style
4701    optional int32 num_people = 12;  // Number of Person records attached to the notification
4702
4703    // Ordering, importance and interruptiveness
4704
4705    optional int32 position = 13;    // Position in NotificationManager's list
4706
4707    optional android.stats.sysui.NotificationImportance importance = 14;
4708    optional int32 alerting = 15;    // Bitfield, 1=buzz 2=beep 4=blink
4709
4710    enum NotificationImportanceExplanation {
4711        IMPORTANCE_EXPLANATION_UNKNOWN = 0;
4712        IMPORTANCE_EXPLANATION_APP = 1;     // App-specified channel importance.
4713        IMPORTANCE_EXPLANATION_USER = 2;    // User-specified channel importance.
4714        IMPORTANCE_EXPLANATION_ASST = 3;    // Notification Assistant override.
4715        IMPORTANCE_EXPLANATION_SYSTEM = 4;  // System override.
4716        // Like _APP, but based on pre-channels priority signal.
4717        IMPORTANCE_EXPLANATION_APP_PRE_CHANNELS = 5;
4718    }
4719
4720    optional NotificationImportanceExplanation importance_source = 16;
4721    optional android.stats.sysui.NotificationImportance importance_initial = 17;
4722    optional NotificationImportanceExplanation importance_initial_source = 18;
4723    optional android.stats.sysui.NotificationImportance importance_asst = 19;
4724    optional int32 assistant_hash = 20;
4725    optional float assistant_ranking_score = 21;
4726}
4727
4728message Notification {
4729    // The notifying app's uid and package.
4730    optional int32 uid = 1 [(is_uid) = true];
4731    optional string package_name = 2;
4732    // A small system-assigned identifier for the notification.
4733    optional int32 instance_id = 3;
4734
4735    // Grouping information.
4736    optional int32 group_instance_id = 4;
4737    optional bool is_group_summary = 5;
4738
4739    // The section of the shade that the notification is in.
4740    // See SystemUI Notifications.proto.
4741    enum NotificationSection {
4742        SECTION_UNKNOWN = 0;
4743        SECTION_HEADS_UP = 1;
4744        SECTION_MEDIA_CONTROLS = 2;
4745        SECTION_PEOPLE = 3;
4746        SECTION_ALERTING = 4;
4747        SECTION_SILENT = 5;
4748        SECTION_FOREGROUND_SERVICE = 6;
4749    }
4750    optional NotificationSection section = 6;
4751}
4752
4753message NotificationList {
4754    repeated Notification notifications = 1;  // An ordered sequence of notifications.
4755}
4756
4757/**
4758 * Reports a notification panel was displayed, e.g. from the lockscreen or status bar.
4759 *
4760 * Logged from:
4761 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/
4762 */
4763message NotificationPanelReported {
4764    // The event_id (as for UiEventReported).
4765    optional int32 event_id = 1;
4766    optional int32 num_notifications = 2;
4767    // The notifications in the panel, in the order that they appear there.
4768    optional NotificationList notifications = 3 [(log_mode) = MODE_BYTES];
4769}
4770
4771/**
4772 * Reports a notification channel, or channel group, was created, updated, or deleted.
4773 *
4774 * Logged from:
4775 *   frameworks/base/services/core/java/com/android/server/notification/
4776 */
4777message NotificationChannelModified {
4778    // The event_id (as for UiEventReported).
4779    optional int32 event_id = 1;
4780    // The notifying app's uid and package.
4781    optional int32 uid = 2 [(is_uid) = true];
4782    optional string package_name = 3;
4783    // Hash of app-assigned notification channel ID or channel-group ID
4784    optional int32 channel_id_hash = 4;
4785    // Previous importance setting, if applicable
4786    optional android.stats.sysui.NotificationImportance old_importance = 5;
4787    // New importance setting
4788    optional android.stats.sysui.NotificationImportance importance = 6;
4789    // whether or not this channel represents a conversation
4790    optional bool is_conversation = 7;
4791    // Hash of app-assigned notification conversation id
4792    optional int32 conversation_id_hash = 8;
4793    // whether or not the user demoted this channel out of the conversation space
4794    optional bool is_conversation_demoted = 9;
4795    // whether this conversation is marked as being a priority
4796    optional bool is_conversation_priority = 10;
4797}
4798
4799/**
4800 * Logs when a biometric acquire event occurs.
4801 *
4802 * Logged from:
4803 *   frameworks/base/services/core/java/com/android/server/biometrics
4804 */
4805message BiometricAcquired {
4806    // Biometric modality that was acquired.
4807    optional android.hardware.biometrics.ModalityEnum modality = 1;
4808    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java.
4809    optional int32 user = 2;
4810    // If this acquire is for a crypto operation. e.g. Secure purchases, unlock password storage.
4811    optional bool is_crypto = 3;
4812    // Action that the device is performing. Acquired messages are only expected for enroll and
4813    // authenticate. Other actions may indicate an error.
4814    optional android.hardware.biometrics.ActionEnum action = 4;
4815    // The client that this acquisition was received for.
4816    optional android.hardware.biometrics.ClientEnum client = 5;
4817    // Acquired constants, e.g. ACQUIRED_GOOD. See constants defined by <Biometric>Manager.
4818    optional int32 acquire_info = 6;
4819    // Vendor-specific acquire info. Valid only if acquire_info == ACQUIRED_VENDOR.
4820    optional int32 acquire_info_vendor = 7;
4821    // Dictates if this message should trigger additional debugging.
4822    optional bool debug = 8;
4823    // The ID of the biometric sensor associated with this action.
4824    optional int32 sensor_id = 9;
4825}
4826
4827/**
4828 * Logs when a biometric authentication event occurs.
4829 *
4830 * Logged from:
4831 *   frameworks/base/services/core/java/com/android/server/biometrics
4832 */
4833message BiometricAuthenticated {
4834    // Biometric modality that was used.
4835    optional android.hardware.biometrics.ModalityEnum modality = 1;
4836    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
4837    optional int32 user = 2;
4838    // If this authentication is for a crypto operation. e.g. Secure purchases, unlock password
4839    // storage.
4840    optional bool is_crypto = 3;
4841    // The client that this acquisition was received for.
4842    optional android.hardware.biometrics.ClientEnum client = 4;
4843    // If authentication requires user confirmation. See BiometricPrompt's
4844    // setRequireConfirmation(bool) method.
4845    optional bool require_confirmation = 5;
4846
4847    enum State {
4848        UNKNOWN = 0;
4849        REJECTED = 1;
4850        PENDING_CONFIRMATION = 2;
4851        CONFIRMED = 3;
4852    }
4853
4854    // State of the current auth attempt.
4855    optional State state = 6;
4856    // Time it took to authenticate. For BiometricPrompt where setRequireConfirmation(false) is
4857    // specified and supported by the biometric modality, this is from the first ACQUIRED_GOOD to
4858    // AUTHENTICATED. for setRequireConfirmation(true), this is from PENDING_CONFIRMATION to
4859    // CONFIRMED.
4860    optional int64 latency_millis = 7;
4861    // Dictates if this message should trigger additional debugging.
4862    optional bool debug = 8;
4863    // The ID of the biometric sensor associated with this action.
4864    optional int32 sensor_id = 9;
4865    // The ambient light lux when authenticated.
4866    optional float ambient_light_lux = 10;
4867}
4868
4869/**
4870 * Logs when a biometric error occurs.
4871 *
4872 * Logged from:
4873 *   frameworks/base/services/core/java/com/android/server/biometrics
4874 */
4875message BiometricErrorOccurred {
4876    // Biometric modality that was used.
4877    optional android.hardware.biometrics.ModalityEnum modality = 1;
4878    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
4879    optional int32 user = 2;
4880    // If this error is for a crypto operation. e.g. Secure purchases, unlock password storage.
4881    optional bool is_crypto = 3;
4882    // Action that the device is performing.
4883    optional android.hardware.biometrics.ActionEnum action = 4;
4884    // The client that this acquisition was received for.
4885    optional android.hardware.biometrics.ClientEnum client = 5;
4886    // Error constants. See constants defined by <Biometric>Manager. Enums won't work since errors
4887    // are unique to modality.
4888    optional int32 error_info = 6;
4889    // Vendor-specific error info. Valid only if acquire_info == ACQUIRED_VENDOR. These are defined
4890    // by the vendor and not specified by the HIDL interface.
4891    optional int32 error_info_vendor = 7;
4892    // Dictates if this message should trigger additional debugging.
4893    optional bool debug = 8;
4894    // Time spent during the authentication attempt.
4895    optional int64 latency_millis = 9;
4896    // The ID of the biometric sensor associated with this action.
4897    optional int32 sensor_id = 10;
4898}
4899
4900/**
4901 * Logs when a system health issue is detected.
4902 * Logged from:
4903 *   frameworks/base/services/core/java/com/android/server/biometrics
4904 */
4905message BiometricSystemHealthIssueDetected {
4906    // Biometric modality.
4907    optional android.hardware.biometrics.ModalityEnum modality = 1;
4908    // Type of issue detected.
4909    optional android.hardware.biometrics.IssueEnum issue = 2;
4910    // Dictates if this message should trigger additional debugging.
4911    optional bool debug = 3;
4912    // The ID of the biometric sensor associated with this action.
4913    optional int32 sensor_id = 4;
4914}
4915
4916/**
4917 * Logs when a biometric enrollment occurs.
4918 *
4919 * Logged from:
4920 *   frameworks/base/services/core/java/com/android/server/biometrics
4921 */
4922message BiometricEnrolled {
4923    // Biometric modality that was used.
4924    optional android.hardware.biometrics.ModalityEnum modality = 1;
4925    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
4926    optional int32 user = 2;
4927    // The amount of time the enrollment took in milliseconds.
4928    optional int64 latency_millis = 3;
4929    // Whether or not the enrollment was successful.
4930    optional bool success = 4;
4931    // The ID of the biometric sensor associated with this action.
4932    optional int32 sensor_id = 5;
4933    // The ambient light lux when the user enrolled.
4934    optional float ambient_light_lux = 6;
4935}
4936
4937/*
4938 * Logs when one of the BiometricPrompt#authenticate() method variants is called.
4939 *
4940 * Logged from:
4941 *   frameworks/base/services/core/java/com/android/server/biometrics
4942 *
4943 */
4944 message AuthPromptAuthenticateInvoked {
4945    // Whether an explicit CryptoObject was passed to the biometric prompt.
4946    optional bool is_crypto = 1;
4947    // The value passed to setConfirmationRequired(boolean), or true if not set.
4948    optional bool is_confirmation_required = 2;
4949    // The value passed to setDeviceCredentialAllowed(boolean), or false if not set.
4950    optional bool is_credential_allowed = 3;
4951    // Whether a value was passed to setAllowedAuthenticators(int).
4952    optional bool is_allowed_authenticators_set = 4;
4953    // The value passed to setAllowedAuthenticators(int), if any.
4954    optional int32 allowed_authenticators = 5;
4955}
4956
4957/*
4958 * Logs when one of the BiometricPrompt#canAuthenticate() method variants is called.
4959 *
4960 * Logged from:
4961 *   frameworks/base/services/core/java/com/android/server/biometrics
4962 *
4963 */
4964message AuthManagerCanAuthenticateInvoked {
4965    // Whether a bit field of allowed authenticator types was provided as an argument.
4966    optional bool is_allowed_authenticators_set = 1;
4967    // The bit field of allowed authenticator types provided, if any.
4968    optional int32 allowed_authenticators = 2;
4969    // The authentication status code that was returned.
4970    optional int32 result_code = 3;
4971}
4972
4973/*
4974 * Logs when Biometric enrollment is requested via the ACTION_BIOMETRIC_ENROLL intent action.
4975 *
4976 * Logged from:
4977 *   frameworks/base/services/core/java/com/android/server/biometrics
4978 *
4979 */
4980message AuthEnrollActionInvoked {
4981    // Whether a Class 3 (strong) biometric was previously enrolled on this device.
4982    optional bool is_strong_biometric_enrolled = 1;
4983    // Whether a Class 2 (weak) biometric was previously enrolled on this device.
4984    optional bool is_weak_biometric_enrolled = 2;
4985    // Whether a PIN/pattern/password was previously enrolled on this device.
4986    optional bool is_device_credential_enrolled = 3;
4987    // Whether a bit field of allowed authenticator types was provided as an extra.
4988    optional bool is_allowed_authenticators_set = 4;
4989    // The bit field of allowed authenticator types provided, if any.
4990    optional int32 allowed_authenticators = 5;
4991}
4992
4993/*
4994 * Logs when an application uses a deprecated biometric or authentication API feature.
4995 *
4996 * Logged from:
4997 *   frameworks/base/services/core/java/com/android/server/biometrics
4998 */
4999 message AuthDeprecatedAPIUsed {
5000    enum APIEnum {
5001        API_UNKNOWN = 0;
5002        // android.hardware.fingerprint.FingerprintManager#authenticate(CryptoObject,
5003        // CancellationSignal, int, AuthenticationCallback, Handler)
5004        API_FINGERPRINT_MANAGER_AUTHENTICATE = 1;
5005        // android.hardware.fingerprint.FingerprintManager#hasEnrolledFingerprints()
5006        API_FINGERPRINT_MANAGER_HAS_ENROLLED_FINGERPRINTS = 2;
5007        // android.hardware.fingerprint.FingerprintManager#isHardwareDetected()
5008        API_FINGERPRINT_MANAGER_IS_HARDWARE_DETECTED = 3;
5009        // android.hardware.biometrics.BiometricManager#canAuthenticate()
5010        API_BIOMETRIC_MANAGER_CAN_AUTHENTICATE = 4;
5011    }
5012
5013     // The deprecated API feature that was used.
5014     optional APIEnum deprecated_api = 1;
5015     // The UID of the application that used the deprecated API.
5016     optional int32 app_uid = 2;
5017     // The target SDK version (API level) of the application that used the deprecated API.
5018     optional int32 target_sdk = 3;
5019 }
5020
5021/*
5022 * Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
5023 */
5024message FlagFlipUpdateOccurred {
5025    // If the event is from a flag config package, specify the package name.
5026    optional string flag_flip_package_name = 1;
5027
5028    // The order id of the package
5029    optional int64 order_id = 2;
5030}
5031
5032/**
5033 * Potential experiment ids that goes with a train install.
5034 * Should be kept in sync with experiment_ids.proto.
5035 */
5036message TrainExperimentIds {
5037    repeated int64 experiment_id = 1;
5038}
5039
5040/*
5041 * Logs when a binary push state changes.
5042 * Logged by the installer via public api.
5043 */
5044message BinaryPushStateChanged {
5045    // Name of the train.
5046    optional string train_name = 1;
5047    // Version code for a "train" of packages that need to be installed atomically
5048    optional int64 train_version_code = 2;
5049    // After installation of this package, device requires a restart.
5050    optional bool requires_staging = 3;
5051    // Rollback should be enabled for this install.
5052    optional bool rollback_enabled = 4;
5053    // Requires low latency monitoring if possible.
5054    optional bool requires_low_latency_monitor = 5;
5055
5056    enum State {
5057        UNKNOWN = 0;
5058        INSTALL_REQUESTED = 1;
5059        INSTALL_STARTED = 2;
5060        INSTALL_STAGED_NOT_READY = 3;
5061        INSTALL_STAGED_READY = 4;
5062        INSTALL_SUCCESS = 5;
5063        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
5064        // and INSTALL_FAILURE_COMMIT.
5065        INSTALL_FAILURE = 6  [deprecated = true];
5066        // This enum is for installs that are manually cancelled via the Manual Update UI.
5067        INSTALL_CANCELLED = 7;
5068        INSTALLER_ROLLBACK_REQUESTED = 8;
5069        INSTALLER_ROLLBACK_INITIATED = 9;
5070        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
5071        INSTALLER_ROLLBACK_STAGED = 11;
5072        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
5073        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
5074        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
5075        INSTALLER_ROLLBACK_SUCCESS = 15;
5076        INSTALLER_ROLLBACK_FAILURE = 16;
5077        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
5078        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
5079        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
5080        INSTALL_STAGED_CANCEL_REQUESTED = 20;
5081        INSTALL_STAGED_CANCEL_SUCCESS = 21;
5082        INSTALL_STAGED_CANCEL_FAILURE = 22;
5083        INSTALL_FAILURE_DOWNLOAD = 23;
5084        INSTALL_FAILURE_STATE_MISMATCH = 24;
5085        INSTALL_FAILURE_COMMIT = 25;
5086        REBOOT_TRIGGERED = 26;
5087        // Logged after INSTALL_REQUESTED for devices installing a train that
5088        // contains no module requiring reboot.
5089        REBOOT_NOT_REQUIRED = 27;
5090        // Logged after INSTALL_REQUESTED for devices that are installing a train
5091        // which requires reboot and eligible for soft restart.
5092        SOFT_RESTART_ELIGIBLE = 28;
5093        // Logged after INSTALL_REQUESTED for devices that are installing a train
5094        // which requires reboot and eligible for notification restart.
5095        NOTIFICATION_RESTART_ELIGIBLE = 29;
5096        // Logged after INSTALL_REQUESTED for devices that are installing a train
5097        // which requires reboot and not eligible for any reboot promotion strategy
5098        // (e.g. soft restart, notification restart).
5099        NO_REBOOT_PROMOTION_STRATEGY_ELIGIBLE = 30;
5100        REBOOT_TRIGGER_FAILURE = 31;
5101    }
5102    optional State state = 6;
5103    // Possible experiment ids for monitoring this push.
5104    optional TrainExperimentIds experiment_ids = 7 [(log_mode) = MODE_BYTES];
5105    // user id
5106    optional int32 user_id = 8;
5107    optional int32 reason = 9;
5108    // Whether or not this is a rollback event
5109    optional bool is_rollback = 10;
5110}
5111
5112/* Test atom, is not logged anywhere */
5113message TestAtomReported {
5114    repeated AttributionNode attribution_node = 1;
5115    optional int32 int_field = 2;
5116    optional int64 long_field = 3;
5117    optional float float_field = 4;
5118    optional string string_field = 5;
5119    optional bool boolean_field = 6;
5120    enum State {
5121        UNKNOWN = 0;
5122        OFF = 1;
5123        ON = 2;
5124    }
5125    optional State state = 7;
5126    optional TrainExperimentIds bytes_field = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
5127}
5128
5129/** Represents USB port overheat event. */
5130message UsbPortOverheatEvent {
5131    /* Temperature of USB port at USB plug event, in 1/10ths of degree C. */
5132    optional int32 plug_temperature_deci_c = 1;
5133
5134    /* Maximum temperature of USB port during overheat event, in 1/10ths of degree C. */
5135    optional int32 max_temperature_deci_c = 2;
5136
5137    /* Time between USB plug event and overheat threshold trip, in seconds. */
5138    optional int32 time_to_overheat_secs = 3;
5139
5140    /* Time between overheat threshold trip and hysteresis, in seconds. */
5141    optional int32 time_to_hysteresis_secs = 4;
5142
5143    /* Time between hysteresis and active mitigation ending, in seconds. */
5144    optional int32 time_to_inactive_secs = 5;
5145};
5146
5147/**
5148 * Logs total effective full charge and discharge cycles on a battery.
5149 * Here are some examples of one effective cycle:
5150 *   1) the battery charges from 0% to 100% and drains back to 0%,
5151 *   2) charging from 50% to 100% and draining back to 50% twice.
5152 * Pulled from:
5153 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
5154 */
5155message BatteryCycleCount {
5156    /* Number of total charge and discharge cycles on the system battery. */
5157    optional int32 cycle_count = 1;
5158}
5159
5160/**
5161 * Logs that external storage is mounted and information about it, the storage type (sd card/usb/
5162 * others), its type (public or private) and the size in bytes.
5163 * Pulled from:
5164 *   StatsCompanionService
5165 */
5166
5167message ExternalStorageInfo {
5168
5169    enum VolumeType {
5170        UNKNOWN = 0;
5171        PUBLIC = 1;
5172        PRIVATE = 2;
5173        OTHER = 3;
5174    }
5175
5176    // The type of external storage.
5177    optional android.stats.storage.ExternalStorageType storage_type = 1;
5178    // Type of the volume: TYPE_PUBLIC if portable and TYPE_PRIVATE if internal.
5179    optional VolumeType volume_type = 2;
5180    // Total size of the sd card in bytes.
5181    optional int64 size_bytes = 3;
5182}
5183
5184/*
5185 * Logs when a connection becomes available and lost.
5186 * Logged in StatsCompanionService.java
5187 */
5188message ConnectivityStateChanged {
5189  // Id of the network.
5190  optional int32 net_id = 1;
5191
5192  enum State {
5193    UNKNOWN = 0;
5194    CONNECTED = 1;
5195    DISCONNECTED = 2;
5196  }
5197  // Connected state of a network.
5198  optional State state = 2;
5199}
5200
5201/**
5202 * Logs when a service starts and stops.
5203 * Logged from:
5204 *   services/core/java/com/android/server/am/ActiveServices.java
5205 */
5206message ServiceStateChanged {
5207
5208    optional int32 uid = 1 [(is_uid) = true];
5209
5210    optional string package_name = 2;
5211
5212    optional string service_name = 3;
5213
5214    enum State {
5215        START = 1;
5216        STOP = 2;
5217    }
5218
5219    optional State state = 4;
5220}
5221
5222/**
5223 * Logs when a service is launched.
5224 * Logged from:
5225 *   services/core/java/com/android/server/am/ActiveServices.java
5226 */
5227message ServiceLaunchReported {
5228
5229    optional int32 uid = 1 [(is_uid) = true];
5230
5231    optional string package_name = 2;
5232
5233    optional string service_name = 3;
5234}
5235
5236/**
5237 * Logs when a hidden API is used.
5238 *
5239 * Logged from:
5240 *     libcore/libart/src/main/java/dalvik/system/VMRuntime.java
5241 */
5242message HiddenApiUsed {
5243    // The uid of the app making the hidden access.
5244    optional int32 uid = 1 [(is_uid) = true];
5245
5246    // Signature of the method or field accessed.
5247    optional string signature = 2;
5248
5249    enum AccessMethod {
5250        NONE = 0;
5251        REFLECTION = 1;
5252        JNI = 2;
5253        LINKING = 3;
5254    }
5255
5256    // Type of access.
5257    optional AccessMethod access_method = 3;
5258
5259    // Whether the access was prevented or not.
5260    optional bool access_denied = 4;
5261}
5262
5263/**
5264 * Logs user interaction with the Privacy Indicators added in Q. In particular:
5265 * - When user sees privacy chip
5266 * - When user clicks privacy chip
5267 * - How does the user exit the Privacy Dialog
5268 * Logged from:
5269 *   packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
5270 */
5271message PrivacyIndicatorsInteracted {
5272
5273    enum Type {
5274        UNKNOWN = 0;
5275        CHIP_VIEWED = 1;
5276        CHIP_CLICKED = 2;
5277        reserved 3; // Used only in beta builds, never shipped
5278        DIALOG_DISMISS = 4;
5279        DIALOG_LINE_ITEM = 5;
5280    }
5281
5282    optional Type type = 1 [(state_field_option).exclusive_state = true];
5283}
5284
5285/**
5286 * Logs information about a package that is moved from the internal to external storage and vice
5287 * versa.
5288 * It logs the package name, the type of the external storage where the package is installed
5289 * (if moved to external storage, or UNKNOWN if moved to internal storage),
5290 * and the move type: if it's from internal to external or the other way around.
5291 *
5292 * Logged from:
5293        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
5294 */
5295message AppMovedStorageReported {
5296    enum MoveType {
5297        UNKNOWN = 0;
5298        TO_EXTERNAL = 1;
5299        TO_INTERNAL = 2;
5300    }
5301    // The type of the external storage.
5302    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
5303    // The type of move.
5304    optional MoveType move_type = 2;
5305    // The name of the package that was moved.
5306    optional string package_name = 3;
5307}
5308
5309/**
5310 * Logs when system server watchdog occurs.
5311 * Logged from:
5312 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
5313 */
5314message SystemServerWatchdogOccurred {
5315    optional string subject = 1;
5316}
5317
5318/**
5319 * Logs when new file added to tombstones.
5320 * Logged from:
5321 *      frameworks/base/core/java/com/android/server/BootReceiver.java
5322 */
5323message TombStoneOccurred {
5324}
5325
5326/*
5327 * Information about a role request
5328 *
5329 * Logged from:
5330 *   packages/apps/PermissionController/src/com/android/packageinstaller/role/ui/RequestRoleFragment.java
5331 */
5332message RoleRequestResultReported {
5333    // UID of application requesting the role
5334    optional int32 requesting_uid = 1;
5335
5336    // Package name of application requesting the role
5337    optional string requesting_package_name = 2;
5338
5339    // The role to be granted
5340    optional string role_name = 3;
5341
5342    // The count of applications qualifying for the role
5343    optional int32 qualifying_count = 4;
5344
5345    // UID of application current granted the role
5346    optional int32 current_uid = 5;
5347
5348    // Package name of application current granted the role
5349    optional string current_package_name = 6;
5350
5351    // UID of another application that user chose to grant the role to, instead of the requesting
5352    // application
5353    optional int32 granted_another_uid = 7;
5354
5355    // Package name of another application that user chose to grant the role to, instead of the
5356    // requesting application
5357    optional string granted_another_package_name = 8;
5358
5359    enum Result {
5360        UNDEFINED = 0;
5361        // role request was ignored
5362        IGNORED = 1;
5363        // role request was ignored because it's already granted
5364        IGNORED_ALREADY_GRANTED = 2;
5365        // role request was ignored because the application isn't qualified
5366        IGNORED_NOT_QUALIFIED = 3;
5367        // role request was ignored because user said it should be always denied
5368        IGNORED_USER_ALWAYS_DENIED = 4;
5369        // role was granted by user action
5370        USER_GRANTED = 5;
5371        // role was denied by user action
5372        USER_DENIED = 6;
5373        // role was denied by user granting another application the role
5374        USER_DENIED_GRANTED_ANOTHER = 7;
5375        // role was denied and set to be always denied by the user
5376        USER_DENIED_WITH_ALWAYS = 8;
5377    }
5378    // The result of the role request
5379    optional Result result = 9;
5380}
5381
5382/**
5383 * Logs when a Vehicle Maps Service client's connection state has changed
5384 *
5385 * Logged from:
5386 *   packages/services/Car/service/src/com/android/car/stats/VmsClientLog.java
5387 */
5388message VmsClientConnectionStateChanged {
5389    // The UID of the VMS client app
5390    optional int32 uid = 1 [(is_uid) = true];
5391
5392    enum State {
5393        UNKNOWN = 0;
5394        // Attempting to connect to the client
5395        CONNECTING = 1;
5396        // Client connection established
5397        CONNECTED = 2;
5398        // Client connection closed unexpectedly
5399        DISCONNECTED = 3;
5400        // Client connection closed by VMS
5401        TERMINATED = 4;
5402        // Error establishing the client connection
5403        CONNECTION_ERROR = 5;
5404    }
5405
5406    optional State state  = 2;
5407}
5408
5409message MimeTypes {
5410    repeated string mime_types = 1;
5411}
5412
5413/**
5414 * Logs statistics regarding accesses to external storage.
5415 * All stats are normalized for one day period.
5416 *
5417 * Logged from:
5418 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
5419 */
5420message GeneralExternalStorageAccessStats {
5421    optional int32 uid = 1 [(is_uid) = true];
5422    // Total number of accesses like creation, open, delete and rename/update.
5423    // Includes file path and ContentResolver accesses
5424    optional uint32 total_accesses = 2;
5425    // Number of file path accesses, as opposed to file path and ContentResolver.
5426    optional uint32 file_path_accesses = 3;
5427    // Number of accesses on secondary volumes like SD cards.
5428    // Includes file path and ContentResolver accesses
5429    optional uint32 secondary_storage_accesses = 4;
5430    // Comma-separated list of mime types that were accessed.
5431    optional MimeTypes mime_types_accessed = 5 [(log_mode) = MODE_BYTES];
5432}
5433
5434/**
5435 * Logs when MediaProvider has successfully finished scanning a storage volume.
5436 *
5437 * Logged from:
5438 *   packages/providers/MediaProvider/src/com/android/providers/media/scan/ModernMediaScanner.java
5439 */
5440message MediaProviderScanOccurred {
5441    enum Reason {
5442        // Scan triggered due to unknown reason
5443        UNKNOWN = 0;
5444        // Scan triggered due to storage volume being mounted
5445        MOUNTED = 1;
5446        // Scan triggered due to explicit user action or app request
5447        DEMAND = 2;
5448        // Scan triggered due to idle maintenance
5449        IDLE = 3;
5450    }
5451
5452    // Volume type that this event pertains to
5453    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5454    // Reason why this scan was triggered
5455    optional Reason reason = 2;
5456    // Total number of files scanned
5457    optional int64 item_count = 3;
5458    // Duration of scan, normalized per file
5459    optional float normalized_duration_millis = 4;
5460    // Number of database inserts, normalized per file
5461    optional float normalized_insert_count = 5;
5462    // Number of database updates, normalized per file
5463    optional float normalized_update_count = 6;
5464    // Number of database deletes, normalized per file
5465    optional float normalized_delete_count = 7;
5466}
5467
5468/**
5469 * Logs when an app has asked MediaProvider to delete media belonging to the user.
5470 *
5471 * Logged from:
5472 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
5473 */
5474message MediaContentDeleted {
5475    // Volume type that this event pertains to
5476    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5477    // UID of app that requested deletion
5478    optional int32 uid = 2 [(is_uid) = true];
5479    // Number of items that were deleted
5480    optional int32 item_count = 3;
5481}
5482
5483/**
5484 * Logs when an app has asked MediaProvider to grant them access to media belonging to the user.
5485 *
5486 * Logged from:
5487 *   packages/providers/MediaProvider/src/com/android/providers/media/PermissionActivity.java
5488 */
5489message MediaProviderPermissionRequested {
5490    enum Result {
5491        UNKNOWN = 0;
5492        USER_GRANTED = 1;
5493        AUTO_GRANTED = 2;
5494        USER_DENIED = 3;
5495        USER_DENIED_WITH_PREJUDICE = 4;
5496        AUTO_DENIED = 5;
5497    }
5498
5499    // Volume type that this event pertains to
5500    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5501    // UID of app that requested permission
5502    optional int32 uid = 2 [(is_uid) = true];
5503    // Number of items that were requested
5504    optional int32 item_count = 3;
5505    // Result of this request
5506    optional Result result = 4;
5507}
5508
5509/**
5510 * Logs when MediaProvider has finished upgrading or downgrading its database schema.
5511 *
5512 * Logged from:
5513 *   packages/providers/MediaProvider/src/com/android/providers/media/DatabaseHelper.java
5514 */
5515message MediaProviderSchemaChanged {
5516    // Volume type that this event pertains to
5517    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5518    // Old database version code
5519    optional int32 version_from = 2;
5520    // New database version code
5521    optional int32 version_to = 3;
5522    // Total number of files in database
5523    optional int64 item_count = 4;
5524    // Duration of schema change, normalized per file
5525    optional float normalized_duration_millis = 5;
5526}
5527
5528/**
5529 * Logs when MediaProvider has finished an idle maintenance job.
5530 *
5531 * Logged from:
5532 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
5533 */
5534message MediaProviderIdleMaintenanceFinished {
5535    // Volume type that this event pertains to
5536    optional android.stats.mediaprovider.VolumeType volume_type = 1;
5537
5538    // Total number of files in database
5539    optional int64 item_count = 2;
5540    // Duration of idle maintenance, normalized per file
5541    optional float normalized_duration_millis = 3;
5542    // Number of thumbnails found to be stale, normalized per file
5543    optional float normalized_stale_thumbnails = 4;
5544    // Number of items found to be expired, normalized per file
5545    optional float normalized_expired_media = 5;
5546}
5547
5548/**
5549 * Represents boot time event with duration in ms.
5550 *
5551 * Logged from: bootstat and various system server components. Check each enums for details.
5552 */
5553message BootTimeEventDuration {
5554    enum DurationEvent {
5555        UNKNOWN = 0;
5556        // Bootloader time excluding BOOTLOADER_UI_WAIT + boot complete time. Logged from bootstat.
5557        ABSOLUTE_BOOT_TIME = 1;
5558        // Bootloader's 1st stage execution time.
5559        // Logged from bootstat.
5560        BOOTLOADER_FIRST_STAGE_EXEC = 2;
5561        // Bootloader's 1st stage loading time.
5562        // Logged from bootstat.
5563        BOOTLOADER_FIRST_STAGE_LOAD = 3;
5564        // Bootloader's kernel loading time.
5565        // Logged from bootstat.
5566        BOOTLOADER_KERNEL_LOAD = 4;
5567        // Bootloader's 2nd stage execution time.
5568        // Logged from bootstat.
5569        BOOTLOADER_SECOND_STAGE_EXEC = 5;
5570        // Bootloader's 2nd stage loading time.
5571        // Logged from bootstat.
5572        BOOTLOADER_SECOND_STAGE_LOAD = 6;
5573        // Duration for Bootloader to show unlocked device's warning UI. This should not happen
5574        // for locked device.
5575        // Logged from bootstat.
5576        BOOTLOADER_UI_WAIT = 7;
5577        // Total time spend in bootloader. This is the sum of all BOOTLOADER_* listed above.
5578        // Logged from bootstat.
5579        BOOTLOADER_TOTAL = 8;
5580        // Shutdown duration inside init for the reboot before the current boot up.
5581        // Logged from f/b/services/.../BootReceiver.java.
5582        SHUTDOWN_DURATION = 9;
5583        // Total time for mounting of disk devices during bootup.
5584        // Logged from f/b/services/.../BootReceiver.java.
5585        MOUNT_DEFAULT_DURATION = 10;
5586        // Total time for early stage mounting of disk devices during bootup.
5587        // Logged from f/b/services/.../BootReceiver.java.
5588        MOUNT_EARLY_DURATION = 11;
5589        // Total time for late stage mounting of disk devices during bootup.
5590        // Logged from f/b/services/.../BootReceiver.java.
5591        MOUNT_LATE_DURATION = 12;
5592        // Average time to scan non-system app after OTA
5593        // Logged from f/b/services/.../PackageManagerService.java
5594        OTA_PACKAGE_MANAGER_INIT_TIME = 13;
5595        // Time to initialize Package manager after OTA
5596        // Logged from f/b/services/.../PackageManagerService.java
5597        OTA_PACKAGE_MANAGER_DATA_APP_AVG_SCAN_TIME = 14;
5598        // Time to scan all system app from Package manager after OTA
5599        // Logged from f/b/services/.../PackageManagerService.java
5600        OTA_PACKAGE_MANAGER_SYSTEM_APP_AVG_SCAN_TIME = 15;
5601        // Init's total time for cold boot stage.
5602        // Logged from bootstat.
5603        COLDBOOT_WAIT = 16;
5604        // Init's total time for initializing selinux.
5605        // Logged from bootstat.
5606        SELINUX_INIT = 17;
5607        // Time since last factory reset.
5608        // Logged from bootstat.
5609        FACTORY_RESET_TIME_SINCE_RESET = 18;
5610        // Init's total time spent for completing the 1st stage.
5611        // Logged from bootstat.
5612        ANDROID_INIT_STAGE_1 = 19;
5613    }
5614
5615    // Type of the event.
5616    optional DurationEvent event = 1;
5617    // Duration of the event in ms.
5618    optional int64 duration_millis = 2;
5619}
5620
5621/**
5622 * Represents the start of specific boot time event during bootup in ms. This is usually a time
5623 * since boot-up.
5624 *
5625 * Logged from: bootstat and various system server components. Check each enums for details.
5626 */
5627message BootTimeEventElapsedTime {
5628    enum ElapsedTimeEvent {
5629        UNKNOWN = 0;
5630        // Time when init starts 1st stage. Logged from bootstat.
5631        ANDROID_INIT_STAGE_1 = 1;
5632        // Time when sys.boot_completed prop is set.
5633        // Logged from bootstat.
5634        BOOT_COMPLETE = 2;
5635        // BOOT_COMPLETE for encrypted device.
5636        BOOT_COMPLETE_ENCRYPTION = 3;
5637        // BOOT_COMPLETE for device with no encryption.
5638        BOOT_COMPLETE_NO_ENCRYPTION = 4;
5639        // Adjusted BOOT_COMPLETE for encrypted device extracting decryption time.
5640        BOOT_COMPLETE_POST_DECRYPT = 5;
5641        // BOOT_COMPLETE after factory reset.
5642        FACTORY_RESET_BOOT_COMPLETE = 6;
5643        // BOOT_COMPLETE_NO_ENCRYPTION after factory reset.
5644        FACTORY_RESET_BOOT_COMPLETE_NO_ENCRYPTION = 7;
5645        // BOOT_COMPLETE_POST_DECRYPT after factory reset.
5646        FACTORY_RESET_BOOT_COMPLETE_POST_DECRYPT = 8;
5647        // BOOT_COMPLETE after OTA.
5648        OTA_BOOT_COMPLETE = 9;
5649        // BOOT_COMPLETE_NO_ENCRYPTION after OTA.
5650        OTA_BOOT_COMPLETE_NO_ENCRYPTION = 10;
5651        // BOOT_COMPLETE_POST_DECRYPT after OTA.
5652        OTA_BOOT_COMPLETE_POST_DECRYPT = 11;
5653        // Time when the system starts sending LOCKED_BOOT_COMPLETED broadcast.
5654        // Logged from  f/b/services/.../UserController.java
5655        FRAMEWORK_LOCKED_BOOT_COMPLETED = 12;
5656        // Time when the system starts sending BOOT_COMPLETED broadcast.
5657        // Logged from  f/b/services/.../UserController.java
5658        FRAMEWORK_BOOT_COMPLETED = 13;
5659        // Time when the package manager starts init.
5660        // Logged from f/b/services/.../SystemServer.java
5661        PACKAGE_MANAGER_INIT_START = 14;
5662        // Time when package manager is ready
5663        // Logged from f/b/services/.../SystemServer.java
5664        PACKAGE_MANAGER_INIT_READY = 15;
5665        // Represents the time when user has entered unlock credential for system with user pin.
5666        // Logged from bootstat.
5667        POST_DECRYPT = 16;
5668        // Represents the start of zygote's init.
5669        // Logged from zygote itself.
5670        ZYGOTE_INIT_START = 17;
5671        // Represents the start of secondary zygote's init.
5672        // TODO: add logging to zygote
5673        SECONDARY_ZYGOTE_INIT_START = 18;
5674        // Represents the start of system server's init.
5675        // Logged from f/b/services/.../SystemServer.java
5676        SYSTEM_SERVER_INIT_START = 19;
5677        // Represents the completion of system server's init.
5678        // Logged from f/b/services/.../SystemServer.java
5679        SYSTEM_SERVER_READY = 20;
5680        // Represents the start of launcher during boot-up.
5681        // TODO: add logging
5682        LAUNCHER_START = 21;
5683        // Represents the completion of launcher's initial rendering. User can use other apps from
5684        // launcher from this point.
5685        // TODO: add logging
5686        LAUNCHER_SHOWN = 22;
5687    }
5688
5689    // Type of the event.
5690    optional ElapsedTimeEvent event = 1;
5691    // Time since bootup for the event.
5692    // It should be acquired from SystemClock elapsedRealtime() call or equivalent.
5693    optional int64 time_millis = 2;
5694}
5695
5696/**
5697 * Boot time events with UTC time.
5698 *
5699 * Logged from: bootstat and various system server components. Check each enums for details.
5700 */
5701message BootTimeEventUtcTime {
5702    enum UtcTimeEvent {
5703        UNKNOWN = 0;
5704        // Time of the bootstat's marking of 1st boot after the last factory reset.
5705        // Logged from bootstat.
5706        FACTORY_RESET_RESET_TIME = 1;
5707        // The time when bootstat records FACTORY_RESET_* events. This is close to
5708        // BOOT_COMPLETE time for the current bootup.
5709        // Logged from bootstat.
5710        FACTORY_RESET_CURRENT_TIME = 2;
5711        // DUplicate of FACTORY_RESET_RESET_TIME added for debugging purpose.
5712        // Logged from bootstat.
5713        FACTORY_RESET_RECORD_VALUE = 3;
5714    }
5715
5716    // Type of the event.
5717    optional UtcTimeEvent event = 1;
5718    // UTC time for the event.
5719    optional int64 utc_time_secs = 2;
5720}
5721
5722/**
5723 * Boot time events representing specific error code during bootup.
5724 * Meaning of error code can be different per each event type.
5725 *
5726 * Logged from: bootstat and various system server components. Check each enums for details.
5727 */
5728message BootTimeEventErrorCode {
5729    enum ErrorCodeEvent {
5730        UNKNOWN = 0;
5731        // Linux error code for time() call to get the current UTC time.
5732        // Logged from bootstat.
5733        FACTORY_RESET_CURRENT_TIME_FAILURE = 1;
5734        // Represents UmountStat before the reboot for the current boot up. Error codes defined
5735        // as UMOUNT_STAT_* from init/reboot.cpp.
5736        // Logged from f/b/services/.../BootReceiver.java.
5737        SHUTDOWN_UMOUNT_STAT = 2;
5738        // Reprepsents fie system mounting error code of /data partition for the current boot.
5739        // Error codes defined as combination of FsStatFlags from system/core/fs_mgr/fs_mgr.cpp.
5740        // Logged from f/b/services/.../BootReceiver.java.
5741        FS_MGR_FS_STAT_DATA_PARTITION = 3;
5742    }
5743
5744    // Type of the event.
5745    optional ErrorCodeEvent event = 1;
5746    // error code defined per each event type.
5747    // For example, this can have a value of FsStatFlags.FS_STAT_FULL_MOUNT_FAILED for the event of
5748    // FS_MGR_FS_STAT.
5749    optional int32 error_code = 2;
5750}
5751
5752/**
5753 * Collects Virtual A/B statistics related to the use of dm-snapshot performed
5754 * after an OTA.
5755 *
5756 * Logged from:
5757 *  - system/update_engine/cleanup_previous_update_action.cc
5758 */
5759message SnapshotMergeReported {
5760    // Keep in sync with
5761    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
5762    enum UpdateState {
5763        // No update or merge is in progress.
5764        NONE = 0;
5765        // An update is applying; snapshots may already exist.
5766        INITIATED = 1;
5767        // An update is pending, but has not been successfully booted yet.
5768        UNVERIFIED = 2;
5769        // The kernel is merging in the background.
5770        MERGING = 3;
5771        // Post-merge cleanup steps could not be completed due to a transient
5772        // error, but the next reboot will finish any pending operations.
5773        MERGE_NEEDS_REBOOT = 4;
5774        // Merging is complete, and needs to be acknowledged.
5775        MERGE_COMPLETED = 5;
5776        // Merging failed due to an unrecoverable error.
5777        MERGE_FAILED = 6;
5778        // The update was implicitly cancelled, either by a rollback or a flash
5779        // operation via fastboot. This state can only be returned by WaitForMerge.
5780        CANCELLED = 7;
5781    };
5782
5783    // Status codes correspond to specific failure conditions in
5784    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.cpp
5785    //
5786    // Keep in sync with
5787    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
5788    enum MergeFailureCode {
5789        OK = 0;
5790        READ_STATUS = 1;
5791        GET_TABLE_INFO = 2;
5792        UNKNOWN_TABLE = 3;
5793        GET_TABLE_PARAMS = 4;
5794        ACTIVATE_NEW_TABLE = 5;
5795        ACQUIRE_LOCK = 6;
5796        LIST_SNAPSHOTS = 7;
5797        WRITE_STATUS = 8;
5798        UNKNOWN_TARGET_TYPE = 9;
5799        QUERY_SNAPSHOT_STATUS = 10;
5800        EXPECTED_MERGE_TARGET = 11;
5801        UNMERGED_SECTORS_AFTER_COMPLETION = 12;
5802        UNEXPECTED_MERGE_STATE = 13;
5803    };
5804
5805    // Status of the update after the merge attempts.
5806    optional UpdateState final_state = 1;
5807
5808    // Time to complete a merge operation in milliseconds.
5809    // A negative value corresponds to the case in which the merge operation
5810    // was interrupted and resumed (e.g. in case of a system reboot during the
5811    // merge).
5812    optional int64 duration_millis = 2;
5813
5814    // Number of reboots that occurred after issuing and before completing the
5815    // merge of all the snapshot devices.
5816    optional int32 intermediate_reboots = 3;
5817
5818    // The device has been upgraded to Virtual A/B.
5819    optional bool is_vab_retrofit = 4;
5820
5821    // Space that has been temporarily allocated in the /data partition
5822    // containing the dm-snapshot's copy-on-write data generated during a
5823    // Virtual A/B update.
5824    optional int64 cow_file_size_bytes = 5;
5825
5826    // Whether the device enables Virtual A/B compression.
5827    optional bool vab_compression_enabled = 6;
5828
5829    // Whether this update attempt uses Virtual A/B compression.
5830    optional bool vab_compression_used = 7;
5831
5832    // Total size used by COWs, including /data and the super partition.
5833    optional int64 total_cow_size_bytes = 8;
5834
5835    // Sum of the estimated COW fields in the OTA manifest.
5836    optional int64 estimated_cow_size_bytes = 9;
5837
5838    // Time from boot to sys.boot_completed, in milliseconds.
5839    optional int32 boot_complete_time_millis = 10;
5840
5841    // Time from sys.boot_completed to merge start, in milliseconds.
5842    optional int32 boot_complete_to_merge_start_time_millis = 11;
5843
5844    optional MergeFailureCode merge_failure_code = 12;
5845
5846    // Build fingerprint at the time the OTA was downloaded.
5847    optional string source_build_fingerprint = 13;
5848
5849    // Build fingerprint at the time the merge was initiated.
5850    optional string target_build_fingerprint = 14;
5851}
5852
5853/**
5854 * Event representing when BlobStoreManager.Session#commit() is called
5855 *
5856 * Logged from:
5857 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
5858 */
5859message BlobCommitted {
5860    // Uid of the Blob committer
5861    optional int32 uid = 1 [(is_uid) = true];
5862
5863    // Id of the Blob committed
5864    optional int64 blob_id = 2;
5865
5866    // Size of the Blob
5867    optional int64 size = 3;
5868
5869    enum Result {
5870        UNKNOWN = 0;
5871        // Commit Succeeded
5872        SUCCESS = 1;
5873        // Commit Failed: Error occurred during commit
5874        ERROR_DURING_COMMIT = 2;
5875        // Commit Failed: Digest of the data did not match Blob digest
5876        DIGEST_MISMATCH = 3;
5877        // Commit Failed: Allowed count limit exceeded
5878        COUNT_LIMIT_EXCEEDED = 4;
5879    }
5880    optional Result result = 4;
5881}
5882
5883/**
5884 * Event representing when BlobStoreManager#acquireLease() is called
5885 *
5886 * Logged from:
5887 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
5888 */
5889message BlobLeased{
5890    // Uid of the Blob leasee
5891    optional int32 uid = 1 [(is_uid) = true];
5892
5893    // Id of the Blob leased or 0 if the Blob does not exist
5894    optional int64 blob_id = 2;
5895
5896    // Size of the Blob or 0 if the Blob does not exist
5897    optional int64 size = 3;
5898
5899    enum Result {
5900        UNKNOWN = 0;
5901        // Lease Succeeded
5902        SUCCESS = 1;
5903        // Lease Failed: Blob does not exist
5904        BLOB_DNE = 2;
5905        // Lease Failed: Leasee does not have access to the Blob
5906        ACCESS_NOT_ALLOWED = 3;
5907        // Lease Failed: Leasee requested an invalid expiry duration
5908        LEASE_EXPIRY_INVALID = 4;
5909        // Lease Failed: Leasee has exceeded the total data lease limit
5910        DATA_SIZE_LIMIT_EXCEEDED = 5;
5911        // Leasee Failed: Allowed count limit exceeded
5912        COUNT_LIMIT_EXCEEDED = 6;
5913    }
5914    optional Result result = 4;
5915}
5916
5917/**
5918 * Event representing when BlobStoreManager#openBlob() is called
5919 *
5920 * Logged from:
5921 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
5922 */
5923message BlobOpened{
5924    // Uid of the Blob opener
5925    optional int32 uid = 1 [(is_uid) = true];
5926
5927    // Id of the Blob opened or 0 if the Blob does not exist
5928    optional int64 blob_id = 2;
5929
5930    // Size of the Blob or 0 if the Blob does not exist
5931    optional int64 size = 3;
5932
5933    enum Result {
5934        UNKNOWN = 0;
5935        // Open Succeeded
5936        SUCCESS = 1;
5937        // Open Failed: Blob does not exist
5938        BLOB_DNE = 2;
5939        // Open Failed: Opener does not have access to the Blob
5940        ACCESS_NOT_ALLOWED = 3;
5941    }
5942    optional Result result = 4;
5943}
5944
5945/**
5946 * Event to track Jank for various system interactions.
5947 *
5948 * Logged from:
5949 *  frameworks/base/core/java/com/android/internal/jank/FrameTracker.java
5950 *
5951 * Next Tag: 31
5952 */
5953message UIInteractionFrameInfoReported {
5954    enum InteractionType {
5955        UNKNOWN = 0;
5956        NOTIFICATION_SHADE_SWIPE = 1;
5957        SHADE_EXPAND_COLLAPSE_LOCK = 2;
5958        SHADE_SCROLL_FLING = 3;
5959        SHADE_ROW_EXPAND = 4;
5960        SHADE_ROW_SWIPE = 5;
5961        SHADE_QS_EXPAND_COLLAPSE = 6;
5962        SHADE_QS_SCROLL_SWIPE = 7;
5963        LAUNCHER_APP_LAUNCH_FROM_RECENTS = 8;
5964        LAUNCHER_APP_LAUNCH_FROM_ICON = 9;
5965        LAUNCHER_APP_CLOSE_TO_HOME = 10;
5966        LAUNCHER_APP_CLOSE_TO_PIP = 11;
5967        LAUNCHER_QUICK_SWITCH = 12;
5968        SHADE_HEADS_UP_APPEAR = 13;
5969        SHADE_HEADS_UP_DISAPPEAR = 14;
5970        SHADE_NOTIFICATION_ADD = 15;
5971        SHADE_NOTIFICATION_REMOVE = 16;
5972        SHADE_APP_LAUNCH = 17;
5973        LOCKSCREEN_PASSWORD_APPEAR = 18;
5974        LOCKSCREEN_PATTERN_APPEAR = 19;
5975        LOCKSCREEN_PIN_APPEAR = 20;
5976        LOCKSCREEN_PASSWORD_DISAPPEAR = 21;
5977        LOCKSCREEN_PATTERN_DISAPPEAR = 22;
5978        LOCKSCREEN_PIN_DISAPPEAR = 23;
5979        LOCKSCREEN_TRANSITION_FROM_AOD = 24;
5980        LOCKSCREEN_TRANSITION_TO_AOD = 25;
5981        LAUNCHER_OPEN_ALL_APPS = 26;
5982        LAUNCHER_ALL_APPS_SCROLL = 27;
5983        LAUNCHER_APP_LAUNCH_FROM_WIDGET = 28;
5984        SETTINGS_PAGE_SCROLL = 29;
5985        LOCKSCREEN_UNLOCK_ANIMATION = 30;
5986        SHADE_APP_LAUNCH_FROM_HISTORY_BUTTON = 31;
5987        SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER = 32;
5988        SHADE_APP_LAUNCH_FROM_QS_TILE = 33;
5989        SHADE_APP_LAUNCH_FROM_SETTINGS_BUTTON = 34;
5990        STATUS_BAR_APP_LAUNCH_FROM_CALL_CHIP = 35;
5991    }
5992
5993    optional InteractionType interaction_type = 1;
5994
5995    // Number of frames rendered during the interaction.
5996    optional int64 total_frames = 2;
5997
5998    // Number of frames that were skipped in rendering during the interaction.
5999    optional int64 missed_frames = 3;
6000
6001    // Number of frames that were missed in Surface Flinger during the interaction.
6002    optional int64 sf_missed_frames = 5;
6003
6004    // Number of frames that were missed in the app during the interaction.
6005    optional int64 app_missed_frames = 6;
6006
6007    // Maximum time it took to render a single frame during the interaction.
6008    optional int64 max_frame_time_nanos = 4;
6009}
6010
6011/**
6012 * Event to track various latencies in SystemUI.
6013 *
6014 * Logged from:
6015 *  frameworks/base/core/java/com/android/internal/util/LatencyTracker.java
6016 */
6017message UIActionLatencyReported {
6018    enum ActionType {
6019        UNKNOWN = 0;
6020        ACTION_EXPAND_PANEL = 1;
6021        ACTION_TOGGLE_RECENTS = 2;
6022        ACTION_FINGERPRINT_WAKE_AND_UNLOCK = 3;
6023        ACTION_CHECK_CREDENTIAL = 4;
6024        ACTION_CHECK_CREDENTIAL_UNLOCKED = 5;
6025        ACTION_TURN_ON_SCREEN = 6;
6026        ACTION_ROTATE_SCREEN = 7;
6027        ACTION_FACE_WAKE_AND_UNLOCK = 8;
6028        ACTION_START_RECENTS_ANIMATION = 9;
6029        ACTION_ROTATE_SCREEN_CAMERA_CHECK = 10;
6030        ACTION_ROTATE_SCREEN_SENSOR = 11;
6031        ACTION_LOCKSCREEN_UNLOCK = 12;
6032    }
6033
6034    optional ActionType action = 1;
6035
6036    optional int64 latency_millis = 2;
6037}
6038
6039//////////////////////////////////////////////////////////////////////
6040// Pulled atoms below this line //
6041//////////////////////////////////////////////////////////////////////
6042
6043/**
6044 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
6045 *
6046 * Pulled from:
6047 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
6048 */
6049message WifiBytesTransfer {
6050    optional int32 uid = 1 [(is_uid) = true];
6051
6052    optional int64 rx_bytes = 2;
6053
6054    optional int64 rx_packets = 3;
6055
6056    optional int64 tx_bytes = 4;
6057
6058    optional int64 tx_packets = 5;
6059}
6060
6061/**
6062 * Pulls bytes transferred via wifi (separated by foreground and background usage).
6063 *
6064 * Pulled from:
6065 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
6066 */
6067message WifiBytesTransferByFgBg {
6068    optional int32 uid = 1 [(is_uid) = true];
6069
6070    // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
6071    optional bool is_foreground = 2;
6072
6073    optional int64 rx_bytes = 3;
6074
6075    optional int64 rx_packets = 4;
6076
6077    optional int64 tx_bytes = 5;
6078
6079    optional int64 tx_packets = 6;
6080}
6081
6082/**
6083 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
6084 *
6085 * Pulled from:
6086 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
6087 */
6088message MobileBytesTransfer {
6089    optional int32 uid = 1 [(is_uid) = true];
6090
6091    optional int64 rx_bytes = 2;
6092
6093    optional int64 rx_packets = 3;
6094
6095    optional int64 tx_bytes = 4;
6096
6097    optional int64 tx_packets = 5;
6098}
6099
6100/**
6101 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
6102 *
6103 * Pulled from:
6104 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
6105 */
6106message MobileBytesTransferByFgBg {
6107    optional int32 uid = 1 [(is_uid) = true];
6108
6109    // 1 denotes foreground and 0 denotes background. This is called Set in
6110    // NetworkStats.
6111    optional bool is_foreground = 2;
6112
6113    optional int64 rx_bytes = 3;
6114
6115    optional int64 rx_packets = 4;
6116
6117    optional int64 tx_bytes = 5;
6118
6119    optional int64 tx_packets = 6;
6120}
6121
6122/**
6123 * Used for pull network statistics via mobile|wifi networks, and sliced by interesting dimensions.
6124 * Note that the data is expected to be sliced into more dimensions in future. In other words,
6125 * the caller must not assume any row of data is one full report when filtering with a set of
6126 * matching conditions, because future data may represent with multiple rows what is currently
6127 * represented by one.
6128 * To avoid being broken by future slicing, callers must take care to aggregate rows even if they
6129 * query all the existing columns.
6130 *
6131 * Pulled from:
6132 *   StatsPullAtomService (using NetworkStatsService to get NetworkStats)
6133 */
6134message DataUsageBytesTransfer {
6135    // State of this record. Should be NetworkStats#SET_DEFAULT or NetworkStats#SET_FOREGROUND to
6136    // indicate the foreground state, or NetworkStats#SET_ALL to indicate the record is for all
6137    // states combined, not including debug states. See NetworkStats#SET_*.
6138    optional int32 state = 1;
6139
6140    optional int64 rx_bytes = 2;
6141
6142    optional int64 rx_packets = 3;
6143
6144    optional int64 tx_bytes = 4;
6145
6146    optional int64 tx_packets = 5;
6147
6148    // Radio Access Technology (RAT) type of this record, should be one of
6149    // TelephonyManager#NETWORK_TYPE_* constants, or NetworkTemplate#NETWORK_TYPE_ALL to indicate
6150    // the record is for all rat types combined.
6151    optional int32 rat_type = 6;
6152
6153    // Mcc/Mnc read from sim if the record is for a specific subscription, null indicates the
6154    // record is combined across subscriptions.
6155    optional string sim_mcc = 7;
6156    optional string sim_mnc = 8;
6157
6158    // Allows mobile virtual network operators (MVNOs) to be identified with individual IDs.
6159    // See TelephonyManager#getSimCarrierId.
6160    optional int32 carrier_id = 9;
6161
6162    // Enumeration of opportunistic states with an additional ALL state indicates the record is
6163    // combined regardless of the boolean value in its field.
6164    enum DataSubscriptionState {
6165        UNKNOWN = 0; // For server side backward compatibility.
6166        ALL = 1;
6167        OPPORTUNISTIC = 2;
6168        NOT_OPPORTUNISTIC = 3;
6169    }
6170    // Mark whether the subscription is an opportunistic data subscription, and ALL indicates the
6171    // record is combined across opportunistic data subscriptions.
6172    // See {@link SubscriptionManager#setOpportunistic}.
6173    optional DataSubscriptionState opportunistic_data_sub = 10;
6174
6175    // Indicate whether NR is connected, server side could use this with RAT type to determine if
6176    // the record is for 5G NSA (Non Stand Alone) mode, where the primary cell is still LTE and
6177    // network allocates a secondary 5G cell so telephony reports RAT = LTE along with NR state as
6178    // connected.
6179    optional bool is_nr_connected = 11;
6180}
6181
6182/**
6183 * Pulls bytes transferred via OEM managed networks. Data is split up by which
6184 * type of OEM managed network it is, what transport it went over, and if it was
6185 * in the foreground or background.
6186 *
6187 * Pulled from:
6188 *   StatsPullAtomService
6189 */
6190 message OemManagedBytesTransfer {
6191    optional int32 uid = 1 [(is_uid) = true];
6192
6193    // 1 denotes foreground and 0 denotes background. This is called Set in
6194    // NetworkStats.
6195    optional bool is_foreground = 2;
6196
6197    // Corresponds to the type of OEM managed network, see
6198    // {@link NetworkTemplate#OEM_MANAGED_ANY} and {@code NetworkIdentity#OEM_*}.
6199    optional int32 oem_managed_type = 3;
6200
6201    // Corresponds to the type of transport the bytes were transferred over, see
6202    // {@link NetworkTemplate#transportToMatchRule} and
6203    // {@code NetworkCapabilities#TRANSPORT_*}
6204    optional int32 transport_type = 4;
6205
6206    optional int64 rx_bytes = 5;
6207
6208    optional int64 rx_packets = 6;
6209
6210    optional int64 tx_bytes = 7;
6211
6212    optional int64 tx_packets = 8;
6213  }
6214
6215/**
6216 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
6217 *
6218 * Pulled from:
6219 *   StatsCompanionService
6220 */
6221message BluetoothBytesTransfer {
6222    optional int32 uid = 1 [(is_uid) = true];
6223
6224    optional int64 rx_bytes = 2;
6225
6226    optional int64 tx_bytes = 3;
6227}
6228
6229/**
6230 * Pulls the kernel wakelock durations. This atom is adapted from
6231 * android/internal/os/KernelWakelockStats.java
6232 *
6233 * Pulled from:
6234 *   StatsCompanionService using KernelWakelockReader.
6235 */
6236message KernelWakelock {
6237    optional string name = 1;
6238
6239    optional int32 count = 2;
6240
6241    optional int32 version = 3;
6242
6243    optional int64 time_micros = 4;
6244}
6245
6246/**
6247 * Pulls power state information.
6248 * Pulled from:
6249 *   frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
6250 */
6251message SubsystemSleepState {
6252    // Subsystem name
6253    optional string subsystem_name = 1;
6254    // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
6255    // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
6256    // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
6257    //    powerEntityStateName from the corresponding PowerEntityStateInfo.
6258    optional string subname = 2;
6259    // The number of times it entered, or voted for entering the sleep state
6260    optional uint64 count = 3;
6261    // The length of time spent in, or spent voting for, the sleep state
6262    optional uint64 time_millis = 4;
6263}
6264
6265/**
6266 * Pulls on-device power measurement information.
6267 * Pulled from:
6268 *   frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
6269 */
6270message OnDevicePowerMeasurement {
6271    // Name of the subsystem (to which the rail belongs).
6272    optional string subsystem_name = 1;
6273
6274    // Rail name. The rail lies within the subsystem.
6275    optional string rail_name = 2;
6276
6277    // Time (in ms since boot) at which the rail energy value was measured.
6278    // This may differ slightly from the time that statsd logs this information.
6279    optional uint64 measurement_timestamp_millis = 3;
6280
6281    // Accumulated energy used via the rail since device boot in uWs.
6282    optional uint64 energy_microwatt_secs = 4;
6283}
6284
6285/**
6286 * Pulls Cpu time per cluster per frequency.
6287 * This is tracked by the time_in_state eBPF program.
6288 */
6289message CpuTimePerClusterFreq {
6290    optional uint32 cluster = 1;
6291    optional uint32 freq_khz = 2;
6292    // Time spent at this frequency excluding sleep since tracking started.
6293    optional uint64 time_millis = 3;
6294}
6295
6296/**
6297 * Pulls Cpu Time Per Uid.
6298 * Note that isolated process uid time should be attributed to host uids.
6299 */
6300message CpuTimePerUid {
6301    optional int32 uid = 1 [(is_uid) = true];
6302    optional uint64 user_time_micros = 2;
6303    optional uint64 sys_time_micros = 3;
6304}
6305
6306/**
6307 * Pulls Cpu Cycles Per Uid Per Cluster.
6308 * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
6309 * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
6310 * because they are recycled and removed from the underlying data source. All uids are normalized
6311 * to their base uids.
6312 */
6313message CpuCyclesPerUidCluster {
6314    optional int32 uid = 1 [(is_uid) = true];
6315    optional int32 cluster = 2;
6316    // Megacycles, i.e. millions of cycles.
6317    optional int64 mcycles = 3;
6318    // Time excluding sleep since tracking started.
6319    optional int64 time_millis = 4;
6320    // Power estimate: time * average power for frequency / 1000.
6321    optional int64 power_profile_estimate = 5;
6322}
6323
6324/**
6325 * Pulls Cpu Time Per Uid per frequency.
6326 * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
6327 * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
6328 * because they are recycled and removed from the underlying data source. All uids are normalized
6329 * to their base uids.
6330 */
6331message CpuTimePerUidFreq {
6332    optional int32 uid = 1 [(is_uid) = true];
6333    optional uint32 freq_index = 2;
6334    optional uint64 time_millis = 3;
6335}
6336
6337/**
6338  * Pulls Cpu Cycles Per ThreadGroup Per Cluster.
6339  * This is tracked by the time_in_state eBPF program.
6340  */
6341message CpuCyclesPerThreadGroupCluster {
6342    enum ThreadGroup {
6343        UNKNOWN_THREAD_GROUP = 0;
6344
6345        // System server threads serving Binder calls.
6346        SYSTEM_SERVER_BINDER = 1;
6347
6348        // All system server threads.
6349        SYSTEM_SERVER = 2;
6350
6351        // All surface flinger threads.
6352        SURFACE_FLINGER = 3;
6353    }
6354    optional ThreadGroup thread_group = 1;
6355
6356    optional int32 cluster = 2;
6357
6358    // Megacycles, i.e. millions of cycles.
6359    optional int64 mcycles = 3;
6360    // Time excluding sleep since tracking started.
6361    optional int64 time_millis = 4;
6362}
6363
6364/**
6365 * Pulls Wifi Controller Activity Energy Info
6366 */
6367message WifiActivityInfo {
6368    // timestamp(wall clock) of record creation
6369    optional uint64 timestamp_millis = 1;
6370    // stack reported state
6371    // TODO: replace this with proto enum
6372    optional int32 stack_state = 2;
6373    // tx time in millis
6374    optional uint64 controller_tx_time_millis = 3;
6375    // rx time in millis
6376    optional uint64 controller_rx_time_millis = 4;
6377    // idle time in millis
6378    optional uint64 controller_idle_time_millis = 5;
6379    // product of current(mA), voltage(V) and time(ms)
6380    optional uint64 controller_energy_used = 6;
6381}
6382
6383/**
6384 * Pulls Modem Activity Energy Info
6385 */
6386message ModemActivityInfo {
6387    // timestamp(wall clock) of record creation
6388    optional uint64 timestamp_millis = 1;
6389    // sleep time in millis.
6390    optional uint64 sleep_time_millis = 2;
6391    // idle time in millis
6392    optional uint64 controller_idle_time_millis = 3;
6393    /**
6394     * Tx power index
6395     * index 0 = tx_power < 0dBm
6396     * index 1 = 0dBm < tx_power < 5dBm
6397     * index 2 = 5dBm < tx_power < 15dBm
6398     * index 3 = 15dBm < tx_power < 20dBm
6399     * index 4 = tx_power > 20dBm
6400     */
6401    // tx time in ms at power level 0
6402    optional uint64 controller_tx_time_pl0_millis = 4;
6403    // tx time in ms at power level 1
6404    optional uint64 controller_tx_time_pl1_millis = 5;
6405    // tx time in ms at power level 2
6406    optional uint64 controller_tx_time_pl2_millis = 6;
6407    // tx time in ms at power level 3
6408    optional uint64 controller_tx_time_pl3_millis = 7;
6409    // tx time in ms at power level 4
6410    optional uint64 controller_tx_time_pl4_millis = 8;
6411    // rx time in ms at power level 5
6412    optional uint64 controller_rx_time_millis = 9;
6413    // product of current(mA), voltage(V) and time(ms)
6414    optional uint64 energy_used = 10 [deprecated=true];
6415}
6416
6417/**
6418 * Pulls Bluetooth Activity Energy Info
6419 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
6420 */
6421message BluetoothActivityInfo {
6422    // timestamp(wall clock) of record creation
6423    optional uint64 timestamp_millis = 1;
6424    // bluetooth stack state
6425    optional int32 bluetooth_stack_state = 2;
6426    // tx time in millis
6427    optional uint64 controller_tx_time_millis = 3;
6428    // rx time in millis
6429    optional uint64 controller_rx_time_millis = 4;
6430    // idle time in millis
6431    optional uint64 controller_idle_time_millis = 5;
6432    // product of current(mA), voltage(V) and time(ms)
6433    optional uint64 energy_used = 6;
6434}
6435
6436/*
6437 * Logs the memory stats for a process.
6438 *
6439 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
6440 */
6441message ProcessMemoryState {
6442    // The uid if available. -1 means not available.
6443    optional int32 uid = 1 [(is_uid) = true];
6444
6445    // The process name.
6446    // Usually package name, "system" for system server.
6447    // Provided by ActivityManagerService.
6448    optional string process_name = 2;
6449
6450    // Current OOM score adjustment. Value read from ProcessRecord.
6451    optional int32 oom_adj_score = 3;
6452
6453    // # of page-faults
6454    optional int64 page_fault = 4;
6455
6456    // # of major page-faults
6457    optional int64 page_major_fault = 5;
6458
6459    // RSS
6460    // Value is read from memory.stat, field total_rss if per-app memory
6461    // cgroups are enabled. Otherwise, value from /proc/pid/stat.
6462    optional int64 rss_in_bytes = 6;
6463
6464    // CACHE
6465    // Value is read from memory.stat, field total_cache if per-app memory
6466    // cgroups are enabled. Otherwise, 0.
6467    optional int64 cache_in_bytes = 7;
6468
6469    // SWAP
6470    // Value is read from memory.stat, field total_swap if per-app memory
6471    // cgroups are enabled. Otherwise, 0.
6472    optional int64 swap_in_bytes = 8;
6473
6474    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always -1.
6475    optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
6476
6477    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
6478    optional int64 start_time_nanos = 10 [deprecated = true];
6479
6480    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
6481    optional int32 anon_rss_and_swap_in_kilobytes = 11 [deprecated = true];
6482}
6483
6484/*
6485 * Logs the memory high-water mark for a process.
6486 *
6487 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
6488 * and for selected native processes.
6489 *
6490 * Pulling this atom resets high-water mark counters for all processes.
6491 */
6492message ProcessMemoryHighWaterMark {
6493    // The uid if available. -1 means not available.
6494    optional int32 uid = 1 [(is_uid) = true];
6495
6496    // The process name.
6497    // Usually package name or process cmdline.
6498    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
6499    optional string process_name = 2;
6500
6501    // Deprecated: use rss_high_water_mark_in_kilobytes instead. This field is
6502    // computed by converting kilobytes to bytes.
6503    optional int64 rss_high_water_mark_in_bytes = 3 [deprecated = true];
6504
6505    // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
6506    // /proc/PID/status.
6507    optional int32 rss_high_water_mark_in_kilobytes = 4;
6508}
6509
6510/*
6511 * Logs the memory stats for a process.
6512 *
6513 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService)
6514 * and for selected native processes.
6515 */
6516message ProcessMemorySnapshot {
6517    // The uid if available. -1 means not available.
6518    optional int32 uid = 1 [(is_uid) = true];
6519
6520    // The process name.
6521    // Usually package name or process cmdline.
6522    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
6523    optional string process_name = 2;
6524
6525    // The pid of the process.
6526    // Allows to disambiguate instances of the process.
6527    optional int32 pid = 3;
6528
6529    // The current OOM score adjustment value.
6530    // Read from ProcessRecord for managed processes.
6531    // Placeholder -1001 (OOM_SCORE_ADJ_MIN - 1, outside of allowed range) for native ones.
6532    optional int32 oom_score_adj = 4;
6533
6534    // The current RSS of the process.
6535    // VmRSS from /proc/pid/status.
6536    optional int32 rss_in_kilobytes = 5;
6537
6538    // The current anon RSS of the process.
6539    // RssAnon from /proc/pid/status.
6540    optional int32 anon_rss_in_kilobytes = 6;
6541
6542    // The current swap size of the process.
6543    // VmSwap from /proc/pid/status.
6544    optional int32 swap_in_kilobytes = 7;
6545
6546    // The sum of rss_in_kilobytes and swap_in_kilobytes.
6547    optional int32 anon_rss_and_swap_in_kilobytes = 8;
6548}
6549
6550/*
6551 * Elapsed real time from SystemClock.
6552 */
6553message SystemElapsedRealtime {
6554    optional uint64 time_millis = 1;
6555}
6556
6557/*
6558 * Up time from SystemClock.
6559 */
6560message SystemUptime {
6561    // Milliseconds since the system was booted.
6562    // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
6563    // for external input).
6564    // It is not affected by clock scaling, idle, or other power saving mechanisms.
6565    optional uint64 uptime_millis = 1;
6566}
6567
6568/*
6569 * Reads from /proc/uid_concurrent_active_time which has the format:
6570 * active: X (X is # cores)
6571 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
6572 * [uid1]: [time-0] [time-1] [time-2] ... ...
6573 * ...
6574 * Time-N means the CPU time a UID spent running concurrently with N other processes.
6575 * The file contains a monotonically increasing count of time for a single boot.
6576 */
6577message CpuActiveTime {
6578    optional int32 uid = 1 [(is_uid) = true];
6579    optional uint64 time_millis = 2;
6580}
6581
6582/**
6583 * Reads from /proc/uid_concurrent_policy_time which has the format:
6584 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
6585 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
6586 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
6587 * ...
6588 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
6589 * The file contains a monotonically increasing count of time for a single boot.
6590 */
6591message CpuClusterTime {
6592    optional int32 uid = 1 [(is_uid) = true];
6593    optional int32 cluster_index = 2;
6594    optional uint64 time_millis = 3;
6595}
6596
6597/*
6598 * Pulls free disk space, for data, system partition and temporary directory.
6599 */
6600message DiskSpace {
6601    // available bytes in data partition
6602    optional uint64 data_available_bytes = 1;
6603    // available bytes in system partition
6604    optional uint64 system_available_bytes = 2;
6605    // available bytes in download cache or temp directories
6606    optional uint64 temp_available_bytes = 3;
6607}
6608
6609/**
6610 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
6611 *
6612 * Pulled from StatsCompanionService.java
6613 */
6614message RemainingBatteryCapacity {
6615    optional int32 charge_micro_ampere_hour = 1;
6616}
6617
6618/**
6619 * Pulls battery capacity, which is the battery capacity when full in uAh.
6620 * Pulled from:
6621 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
6622 */
6623message FullBatteryCapacity {
6624    optional int32 capacity_micro_ampere_hour = 1;
6625}
6626
6627/**
6628 * Pulls battery voltage.
6629 * Pulled from:
6630 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
6631 */
6632message BatteryVoltage {
6633    // The voltage of the battery, in millivolts.
6634    optional int32 voltage_millivolt = 1;
6635}
6636
6637/**
6638 * Pulls battery level (percent full, from 0 to 100).
6639 *
6640 * Pulled from:
6641 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
6642 */
6643message BatteryLevel {
6644    // Battery level. Should be in [0, 100].
6645    optional int32 battery_level = 1;
6646}
6647
6648/**
6649 * Pulls the temperature of various parts of the device.
6650 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
6651 *
6652 * Pulled from StatsCompanionService.java
6653 */
6654message Temperature {
6655    // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
6656    optional android.os.TemperatureTypeEnum sensor_location = 1;
6657
6658    // The name of the temperature source. Eg. CPU0
6659    optional string sensor_name = 2;
6660
6661    // Temperature in tenths of a degree C.
6662    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
6663    optional int32 temperature_deci_celsius = 3;
6664
6665    // Relative severity of the throttling, see enum definition.
6666    optional android.os.ThrottlingSeverityEnum severity = 4;
6667}
6668
6669/**
6670 * Pulls the statistics of calls to Binder.
6671 *
6672 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
6673 * config on the device.
6674 *
6675 * Next tag: 15
6676 */
6677message BinderCalls {
6678    // UID of the process responsible for the binder transaction. It will be set if the process
6679    // executing the binder transaction attribute the transaction to another uid using
6680    // Binder.setThreadWorkSource().
6681    //
6682    // If not set, the value will be -1.
6683    optional int32 uid = 1 [(is_uid) = true];
6684    // UID of the process executing the binder transaction.
6685    optional int32 direct_caller_uid = 14;
6686    // Fully qualified class name of the API call.
6687    //
6688    // This is a system server class name.
6689    //
6690    // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
6691    // gets recycled and we have isolated uids, we might attribute the data incorrectly.
6692    // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
6693    // commonly used APIs.
6694    optional string service_class_name = 2;
6695    // Method name of the API call. It can also be a transaction code if we cannot
6696    // resolve it to a name. See Binder#getTransactionName.
6697    //
6698    // This is a system server method name.
6699    optional string service_method_name = 3;
6700    // Total number of API calls.
6701    optional int64 call_count = 4;
6702    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
6703    optional bool screen_interactive = 13;
6704    // Total number of API calls we have data recorded for. If we collected data for all the calls,
6705    // call_count will be equal to recorded_call_count.
6706    //
6707    // If recorded_call_count is different than call_count, it means data collection has been
6708    // sampled. All the fields below will be sampled in this case.
6709    optional int64 recorded_call_count = 12;
6710    // Number of exceptions thrown by the API.
6711    optional int64 recorded_exception_count = 5;
6712    // Total latency of all API calls.
6713    // Average can be computed using total_latency_micros / recorded_call_count.
6714    optional int64 recorded_total_latency_micros = 6;
6715    // Maximum latency of one API call.
6716    optional int64 recorded_max_latency_micros = 7;
6717    // Total CPU usage of all API calls.
6718    // Average can be computed using total_cpu_micros / recorded_call_count.
6719    // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
6720    optional int64 recorded_total_cpu_micros = 8;
6721    // Maximum CPU usage of one API call.
6722    optional int64 recorded_max_cpu_micros = 9;
6723    // Maximum parcel reply size of one API call.
6724    optional int64 recorded_max_reply_size_bytes = 10;
6725    // Maximum parcel request size of one API call.
6726    optional int64 recorded_max_request_size_bytes = 11;
6727}
6728
6729/**
6730 * Pulls the statistics of exceptions during calls to Binder.
6731 *
6732 * Binder stats are cumulative from boot unless somebody reset the data using
6733 * > adb shell dumpsys binder_calls_stats --reset
6734 */
6735message BinderCallsExceptions {
6736    // Exception class name, e.g. java.lang.IllegalArgumentException.
6737    //
6738    // This is an exception class name thrown by the system server.
6739    optional string exception_class_name = 1;
6740    // Total number of exceptions.
6741    optional int64 exception_count = 2;
6742}
6743
6744/**
6745 * Pulls the statistics of message dispatching on HandlerThreads.
6746 *
6747 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
6748 * config on the device.
6749 *
6750 * Next tag: 11
6751 */
6752message LooperStats {
6753    // The uid that made a call to the System Server and caused the message to be enqueued.
6754    optional int32 uid = 1 [(is_uid) = true];
6755
6756    // Fully qualified class name of the handler target class.
6757    //
6758    // This field does not contain PII. This is a system server class name.
6759    optional string handler_class_name = 2;
6760
6761    // The name of the thread that runs the Looper.
6762    //
6763    // This field does not contain PII. This is a system server thread name.
6764    optional string looper_thread_name = 3;
6765
6766    // The name of the dispatched message.
6767    //
6768    // This field does not contain PII. This is a system server constant or class
6769    // name.
6770    optional string message_name = 4;
6771
6772    // Total number of successfully dispatched messages.
6773    optional int64 message_count = 5;
6774
6775    // Total number of messages that failed dispatching.
6776    optional int64 exception_count = 6;
6777
6778    // Total number of processed messages we have data recorded for. If we
6779    // collected data for all the messages, message_count will be equal to
6780    // recorded_message_count.
6781    //
6782    // If recorded_message_count is different than message_count, it means data
6783    // collection has been sampled. The fields below will be sampled in this case.
6784    optional int64 recorded_message_count = 7;
6785
6786    // Total latency of all processed messages.
6787    // Average can be computed using recorded_total_latency_micros /
6788    // recorded_message_count.
6789    optional int64 recorded_total_latency_micros = 8;
6790
6791    // Total CPU usage of all processed message.
6792    // Average can be computed using recorded_total_cpu_micros /
6793    // recorded_message_count. Total can be computed using
6794    // recorded_total_cpu_micros / recorded_message_count * message_count.
6795    optional int64 recorded_total_cpu_micros = 9;
6796
6797    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
6798    optional bool screen_interactive = 10;
6799
6800    // Max recorded CPU usage of all processed messages.
6801    optional int64 recorded_max_cpu_micros = 11;
6802
6803    // Max recorded latency of all processed messages.
6804    optional int64 recorded_max_latency_micros = 12;
6805
6806    // Total number of messages we tracked the dispatching delay for. If we
6807    // collected data for all the messages, message_count will be equal to
6808    // recorded_delay_message_count.
6809    //
6810    // If recorded_delay_message_count is different than message_count, it means data
6811    // collection has been sampled or/and not all messages specified the target dispatch time.
6812    // The fields below will be sampled in this case.
6813    optional int64 recorded_delay_message_count = 13;
6814
6815    // Total dispatching delay of all processed messages.
6816    // Calculated as a difference between the target dispatching time (Message.when)
6817    // and the actual dispatching time.
6818    // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
6819    optional int64 recorded_total_delay_millis = 14;
6820
6821    // Max dispatching delay of all processed messages.
6822    // Calculated as a difference between the target dispatching time (Message.when)
6823    // and the actual dispatching time.
6824    optional int64 recorded_max_delay_millis = 15;
6825}
6826
6827/**
6828 * Pulls disk information, such as write speed and latency.
6829 */
6830message DiskStats {
6831    // Time taken to open, write 512B to, and close a file.
6832    // -1 if error performing the check.
6833    optional int64 data_write_latency_millis = 1;
6834
6835    optional bool file_based_encryption = 2;
6836
6837    // Recent disk write speed in kB/s.
6838    // -1 if error querying storageed.
6839    // 0 if data is unavailable.
6840    optional int32 recent_disk_write_speed = 3;
6841}
6842
6843
6844/**
6845 * Free and total bytes of the Data, Cache, and System partition.
6846 */
6847message DirectoryUsage {
6848    enum Directory {
6849        UNKNOWN = 0;
6850        DATA = 1;
6851        CACHE = 2;
6852        SYSTEM = 3;
6853    }
6854    optional Directory directory = 1;
6855    optional int64 free_bytes = 2;
6856    optional int64 total_bytes = 3;
6857}
6858
6859
6860/**
6861 * Size of an application: apk size, data size, and cache size.
6862 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
6863 * Information is only reported for apps with the primary user (user 0).
6864 * Sizes are aggregated by package name.
6865 */
6866message AppSize {
6867    // Including uids will involve modifying diskstats logic.
6868    optional string package_name = 1;
6869    // App size in bytes. -1 if unavailable.
6870    optional int64 app_size_bytes = 2;
6871    // App data size in bytes. -1 if unavailable.
6872    optional int64 app_data_size_bytes = 3;
6873    // App cache size in bytes. -1 if unavailable.
6874    optional int64 app_cache_size_bytes = 4;
6875    // Time that the cache file was produced.
6876    // Uses System.currentTimeMillis(), which is wall clock time.
6877    optional int64 cache_time_millis = 5;
6878}
6879
6880
6881/**
6882 * Size of a particular category. Eg: photos, videos.
6883 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
6884 */
6885message CategorySize {
6886    enum Category {
6887        UNKNOWN = 0;
6888        APP_SIZE = 1;
6889        APP_DATA_SIZE = 2;
6890        APP_CACHE_SIZE = 3;
6891        PHOTOS = 4;
6892        VIDEOS = 5;
6893        AUDIO = 6;
6894        DOWNLOADS = 7;
6895        SYSTEM = 8;
6896        OTHER = 9;
6897    }
6898    optional Category category = 1;
6899    // Category size in bytes.
6900    optional int64 size_bytes = 2;
6901    // Time that the cache file was produced.
6902    // Uses System.currentTimeMillis(), which is wall clock time.
6903    optional int64 cache_time_millis = 3;
6904}
6905
6906/**
6907 * Pulls per uid I/O stats. The stats are cumulative since boot.
6908 *
6909 * Read/write bytes are I/O events from a storage device
6910 * Read/write chars are data requested by read/write syscalls, and can be
6911 *   satisfied by caching.
6912 *
6913 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
6914 */
6915message DiskIo {
6916    optional int32 uid = 1 [(is_uid) = true];
6917    optional int64 fg_chars_read = 2;
6918    optional int64 fg_chars_write = 3;
6919    optional int64 fg_bytes_read = 4;
6920    optional int64 fg_bytes_write = 5;
6921    optional int64 bg_chars_read = 6;
6922    optional int64 bg_chars_write = 7;
6923    optional int64 bg_bytes_read = 8;
6924    optional int64 bg_bytes_write = 9;
6925    optional int64 fg_fsync = 10;
6926    optional int64 bg_fsync= 11;
6927}
6928
6929
6930/**
6931 * Pulls the number of fingerprints for each user.
6932 *
6933 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
6934 */
6935message NumFingerprintsEnrolled {
6936    // The associated user. Eg: 0 for owners, 10+ for others.
6937    // Defined in android/os/UserHandle.java
6938    optional int32 user = 1;
6939    // Number of fingerprints registered to that user.
6940    optional int32 num_fingerprints_enrolled = 2;
6941}
6942
6943/**
6944 * Pulls the number of faces for each user.
6945 *
6946 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
6947 */
6948message NumFacesEnrolled {
6949    // The associated user. Eg: 0 for owners, 10+ for others.
6950    // Defined in android/os/UserHandle.java
6951    optional int32 user = 1;
6952    // Number of faces registered to that user.
6953    optional int32 num_faces_enrolled = 2;
6954}
6955/**
6956 * A mapping of role holder -> role
6957 */
6958message RoleHolder {
6959    // uid of the role holder
6960    optional int32 uid = 1 [(is_uid) = true];
6961
6962    // package name of the role holder
6963    optional string package_name = 2;
6964
6965    // the role held
6966    optional string role = 3;
6967}
6968
6969message AggStats {
6970    // These are all in byte resolution.
6971    optional int64 min = 1 [deprecated = true];
6972    optional int64 average = 2 [deprecated = true];
6973    optional int64 max = 3 [deprecated = true];
6974
6975    // These are all in kilobyte resolution. Can fit in int32, so smaller on the wire than the above
6976    // int64 fields.
6977    optional int32 mean_kb = 4;
6978    optional int32 max_kb = 5;
6979}
6980
6981// A reduced subset of process states; reducing the number of possible states allows more
6982// aggressive device-side aggregation of statistics and hence reduces metric upload size.
6983enum ProcessStateAggregated {
6984    PROCESS_STATE_UNKNOWN = 0;
6985    // Persistent system process.
6986    PROCESS_STATE_PERSISTENT = 1;
6987    // Top activity; actually any visible activity.
6988    PROCESS_STATE_TOP = 2;
6989    // Process binding to top or a foreground service.
6990    PROCESS_STATE_BOUND_TOP_OR_FGS = 3;
6991    // Processing running a foreground service.
6992    PROCESS_STATE_FGS = 4;
6993    // Important foreground process (ime, wallpaper, etc).
6994    PROCESS_STATE_IMPORTANT_FOREGROUND = 5;
6995    // Important background process.
6996    PROCESS_STATE_BACKGROUND = 6;
6997    // Process running a receiver.
6998    PROCESS_STATE_RECEIVER = 7;
6999    // All kinds of cached processes.
7000    PROCESS_STATE_CACHED = 8;
7001}
7002
7003// Next tag: 13
7004message ProcessStatsStateProto {
7005    optional android.service.procstats.ScreenState screen_state = 1;
7006
7007    optional android.service.procstats.MemoryState memory_state = 2 [deprecated = true];
7008
7009    // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
7010    // and not frameworks/base/core/java/android/app/ActivityManager.java
7011    optional android.service.procstats.ProcessState process_state = 3 [deprecated = true];
7012
7013    optional ProcessStateAggregated process_state_aggregated = 10;
7014
7015    // Millisecond uptime duration spent in this state
7016    optional int64 duration_millis = 4 [deprecated = true];
7017    // Same as above, but with minute resolution so it fits into an int32.
7018    optional int32 duration_minutes = 11;
7019
7020    // Millisecond elapsed realtime duration spent in this state
7021    optional int64 realtime_duration_millis = 9 [deprecated = true];
7022    // Same as above, but with minute resolution so it fits into an int32.
7023    optional int32 realtime_duration_minutes = 12;
7024
7025    // # of samples taken
7026    optional int32 sample_size = 5;
7027
7028    // PSS is memory reserved for this process
7029    optional AggStats pss = 6 [deprecated = true];
7030
7031    // USS is memory shared between processes, divided evenly for accounting
7032    optional AggStats uss = 7 [deprecated = true];
7033
7034    // RSS is memory resident for this process
7035    optional AggStats rss = 8;
7036}
7037
7038// Next Tag: 8
7039message ProcessStatsProto {
7040    // Name of process.
7041    optional string process = 1;
7042
7043    // Uid of the process.
7044    optional int32 uid = 2 [(is_uid) = true];
7045
7046    // Information about how often kills occurred
7047    message Kill {
7048        // Count of excessive CPU kills
7049        optional int32 cpu = 1;
7050
7051        // Count of kills when cached
7052        optional int32 cached = 2;
7053
7054        // PSS stats during cached kill
7055        optional AggStats cached_pss = 3;
7056    }
7057    optional Kill kill = 3 [deprecated = true];
7058
7059    // Time and memory spent in various states.
7060    repeated ProcessStatsStateProto states = 5;
7061
7062    // Total time process has been running...  screen_state, memory_state, and process_state
7063    // will not be set.
7064    optional ProcessStatsStateProto total_running_state = 6;
7065
7066    // Association data for this process in this state;
7067    // each entry here is one association.
7068    repeated ProcessStatsAssociationProto assocs = 7;
7069}
7070
7071// Next Tag: 6
7072message ProcessStatsAssociationProto {
7073    // Procss Name of the associated process (client process of service binding)
7074    optional string assoc_process_name = 1;
7075
7076    // Package Name of the associated package (client package of service binding)
7077    optional string assoc_package_name = 2 [deprecated = true];
7078
7079    // UID of the associated process/package (client package of service binding)
7080    optional int32 assoc_uid = 5 [(is_uid) = true];
7081
7082    // Total count of the times this association (service binding) appeared.
7083    optional int32 total_count = 3;
7084
7085    // Uptime total duration in seconds this association (service binding) was around.
7086    optional int32 total_duration_secs = 4;
7087}
7088
7089message PackageServiceOperationStatsProto {
7090    // Operate enum: Started, Foreground, Bound, Executing
7091    optional android.service.procstats.ServiceOperationState operation = 1;
7092
7093    // Number of times the service was in this operation.
7094    optional int32 count = 2;
7095
7096    // Information about a state the service can be in.
7097    message StateStats {
7098        // Screen state enum.
7099        optional android.service.procstats.ScreenState screen_state = 1;
7100        // Memory state enum.
7101        optional android.service.procstats.MemoryState memory_state = 2;
7102
7103        // duration in milliseconds.
7104        optional int64 duration_millis = 3;
7105        // Millisecond elapsed realtime duration spent in this state
7106        optional int64 realtime_duration_millis = 4;
7107    }
7108    repeated StateStats state_stats = 3;
7109}
7110
7111message PackageServiceStatsProto {
7112    // Name of service component.
7113    optional string service_name = 1;
7114
7115    // The operation stats.
7116    // The package_name, package_uid, package_version, service_name will not be set to save space.
7117    repeated PackageServiceOperationStatsProto operation_stats = 2;
7118}
7119
7120message PackageAssociationSourceProcessStatsProto {
7121    // Uid of the process.
7122    optional int32 process_uid = 1;
7123    // Process name.
7124    optional string process_name = 2;
7125    // Package name.
7126    optional string package_name = 7;
7127    // Total count of the times this association appeared.
7128    optional int32 total_count = 3;
7129
7130    // Millisecond uptime total duration this association was around.
7131    optional int64 total_duration_millis = 4;
7132
7133    // Total count of the times this association became actively impacting its target process.
7134    optional int32 active_count = 5;
7135
7136    // Information on one source in this association.
7137    message StateStats {
7138        // Process state enum.
7139        optional android.service.procstats.ProcessState process_state = 1;
7140        // Millisecond uptime duration spent in this state
7141        optional int64 duration_millis = 2;
7142        // Millisecond elapsed realtime duration spent in this state
7143        optional int64 realtime_duration_mmillis = 3;
7144    }
7145    repeated StateStats active_state_stats = 6;
7146}
7147
7148message PackageAssociationProcessStatsProto {
7149    // Name of the target component.
7150    optional string component_name = 1;
7151    // Information on one source in this association.
7152    repeated PackageAssociationSourceProcessStatsProto sources = 2;
7153}
7154
7155
7156message ProcessStatsPackageProto {
7157    // Name of package.
7158    optional string package = 1;
7159
7160    // Uid of the package.
7161    optional int32 uid = 2;
7162
7163    // Version of the package.
7164    optional int64 version = 3;
7165
7166    // Stats for each process running with the package loaded in to it.
7167    repeated ProcessStatsProto process_stats = 4;
7168
7169    // Stats for each of the package's services.
7170    repeated PackageServiceStatsProto service_stats = 5;
7171
7172    // Stats for each association with the package.
7173    repeated PackageAssociationProcessStatsProto association_stats = 6;
7174}
7175
7176message ProcessStatsSectionProto {
7177    // Elapsed realtime at start of report.
7178    optional int64 start_realtime_millis = 1;
7179
7180    // Elapsed realtime at end of report.
7181    optional int64 end_realtime_millis = 2;
7182
7183    // CPU uptime at start of report.
7184    optional int64 start_uptime_millis = 3;
7185
7186    // CPU uptime at end of report.
7187    optional int64 end_uptime_millis = 4;
7188
7189    // System runtime library. e.g. "libdvm.so", "libart.so".
7190    optional string runtime = 5;
7191
7192    // whether kernel reports swapped pss.
7193    optional bool has_swapped_pss = 6;
7194
7195    // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
7196    enum Status {
7197        STATUS_UNKNOWN = 0;
7198        STATUS_COMPLETE = 1;
7199        STATUS_PARTIAL = 2;
7200        STATUS_SHUTDOWN = 3;
7201        STATUS_SYSPROPS = 4;
7202    }
7203    repeated Status status = 7;
7204
7205    // Number of pages available of various types and sizes, representation fragmentation.
7206    repeated ProcessStatsAvailablePagesProto available_pages = 10;
7207
7208    // Stats for each process.
7209    repeated ProcessStatsProto process_stats = 8;
7210
7211    // Stats for each package.
7212    repeated ProcessStatsPackageProto package_stats = 9;
7213}
7214
7215message ProcessStatsAvailablePagesProto {
7216    // Node these pages are in (as per /proc/pagetypeinfo)
7217    optional int32 node = 1;
7218
7219    // Zone these pages are in (as per /proc/pagetypeinfo)
7220    optional string zone = 2;
7221
7222    // Label for the type of these pages (as per /proc/pagetypeinfo)
7223    optional string label = 3;
7224
7225    // Distribution of number of pages available by order size.  First entry in array is
7226    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
7227    repeated int32 pages_per_order = 4;
7228}
7229
7230/**
7231 * Pulled from ProcessStatsService.java
7232 */
7233message ProcStats {
7234    optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
7235    // Data pulled from device into this is sometimes sharded across multiple atoms to work around
7236    // a size limit. When this happens, this shard ID will contain an increasing 1-indexed integer
7237    // with the number of this shard.
7238    optional int32 shard_id = 2;
7239}
7240
7241/**
7242 * Pulled from ProcessStatsService.java
7243 */
7244message ProcStatsPkgProc {
7245    optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
7246}
7247
7248// Next Tag: 2
7249message PackageRemoteViewInfoProto {
7250    optional string package_name = 1;
7251    // add per-package additional info here (like channels)
7252}
7253
7254// Next Tag: 2
7255message NotificationRemoteViewsProto {
7256    repeated PackageRemoteViewInfoProto package_remote_view_info = 1;
7257}
7258
7259/**
7260 * Pulled from NotificationManagerService.java
7261 */
7262message NotificationRemoteViews {
7263    optional NotificationRemoteViewsProto notification_remote_views = 1 [(log_mode) = MODE_BYTES];
7264}
7265
7266/**
7267 * Atom that contains a list of a package's preferences, pulled from NotificationManagerService.java
7268 */
7269message PackageNotificationPreferences {
7270    // Uid under which the package is installed.
7271    optional int32 uid = 1 [(is_uid) = true];
7272    // Notification importance, which specifies when and how a notification is displayed.
7273    // Specified under core/java/android/app/NotificationManager.java.
7274    optional int32 importance = 2;
7275    // Lockscreen visibility as set by the user.
7276    optional int32 visibility = 3;
7277    // Bitfield mask indicating what fields were locked by the user (see LockableAppfields in
7278    // PreferencesHelper.java)
7279    optional int32 user_locked_fields = 4;
7280}
7281
7282/**
7283 * Atom that contains a list of a package's channel preferences, pulled from
7284 * NotificationManagerService.java.
7285 */
7286message PackageNotificationChannelPreferences {
7287    // Uid under which the package is installed.
7288    optional int32 uid = 1 [(is_uid) = true];
7289    // Channel's ID. Should always be available.
7290    optional string channel_id = 2;
7291    // Channel's name. Should always be available.
7292    optional string channel_name = 3;
7293    // Channel's description. Optionally set by the channel creator.
7294    optional string description = 4;
7295    // Notification importance, which specifies when and how a notification is displayed. Specified
7296    // under core/java/android/app/NotificationManager.java.
7297    optional int32 importance = 5;
7298    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
7299    // at core/java/android/app/NotificationChannel.java
7300    optional int32 user_locked_fields = 6;
7301    // Indicates if the channel was deleted by the app.
7302    optional bool is_deleted = 7;
7303    // Indicates if the channel was marked as a conversation by the app.
7304    optional bool is_conversation = 8;
7305    // Indicates if the channel is a conversation that was demoted by the user.
7306    optional bool is_demoted_conversation = 9;
7307    // Indicates if the channel is a conversation that was marked as important by the user.
7308    optional bool is_important_conversation = 10;
7309}
7310
7311/**
7312 * Atom that represents an item in the list of Do Not Disturb rules, pulled from
7313 * NotificationManagerService.java.
7314 */
7315message DNDModeProto {
7316    enum Mode {
7317        ROOT_CONFIG = -1;  // Used to distinguish the config (one per user) from the rules.
7318        ZEN_MODE_OFF = 0;
7319        ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
7320        ZEN_MODE_NO_INTERRUPTIONS = 2;
7321        ZEN_MODE_ALARMS = 3;
7322    }
7323    optional int32 user = 1;  // Android user ID (0, 1, 10, ...)
7324    optional bool enabled = 2;  // true for ROOT_CONFIG if a manualRule is enabled
7325    optional bool channels_bypassing = 3; // only valid for ROOT_CONFIG
7326    optional Mode zen_mode = 4;
7327    // id is one of the system default rule IDs, or empty
7328    // May also be "MANUAL_RULE" to indicate app-activation of the manual rule.
7329    optional string id = 5;
7330    optional int32 uid = 6 [(is_uid) = true]; // currently only SYSTEM_UID or 0 for other
7331    optional DNDPolicyProto policy = 7 [(log_mode) = MODE_BYTES];
7332}
7333
7334/**
7335 * Atom that represents a Do Not Disturb policy, an optional detail proto for DNDModeProto.
7336 */
7337message DNDPolicyProto {
7338    enum State {
7339        STATE_UNSET = 0;
7340        STATE_ALLOW = 1;
7341        STATE_DISALLOW = 2;
7342    }
7343    optional State calls = 1;
7344    optional State repeat_callers = 2;
7345    optional State messages = 3;
7346    optional State conversations = 4;
7347    optional State reminders = 5;
7348    optional State events = 6;
7349    optional State alarms = 7;
7350    optional State media = 8;
7351    optional State system = 9;
7352    optional State fullscreen = 10;
7353    optional State lights = 11;
7354    optional State peek = 12;
7355    optional State status_bar = 13;
7356    optional State badge = 14;
7357    optional State ambient = 15;
7358    optional State notification_list = 16;
7359
7360    enum PeopleType {
7361        PEOPLE_UNSET = 0;
7362        PEOPLE_ANYONE = 1;
7363        PEOPLE_CONTACTS = 2;
7364        PEOPLE_STARRED = 3;
7365        PEOPLE_NONE = 4;
7366    }
7367
7368    optional PeopleType allow_calls_from = 17;
7369    optional PeopleType allow_messages_from = 18;
7370
7371    enum ConversationType {
7372        CONV_UNSET = 0;
7373        CONV_ANYONE = 1;
7374        CONV_IMPORTANT = 2;
7375        CONV_NONE = 3;
7376    }
7377
7378    optional ConversationType allow_conversations_from = 19;
7379}
7380
7381/**
7382 * Atom that contains a list of a package's channel group preferences, pulled from
7383 * NotificationManagerService.java.
7384 */
7385message PackageNotificationChannelGroupPreferences {
7386    // Uid under which the package is installed.
7387    optional int32 uid = 1 [(is_uid) = true];
7388    // Channel Group's ID. Should always be available.
7389    optional string group_id = 2;
7390    // Channel Group's name. Should always be available.
7391    optional string group_name = 3;
7392    // Channel Group's description. Optionally set by group creator.
7393    optional string description = 4;
7394    // Indicates if notifications from this channel group are blocked.
7395    optional bool is_blocked = 5;
7396    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
7397    // at core/java/android/app/NotificationChannelGroup.java
7398    optional int32 user_locked_fields = 6;
7399}
7400
7401message PowerProfileProto {
7402    optional double cpu_suspend = 1;
7403
7404    optional double cpu_idle = 2;
7405
7406    optional double cpu_active = 3;
7407
7408    message CpuCluster {
7409        optional int32 id = 1;
7410        optional double cluster_power = 2;
7411        optional int32 cores = 3;
7412        repeated int64 speed = 4;
7413        repeated double core_power = 5;
7414    }
7415
7416    repeated CpuCluster cpu_cluster = 40;
7417
7418    optional double wifi_scan = 4;
7419
7420    optional double wifi_on = 5;
7421
7422    optional double wifi_active = 6;
7423
7424    optional double wifi_controller_idle = 7;
7425
7426    optional double wifi_controller_rx = 8;
7427
7428    optional double wifi_controller_tx = 9;
7429
7430    repeated double wifi_controller_tx_levels = 10;
7431
7432    optional double wifi_controller_operating_voltage = 11;
7433
7434    optional double bluetooth_controller_idle = 12;
7435
7436    optional double bluetooth_controller_rx = 13;
7437
7438    optional double bluetooth_controller_tx = 14;
7439
7440    optional double bluetooth_controller_operating_voltage = 15;
7441
7442    optional double modem_controller_sleep = 16;
7443
7444    optional double modem_controller_idle = 17;
7445
7446    optional double modem_controller_rx = 18;
7447
7448    repeated double modem_controller_tx = 19;
7449
7450    optional double modem_controller_operating_voltage = 20;
7451
7452    optional double gps_on = 21;
7453
7454    repeated double gps_signal_quality_based = 22;
7455
7456    optional double gps_operating_voltage = 23;
7457
7458    optional double bluetooth_on = 24;
7459
7460    optional double bluetooth_active = 25;
7461
7462    optional double bluetooth_at_cmd = 26;
7463
7464    optional double ambient_display = 27;
7465
7466    optional double screen_on = 28;
7467
7468    optional double radio_on = 29;
7469
7470    optional double radio_scanning = 30;
7471
7472    optional double radio_active = 31;
7473
7474    optional double screen_full = 32;
7475
7476    optional double audio = 33;
7477
7478    optional double video = 34;
7479
7480    optional double flashlight = 35;
7481
7482    optional double memory = 36;
7483
7484    optional double camera = 37;
7485
7486    optional double wifi_batched_scan = 38;
7487
7488    optional double battery_capacity = 39;
7489}
7490
7491/**
7492 * power_profile.xml and other constants for power model calculations.
7493 * Pulled from PowerProfile.java
7494 */
7495message PowerProfile {
7496    optional PowerProfileProto power_profile = 1 [(log_mode) = MODE_BYTES];
7497}
7498
7499/**
7500 * Logs when a user restriction was added or removed.
7501 *
7502 * Logged from:
7503 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
7504 */
7505message UserRestrictionChanged {
7506    // The raw string of the user restriction as defined in UserManager.
7507    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
7508    optional string restriction = 1;
7509    // Whether the restriction is enabled or disabled.
7510    optional bool enabled = 2;
7511}
7512
7513/**
7514 * Pulls process user time and system time. Puller takes a snapshot of all pids
7515 * in the system and returns cpu stats for those that are working at the time.
7516 * Dead pids will be dropped. Kernel processes are excluded.
7517 * Min cool-down is 5 sec.
7518 */
7519message ProcessCpuTime {
7520    optional int32 uid = 1 [(is_uid) = true];
7521
7522    optional string process_name = 2;
7523    // Process cpu time in user space, cumulative from boot/process start
7524    optional int64 user_time_millis = 3;
7525    // Process cpu time in system space, cumulative from boot/process start
7526    optional int64 system_time_millis = 4;
7527}
7528
7529/**
7530 * Pulls the CPU usage for each thread.
7531 *
7532 * Read from /proc/$PID/task/$TID/time_in_state files.
7533 *
7534 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
7535 * time_in_state files not being present on some phones, have not been addressed. These should be
7536 * considered before a public release.
7537 */
7538message CpuTimePerThreadFreq {
7539    // UID that owns the process.
7540    optional int32 uid = 1 [(is_uid) = true];
7541    // ID of the process.
7542    optional int32 process_id = 2;
7543    // ID of the thread.
7544    optional int32 thread_id = 3;
7545    // Name of the process taken from `/proc/$PID/cmdline`.
7546    optional string process_name = 4;
7547    // Name of the thread taken from `/proc/$PID/task/$TID/comm`
7548    optional string thread_name = 5;
7549
7550    // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
7551    // are given in KHz, and time is given in milliseconds since the thread started. All eight
7552    // frequencies are given here as the alternative is sending eight separate atoms. This method
7553    // significantly reduces the amount of data created
7554    optional int32 frequency1_khz = 6;
7555    optional int32 time1_millis = 7;
7556    optional int32 frequency2_khz = 8;
7557    optional int32 time2_millis = 9;
7558    optional int32 frequency3_khz = 10;
7559    optional int32 time3_millis = 11;
7560    optional int32 frequency4_khz = 12;
7561    optional int32 time4_millis = 13;
7562    optional int32 frequency5_khz = 14;
7563    optional int32 time5_millis = 15;
7564    optional int32 frequency6_khz = 16;
7565    optional int32 time6_millis = 17;
7566    optional int32 frequency7_khz = 18;
7567    optional int32 time7_millis = 19;
7568    optional int32 frequency8_khz = 20;
7569    optional int32 time8_millis = 21;
7570}
7571
7572/**
7573 * Pulls information about the device's build.
7574 */
7575message BuildInformation {
7576    // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
7577    // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
7578    optional string fingerprint = 1;
7579
7580    // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
7581    optional string brand = 2;
7582
7583    // Build.PRODUCT. The name of the overall product.
7584    optional string product = 3;
7585
7586    // Build.DEVICE. The name of the industrial design.
7587    optional string device = 4;
7588
7589    // Build.VERSION.RELEASE. The user-visible version string.  E.g., "1.0" or "3.4b5" or "bananas".
7590    optional string version_release = 5;
7591
7592    // Build.ID. E.g. a label like "M4-rc20".
7593    optional string id = 6;
7594
7595    // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
7596    // represent this build.
7597    optional string version_incremental = 7;
7598
7599    // Build.TYPE. The type of build, like "user" or "eng".
7600    optional string type = 8;
7601
7602    // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
7603    optional string tags = 9;
7604}
7605
7606/**
7607 * Logs information about mismatched caller for content capture.
7608 *
7609 * Logged from:
7610 *   frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java
7611 */
7612message ContentCaptureCallerMismatchReported {
7613    optional string intended_package = 1;
7614    optional string calling_package = 2;
7615}
7616
7617/**
7618 * Logs information about content capture service events.
7619 *
7620 * Logged from:
7621 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
7622 */
7623message ContentCaptureServiceEvents {
7624    // The type of event.
7625    enum Event {
7626        UNKNOWN = 0;
7627        ON_CONNECTED = 1;
7628        ON_DISCONNECTED = 2;
7629        SET_WHITELIST = 3;
7630        SET_DISABLED = 4;
7631        ON_USER_DATA_REMOVED = 5;
7632        ON_DATA_SHARE_REQUEST = 6;
7633        ACCEPT_DATA_SHARE_REQUEST = 7;
7634        REJECT_DATA_SHARE_REQUEST = 8;
7635        DATA_SHARE_WRITE_FINISHED = 9;
7636        DATA_SHARE_ERROR_IOEXCEPTION = 10;
7637        DATA_SHARE_ERROR_EMPTY_DATA = 11;
7638        DATA_SHARE_ERROR_CLIENT_PIPE_FAIL = 12;
7639        DATA_SHARE_ERROR_SERVICE_PIPE_FAIL = 13;
7640        DATA_SHARE_ERROR_CONCURRENT_REQUEST = 14;
7641        DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED = 15;
7642    }
7643    optional Event event = 1;
7644    // component/package of content capture service.
7645    optional string service_info = 2;
7646    // component/package of target.
7647    // it's a concatenated list of component/package for SET_WHITELIST event
7648    // separated by " ".
7649    optional string target_info = 3;
7650}
7651
7652/**
7653 * Logs information about content capture session events.
7654 *
7655 * Logged from:
7656 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
7657 */
7658message ContentCaptureSessionEvents {
7659    // The type of event.
7660    enum Event {
7661        UNKNOWN = 0;
7662        ON_SESSION_STARTED = 1;
7663        ON_SESSION_FINISHED = 2;
7664        SESSION_NOT_CREATED = 3;
7665    }
7666    optional int32 session_id = 1;
7667    optional Event event = 2;
7668    // (n/a on session finished)
7669    optional int32 state_flags = 3;
7670    // component/package of content capture service.
7671    optional string service_info = 4;
7672    // component/package of app.
7673    // (n/a on session finished)
7674    optional string app_info = 5;
7675    optional bool is_child_session = 6;
7676}
7677
7678/**
7679 * Logs information about session being flushed.
7680 *
7681 * Logged from:
7682 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
7683 */
7684message ContentCaptureFlushed {
7685    optional int32 session_id = 1;
7686    // component/package of content capture service.
7687    optional string service_info = 2;
7688    // component/package of app.
7689    optional string app_info = 3;
7690    // session start/finish events
7691    optional int32 child_session_started = 4;
7692    optional int32 child_session_finished = 5;
7693    // count of view events.
7694    optional int32 view_appeared_count = 6;
7695    optional int32 view_disappeared_count = 7;
7696    optional int32 view_text_changed_count = 8;
7697
7698    // Flush stats.
7699    optional int32 max_events = 9;
7700    optional int32 idle_flush_freq = 10;
7701    optional int32 text_flush_freq = 11;
7702    optional int32 flush_reason = 12;
7703}
7704
7705/**
7706 * Pulls on-device BatteryStats power use calculations for the overall device.
7707 */
7708message DeviceCalculatedPowerUse {
7709    // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
7710    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
7711    // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
7712    optional int64 computed_power_nano_amp_secs = 1;
7713}
7714
7715/**
7716 * Pulls on-device BatteryStats power use calculations broken down by uid.
7717 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
7718 * that is attributed to non-uid items. They must all be included to get the total power use.
7719 */
7720message DeviceCalculatedPowerBlameUid {
7721    // Uid being blamed. Note: isolated uids have already been mapped to host uid.
7722    optional int32 uid = 1 [(is_uid) = true];
7723
7724    // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
7725    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
7726    optional int64 power_nano_amp_secs = 2;
7727}
7728
7729/**
7730 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
7731 * drain type.
7732 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
7733 * is attributed uids. They must all be included to get the total power use.
7734 */
7735message DeviceCalculatedPowerBlameOther {
7736    // The type of item whose power use is being reported.
7737    enum DrainType {
7738        AMBIENT_DISPLAY = 0;
7739        // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
7740        BLUETOOTH = 2;
7741        CAMERA = 3;
7742        // Cell-standby
7743        CELL = 4;
7744        FLASHLIGHT = 5;
7745        IDLE = 6;
7746        MEMORY = 7;
7747        // Amount that total computed drain exceeded the drain estimated using the
7748        // battery level changes and capacity.
7749        OVERCOUNTED = 8;
7750        PHONE = 9;
7751        SCREEN = 10;
7752        // Amount that total computed drain was below the drain estimated using the
7753        // battery level changes and capacity.
7754        UNACCOUNTED = 11;
7755        // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
7756        WIFI = 13;
7757    }
7758    optional DrainType drain_type = 1;
7759
7760    // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
7761    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
7762    optional int64 power_nano_amp_secs = 2;
7763}
7764
7765// Keep in sync with frameworks/base/core/proto/android/os/batteryusagestats.proto
7766/**
7767 * Represents a device's BatteryUsageStats, with power usage information about the device
7768 * and each app.
7769 */
7770message BatteryUsageStatsAtomsProto {
7771
7772    // The session start timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
7773    // All data is no older than this time.
7774    optional int64 session_start_millis = 1;
7775
7776    // The session end timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
7777    // All data is no more recent than this time.
7778    optional int64 session_end_millis = 2;
7779
7780    // Length that the reported data covered. This usually will be equal to the entire session,
7781    // session_end_millis - session_start_millis, but may not be if some data during this time frame
7782    // is missing.
7783    optional int64 session_duration_millis = 3;
7784
7785    // Represents usage of a consumer, storing all of its power component usage.
7786    message BatteryConsumerData {
7787        // Total power consumed by this BatteryConsumer (including all of its PowerComponents).
7788        // May not equal the sum of the PowerComponentUsage due to under- or over-estimations.
7789        // Multiply by 1/36 to obtain mAh.
7790        optional int64 total_consumed_power_deci_coulombs = 1;
7791
7792        // Represents power and time usage of a particular power component.
7793        message PowerComponentUsage {
7794            // Holds android.os.PowerComponentEnum, or custom component value between 1000 and 9999.
7795            // Evidently, if one attempts to write an int to an enum field that is out of range, it
7796            // is treated as 0, so we must make this an int32.
7797            optional int32 component = 1;
7798
7799            // Power consumed by this component. Multiply by 1/36 to obtain mAh.
7800            optional int64 power_deci_coulombs = 2;
7801
7802            optional int64 duration_millis = 3;
7803        }
7804        repeated PowerComponentUsage power_components = 2;
7805    }
7806
7807    // Total power usage for the device during this session.
7808    optional BatteryConsumerData device_battery_consumer = 4;
7809
7810    // Power usage by a uid during this session.
7811    message UidBatteryConsumer {
7812        optional int32 uid = 1 [(is_uid) = true];
7813        optional BatteryConsumerData battery_consumer_data = 2;
7814        optional int64 time_in_foreground_millis = 3;
7815        optional int64 time_in_background_millis = 4;
7816    }
7817    repeated UidBatteryConsumer uid_battery_consumers = 5;
7818
7819    // Sum of all discharge percentage point drops during the reported session.
7820    optional int32 session_discharge_percentage = 6;
7821}
7822
7823/**
7824 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
7825 * using the best data available.
7826 *
7827 * Includes the data since the last time statsd pulled this atom (i.e. since the
7828 * last-BatteryStats-reset-prior-to-last-statsd-pull) until the most recent BatteryStats reset.
7829 *
7830 * Does NOT include data after the most recent reset (use BatteryUsageStatsSinceReset too for that).
7831 *
7832 * Pulled from BatteryManager.getBatteryUsageStats().
7833 */
7834message BatteryUsageStatsBeforeReset {
7835    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
7836}
7837
7838/**
7839 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
7840 * using the best data available.
7841 *
7842 * Includes all data since the most recent BatteryStats reset event, but none prior to it.
7843 *
7844 * Pulled from BatteryManager.getBatteryUsageStats().
7845 */
7846message BatteryUsageStatsSinceReset {
7847    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
7848}
7849
7850/**
7851 * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
7852 * using only PowerProfile Model data (even if better data is available).
7853 *
7854 * Includes all data since the most recent BatteryStats reset event, but none prior to it.
7855 *
7856 * @see android.os.BatteryUsageStatsQuery#FLAG_BATTERY_USAGE_STATS_POWER_PROFILE_MODEL
7857 * Pulled from BatteryManager.getBatteryUsageStats().
7858 */
7859message BatteryUsageStatsSinceResetUsingPowerProfileModel {
7860    optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
7861}
7862
7863/**
7864 * Logs device policy features.
7865 *
7866 * Logged from:
7867 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
7868 *   packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
7869 */
7870message DevicePolicyEvent {
7871    // The event id - unique for each event.
7872    optional android.stats.devicepolicy.EventId event_id = 1;
7873    // The admin package name.
7874    optional string admin_package_name = 2;
7875    // A generic integer parameter.
7876    optional int32 integer_value = 3;
7877    // A generic boolean parameter.
7878    optional bool boolean_value = 4;
7879    // A parameter specifying a time period in milliseconds.
7880    optional uint64 time_period_millis = 5;
7881    // A parameter specifying a list of package names, bundle extras or string parameters.
7882    optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
7883}
7884
7885/**
7886 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
7887 *
7888 * Logged from:
7889 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7890 */
7891message DocsUILaunchReported {
7892    optional android.stats.docsui.LaunchAction launch_action = 1;
7893    optional bool has_initial_uri = 2;
7894    optional android.stats.docsui.MimeType mime_type = 3;
7895    optional android.stats.docsui.Root initial_root = 4;
7896}
7897
7898/**
7899 * Logs root/app visited event in file managers/picker. Call this when the user
7900 * taps on root/app in hamburger menu.
7901 *
7902 * Logged from:
7903 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7904 */
7905message DocsUIRootVisitedReported {
7906    optional android.stats.docsui.ContextScope scope = 1;
7907    optional android.stats.docsui.Root root = 2;
7908}
7909
7910/**
7911 * Logs file operation stats. Call this when a file operation has completed.
7912 *
7913 * Logged from:
7914 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7915 */
7916message DocsUIFileOperationReported {
7917    optional android.stats.docsui.Provider provider = 1;
7918    optional android.stats.docsui.FileOperation file_op = 2;
7919}
7920
7921/**
7922 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
7923 * mode.
7924 *
7925 * Logged from:
7926 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7927 */
7928message DocsUIFileOperationCopyMoveModeReported {
7929    optional android.stats.docsui.FileOperation file_op = 1;
7930    optional android.stats.docsui.CopyMoveOpMode mode = 2;
7931}
7932
7933
7934/**
7935 * Logs file sub operation stats. Call this when a file operation has failed.
7936 *
7937 * Logged from:
7938 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7939 */
7940message DocsUIFileOperationFailureReported {
7941    optional android.stats.docsui.Authority authority = 1;
7942    optional android.stats.docsui.SubFileOperation sub_op = 2;
7943}
7944
7945/**
7946* Logs the cancellation of a file operation. Call this when a job is canceled
7947*
7948* Logged from:
7949*     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7950*/
7951message DocsUIFileOperationCanceledReported {
7952    optional android.stats.docsui.FileOperation file_op = 1;
7953}
7954
7955/**
7956 * Logs startup time in milliseconds.
7957 *
7958 * Logged from:
7959 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7960 */
7961message DocsUIStartupMsReported {
7962    optional int32 startup_millis = 1;
7963}
7964
7965/**
7966 * Logs the action that was started by user.
7967 *
7968 * Logged from:
7969 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7970 */
7971message DocsUIUserActionReported {
7972    optional android.stats.docsui.UserAction action = 1;
7973}
7974
7975/**
7976 * Logs the invalid type when invalid scoped access is requested.
7977 *
7978 * Logged from:
7979 *     package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
7980 */
7981message DocsUIInvalidScopedAccessRequestReported {
7982    optional android.stats.docsui.InvalidScopedAccess type = 1;
7983}
7984
7985/**
7986 * Logs the package name that launches docsui picker mode.
7987 *
7988 * Logged from:
7989 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
7990 */
7991message DocsUIPickerLaunchedFromReported {
7992    optional string package_name = 1;
7993}
7994
7995/**
7996 * Logs the search type.
7997 *
7998 * Logged from:
7999 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8000 */
8001message DocsUISearchTypeReported {
8002    optional android.stats.docsui.SearchType search_type = 1;
8003}
8004
8005/**
8006 * Logs the search mode.
8007 *
8008 * Logged from:
8009 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8010 */
8011message DocsUISearchModeReported {
8012    optional android.stats.docsui.SearchMode search_mode = 1;
8013}
8014
8015/**
8016 * Logs the pick result information.
8017 *
8018 * Logged from:
8019 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8020 */
8021message DocsUIPickResultReported {
8022    optional int32 total_action_count = 1;
8023    optional int64 duration_millis = 2;
8024    optional int32 file_count= 3;
8025    optional bool is_searching = 4;
8026    optional android.stats.docsui.Root picked_from = 5;
8027    optional android.stats.docsui.MimeType mime_type = 6;
8028    optional int32 repeatedly_pick_times = 7;
8029}
8030
8031/** Logs the drag and drop of files.
8032
8033 * Logged from:
8034 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
8035 */
8036message DocsUIDragAndDropReported {
8037    optional bool drag_initiated_from_docsui = 1;
8038}
8039
8040/**
8041 * Logs when an app's memory is compacted.
8042 *
8043 * Logged from:
8044 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8045 */
8046message AppCompacted {
8047  // The pid of the process being compacted.
8048  optional int32 pid = 1;
8049
8050  // The name of the process being compacted.
8051  optional string process_name = 2;
8052
8053  // The type of compaction.
8054  enum Action {
8055    UNKNOWN = 0;
8056    SOME = 1;
8057    FULL = 2;
8058    PERSISTENT = 3;
8059    BFGS = 4;
8060  }
8061  optional Action action = 3;
8062
8063  // Total RSS in kilobytes consumed by the process prior to compaction.
8064  optional int64 before_rss_total_kilobytes = 4;
8065
8066  // File RSS in kilobytes consumed by the process prior to compaction.
8067  optional int64 before_rss_file_kilobytes = 5;
8068
8069  // Anonymous RSS in kilobytes consumed by the process prior to compaction.
8070  optional int64 before_rss_anon_kilobytes = 6;
8071
8072  // Swap in kilobytes consumed by the process prior to compaction.
8073  optional int64 before_swap_kilobytes = 7;
8074
8075  // Total RSS in kilobytes consumed by the process after compaction.
8076  optional int64 after_rss_total_kilobytes = 8;
8077
8078  // File RSS in kilobytes consumed by the process after compaction.
8079  optional int64 after_rss_file_kilobytes = 9;
8080
8081  // Anonymous RSS in kilobytes consumed by the process after compaction.
8082  optional int64 after_rss_anon_kilobytes = 10;
8083
8084  // Swap in kilobytes consumed by the process after compaction.
8085  optional int64 after_swap_kilobytes = 11;
8086
8087  // The time taken to perform compaction in milliseconds.
8088  optional int64 time_to_compact_millis = 12;
8089
8090  // The last compaction action performed for this app.
8091  optional Action last_action = 13;
8092
8093  // The last time that compaction was attempted on this process in milliseconds
8094  // since boot, not including sleep (see SystemClock.uptimeMillis()).
8095  optional int64 last_compact_timestamp_ms_since_boot = 14;
8096
8097  // The "setAdj" (i.e. previous) oom_score_adj at the time of compaction.
8098  optional int32 oom_score_adj = 15;
8099
8100  // The process state at the time of compaction.
8101  optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
8102
8103  // Free ZRAM in kilobytes before compaction.
8104  optional int64 before_zram_free_kilobytes = 17;
8105
8106  // Free ZRAM in kilobytes after compaction.
8107  optional int64 after_zram_free_kilobytes = 18;
8108}
8109
8110/**
8111 * Logs when a Tethering event occurs.
8112 *
8113 */
8114message NetworkTetheringReported {
8115  // tethering error code
8116  optional android.stats.connectivity.ErrorCode error_code = 1;
8117
8118  // tethering downstream type
8119  optional android.stats.connectivity.DownstreamType downstream_type = 2;
8120
8121  // transport type of upstream network
8122  optional android.stats.connectivity.UpstreamType upstream_type = 3;
8123
8124  // The user type of Tethering
8125  optional android.stats.connectivity.UserType user_type= 4;
8126}
8127
8128/**
8129 * Logs a DNS lookup operation initiated by the system resolver on behalf of an application
8130 * invoking native APIs such as getaddrinfo() or Java APIs such as Network#getAllByName().
8131 *
8132 * The NetworkDnsEventReported message represents the entire lookup operation, which may
8133 * result one or more queries to the recursive DNS resolvers. Those are individually logged
8134 * in DnsQueryEvents to enable computing error rates and network latency and timeouts
8135 * broken up by query type, transport, network interface, etc.
8136 */
8137message NetworkDnsEventReported {
8138    optional android.stats.dnsresolver.EventType event_type = 1;
8139
8140    optional android.stats.dnsresolver.ReturnCode return_code = 2;
8141
8142    // The latency in microseconds of the entire DNS lookup operation.
8143    optional int32 latency_micros = 3;
8144
8145    // Only valid for event_type = EVENT_GETADDRINFO.
8146    optional int32 hints_ai_flags = 4;
8147
8148    // Flags passed to android_res_nsend() defined in multinetwork.h
8149    // Only valid for event_type = EVENT_RESNSEND.
8150    optional int32 res_nsend_flags = 5;
8151
8152    optional android.stats.dnsresolver.NetworkType network_type = 6;
8153
8154    // The DNS over TLS mode on a specific netId.
8155    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7;
8156
8157    // Additional pass-through fields opaque to statsd.
8158    // The DNS resolver Mainline module can add new fields here without requiring an OS update.
8159    optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES];
8160
8161    // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom.
8162    optional int32 sampling_rate_denom = 9;
8163}
8164
8165/**
8166 * logs the CapportApiData info
8167 * Logged from:
8168 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8169 */
8170message CapportApiData {
8171    // The TTL of the network connection provided by captive portal
8172    optional int32 remaining_ttl_secs = 1;
8173
8174    // The limit traffic data of the network connection provided by captive portal
8175    optional int32 remaining_bytes = 2;
8176
8177    // Is portal url option included in the DHCP packet (Yes, No)
8178    optional bool has_portal_url = 3;
8179
8180    // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
8181    optional bool has_venue_info = 4;
8182}
8183
8184/**
8185 * logs a network Probe Event
8186 * Logged from:
8187 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8188 */
8189message ProbeEvent {
8190    // The probe type (http or https, or captive portal API...)
8191    optional android.stats.connectivity.ProbeType probe_type = 1;
8192
8193    // The latency in microseconds of the probe event
8194    optional int32 latency_micros = 2;
8195
8196    // The result of the probe event
8197    optional android.stats.connectivity.ProbeResult probe_result = 3;
8198
8199    // The CaptivePortal API info
8200    optional CapportApiData capport_api_data = 4;
8201}
8202
8203/**
8204 * log each ProbeEvent in ProbeEvents
8205 * Logged from:
8206 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8207 */
8208message ProbeEvents {
8209    // Record probe event during the validation
8210    repeated ProbeEvent probe_event = 1;
8211}
8212
8213/**
8214 * The DHCP (Dynamic Host Configuration Protocol) session info
8215 * Logged from:
8216 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
8217 */
8218message DhcpSession {
8219    // The DHCP Feature(s) enabled in this session
8220    repeated android.stats.connectivity.DhcpFeature used_features = 1;
8221
8222    // The discover packet (re)transmit count
8223    optional int32 discover_count = 2;
8224
8225    // The request packet (re)transmit count
8226    optional int32 request_count = 3;
8227
8228    // The IPv4 address conflict count
8229    // (only be meaningful when duplicate address detection is enabled)
8230    optional int32 conflict_count = 4;
8231
8232    // The DHCP packet parsing error code in this session
8233    // (defined in android.net.metrics.DhcpErrorEvent)
8234    repeated android.stats.connectivity.DhcpErrorCode error_code = 5;
8235
8236    // The result of DHCP hostname transliteration
8237    optional android.stats.connectivity.HostnameTransResult ht_result = 6;
8238}
8239
8240/**
8241 * Logs Network IP provisioning event
8242 * Logged from:
8243 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
8244 */
8245message NetworkIpProvisioningReported {
8246    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8247    optional android.stats.connectivity.TransportType transport_type = 1;
8248
8249    // The latency in microseconds of IP Provisioning over IPV4
8250    optional int32 ipv4_latency_micros = 2;
8251
8252    // The latency in microseconds of IP Provisioning over IPV6
8253    optional int32 ipv6_latency_micros = 3;
8254
8255    // The time duration between provisioning start and end (success or failure)
8256    optional int64 provisioning_duration_micros = 4;
8257
8258    // The specific disconnect reason for this IP provisioning
8259    optional android.stats.connectivity.DisconnectCode disconnect_code = 5;
8260
8261    // Log DHCP session info (Only valid for IPv4)
8262    optional DhcpSession dhcp_session = 6 [(log_mode) = MODE_BYTES];
8263
8264    // The random number between 0 ~ 999 for sampling
8265    optional int32 random_number = 7;
8266}
8267
8268/**
8269 * Logs Network DHCP Renew event
8270 * Logged from:
8271 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
8272 */
8273message NetworkDhcpRenewReported {
8274    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8275    optional android.stats.connectivity.TransportType transport_type = 1;
8276
8277    // The request packet (re)transmit count
8278    optional int32 request_count = 2;
8279
8280    // The latency in microseconds of DHCP Renew
8281    optional int32 latency_micros = 3;
8282
8283    // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
8284    optional android.stats.connectivity.DhcpErrorCode error_code = 4;
8285
8286    // The result of DHCP renew
8287    optional android.stats.connectivity.DhcpRenewResult renew_result = 5;
8288
8289    // The random number between 0 ~ 999 for sampling
8290    optional int32 random_number = 6;
8291}
8292
8293/**
8294 * Logs Network Validation event
8295 * Logged from:
8296 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8297 */
8298message NetworkValidationReported {
8299    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8300    optional android.stats.connectivity.TransportType transport_type = 1;
8301
8302    // Record each probe event
8303    optional ProbeEvents probe_events = 2 [(log_mode) = MODE_BYTES];
8304
8305    // The result of the network validation
8306    optional android.stats.connectivity.ValidationResult validation_result = 3;
8307
8308    // The latency in microseconds of network validation
8309    optional int32 latency_micros = 4;
8310
8311    // The validation index (the first validation attempt or second, third...)
8312    optional int32 validation_index = 5;
8313
8314    // The random number between 0 ~ 999 for sampling
8315    optional int32 random_number = 6;
8316}
8317
8318/**
8319 * Logs NetworkStack Quirk event
8320 * Logged from:
8321 * packages/modules/NetworkStack/src/com/android/networkstack/
8322 */
8323message NetworkStackQuirkReported {
8324    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
8325    optional android.stats.connectivity.TransportType transport_type = 1;
8326
8327    // Record each Quirk event
8328    optional android.stats.connectivity.NetworkQuirkEvent event = 2;
8329}
8330
8331/**
8332 * Logs Neighbor Unreachability Detection event
8333 * Logged from:
8334 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpReachabilityMonitorMetrics.java
8335 */
8336message NetworkIpReachabilityMonitorReported {
8337    // Neighbor Unreachability Detection event.
8338    optional android.stats.connectivity.NudEventType event_type = 1;
8339
8340    // NUD probe based on IPv4 ARP or IPv6 ND packet.
8341    optional android.stats.connectivity.IpType ip_type = 2;
8342
8343    // NUD neighbor type, default gateway, DNS server or both.
8344    optional android.stats.connectivity.NudNeighborType neighbor_type = 3;
8345}
8346
8347/**
8348 * Logs when a data stall event occurs.
8349 *
8350 * Log from:
8351 *     packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8352 */
8353message DataStallEvent {
8354    // Data stall evaluation type.
8355    // See packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
8356    // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
8357    optional int32 evaluation_type = 1;
8358    // See definition in data_stall_event.proto.
8359    optional com.android.server.connectivity.ProbeResult validation_result = 2;
8360    // See definition in data_stall_event.proto.
8361    optional android.net.Transport network_type = 3;
8362    // See definition in data_stall_event.proto.
8363    optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
8364    // See definition in data_stall_event.proto.
8365    optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
8366    // See definition in data_stall_event.proto.
8367    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
8368    // The tcp packets fail rate from the latest tcp polling.
8369    optional int32 tcp_fail_rate = 7;
8370    // Number of packets sent since the last received packet.
8371    optional int32 tcp_sent_since_last_recv = 8;
8372}
8373
8374/*
8375 * Logs when RescueParty resets some set of experiment flags.
8376 *
8377 * Logged from:
8378 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
8379 */
8380message RescuePartyResetReported {
8381    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
8382    optional int32 rescue_level = 1;
8383}
8384
8385/**
8386 * Logs when signed config is received from an APK, and if that config was applied successfully.
8387 * Logged from:
8388 *   frameworks/base/services/core/java/com/android/server/signedconfig/SignedConfigService.java
8389 */
8390message SignedConfigReported {
8391    enum Type {
8392        UNKNOWN_TYPE = 0;
8393        GLOBAL_SETTINGS = 1;
8394    }
8395    optional Type type = 1;
8396
8397    // The final status of the signed config received.
8398    enum Status {
8399        UNKNOWN_STATUS = 0;
8400        APPLIED = 1;
8401        BASE64_FAILURE_CONFIG = 2;
8402        BASE64_FAILURE_SIGNATURE = 3;
8403        SECURITY_EXCEPTION = 4;
8404        INVALID_CONFIG = 5;
8405        OLD_CONFIG = 6;
8406        SIGNATURE_CHECK_FAILED = 7;
8407        NOT_APPLICABLE = 8;
8408        SIGNATURE_CHECK_FAILED_PROD_KEY_ABSENT = 9;
8409    }
8410    optional Status status = 2;
8411
8412    // The version of the signed config processed.
8413    optional int32 version = 3;
8414
8415    // The package name that the config was extracted from.
8416    optional string from_package = 4;
8417
8418    enum Key {
8419        NO_KEY = 0;
8420        DEBUG = 1;
8421        PRODUCTION = 2;
8422    }
8423    // Which key was used to verify the config.
8424    optional Key verified_with = 5;
8425}
8426
8427/*
8428 * Logs GNSS Network-Initiated (NI) location events.
8429 *
8430 * Logged from:
8431 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
8432 */
8433message GnssNiEventReported {
8434    // The type of GnssNiEvent.
8435    enum EventType {
8436        UNKNOWN = 0;
8437        NI_REQUEST = 1;
8438        NI_RESPONSE = 2;
8439    }
8440    optional EventType event_type = 1;
8441
8442    // An ID generated by HAL to associate NI notifications and UI responses.
8443    optional int32 notification_id = 2;
8444
8445    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
8446    optional android.server.location.GnssNiType ni_type = 3;
8447
8448    // NI requires notification.
8449    optional bool need_notify = 4;
8450
8451    // NI requires verification.
8452    optional bool need_verify = 5;
8453
8454    // NI requires privacy override, no notification/minimal trace.
8455    optional bool privacy_override = 6;
8456
8457    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
8458    // seconds.
8459    optional int32 timeout = 7;
8460
8461    // Default response when timeout.
8462    optional android.server.location.GnssUserResponseType default_response = 8;
8463
8464    // String representing the requester of the network inititated location request.
8465    optional string requestor_id = 9;
8466
8467    // Notification message text string representing the service(for eg. SUPL-service) who sent the
8468    // network initiated location request.
8469    optional string text = 10;
8470
8471    // requestorId decoding scheme.
8472    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;
8473
8474    // Notification message text decoding scheme.
8475    optional android.server.location.GnssNiEncodingType text_encoding = 12;
8476
8477    // True if SUPL ES is enabled.
8478    optional bool is_supl_es_enabled = 13;
8479
8480    // True if GNSS location is enabled.
8481    optional bool is_location_enabled = 14;
8482
8483    // GNSS NI responses which define the response in NI structures.
8484    optional android.server.location.GnssUserResponseType user_response = 15;
8485}
8486
8487/**
8488 * Logs GNSS non-framework (NFW) location notification.
8489 *
8490 * Logged from:
8491 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
8492 */
8493message GnssNfwNotificationReported {
8494    // Package name of the Android proxy application representing the non-framework entity that
8495    // requested location. Set to empty string if unknown.
8496    optional string proxy_app_package_name = 1;
8497
8498    // Protocol stack that initiated the non-framework location request.
8499    optional android.server.location.NfwProtocolStack protocol_stack = 2;
8500
8501    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
8502    // set to empty string. This field is opaque to the framework and used for logging purposes.
8503    optional string other_protocol_stack_name = 3;
8504
8505    // Source initiating/receiving the location information.
8506    optional android.server.location.NfwRequestor requestor = 4;
8507
8508    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
8509    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
8510    // and used for logging purposes.
8511    optional string requestor_id = 5;
8512
8513    // Indicates whether location information was provided for this request.
8514    optional android.server.location.NfwResponseType response_type = 6;
8515
8516    // True if the device is in user initiated emergency session.
8517    optional bool in_emergency_mode = 7;
8518
8519    // True if cached location is provided.
8520    optional bool is_cached_location = 8;
8521
8522    // True if proxy app permission mismatch between framework and GNSS HAL.
8523    optional bool is_permission_mismatched = 9;
8524}
8525
8526/**
8527 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
8528 *
8529 * Logged from:
8530 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
8531 */
8532message GnssConfigurationReported {
8533    // SUPL host name.
8534    optional string supl_host = 1;
8535
8536    // SUPL port number.
8537    optional int32 supl_port = 2;
8538
8539    // C2K host name.
8540    optional string c2k_host = 3;
8541
8542    // C2K port number.
8543    optional int32 c2k_port = 4;
8544
8545    // The SUPL version requested by Carrier.
8546    optional int32 supl_ver = 5;
8547
8548    // The SUPL mode.
8549    optional android.server.location.SuplMode supl_mode = 6;
8550
8551    // True if NI emergency SUPL restrictions is enabled.
8552    optional bool supl_es = 7;
8553
8554    // LTE Positioning Profile settings
8555    optional android.server.location.LppProfile lpp_profile = 8;
8556
8557    // Positioning protocol on A-Glonass system.
8558    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;
8559
8560    // True if emergency PDN is used. Otherwise, regular PDN is used.
8561    optional bool use_emergency_pdn_for_emergency_supl= 10;
8562
8563    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
8564    optional android.server.location.GpsLock gps_lock = 11;
8565
8566    // Number of seconds to extend the emergency session duration post emergency call.
8567    optional int32 es_extension_sec = 12;
8568
8569    // The full list of package names of proxy Android applications representing the non-framework
8570    // location access entities (on/off the device) for which the framework user has granted
8571    // non-framework location access permission. The package names are concatenated in one string
8572    // with spaces as separators.
8573    optional string enabled_proxy_app_package_name_list = 13;
8574}
8575
8576/**
8577 * Logs when a NFC device's error occurred.
8578 * Logged from:
8579 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
8580 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
8581 */
8582message NfcErrorOccurred {
8583    enum Type {
8584        UNKNOWN = 0;
8585        CMD_TIMEOUT = 1;
8586        ERROR_NOTIFICATION = 2;
8587        AID_OVERFLOW = 3;
8588    }
8589    optional Type type = 1;
8590    // If it's nci cmd timeout, log the timeout command.
8591    optional uint32 nci_cmd = 2;
8592
8593    optional uint32 error_ntf_status_code = 3;
8594}
8595
8596/**
8597 * Logs when a NFC device's state changed event
8598 * Logged from:
8599 *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
8600 */
8601message NfcStateChanged {
8602    enum State {
8603        UNKNOWN = 0;
8604        OFF = 1;
8605        ON = 2;
8606        ON_LOCKED = 3; // Secure Nfc enabled.
8607        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
8608    }
8609    optional State state = 1;
8610}
8611
8612/**
8613 * Logs when a NFC Beam Transaction occurred.
8614 * Logged from:
8615 *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
8616 */
8617message NfcBeamOccurred {
8618    enum Operation {
8619        UNKNOWN = 0;
8620        SEND = 1;
8621        RECEIVE = 2;
8622    }
8623    optional Operation operation = 1;
8624}
8625
8626/**
8627 * Logs when a NFC Card Emulation Transaction occurred.
8628 * Logged from:
8629 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
8630 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
8631 */
8632message NfcCardemulationOccurred {
8633    enum Category {
8634        UNKNOWN = 0;
8635        HCE_PAYMENT = 1;
8636        HCE_OTHER = 2;
8637        OFFHOST = 3;
8638    }
8639    // Transaction belongs to HCE payment or HCE other category, or offhost.
8640    optional Category category = 1;
8641    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
8642    optional string se_name = 2;
8643}
8644
8645/**
8646 * Logs when a NFC Tag event occurred.
8647 * Logged from:
8648 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
8649 */
8650message NfcTagOccurred {
8651    enum Type {
8652        UNKNOWN = 0;
8653        URL = 1;
8654        BT_PAIRING = 2;
8655        PROVISION = 3;
8656        WIFI_CONNECT = 4;
8657        APP_LAUNCH = 5;
8658        OTHERS = 6;
8659    }
8660    optional Type type = 1;
8661}
8662
8663/**
8664 * Logs when Hce transaction triggered
8665 * Logged from:
8666 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
8667 */
8668message NfcHceTransactionOccurred {
8669    // The latency period(in microseconds) it took for the first HCE data
8670    // exchange.
8671    optional uint32 latency_micros = 1;
8672}
8673
8674/**
8675 * Logs when SecureElement state event changed
8676 * Logged from:
8677 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
8678 */
8679message SeStateChanged {
8680    enum State {
8681        UNKNOWN = 0;
8682        INITIALIZED = 1;
8683        DISCONNECTED = 2;
8684        CONNECTED = 3;
8685        HALCRASH = 4;
8686    }
8687    optional State state = 1;
8688
8689    optional string state_change_reason = 2;
8690    // SIMx or eSEx.
8691    optional string terminal = 3;
8692}
8693
8694/**
8695 * Information about a permission grant request
8696 */
8697message PermissionGrantRequestResultReported {
8698    // unique value identifying an API call. A API call might result in multiple of these atoms
8699    optional int64 request_id = 1;
8700
8701    // UID of package requesting the permission grant
8702    optional int32 uid = 2 [(is_uid) = true];
8703
8704    // Name of package requesting the permission grant
8705    optional string package_name = 3;
8706
8707    // The permission to be granted
8708    optional string permission_name = 4;
8709
8710    // If the permission was explicitly requested via the API or added by the system
8711    optional bool is_implicit = 5;
8712
8713    enum Result {
8714        UNDEFINED = 0;
8715        // permission request was ignored
8716        IGNORED = 1;
8717        // permission request was ignored because it was user fixed
8718        IGNORED_USER_FIXED = 2;
8719        // permission request was ignored because it was policy fixed
8720        IGNORED_POLICY_FIXED = 3;
8721        // permission was granted by user action
8722        USER_GRANTED = 4;
8723        // permission was automatically granted
8724        AUTO_GRANTED = 5;
8725        // permission was denied by user action
8726        USER_DENIED = 6;
8727        // permission was denied with prejudice by the user
8728        USER_DENIED_WITH_PREJUDICE = 7;
8729        // permission was automatically denied
8730        AUTO_DENIED = 8;
8731        // permission request was ignored because permission is restricted
8732        IGNORED_RESTRICTED_PERMISSION = 9;
8733        // one time permission was granted by user action
8734        USER_GRANTED_ONE_TIME = 10;
8735        // user ignored request by leaving the request screen without choosing any option
8736        USER_IGNORED = 11;
8737        // user granted the permission after being linked to settings
8738        USER_GRANTED_IN_SETTINGS = 12;
8739        // user denied the permission after being linked to settings
8740        USER_DENIED_IN_SETTINGS = 13;
8741        // user denied the permission with prejudice after being linked to settings
8742        USER_DENIED_WITH_PREJUDICE_IN_SETTINGS = 14;
8743        // permission was automatically revoked after one-time permission expired
8744        AUTO_ONE_TIME_PERMISSION_REVOKED = 15;
8745        // permission was automatically revoked for unused app
8746        AUTO_UNUSED_APP_PERMISSION_REVOKED = 16;
8747    }
8748    // The result of the permission grant
8749    optional Result result = 6;
8750}
8751
8752/**
8753 * Logs when Omapi API used
8754 * Logged from:
8755 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
8756 */
8757message SeOmapiReported {
8758    enum Operation {
8759        UNKNOWN = 0;
8760        OPEN_CHANNEL = 1;
8761    }
8762    optional Operation operation = 1;
8763    // SIMx or eSEx.
8764    optional string terminal = 2;
8765
8766    optional string package_name = 3;
8767}
8768
8769/**
8770  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
8771  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
8772  * Logged from:
8773  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
8774  */
8775message BroadcastDispatchLatencyReported {
8776    optional int64 dispatch_latency_millis = 1;
8777}
8778
8779/**
8780   * Logs AttentionManagerService attention check result.
8781   *
8782   * Logged from:
8783   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
8784   */
8785message AttentionManagerServiceResultReported {
8786    // See core/java/android/service/attention/AttentionService.java
8787    enum AttentionCheckResult {
8788        UNKNOWN = 20;
8789        ATTENTION_SUCCESS_ABSENT = 0;
8790        ATTENTION_SUCCESS_PRESENT = 1;
8791        ATTENTION_FAILURE_UNKNOWN = 2;
8792        ATTENTION_FAILURE_CANCELLED = 3;
8793        ATTENTION_FAILURE_PREEMPTED = 4;
8794        ATTENTION_FAILURE_TIMED_OUT = 5;
8795        ATTENTION_FAILURE_CAMERA_PERMISSION_ABSENT = 6;
8796    }
8797    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
8798}
8799
8800/**
8801 * Logs when an adb connection changes state.
8802 *
8803 * Logged from:
8804 *     frameworks/base/services/core/java/com/android/server/adb/AdbDebuggingManager.java
8805 */
8806message AdbConnectionChanged {
8807    // The last time this system connected via adb, or 0 if the 'always allow' option was not
8808    // previously selected for this system.
8809    optional int64 last_connection_time_millis = 1;
8810
8811    // The time in ms within which a subsequent connection from an 'always allow' system is allowed
8812    // to reconnect via adb without user interaction.
8813    optional int64 auth_window_millis = 2;
8814
8815    // The state of the adb connection from frameworks/proto_logging/stats/enums/debug/enums.proto.
8816    optional android.debug.AdbConnectionStateEnum state = 3;
8817
8818    // True if the 'always allow' option was selected for this system.
8819    optional bool always_allow = 4;
8820}
8821
8822/*
8823 * Logs the reported speech DSP status.
8824 *
8825 * Logged from:
8826 *  Vendor audio implementation.
8827 */
8828message SpeechDspStatReported {
8829    // The total Speech DSP uptime in milliseconds.
8830    optional int32 total_uptime_millis = 1;
8831    // The total Speech DSP downtime in milliseconds.
8832    optional int32 total_downtime_millis = 2;
8833    optional int32 total_crash_count = 3;
8834    optional int32 total_recover_count = 4;
8835}
8836
8837/**
8838 * Logs USB connector contaminant status.
8839 *
8840 * Logged from: USB Service.
8841 */
8842message UsbContaminantReported {
8843    optional string id = 1;
8844    optional android.service.ContaminantPresenceStatus status = 2;
8845}
8846
8847/**
8848 * This atom is for debugging purpose.
8849 */
8850message DebugElapsedClock {
8851    // Monotically increasing value for each pull.
8852    optional int64 pull_count = 1;
8853    // Time from System.elapsedRealtime.
8854    optional int64 elapsed_clock_millis = 2;
8855    // Time from System.elapsedRealtime.
8856    optional int64 same_elapsed_clock_millis = 3;
8857    // Diff between current elapsed time and elapsed time from previous pull.
8858    optional int64 elapsed_clock_diff_millis = 4;
8859
8860    enum Type {
8861      TYPE_UNKNOWN = 0;
8862      ALWAYS_PRESENT = 1;
8863      PRESENT_ON_ODD_PULLS = 2;
8864    }
8865    // Type of behavior for the pulled data.
8866    optional Type type = 5;
8867}
8868
8869/**
8870 * This atom is for debugging purpose.
8871 */
8872message DebugFailingElapsedClock {
8873    // Monotically increasing value for each pull.
8874    optional int64 pull_count = 1;
8875    // Time from System.elapsedRealtime.
8876    optional int64 elapsed_clock_millis = 2;
8877    // Time from System.elapsedRealtime.
8878    optional int64 same_elapsed_clock_millis = 3;
8879    // Diff between current elapsed time and elapsed time from previous pull.
8880    optional int64 elapsed_clock_diff_millis = 4;
8881}
8882
8883/** Logs System UI bubbles event changed.
8884 *
8885 * Logged from:
8886 *     frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles
8887 */
8888message BubbleUIChanged {
8889
8890    // The app package that is posting the bubble.
8891    optional string package_name = 1;
8892
8893    // The notification channel that is posting the bubble.
8894    optional string notification_channel = 2;
8895
8896    // The notification id associated with the posted bubble.
8897    optional int32 notification_id = 3;
8898
8899    // The position of the bubble within the bubble stack.
8900    optional int32 position = 4;
8901
8902    // The total number of bubbles within the bubble stack.
8903    optional int32 total_number = 5;
8904
8905    // User interactions with the bubble.
8906    enum Action {
8907        UNKNOWN = 0;
8908        POSTED = 1;
8909        UPDATED = 2;
8910        EXPANDED = 3;
8911        COLLAPSED = 4;
8912        DISMISSED = 5;
8913        STACK_DISMISSED = 6;
8914        STACK_MOVED = 7;
8915        HEADER_GO_TO_APP = 8;
8916        HEADER_GO_TO_SETTINGS = 9;
8917        PERMISSION_OPT_IN = 10;
8918        PERMISSION_OPT_OUT = 11;
8919        PERMISSION_DIALOG_SHOWN = 12;
8920        SWIPE_LEFT = 13;
8921        SWIPE_RIGHT = 14;
8922        STACK_EXPANDED = 15;
8923        FLYOUT = 16;
8924    }
8925    optional Action action = 6;
8926
8927    // Normalized screen position of the bubble stack. The range is between 0 and 1.
8928    optional float normalized_x_position = 7;
8929    optional float normalized_y_position = 8;
8930
8931    // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
8932    optional bool is_unread = 9;
8933
8934    // Whether the bubble is an on-going one.
8935    optional bool is_ongoing = 10;
8936
8937    // Whether the bubble is produced by an app running in foreground.
8938    // This is deprecated and the value should be ignored.
8939    optional bool is_foreground = 11 [deprecated = true];
8940}
8941
8942/**
8943  * Logs System UI bubbles developer errors.
8944  *
8945  * Logged from:
8946  *   frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
8947  */
8948message BubbleDeveloperErrorReported {
8949
8950    // The app package that is posting the bubble.
8951    optional string package_name = 1;
8952
8953    // Bubble developer error type enums.
8954    enum Error {
8955        UNKNOWN = 0;
8956        ACTIVITY_INFO_MISSING = 1;
8957        ACTIVITY_INFO_NOT_RESIZABLE = 2;
8958        DOCUMENT_LAUNCH_NOT_ALWAYS = 3;
8959    }
8960    optional Error error = 2 [default = UNKNOWN];
8961}
8962
8963/**
8964 * Logs that a constraint for a scheduled job has changed.
8965 *
8966 * Logged from:
8967 *     frameworks/base/services/core/java/com/android/server/job/controllers/JobStatus.java
8968 */
8969message ScheduledJobConstraintChanged {
8970    repeated AttributionNode attribution_node = 1;
8971
8972    // Name of the job.
8973    optional string job_name = 2;
8974
8975    optional com.android.server.job.ConstraintEnum constraint = 3;
8976
8977    enum State {
8978        UNKNOWN = 0;
8979        UNSATISFIED = 1;
8980        SATISFIED = 2;
8981    }
8982    optional State state = 4;
8983}
8984
8985/**
8986 * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
8987 * returns true.
8988 *
8989 * Logged from:
8990 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
8991 */
8992message ScreenTimeoutExtensionReported {
8993    // Describes how many times in a row did the power manager reset the screen off timeout.
8994    optional uint32 consecutive_timeout_extended_count = 1;
8995}
8996
8997/*
8998* Logs number of milliseconds it takes to start a process.
8999* The definition of app process start time is from the app launch time to
9000* the time that Zygote finished forking the app process and loaded the
9001* application package's java classes.
9002
9003* This metric is different from AppStartOccurred which is for foreground
9004* activity only.
9005
9006* ProcessStartTime can report all processes (both foreground and background)
9007* start time.
9008*
9009* Logged from:
9010*   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9011*/
9012message ProcessStartTime {
9013    // The uid of the ProcessRecord.
9014    optional int32 uid = 1 [(is_uid) = true];
9015
9016    // The process pid.
9017    optional int32 pid = 2;
9018
9019    // The process name.
9020    // Usually package name, "system" for system server.
9021    // Provided by ActivityManagerService.
9022    optional string process_name = 3;
9023
9024    enum StartType {
9025        UNKNOWN = 0;
9026        WARM = 1;
9027        HOT = 2;
9028        COLD = 3;
9029    }
9030
9031    // The start type.
9032    optional StartType type = 4;
9033
9034    // The elapsed realtime at the start of the process.
9035    optional int64 process_start_time_millis = 5;
9036
9037    // Number of milliseconds it takes to reach bind application.
9038    optional int32 bind_application_delay_millis = 6;
9039
9040    // Number of milliseconds it takes to finish start of the process.
9041    optional int32 process_start_delay_millis = 7;
9042
9043    // hostingType field in ProcessRecord, the component type such as "activity",
9044    // "service", "content provider", "broadcast" or other strings.
9045    optional string hosting_type = 8;
9046
9047    // hostingNameStr field in ProcessRecord. The component class name that runs
9048    // in this process.
9049    optional string hosting_name = 9;
9050}
9051
9052/**
9053 * Track Media Codec usage (nested proto version)
9054 *   This atom is being deprecated in favor of MediaCodecReported which has a
9055 *   flattened CodecData to enable field filtering. The data is identical
9056 *   except MediaCodecReported also has the playback_duration field.
9057 * Logged from:
9058 *   frameworks/av/media/libstagefright/MediaCodec.cpp
9059 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
9060 */
9061message MediametricsCodecReported {
9062    optional int64 timestamp_nanos = 1;
9063    optional string package_name = 2;
9064    optional int64 package_version_code = 3;
9065    optional int64 media_apex_version = 4;
9066
9067    optional android.stats.mediametrics_message.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9068}
9069
9070/**
9071 * Track Media Codec usage
9072 *   This atom is the new version of MediametricsCodecReported and has a
9073 *   flattened CodecData to enable field filtering. The data is identical
9074 *   except for the addition of the playback_duration field.
9075 * Logged from:
9076 *   frameworks/av/media/libstagefright/MediaCodec.cpp
9077 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
9078 */
9079message MediaCodecReported {
9080    optional int64 timestamp_nanos = 1;
9081    // The inclusion of package name in a metric should be carefully analyzed to
9082    // determine if it is absolutely necessary for system health. It is strongly
9083    // discouraged to collect the package name along with other metrics (e.g.
9084    // playback duration).
9085    optional string package_name = 2;
9086    optional int64 package_version_code = 3;
9087    optional int64 media_apex_version = 4;
9088    optional string codec = 5;
9089    optional string mime = 6;
9090    optional string mode = 7;
9091    optional int32 encoder = 8;
9092    optional int32 secure = 9;
9093    optional int32 width = 10;
9094    optional int32 height = 11;
9095    optional int32 rotation = 12;
9096    optional int32 crypto = 13;
9097    optional int32 profile = 14;
9098    optional int32 level = 15;
9099    optional int32 max_width = 16;
9100    optional int32 max_height = 17;
9101    optional int32 error_code = 18;
9102    optional string error_state = 19;
9103    optional int64 latency_max = 20;
9104    optional int64 latency_min = 21;
9105    optional int64 latency_avg = 22;
9106    optional int64 latency_count = 23;
9107    optional int64 latency_unknown = 24;
9108    optional int32 queue_input_buffer_error = 25;
9109    optional int32 queue_secure_input_buffer_error = 26;
9110    optional string bitrate_mode = 27;
9111    optional int32 bitrate = 28;
9112    optional int64 lifetime_millis = 29;
9113    optional int64 playback_duration_seconds = 30;
9114    optional string log_session_id = 31;
9115    optional int32 channel_count = 32;
9116    optional int32 sample_rate = 33;
9117    optional int64 video_encode_bytes = 34;
9118    optional int64 video_encode_frames = 35;
9119    optional int64 video_input_bytes = 36;
9120    optional int64 video_input_frames = 37;
9121    optional int64 video_encode_duration_us = 38;
9122    optional int32 color_format = 39;
9123    optional float frame_rate = 40;
9124    optional float capture_rate = 41;
9125    optional float operating_rate = 42;
9126    optional int32 priority = 43;
9127    optional int32 video_qp_i_min = 44;
9128    optional int32 video_qp_i_max = 45;
9129    optional int32 video_qp_p_min = 46;
9130    optional int32 video_qp_p_max = 47;
9131    optional int32 video_qp_b_min = 48;
9132    optional int32 video_qp_b_max = 49;
9133    optional int32 original_bitrate = 50;
9134    optional int32 shaping_enhanced = 51;
9135    optional int32 original_video_qp_i_min = 52;
9136    optional int32 original_video_qp_i_max = 53;
9137    optional int32 original_video_qp_p_min = 54;
9138    optional int32 original_video_qp_p_max = 55;
9139    optional int32 original_video_qp_b_min = 56;
9140    optional int32 original_video_qp_b_max = 57;
9141    // !!! WARNING
9142    // Keep synchronized with MediametricsCodecReported.CodecData in
9143    // mediametrics_message.proto.
9144    // Also keep AStatsEvent serialization synchronized in statsd_codec.cpp
9145    // !!! WARNING
9146}
9147
9148/**
9149 * Track Media Extractor (pulling video/audio streams out of containers) usage
9150 * Logged from:
9151 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
9152 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
9153 */
9154message MediametricsExtractorReported {
9155    optional int64 timestamp_nanos = 1;
9156    optional string package_name = 2;
9157    optional int64 package_version_code = 3;
9158    optional int64 media_apex_version = 4;
9159
9160    optional android.stats.mediametrics_message.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9161}
9162
9163/**
9164 * Track MediaParser (parsing video/audio streams from containers) usage
9165 * Logged from:
9166 *
9167 *   frameworks/av/services/mediametrics/statsd_mediaparser.cpp
9168 *   frameworks/base/apex/media/framework/jni/android_media_MediaParserJNI.cpp
9169 */
9170message MediametricsMediaParserReported {
9171    optional int64 timestamp_nanos = 1;
9172    optional string package_name = 2;
9173    optional int64 package_version_code = 3;
9174
9175    // MediaParser specific data.
9176    /**
9177     * The name of the parser selected for parsing the media, or an empty string
9178     * if no parser was selected.
9179     */
9180    optional string parser_name = 4;
9181    /**
9182     * Whether the parser was created by name. 1 represents true, and 0
9183     * represents false.
9184     */
9185    optional int32 created_by_name = 5;
9186    /**
9187     * The parser names in the sniffing pool separated by "|".
9188     */
9189    optional string parser_pool = 6;
9190    /**
9191     * The fully qualified name of the last encountered exception, or an empty
9192     * string if no exception was encountered.
9193     */
9194    optional string last_exception = 7;
9195    /**
9196     * The size of the parsed media in bytes, or -1 if unknown. Note this value
9197     * contains intentional random error to prevent media content
9198     * identification.
9199     */
9200    optional int64 resource_byte_count = 8;
9201    /**
9202     * The duration of the media in milliseconds, or -1 if unknown. Note this
9203     * value contains intentional random error to prevent media content
9204     * identification.
9205     */
9206    optional int64 duration_millis = 9;
9207    /**
9208     * The MIME types of the tracks separated by "|".
9209     */
9210    optional string track_mime_types = 10;
9211    /**
9212     * The tracks' RFC 6381 codec strings separated by "|".
9213     */
9214    optional string track_codecs = 11;
9215    /**
9216     * Concatenation of the parameters altered by the client, separated by "|".
9217     */
9218    optional string altered_parameters = 12;
9219    /**
9220     * The video width in pixels, or -1 if unknown or not applicable.
9221     */
9222    optional int32 video_width = 13;
9223    /**
9224     * The video height in pixels, or -1 if unknown or not applicable.
9225     */
9226    optional int32 video_height = 14;
9227    /**
9228     * Session id for correlating playback metrics.
9229     */
9230    optional string log_session_id = 15;
9231}
9232
9233/**
9234 * Track how we arbitrate between microphone/input requests.
9235 * Logged from
9236 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
9237 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
9238 */
9239message MediametricsAudiopolicyReported {
9240    optional int64 timestamp_nanos = 1;
9241    optional string package_name = 2;
9242    optional int64 package_version_code = 3;
9243    optional int64 media_apex_version = 4;
9244
9245    optional android.stats.mediametrics_message.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9246}
9247
9248/**
9249 * Track how we arbitrate between microphone requests.
9250 * Logged from
9251 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
9252 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
9253 */
9254message MediametricsAudiorecordReported {
9255    optional int64 timestamp_nanos = 1;
9256    optional string package_name = 2;
9257    optional int64 package_version_code = 3;
9258    optional int64 media_apex_version = 4;
9259
9260    optional android.stats.mediametrics_message.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9261
9262    // Android S
9263    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
9264    // An empty string means no session id is set.
9265    optional string log_session_id = 6;
9266}
9267
9268/**
9269 * Track how we arbitrate between microphone/input requests.
9270 * Logged from
9271 *   frameworks/av/media/libnblog/ReportPerformance.cpp
9272 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
9273 */
9274message MediametricsAudiothreadReported {
9275    optional int64 timestamp_nanos = 1;
9276    optional string package_name = 2;
9277    optional int64 package_version_code = 3;
9278    optional int64 media_apex_version = 4;
9279
9280    optional android.stats.mediametrics_message.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9281}
9282
9283/**
9284 * Track how we arbitrate between microphone/input requests.
9285 * Logged from
9286 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
9287 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
9288 */
9289message MediametricsAudiotrackReported {
9290    optional int64 timestamp_nanos = 1;
9291    optional string package_name = 2;
9292    optional int64 package_version_code = 3;
9293    optional int64 media_apex_version = 4;
9294
9295    optional android.stats.mediametrics_message.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9296
9297    // Android S
9298    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
9299    // An empty string means no session id is set.
9300    optional string log_session_id = 6;
9301}
9302
9303/**
9304 * Track information about DRM framework performance
9305 * Logged from
9306 *   frameworks/av/drm/libmediadrm/DrmHal.cpp
9307 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
9308 */
9309message MediametricsMediadrmReported {
9310    optional int64 timestamp_nanos = 1;
9311    optional string package_name = 2;
9312    optional int64 package_version_code = 3;
9313    optional int64 media_apex_version = 4;
9314
9315    // vendor+description tell about which DRM plugin is in use on this device
9316    optional string vendor = 5;
9317    optional string description = 6;
9318    // from frameworks/av/drm/libmediadrm/protos/metrics.proto
9319    optional bytes framework_stats = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
9320}
9321
9322/**
9323 * Track information about the widevine DRM plugin performance
9324 * Logged from
9325 *   vendor/widevine/libwvdrmengine/cdm/metrics
9326 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
9327 *
9328 * TODO b/182382094 -remove after migrated mediadrm metrics
9329 * reporting to statsd.
9330 */
9331message MediametricsDrmWidevineReported {
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 bytes vendor_specific_stats = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9338}
9339
9340/**
9341 * Track information about recordings (e.g. camcorder)
9342 * Logged from
9343 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
9344 *   frameworks/av/services/mediaanalytics/statsd_recorder.cpp
9345 */
9346message MediametricsRecorderReported {
9347    optional int64 timestamp_nanos = 1;
9348    optional string package_name = 2;
9349    optional int64 package_version_code = 3;
9350    optional int64 media_apex_version = 4;
9351
9352    optional android.stats.mediametrics_message.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9353}
9354
9355/**
9356 * Track Media Player usage
9357 * Logged from:
9358 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
9359 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
9360 */
9361message MediametricsNuPlayerReported {
9362    optional int64 timestamp_nanos = 1;
9363    optional string package_name = 2;
9364    optional int64 package_version_code = 3;
9365    optional int64 media_apex_version = 4;
9366
9367    optional android.stats.mediametrics_message.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
9368}
9369
9370/**
9371 * Track Legacy DRM usage
9372 * Logged from
9373 *   frameworks/av/drm/drmserver/DrmManager.cpp
9374 */
9375message MediametricsDrmManagerReported {
9376    optional int64 timestamp_nanos = 1;
9377    optional string package_name = 2;
9378    optional int64 package_version_code = 3;
9379    optional int64 media_apex_version = 4;
9380
9381    enum Method {
9382        METHOD_NOT_FOUND       = -1;
9383        GET_CONSTRAINTS        =  0;
9384        GET_METADATA           =  1;
9385        CAN_HANDLE             =  2;
9386        PROCESS_DRM_INFO       =  3;
9387        ACQUIRE_DRM_INFO       =  4;
9388        SAVE_RIGHTS            =  5;
9389        GET_ORIGINAL_MIME_TYPE =  6;
9390        GET_DRM_OBJECT_TYPE    =  7;
9391        CHECK_RIGHTS_STATUS    =  8;
9392        REMOVE_RIGHTS          =  9;
9393        REMOVE_ALL_RIGHTS      = 10;
9394        OPEN_CONVERT_SESSION   = 11;
9395        OPEN_DECRYPT_SESSION   = 12;
9396    }
9397
9398    // plugin_id+description inform which Legacy DRM plugins are still in use on device
9399    optional string plugin_id = 5;
9400    optional string description = 6;
9401    optional Method method = 7;
9402    optional string mime_types = 8;
9403
9404    optional int64 get_constraints_count =  9;
9405    optional int64 get_metadata_count = 10;
9406    optional int64 can_handle_count = 11;
9407    optional int64 process_drm_info_count = 12;
9408    optional int64 acquire_drm_info_count = 13;
9409    optional int64 save_rights_count = 14;
9410    optional int64 get_original_mime_type_count = 15;
9411    optional int64 get_drm_object_type_count = 16;
9412    optional int64 check_rights_status_count = 17;
9413    optional int64 remove_rights_count = 18;
9414    optional int64 remove_all_rights_count = 19;
9415    optional int64 open_convert_session_count = 20;
9416    optional int64 open_decrypt_session_count = 21;
9417}
9418
9419/**
9420 * State of a all permission requested by a all package
9421 * Pulled from: StatsCompanionService
9422*/
9423message DangerousPermissionState {
9424    // Name of the permission
9425    optional string permission_name = 1;
9426
9427    // Uid of the package
9428    optional int32 uid = 2 [(is_uid) = true];
9429
9430    // Package requesting the permission
9431    optional string package_name = 3;
9432
9433    // If the permission is granted to the uid
9434    optional bool is_granted = 4;
9435
9436    // Permission flags as per android.content.pm.PermissionFlags
9437    optional int32 permission_flags = 5;
9438
9439    // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
9440    optional int32 protection_flags = 6;
9441}
9442
9443/**
9444 * Logs when a package is denied access to a device identifier based on the new access requirements.
9445 *
9446 * Logged from:
9447 *     frameworks/base/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
9448 */
9449message DeviceIdentifierAccessDenied {
9450    // The name of the package denied access to the requested device identifier.
9451    optional string package_name = 1;
9452
9453    // The name of the device identifier method the package attempted to invoke.
9454    optional string method_name = 2;
9455
9456    // True if the package is preinstalled.
9457    // Starting from Android 11, this boolean is not set and will always be false.
9458    optional bool is_preinstalled = 3 [deprecated = true];
9459
9460    // True if the package is privileged.
9461    // Starting from Android 11, this boolean is not set and will always be false.
9462    optional bool is_priv_app = 4 [deprecated = true];
9463}
9464
9465/**
9466 * Pulls the ongoing mainline install train version code.
9467 * Pulled from StatsCompanionService
9468 */
9469message TrainInfo {
9470    optional int64 train_version_code = 1;
9471
9472    optional TrainExperimentIds train_experiment_id = 2 [(log_mode) = MODE_BYTES];
9473
9474    optional string train_name = 3;
9475
9476    enum Status {
9477        UNKNOWN = 0;
9478        INSTALL_REQUESTED = 1;
9479        INSTALL_STARTED = 2;
9480        INSTALL_STAGED_NOT_READY = 3;
9481        INSTALL_STAGED_READY = 4;
9482        INSTALL_SUCCESS = 5;
9483        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
9484        // and INSTALL_FAILURE_COMMIT.
9485        INSTALL_FAILURE = 6  [deprecated = true];
9486        // This enum is for installs that are manually cancelled via the Manual Update UI.
9487        INSTALL_CANCELLED = 7;
9488        INSTALLER_ROLLBACK_REQUESTED = 8;
9489        INSTALLER_ROLLBACK_INITIATED = 9;
9490        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
9491        INSTALLER_ROLLBACK_STAGED = 11;
9492        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
9493        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
9494        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
9495        INSTALLER_ROLLBACK_SUCCESS = 15;
9496        INSTALLER_ROLLBACK_FAILURE = 16;
9497        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
9498        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
9499        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
9500        INSTALL_STAGED_CANCEL_REQUESTED = 20;
9501        INSTALL_STAGED_CANCEL_SUCCESS = 21;
9502        INSTALL_STAGED_CANCEL_FAILURE = 22;
9503        INSTALL_FAILURE_DOWNLOAD = 23;
9504        INSTALL_FAILURE_STATE_MISMATCH = 24;
9505        INSTALL_FAILURE_COMMIT = 25;
9506        REBOOT_TRIGGERED = 26;
9507    }
9508    optional Status status = 4;
9509}
9510
9511/**
9512 * Logs the gesture stage changed event.
9513 *
9514 * Logged from:
9515 *   frameworks/base/packages/SystemUI/
9516 */
9517message AssistGestureStageReported {
9518    optional android.hardware.sensor.assist.AssistGestureStageEnum gesture_stage = 1;
9519}
9520
9521/**
9522 * Logs the feedback type.
9523 *
9524 * Logged from:
9525 *   frameworks/base/packages/SystemUI/
9526 */
9527message AssistGestureFeedbackReported {
9528    // Whether or not the gesture was used.
9529    optional android.hardware.sensor.assist.AssistGestureFeedbackEnum feedback_type = 1;
9530}
9531
9532/**
9533 * Logs the progress.
9534 *
9535 * Logged from:
9536 *   frameworks/base/packages/SystemUI/
9537 */
9538message AssistGestureProgressReported {
9539    // [0,100] progress for the assist gesture.
9540    optional int32 progress = 1;
9541}
9542
9543/*
9544 * Information about the time zone data on a device.
9545 */
9546message TimeZoneDataInfo {
9547    // A version identifier for the data set on device. e.g. "2018i"
9548    optional string tzdb_version = 1;
9549}
9550
9551/**
9552 * Logs the GPU stats global health information.
9553 *
9554 * Logged from:
9555 *   frameworks/native/services/gpuservice/gpustats/
9556 */
9557message GpuStatsGlobalInfo {
9558    // Package name of the gpu driver.
9559    optional string driver_package_name = 1;
9560
9561    // Version name of the gpu driver.
9562    optional string driver_version_name = 2;
9563
9564    // Version code of the gpu driver.
9565    optional int64 driver_version_code = 3;
9566
9567    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
9568    optional int64 driver_build_time = 4;
9569
9570    // Total count of the gl driver gets loaded.
9571    optional int64 gl_loading_count = 5;
9572
9573    // Total count of the gl driver fails to be loaded.
9574    optional int64 gl_loading_failure_count = 6;
9575
9576    // Total count of the Vulkan driver gets loaded.
9577    optional int64 vk_loading_count = 7;
9578
9579    // Total count of the Vulkan driver fails to be loaded.
9580    optional int64 vk_loading_failure_count = 8;
9581
9582    // Api version of the system Vulkan driver.
9583    optional int32 vulkan_version = 9;
9584
9585    // Api version of the system CPU Vulkan driver.
9586    optional int32 cpu_vulkan_version = 10;
9587
9588    // Api version of the system GLES driver.
9589    optional int32 gles_version = 11;
9590
9591    // Total count of the angle driver gets loaded.
9592    optional int64 angle_loading_count = 12;
9593
9594    // Total count of the angle driver fails to be loaded.
9595    optional int64 angle_loading_failure_count = 13;
9596}
9597
9598/**
9599 * GPU driver loading time info.
9600 */
9601message GpuDriverLoadingTime {
9602    // List of all the driver loading times for this app. The list size is
9603    // capped at 50.
9604    repeated int64 driver_loading_time = 1;
9605}
9606
9607/**
9608 * Logs the GPU stats per app health information.
9609 *
9610 * Logged from:
9611 *   frameworks/native/services/gpuservice/gpustats/
9612 */
9613message GpuStatsAppInfo {
9614    // Package name of the application that loads the gpu driver. Total number
9615    // of different packages is capped at 100.
9616    optional string app_package_name = 1;
9617
9618    // Version code of the gpu driver this app loads.
9619    optional int64 driver_version_code = 2;
9620
9621    // gl driver loading time info.
9622    optional GpuDriverLoadingTime gl_driver_loading_time = 3
9623            [(android.os.statsd.log_mode) = MODE_BYTES];
9624
9625    // Vulkan driver loading time info.
9626    optional GpuDriverLoadingTime vk_driver_loading_time = 4
9627            [(android.os.statsd.log_mode) = MODE_BYTES];
9628
9629    // Angle driver loading time info.
9630    optional GpuDriverLoadingTime angle_driver_loading_time = 5
9631            [(android.os.statsd.log_mode) = MODE_BYTES];
9632
9633    // CPU Vulkan implementation is in use.
9634    optional bool cpu_vulkan_in_use = 6;
9635
9636    // App is not doing pre-rotation correctly.
9637    optional bool false_prerotation = 7;
9638
9639    // App creates GLESv1 context.
9640    optional bool gles_1_in_use = 8;
9641}
9642
9643/*
9644 * Logs the size of the system ion heap.
9645 *
9646 * Pulled from StatsCompanionService.
9647 */
9648message SystemIonHeapSize {
9649    // Deprecated due to limited support of ion stats in debugfs.
9650    // Use `IonHeapSize` instead.
9651    option deprecated = true;
9652
9653    // Size of the system ion heap in bytes.
9654    // Read from debugfs.
9655    optional int64 size_in_bytes = 1;
9656}
9657
9658/*
9659 * Logs the total size of the ion heap.
9660 *
9661 * Pulled from StatsCompanionService.
9662 */
9663message IonHeapSize {
9664    // Total size of all ion heaps in kilobytes.
9665    // Read from: /sys/kernel/ion/total_heaps_kb.
9666    optional int32 total_size_kb = 1;
9667}
9668
9669/*
9670 * Logs the per-process size of the system ion heap.
9671 *
9672 * Pulled from StatsCompanionService.
9673 */
9674message ProcessSystemIonHeapSize {
9675    // The uid if available. -1 means not available.
9676    optional int32 uid = 1 [(is_uid) = true];
9677
9678    // The process name (from /proc/PID/cmdline).
9679    optional string process_name = 2;
9680
9681    // Sum of sizes of all allocations.
9682    optional int32 total_size_in_kilobytes = 3;
9683
9684    // Number of allocations.
9685    optional int32 allocation_count = 4;
9686
9687    // Size of the largest allocation.
9688    optional int32 max_size_in_kilobytes = 5;
9689}
9690
9691/*
9692 * Logs system-wide (primarily kernel) memory stats. Sourced from
9693 * /proc/meminfo unless explicitly stated otherwise.
9694 *
9695 * Pulled from StatsCompanionService.
9696 */
9697message SystemMemory {
9698    // /proc/meminfo SUnreclaim
9699    optional int32 unreclaimable_slab_kb = 1;
9700
9701    // /proc/meminfo VmallocUsed
9702    optional int32 vmalloc_used_kb = 2;
9703
9704    // /proc/meminfo PageTables
9705    optional int32 page_tables_kb = 3;
9706
9707    // /proc/meminfo KernelStack
9708    optional int32 kernel_stack_kb = 4;
9709
9710    // Total unreclaimable ion.
9711    // Reported from os.Debug.getIonHeapsSizeKb (R+)
9712    optional int32 total_ion_kb = 5;
9713
9714    // Measures for the amount of memory we could not account for.
9715    // Essentially points to kernel allocations (as all userspace allocs are
9716    // already tracked).
9717    // Device-specific.
9718    optional int32 unaccounted_kb = 6;
9719
9720    // GPU kernel driver allocations.
9721    // Can overlap with ion memory.
9722    // Reported from os.Debug.getGpuTotalUsageKb (S+)
9723    optional int32 gpu_total_usage_kb = 7;
9724
9725    // GPU kernel driver private allocations.
9726    // Does not overlap with ion memory
9727    // Computed as total usage - Debug.getGpuDmaBufUsageKb()
9728    // Only available on supported kernel versions (5.4+)
9729    optional int32 gpu_private_usage_kb = 8;
9730
9731    // Total DMABUF memory allocations
9732    // Reported from os.Debug.getDmabufTotalExportedKb (S+)
9733    optional int32 dmabuf_total_exported_kb = 9;
9734}
9735
9736/*
9737 * Log dmabuf memory retained by userspace processes.
9738 * Pulled from StatsPullAtomService.
9739 */
9740 message ProcessDmabufMemory {
9741  // The uid if available. -1 means not available.
9742  optional int32 uid = 1 [(is_uid) = true];
9743
9744  // The process name (from ActivityManager).
9745  optional string process_name = 2;
9746
9747  // OOM adj score.
9748  optional int32 oom_adj_score = 3;
9749
9750  // Size of dmabufs retained by the process. The buffers are either mapped,
9751  // retained via an fd, or both.
9752  // Only available on supported kernel versions (5.4+). When unavailable, set
9753  // to -1.
9754  optional int32 retained_dmabuf_kb = 4;
9755
9756  // Number of buffers retained by the process (mapped / fd).
9757  // Only available on supported kernel versions (5.4+). When unavailable, set
9758  // to -1.
9759  optional int32 retained_dmabuf_count = 5;
9760
9761  // Size of dmabufs mapped to the process address space.
9762  optional int32 mapped_dmabuf_kb = 6;
9763
9764  // Number of dmabufs mapped to the process address space.
9765  optional int32 mapped_dmabuf_count = 7;
9766}
9767
9768/**
9769 * Push network stack events.
9770 *
9771 * Log from:
9772 *     frameworks/base/packages/NetworkStack/
9773 */
9774message NetworkStackReported {
9775    // The id that indicates the event reported from NetworkStack.
9776    optional int32 event_id = 1;
9777    // The data for the reported events.
9778    optional android.stats.connectivity.NetworkStackEventData network_stack_event = 2 [(log_mode) = MODE_BYTES];
9779}
9780
9781/**
9782 * Logs the apps that are installed on the external storage.
9783 * Pulled from:
9784 *   StatsCompanionService
9785 */
9786message AppsOnExternalStorageInfo {
9787    // The type of the external storage.
9788    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
9789    // The name of the package that is installed on the external storage.
9790    optional string package_name = 2;
9791}
9792
9793/**
9794 * Logs the settings related to Face.
9795 * Logged from:
9796 *   frameworks/base/services/core/java/com/android/server/stats
9797 */
9798message FaceSettings {
9799    // Whether or not face unlock is allowed on Keyguard.
9800    optional bool unlock_keyguard_enabled = 1;
9801    // Whether or not face unlock dismisses the Keyguard.
9802    optional bool unlock_dismisses_keyguard = 2;
9803    // Whether or not face unlock requires attention.
9804    optional bool unlock_attention_required = 3;
9805    // Whether or not face unlock is allowed for apps (through BiometricPrompt).
9806    optional bool unlock_app_enabled = 4;
9807    // Whether or not face unlock always requires user confirmation.
9808    optional bool unlock_always_require_confirmation = 5;
9809    // Whether or not a diverse set of poses are required during enrollment.
9810    optional bool unlock_diversity_required = 6;
9811}
9812
9813/**
9814 * Logs cooling devices maintained by the kernel.
9815 *
9816 * Pulled from StatsCompanionService.java
9817 */
9818message CoolingDevice {
9819    // The type of cooling device being reported. Eg. CPU, GPU...
9820    optional android.os.CoolingTypeEnum device_location = 1;
9821    // The name of the cooling device source. Eg. CPU0
9822    optional string device_name = 2;
9823    // Current throttle state of the cooling device. The value can any unsigned
9824    // integer between 0 and max_state defined in its driver. 0 means device is
9825    // not in throttling, higher value means deeper throttling.
9826    optional int32 state = 3;
9827}
9828
9829/**
9830 * Intelligence has several counter-type events that don't warrant a
9831 * full separate atom. These are primarily API call counters but also include
9832 * counters for feature usage and specific failure modes.
9833 *
9834 * Logged from the Intelligence mainline module.
9835 */
9836message IntelligenceEventReported {
9837  // The event type.
9838  optional android.stats.intelligence.EventType event_id = 1;
9839  // Success, failure.
9840  optional android.stats.intelligence.Status status = 2;
9841  // How many times the event occured (to report a batch of high frequency events).
9842  optional int32 count = 3;
9843  // How long the event took (sum of durations if count > 1)
9844  optional int64 duration_millis = 4;
9845}
9846
9847/**
9848 * Logs when Car Power state changed.
9849 *
9850 * Logged from:
9851 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
9852 */
9853message CarPowerStateChanged {
9854    // States come from CpmsState in CarPowerManagementService.java.
9855    enum State {
9856       WAIT_FOR_VHAL = 0;
9857       ON = 1;
9858       SHUTDOWN_PREPARE = 2;
9859       WAIT_FOR_FINISH = 3;
9860       SUSPEND = 4;
9861       SIMULATE_SLEEP = 5;
9862    }
9863    optional State state = 1;
9864}
9865
9866/**
9867 * Logs when Car User Hal is requested to switch/create/remove user.
9868 *
9869 * Logged from:
9870 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
9871 */
9872message CarUserHalModifyUserRequestReported {
9873    // Request id for the request.
9874    optional int32 request_id = 1;
9875    // Request type.
9876    enum RequestType {
9877        UNKNOWN = 0;
9878        // Car user manager requested user switch.
9879        SWITCH_REQUEST_ANDROID = 1;
9880        // OEM requested User switch.
9881        SWITCH_REQUEST_OEM = 2;
9882        // Hal switch requested after android switch using activity manager.
9883        SWITCH_REQUEST_LEGACY = 3;
9884        // Create User
9885        CREATE_REQUEST = 4;
9886        // Remove User
9887        REMOVE_REQUEST = 5;
9888    }
9889    optional RequestType request_type = 2;
9890    // Android User id of the current user which can only be 0, 10, 11 and so on.
9891    // -1 if not available.
9892    optional int32 user_id = 3;
9893    // VHAL flags of the current user. (-1 if not available)
9894    optional int32 user_flags = 4;
9895    // Android User id of the target user for switch/create/remove. It can only
9896    // be 0, 10, 11 and so on. -1 if not available.
9897    optional int32 target_user_id = 5;
9898    // VHAL flags of the target user for switch/create/remove. (-1 if not available)
9899    optional int32 target_user_flags = 6;
9900    // Request timeout Milliseconds (-1 if not available)
9901    optional int32 timeout_millis = 7;
9902}
9903
9904/**
9905 * Logs when Car User Hal responds to switch/create user request.
9906 *
9907 * Logged from:
9908 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
9909 */
9910message CarUserHalModifyUserResponseReported {
9911    // Request id of the request associated with the response.
9912    optional int32 request_id = 1;
9913    // Car user hal callback status.
9914    enum CallbackStatus {
9915        UNKNOWN = 0;
9916        // Hal response was invalid.
9917        INVALID = 1;
9918        // Hal response was ok.
9919        OK = 2;
9920        // Hal timeout during set call.
9921        HAL_SET_TIMEOUT = 3;
9922        // Hal response timeout.
9923        HAL_RESPONSE_TIMEOUT = 4;
9924        // Hal responded with wrong info.
9925        WRONG_HAL_RESPONSE = 5;
9926        // Hal is processing multiple requests simultaneously.
9927        CONCURRENT_OPERATION = 6;
9928    }
9929    optional CallbackStatus callback_status = 2;
9930
9931    // Hal request status for user switch/create/remove.
9932    enum HalRequestStatus {
9933        UNSPECIFIED = 0;
9934        // Hal request for user switch/create is successful.
9935        SUCCESS = 1;
9936        // Hal request for user switch/create failed.
9937        FAILURE = 2;
9938    }
9939    optional HalRequestStatus request_status = 3;
9940}
9941
9942/**
9943 * Logs when post switch response is posted to Car User Hal.
9944 *
9945 * Logged from:
9946 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
9947 */
9948message CarUserHalPostSwitchResponseReported {
9949    // Request id.
9950    optional int32 request_id = 1;
9951
9952    // Android user switch status.
9953    enum UserSwitchStatus {
9954        UNKNOWN = 0;
9955        // Android user switch is successful.
9956        SUCCESS = 1;
9957        // Android user switch failed.
9958        FAILURE = 2;
9959    }
9960    optional UserSwitchStatus switch_status = 2;
9961}
9962
9963/**
9964 * Logs when initial user information is requested from Car User Hal.
9965 *
9966 * Logged from:
9967 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
9968 */
9969message CarUserHalInitialUserInfoRequestReported {
9970    // Request id for the request.
9971    optional int32 request_id = 1;
9972
9973    // Request type for initial user information.
9974    enum InitialUserInfoRequestType {
9975        UNKNOWN = 0;
9976        // At the first time Android was booted (or after a factory reset).
9977        FIRST_BOOT = 1;
9978        // At the first time Android was booted after the system was updated.
9979        FIRST_BOOT_AFTER_OTA = 2;
9980        // When Android was booted "from scratch".
9981        COLD_BOOT = 3;
9982        // When Android was resumed after the system was suspended to memory.
9983        RESUME = 4;
9984    }
9985    optional InitialUserInfoRequestType request_type = 2;
9986    // Request timeout Milliseconds (-1 if not available)
9987    optional int32 timeout_millis = 3;
9988}
9989
9990/**
9991 * Logs when Car User Hal responds to initial user information requests.
9992 *
9993 * Logged from:
9994 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
9995 */
9996message CarUserHalInitialUserInfoResponseReported {
9997    // Request id of the request associated with the response.
9998    optional int32 request_id = 1;
9999    // Car user hal callback status.
10000    enum CallbackStatus {
10001        UNKNOWN = 0;
10002        // Hal response was invalid.
10003        INVALID = 1;
10004        // Hal response was ok.
10005        OK = 2;
10006        // Hal timeout during set call.
10007        HAL_SET_TIMEOUT = 3;
10008        // Hal response timeout.
10009        HAL_RESPONSE_TIMEOUT = 4;
10010        // Hal responded with wrong info.
10011        WRONG_HAL_RESPONSE = 5;
10012        // Hal is processing multiple requests simultaneously.
10013        CONCURRENT_OPERATION = 6;
10014    }
10015    optional CallbackStatus callback_status = 2;
10016    // Response for initial user information request.
10017    enum InitialUserInfoResponseAction {
10018        UNSPECIFIED = 0;
10019        // Let the Android System decide what to do.
10020        DEFAULT = 1;
10021        // Switch to an existing Android user.
10022        SWITCH = 2;
10023        // Create a new Android user (and switch to it).
10024        CREATE = 3;
10025    }
10026    optional InitialUserInfoResponseAction response_action = 3;
10027    // Android User id of the target user which can only be 0, 10, 11 and so on.
10028    // -1 if not available.
10029    optional int32 target_user = 4;
10030    // VHAL flags of the current user. (-1 if not available)
10031    optional int32 target_user_flags = 5;
10032    // User locales
10033    optional string user_locales = 6;
10034}
10035
10036/**
10037 * Logs when set user association is requested from Car User Hal.
10038 *
10039 * Logged from:
10040 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10041 */
10042message CarUserHalUserAssociationRequestReported {
10043    // Request id for the request.
10044    optional int32 request_id = 1;
10045    // Request type.
10046    enum RequestType {
10047        UNKNOWN = 0;
10048        // For setting user association information.
10049        SET = 1;
10050        // For getting user association information.
10051        GET = 2;
10052    }
10053    optional RequestType request_type = 2;
10054    // Android User id of the current user which can only be 0, 10, 11 and so on.
10055    // -1 if not available.
10056    optional int32 current_user_id = 3;
10057    // VHAL flags of the current user. (-1 if not available)
10058    optional int32 current_user_flags = 4;
10059    // Number of the set associations requested.
10060    optional int32 number_associations = 5;
10061    // Concatenated string for the types from set associations request.
10062    // This is a string converted from an array of integers.
10063    optional string user_identification_association_types = 6;
10064    // Concatenated string for the values from set associations request.
10065    // This is a string converted from an array of integers.
10066    optional string user_identification_association_values = 7;
10067}
10068
10069/**
10070 * Logs when Car User Hal responds to set user association requests.
10071 *
10072 * Logged from:
10073 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
10074 */
10075message CarUserHalSetUserAssociationResponseReported {
10076    // Request id of the request associated with the response.
10077    optional int32 request_id = 1;
10078    // Car user hal callback status.
10079    enum CallbackStatus {
10080        UNKNOWN = 0;
10081        // Hal response was invalid.
10082        INVALID = 1;
10083        // Hal response was ok.
10084        OK = 2;
10085        // Hal timeout during set call.
10086        HAL_SET_TIMEOUT = 3;
10087        // Hal response timeout.
10088        HAL_RESPONSE_TIMEOUT = 4;
10089        // Hal responded with wrong info.
10090        WRONG_HAL_RESPONSE = 5;
10091        // Hal is processing multiple requests simultaneously.
10092        CONCURRENT_OPERATION = 6;
10093    }
10094    optional CallbackStatus callback_status = 2;
10095    // Number of the set associations in the response.
10096    optional int32 number_associations = 3;
10097    // Concatenated string for the types from set associations request.
10098    // This is a string converted from an array of integers.
10099    optional string user_identification_association_types = 4;
10100    // Concatenated string for the values from set associations request.
10101    // This is a string converted from an array of integers.
10102    optional string user_identification_association_values = 5;
10103}
10104
10105/**
10106 * Logs whether GarageMode is entered.
10107 *
10108 * Logged from:
10109 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
10110 */
10111message GarageModeInfo {
10112    // Whether GarageMode is entered.
10113    optional bool is_garage_mode = 1;
10114}
10115
10116/**
10117 * Historical app ops data per package.
10118 */
10119message AppOps {
10120    // Uid of the package requesting the op
10121    optional int32 uid = 1 [(is_uid) = true];
10122
10123    // Name of the package performing the op
10124    optional string package_name = 2;
10125
10126    // operation id
10127    optional android.app.AppOpEnum op_id = 3 [default = APP_OP_NONE];
10128
10129    // The number of times the op was granted while the app was in the
10130    // foreground (only for trusted requests)
10131    optional int64 trusted_foreground_granted_count = 4;
10132
10133    // The number of times the op was granted while the app was in the
10134    // background (only for trusted requests)
10135    optional int64 trusted_background_granted_count = 5;
10136
10137    // The number of times the op was rejected while the app was in the
10138    // foreground (only for trusted requests)
10139    optional int64 trusted_foreground_rejected_count = 6;
10140
10141    // The number of times the op was rejected while the app was in the
10142    // background (only for trusted requests)
10143    optional int64 trusted_background_rejected_count = 7;
10144
10145    // For long-running operations, total duration of the operation
10146    // while the app was in the foreground (only for trusted requests)
10147    optional int64 trusted_foreground_duration_millis = 8;
10148
10149    // For long-running operations, total duration of the operation
10150    // while the app was in the background (only for trusted requests)
10151    optional int64 trusted_background_duration_millis = 9;
10152
10153    // Whether AppOps is guarded by Runtime permission
10154    optional bool is_runtime_permission = 10;
10155}
10156
10157/**
10158 * Historical app ops data per package and attribution tag.
10159 */
10160message AttributedAppOps {
10161    // Uid of the package requesting the op
10162    optional int32 uid = 1 [(is_uid) = true];
10163
10164    // Name of the package performing the op
10165    optional string package_name = 2;
10166
10167    // tag; provided by developer when accessing related API, limited at 50 chars by API.
10168    // Attributions must be provided through manifest using <attribution> tag available in R and
10169    // above.
10170    optional string tag = 3;
10171
10172    // operation id
10173    optional android.app.AppOpEnum op = 4 [default = APP_OP_NONE];
10174
10175    // The number of times the op was granted while the app was in the
10176    // foreground (only for trusted requests)
10177    optional int64 trusted_foreground_granted_count = 5;
10178
10179    // The number of times the op was granted while the app was in the
10180    // background (only for trusted requests)
10181    optional int64 trusted_background_granted_count = 6;
10182
10183    // The number of times the op was rejected while the app was in the
10184    // foreground (only for trusted requests)
10185    optional int64 trusted_foreground_rejected_count = 7;
10186
10187    // The number of times the op was rejected while the app was in the
10188    // background (only for trusted requests)
10189    optional int64 trusted_background_rejected_count = 8;
10190
10191    // For long-running operations, total duration of the operation
10192    // while the app was in the foreground (only for trusted requests)
10193    optional int64 trusted_foreground_duration_millis = 9;
10194
10195    // For long-running operations, total duration of the operation
10196    // while the app was in the background (only for trusted requests)
10197    optional int64 trusted_background_duration_millis = 10;
10198
10199    // Whether AppOps is guarded by Runtime permission
10200    optional bool is_runtime_permission = 11;
10201
10202    // Sampling rate used on device, from 0 to 100
10203    optional int32 sampling_rate = 12;
10204}
10205
10206/**
10207 * Location Manager API Usage information(e.g. API under usage,
10208 * API call's parameters).
10209 * Logged from:
10210 *  frameworks/base/services/core/java/com/android/server/LocationManagerService.java
10211 */
10212message LocationManagerApiUsageReported {
10213
10214    // Indicating if usage starts or usage ends.
10215    optional android.stats.location.UsageState state = 1;
10216
10217    // LocationManagerService's API in use.
10218    // We can identify which API from LocationManager is
10219    // invoking current LMS API by the combination of
10220    // API parameter(e.g. is_listener_null, is_intent_null,
10221    // is_location_request_null)
10222    optional android.stats.location.LocationManagerServiceApi api_in_use = 2;
10223
10224    // Name of the package calling the API.
10225    optional string calling_package_name = 3;
10226
10227    // Type of the location provider.
10228    optional android.stats.location.ProviderType provider = 4;
10229
10230    // Quality of the location request
10231    optional android.stats.location.LocationRequestQuality quality = 5;
10232
10233    // The desired interval for active location updates, in milliseconds.
10234    // Bucketized to reduce cardinality.
10235    optional android.stats.location.LocationRequestIntervalBucket bucketized_interval = 6;
10236
10237    // Minimum distance between location updates, in meters.
10238    // Bucketized to reduce cardinality.
10239    optional android.stats.location.SmallestDisplacementBucket
10240            bucketized_smallest_displacement = 7;
10241
10242    // The number of location updates.
10243    optional int64 num_updates = 8;
10244
10245    // The request expiration time, in millisecond since boot.
10246    // Bucketized to reduce cardinality.
10247    optional android.stats.location.ExpirationBucket
10248            bucketized_expire_in = 9;
10249
10250    // Type of Callback passed in for this API.
10251    optional android.stats.location.CallbackType callback_type = 10;
10252
10253    // The radius of the central point of the alert
10254    // region, in meters. Only for API REQUEST_GEOFENCE.
10255    // Bucketized to reduce cardinality.
10256    optional android.stats.location.GeofenceRadiusBucket bucketized_radius = 11;
10257
10258    // Activity Importance of API caller.
10259    // Categorized to 3 types that are interesting from location's perspective.
10260    optional android.stats.location.ActivityImportance activiy_importance = 12;
10261
10262    // Attribution tag passed to this API.
10263    optional string attribution_tag = 13;
10264}
10265
10266/**
10267 * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
10268 */
10269message ReviewPermissionsFragmentResultReported {
10270    // unique value identifying a permission group change. A permission group change might result
10271    // in multiple of these atoms
10272    optional int64 change_id = 1;
10273
10274    // UID of package the permission belongs to
10275    optional int32 uid = 2 [(is_uid) = true];
10276
10277    // Name of package the permission belongs to
10278    optional string package_name = 3;
10279
10280    // The permission to be granted
10281    optional string permission_name = 4;
10282
10283    // The result of the permission grant
10284    optional bool permission_granted = 5;
10285}
10286
10287/**
10288* Information about results of permission upgrade by RuntimePermissionsUpgradeController
10289* Logged from: RuntimePermissionUpdgradeController
10290*/
10291message RuntimePermissionsUpgradeResult {
10292    // Permission granted as result of upgrade
10293    optional string permission_name = 1;
10294
10295    // UID of package granted permission
10296    optional int32 uid = 2 [(is_uid) = true];
10297
10298    // Name of package granted permission
10299    optional string package_name = 3;
10300}
10301
10302/**
10303* Information about a buttons presented in GrantPermissionsActivty and choice made by user
10304*/
10305message GrantPermissionsActivityButtonActions {
10306    // Permission granted as result of upgrade
10307    optional string permission_group_name = 1;
10308
10309    // UID of package granted permission
10310    optional int32 uid = 2 [(is_uid) = true];
10311
10312    // Name of package requesting permission
10313    optional string package_name = 3;
10314
10315    // Buttons presented in the dialog - bit flags, bit numbers are in accordance with
10316    // LABEL_ constants in GrantPermissionActivity.java
10317    optional int32 buttons_presented = 4;
10318
10319    // Button clicked by user - same as bit flags in buttons_presented with only single bit set
10320    optional int32 button_clicked = 5;
10321
10322    // id which identifies single session of user interacting with permission controller
10323    optional int64 session_id = 6;
10324
10325    // Target SDK of the package
10326    optional int32 target_sdk = 7;
10327
10328    // Selected precision of the location permission - bit flags indicate which
10329    // locations were chosen
10330    optional int32 selected_precision = 8;
10331}
10332
10333/**
10334 * Information about LocationAccessCheck notification presented to user
10335 */
10336message LocationAccessCheckNotificationAction {
10337
10338    // id which identifies single session of user interacting with permission controller
10339    optional int64 session_id = 1;
10340
10341    // Uid of package for which location access check is presented
10342    optional int32 package_uid = 2;
10343
10344    // Name of package for which location access check is presented
10345    optional string package_name = 3;
10346
10347    enum Result {
10348        UNDEFINED = 0;
10349        // notification was presented to the user
10350        NOTIFICATION_PRESENTED = 1;
10351        // notification was declined by the user
10352        NOTIFICATION_DECLINED = 2;
10353        // notification was clicked by the user
10354        NOTIFICATION_CLICKED = 3;
10355    }
10356
10357    // View / interaction recorded
10358    optional Result result = 4;
10359}
10360
10361/**
10362 * Information about a permission grant or revoke made by user inside AppPermissionFragment
10363 */
10364message AppPermissionFragmentActionReported {
10365    // id which identifies single session of user interacting with permission controller
10366    optional int64 session_id = 1;
10367
10368    // unique value identifying a permission group change. A permission group change might result
10369    // in multiple of these atoms
10370    optional int64 change_id = 2;
10371
10372    // UID of package the permission belongs to
10373    optional int32 uid = 3 [(is_uid) = true];
10374
10375    // Name of package the permission belongs to
10376    optional string package_name = 4;
10377
10378    // The permission to be granted
10379    optional string permission_name = 5;
10380
10381    // The result of the permission grant
10382    optional bool permission_granted = 6;
10383
10384    // State of Permission Flags after grant as per android.content.pm.PermissionFlags
10385    optional int32 permission_flags = 7;
10386
10387    enum Button {
10388        UNDEFINED = 0;
10389        // Allow button
10390        ALLOW = 1;
10391        // Deny button
10392        DENY = 2;
10393        // Ask every time button
10394        ASK_EVERY_TIME = 3;
10395        // Allow all the time button
10396        ALLOW_ALWAYS = 4;
10397        // Allow only while using the app button
10398        ALLOW_FOREGROUND = 5;
10399        // Same is Deny button but shown in while in use dialog
10400        DENY_FOREGROUND = 6;
10401        // Switch button set to ON for location accuracy
10402        GRANT_FINE_LOCATION = 7;
10403        // Switch button set to OFF for location accuracy
10404        REVOKE_FINE_LOCATION = 8;
10405    }
10406
10407    // Button pressed in the dialog
10408    optional Button button_pressed = 8;
10409}
10410
10411/**
10412* Information about a AppPermissionFragment viewed by user
10413*/
10414message AppPermissionFragmentViewed {
10415    // id which identifies single session of user interacting with permission controller
10416    optional int64 session_id = 1;
10417
10418    // UID of package for which permissions are viewed
10419    optional int32 uid = 2 [(is_uid) = true];
10420
10421    // Name of package for which permissions are viewed
10422    optional string package_name = 3;
10423
10424    // Permission group viewed
10425    optional string permission_group_name = 4;
10426}
10427
10428/**
10429* Information about a AppPermissionGroupsFragment viewed by user. Fragment has been renamed, but
10430* the log retains the old fragment name.
10431*/
10432message AppPermissionsFragmentViewed {
10433    // id which identifies single session of user interacting with permission controller
10434    optional int64 session_id = 1;
10435
10436    // id which identifies single view as every view might have several logging records
10437    // with different package information attached
10438    optional int64 view_id = 2;
10439
10440    // Permission group viewed
10441    optional string permission_group_name = 3;
10442
10443    // UID of package for which permissions are viewed
10444    optional int32 uid = 4 [(is_uid) = true];
10445
10446    // Name of package for which permissions are viewed
10447    optional string package_name = 5;
10448
10449    // Category in which permission is included
10450    enum Category {
10451      UNDEFINED = 0;
10452      ALLOWED = 1;
10453      ALLOWED_FOREGROUND = 2;
10454      DENIED = 3;
10455    }
10456    optional Category category = 6;
10457}
10458/**
10459* Information about a PermissionAppsFragment viewed by user.
10460* Logged from ui/handheld/PermissionAppsFragment.java
10461*/
10462message PermissionAppsFragmentViewed {
10463    // id which identifies single session of user interacting with permission controller
10464    optional int64 session_id = 1;
10465
10466    // id which identifies single view as every view might have several logging records
10467    // with different package information attached
10468    optional int64 view_id = 2;
10469
10470    // Permission group viewed
10471    optional string permission_group_name = 3;
10472
10473    // UID of package for which permissions are viewed
10474    optional int32 uid = 4 [(is_uid) = true];
10475
10476    // Name of package for which permissions are viewed
10477    optional string package_name = 5;
10478
10479    // Category in which app is included
10480    enum Category {
10481        UNDEFINED = 0;
10482        ALLOWED = 1;
10483        ALLOWED_FOREGROUND = 2;
10484        DENIED = 3;
10485    }
10486    optional Category category = 6;
10487}
10488
10489/**
10490* Log that the Auto Revoke notification has been clicked
10491* Logged from ui/ManagePermissionsActivity
10492*/
10493message AutoRevokeNotificationClicked {
10494    // id which identifies single session of user interacting with permission controller
10495    optional int64 session_id = 1;
10496}
10497
10498/**
10499* Log that an app has been displayed on the auto revoke page, and lists one permission that was
10500* auto revoked for it.
10501* Logged from ui/handheld/AutoRevokeFragment
10502*/
10503message AutoRevokeFragmentAppViewed {
10504    // id which identifies single session of user interacting with permission controller
10505    optional int64 session_id = 1;
10506
10507    // UID of package for which permissions are viewed
10508    optional int32 uid = 2 [(is_uid) = true];
10509
10510    // Name of package for which permissions are viewed
10511    optional string package_name = 3;
10512
10513    // The name of a permission group that has been revoked
10514    optional string permission_group_name = 4;
10515
10516    // The age of the app- more than three months old, or more than six months
10517    enum Age {
10518        UNDEFINED = 0;
10519        NEWER_BUCKET = 1;
10520        OLDER_BUCKET = 2;
10521    }
10522
10523    // How long the app has been unused. Currently, newer bucket is 3 months, older is 6 months
10524    optional Age age = 5;
10525}
10526
10527/**
10528* Log that the user has interacted with an app on the auto revoke fragment
10529* Logged from ui/handheld/AutoRevokeFragment
10530*/
10531message AutoRevokedAppInteraction {
10532    // id which identifies single session of user interacting with permission controller
10533    optional int64 session_id = 1;
10534
10535    // UID of package for which permissions are viewed
10536    optional int32 uid = 2 [(is_uid) = true];
10537
10538    // Name of package for which permissions are viewed
10539    optional string package_name = 3;
10540
10541    enum Action {
10542        UNDEFINED = 0;
10543        REMOVE = 1;
10544        OPEN = 2;
10545        APP_INFO = 3;
10546        PERMISSIONS = 4;
10547        REMOVE_IN_SETTINGS = 5;
10548        OPEN_IN_SETTINGS = 6;
10549    }
10550
10551    // The action the user took to interact with the app
10552    optional Action action = 4;
10553}
10554
10555/**
10556* Log that the AppPermissionGroupsFragment has been interacted with for the possible purposes of
10557* auto revoke, or that the auto revoke switch has been changed
10558* Logged from ui/handheld/AppPermissionGroupsFragment
10559 */
10560message AppPermissionGroupsFragmentAutoRevokeAction {
10561    // id which identifies single session of user interacting with permission controller
10562    optional int64 session_id = 1;
10563
10564    // UID of package for which permissions are viewed
10565    optional int32 uid = 2 [(is_uid) = true];
10566
10567    // Name of package for which permissions are viewed
10568    optional string package_name = 3;
10569
10570    enum Action {
10571        UNDEFINED = 0;
10572        OPENED_FOR_AUTO_REVOKE = 1;
10573        OPENED_FROM_INTENT = 2;
10574        SWITCH_ENABLED = 3;
10575        SWITCH_DISABLED = 4;
10576    }
10577
10578    // The action the user took to interact with the fragment
10579    optional Action action = 4;
10580}
10581
10582/**
10583 * Logs when there is a smart selection related event.
10584 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10585 * Logged from: TextClassifierEventLogger.java
10586 */
10587message TextSelectionEvent {
10588    // A session ID.
10589    optional string session_id = 1;
10590
10591    // Event type of this event.
10592    optional android.stats.textclassifier.EventType event_type = 2;
10593
10594    // Name of the annotator model that is involved in this event.
10595    optional string model_name = 3;
10596
10597    // Type of widget that was involved in triggering this event.
10598    optional android.stats.textclassifier.WidgetType widget_type = 4;
10599
10600    // Index of this event in a session.
10601    optional int32 event_index = 5;
10602
10603    // Entity type that is involved.
10604    optional string entity_type = 6;
10605
10606    // Relative word index of the start of the selection.
10607    optional int32 relative_word_start_index = 7;
10608
10609    // Relative word (exclusive) index of the end of the selection.
10610    optional int32 relative_word_end_index = 8;
10611
10612    // Relative word index of the start of the smart selection.
10613    optional int32 relative_suggested_word_start_index = 9;
10614
10615    // Relative word (exclusive) index of the end of the smart selection.
10616    optional int32 relative_suggested_word_end_index = 10;
10617
10618    // Name of source package.
10619    optional string package_name = 11;
10620
10621    // Name of the LangID model that is involved in this event.
10622    optional string langid_model_name = 12;
10623}
10624
10625/**
10626 * Logs when there is a smart linkify related event.
10627 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10628 * Logged from: TextClassifierEventLogger.java
10629 */
10630message TextLinkifyEvent {
10631    // A session ID.
10632    optional string session_id = 1;
10633
10634    // Event type of this event.
10635    optional android.stats.textclassifier.EventType event_type = 2;
10636
10637    // Name of the annotator model that is involved in this event.
10638    optional string model_name = 3;
10639
10640    // Type of widget that was involved in triggering this event.
10641    optional android.stats.textclassifier.WidgetType widget_type = 4;
10642
10643    // Index of this event in a session.
10644    optional int32 event_index = 5;
10645
10646    // Entity type that is involved.
10647    optional string entity_type = 6;
10648
10649    // Number of links detected.
10650    optional int32 num_links = 7;
10651
10652    // The total length of all links.
10653    optional int32 linked_text_length = 8;
10654
10655    // Length of input text.
10656    optional int32 text_length = 9;
10657
10658    // Time spent on generating links in ms.
10659    optional int64 latency_millis = 10;
10660
10661    // Name of source package.
10662    optional string package_name = 11;
10663
10664    // Name of the LangID model that is involved in this event.
10665    optional string langid_model_name = 12;
10666}
10667
10668/**
10669 * Logs when there is a conversation actions related event.
10670 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10671 * Logged from: TextClassifierEventLogger.java
10672 */
10673message ConversationActionsEvent {
10674    // A session ID.
10675    optional string session_id = 1;
10676
10677    // Event type of this event.
10678    optional android.stats.textclassifier.EventType event_type = 2;
10679
10680    // Name of the actions model that is involved in this event.
10681    optional string model_name = 3;
10682
10683    // Type of widget that was involved in triggering this event.
10684    optional android.stats.textclassifier.WidgetType widget_type = 4;
10685
10686    // The first entity type that is involved.
10687    optional string first_entity_type = 5;
10688
10689    // The second entity type that is involved.
10690    optional string second_entity_type = 6;
10691
10692    // The third entity type that is involved.
10693    optional string third_entity_type = 7;
10694
10695    // The score of the first entity type.
10696    optional float score = 8;
10697
10698    // Name of source package.
10699    optional string package_name = 9;
10700
10701    // Name of the annotator model that is involved in this event.
10702    optional string annotator_model_name = 10;
10703
10704    // Name of the LangID model that is involved in this event.
10705    optional string langid_model_name = 11;
10706}
10707
10708/**
10709 * Logs when there is a language detection related event.
10710 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
10711 * Logged from: TextClassifierEventLogger.java
10712 */
10713message LanguageDetectionEvent {
10714    // A session ID.
10715    optional string session_id = 1;
10716
10717    // Event type of this event.
10718    optional android.stats.textclassifier.EventType event_type = 2;
10719
10720    // Name of the language detection model that is involved in this event.
10721    optional string model_name = 3;
10722
10723    // Type of widget that was involved in triggering this event.
10724    optional android.stats.textclassifier.WidgetType widget_type = 4;
10725
10726    // Detected language.
10727    optional string language_tag = 5;
10728
10729    // Score of the detected language.
10730    optional float score = 6;
10731
10732    // Position of this action.
10733    optional int32 action_index = 7;
10734
10735    // Name of source package.
10736    optional string package_name = 8;
10737}
10738
10739/**
10740 * Information about an OTA update attempt by update_engine.
10741 * Logged from platform/system/update_engine/metrics_reporter_android.cc
10742 */
10743message UpdateEngineUpdateAttemptReported {
10744    // The number of attempts for the update engine to apply a given payload.
10745    optional int32 attempt_number = 1;
10746
10747    optional android.stats.otaupdate.PayloadType payload_type = 2;
10748
10749    // The total time in minutes for the update engine to apply a given payload.
10750    // The time is calculated by calling clock_gettime() / CLOCK_BOOTTIME; and
10751    // it's increased when the system is sleeping.
10752    optional int32 duration_boottime_in_minutes = 3;
10753
10754    // The total time in minutes for the update engine to apply a given payload.
10755    // The time is calculated by calling clock_gettime() / CLOCK_MONOTONIC_RAW;
10756    // and it's not increased when the system is sleeping.
10757    optional int32 duration_monotonic_in_minutes = 4;
10758
10759    // The size of the payload in MiBs.
10760    optional int32 payload_size_mib = 5;
10761
10762    // The attempt result reported by the update engine for an OTA update.
10763    optional android.stats.otaupdate.AttemptResult attempt_result = 6;
10764
10765    // The error code reported by the update engine after an OTA update attempt
10766    // on A/B devices.
10767    optional android.stats.otaupdate.ErrorCode error_code = 7;
10768
10769    // The build fingerprint of the source system. The value is read from a
10770    // system property when the device takes the update. e.g.
10771    // Android/aosp_sailfish/sailfish:10/QP1A.190425.004/5507117:userdebug/test-keys
10772    optional string source_fingerprint = 8;
10773
10774    // Size of super partition.
10775    optional int64 super_partition_size_bytes = 9;
10776
10777    // Size of current slot within the super partition.
10778    optional int64 slot_size_bytes = 10;
10779
10780    // Free space available in the super partition.
10781    optional int64 super_free_space_bytes = 11;
10782
10783    // Whether the device enables Virtual A/B compression.
10784    optional bool vab_compression_enabled = 12;
10785
10786    // Whether this update attempt uses Virtual A/B compression.
10787    optional bool vab_compression_used = 13;
10788}
10789
10790/**
10791 * Information about all the attempts the device make before finishing the
10792 * successful update.
10793 * Logged from platform/system/update_engine/metrics_reporter_android.cc
10794 */
10795message UpdateEngineSuccessfulUpdateReported {
10796    // The number of attempts for the update engine to apply the payload for a
10797    // successful update.
10798    optional int32 attempt_count = 1;
10799
10800    optional android.stats.otaupdate.PayloadType payload_type = 2;
10801
10802    optional int32 payload_size_mib = 3;
10803
10804    // The total number of bytes downloaded by update_engine since the last
10805    // successful update.
10806    optional int32 total_bytes_downloaded_mib = 4;
10807
10808    // The ratio in percentage of the over-downloaded bytes compared to the
10809    // total bytes needed to successfully install the update. e.g. 200 if we
10810    // download 200MiB in total for a 100MiB package.
10811    optional int32 download_overhead_percentage = 5;
10812
10813    // The total time in minutes for the update engine to apply the payload for a
10814    // successful update.
10815    optional int32 total_duration_minutes = 6;
10816
10817    // The number of reboot of the device during a successful update.
10818    optional int32 reboot_count = 7;
10819
10820    // Whether on device verity computation is enabled
10821    optional bool fec_enabled = 8;
10822
10823    // Whether on device hash tree computation is enabled
10824    optional bool hash_tree_enabled = 9;
10825
10826}
10827
10828/**
10829 * Reported when a client requests to prepare for resume on reboot.
10830 *
10831 * Logged from:
10832 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
10833 */
10834message RebootEscrowPreparationReported {
10835  enum Result {
10836    ROR_NEED_PREPARATION = 0;
10837    ROR_SKIP_PREPARATION_AND_NOTIFY = 1;
10838    ROR_SKIP_PREPARATION_NOT_NOTIFY = 2;
10839  }
10840
10841  // The uid of the client who requests ror.
10842  optional int32 requesting_uid = 1 [(is_uid) = true];
10843
10844  optional Result result = 2;
10845
10846  // The number of clients who has requested ror, including the current caller.
10847  optional int32 requested_client_count = 3;
10848}
10849
10850/**
10851 * Reported when the lock screen knowledge factor is captured, while there are clients of
10852 * resume on reboot to notify.
10853 *
10854 * Logged from:
10855 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
10856 */
10857message RebootEscrowLskfCaptureReported {
10858  // The uid of the client to notify about the Lskf capture.
10859  optional int32 uid_to_notify = 1 [(is_uid) = true];
10860
10861  // The total number of clients who have requested ror.
10862  optional int32 requested_client_count = 2;
10863
10864  // The duration between RoR request - current LSKF capture event.
10865  optional int32 duration_ror_requested_to_lskf_captured_seconds = 3;
10866}
10867
10868/* Reported when a client (e.g. gmscore) requests to reboot with Resume on Reboot.
10869 *
10870 * Logged from:
10871 *   frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
10872 */
10873message RebootEscrowRebootReported {
10874  optional int32 error_code = 1;
10875
10876  // The uid of clients who requested the reboot
10877  optional int32 request_uid = 2 [(is_uid) = true];
10878
10879  // All clients that have prepared for RoR before this reboot
10880  optional int32 prepared_clients_count = 3;
10881
10882  // The RoR request count for the client who requests reboot.
10883  optional int32 request_count = 4;
10884
10885  // Whether the reboot request assumes a slot switch on a/b devices.
10886  optional bool slot_switch = 5;
10887
10888  // True if the DeviceConfig shows the device is using server based RoR.
10889  optional bool server_based = 6;
10890
10891  // The duration between last LSKF captured - reboot requests
10892  optional int32 duration_lskf_captured_to_reboot_seconds = 7;
10893
10894  // The count of LSKF captured since preparation
10895  optional int32 lskf_captured_counts = 8;
10896}
10897
10898/**
10899 * Logs stats for AppSearch function calls
10900 */
10901message AppSearchCallStatsReported {
10902    // The sampling interval for this specific type of stats
10903    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
10904    optional int32 sampling_interval = 1;
10905
10906    // # of previous skipped sample for this specific type of stats
10907    // We can't push atoms too closely, so some samples might be skipped
10908    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
10909    // For example, the true count of an event could be estimated as:
10910    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
10911    optional int32 num_skipped_sample = 2;
10912
10913    // Package UID of the application.
10914    optional int32 uid = 3 [(is_uid) = true];
10915
10916    // Hash of the database name within AppSearch
10917    optional int32 database = 4;
10918
10919    // The status code for the call or internal state.
10920    // Needs to be sync with AppSearchResult#ResultCode in
10921    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
10922    optional int32 status_code = 5;
10923
10924    // Overall time used for the end-to-end function call in AppSearch.
10925    // It doesn't include binder latency
10926    optional int32 total_latency_millis = 6;
10927
10928    // Type of the function call value is in sync with
10929    // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/CallStats.java
10930    optional int32 call_type = 7;
10931
10932    // Estimated binder latency (estimated as single-trip time * 2)
10933    optional int32 estimated_binder_latency_millis = 8;
10934
10935    // Number of operations succeeded for batch operations.
10936    optional int32 num_operations_succeeded = 9;
10937
10938    // Number of operations failed for batch operations.
10939    optional int32 num_operations_failed = 10;
10940}
10941
10942/**
10943 * Logs detailed stats for putting a single document in AppSearch
10944 */
10945message AppSearchPutDocumentStatsReported {
10946    // The sampling interval for this specific type of stats
10947    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
10948    optional int32 sampling_interval = 1;
10949
10950    // # of previous skipped sample for this specific type of stats
10951    // We can't push atoms too closely, so some samples might be skipped
10952    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
10953    // For example, the true count of an event could be estimated as:
10954    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
10955    optional int32 num_skipped_sample = 2;
10956
10957    // Package UID of the application.
10958    optional int32 uid = 3 [(is_uid) = true];
10959
10960    // Hash of the database name within AppSearch
10961    optional int32 database = 4;
10962
10963    // Needs to be sync with AppSearchResult#ResultCode in
10964    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
10965    optional int32 status_code = 5;
10966
10967    // Overall time used for a put_document
10968    optional int32 total_latency_millis = 6;
10969
10970    // Time used to generate a document proto from a Bundle.
10971    optional int32 generate_document_proto_latency_millis = 7;
10972
10973    // Time used to rewrite types and namespaces in the document.
10974    optional int32 rewrite_document_types_latency_millis = 8;
10975
10976    // Overall time used for the native function call.
10977    optional int32 native_latency_millis = 9;
10978
10979    // Time used to store the document.
10980    optional int32 native_document_store_latency_millis = 10;
10981
10982    // Time used to index the document. It doesn't include the time to
10983    // merge indices.
10984    optional int32 native_index_latency_millis = 11;
10985
10986    // Time used to merge the indices.
10987    optional int32 native_index_merge_latency_millis = 12;
10988
10989    // Document size in bytes.
10990    optional int32 native_document_size_bytes = 13;
10991
10992    // Number of tokens added to the index.
10993    optional int32 native_num_tokens_indexed = 14;
10994
10995    // Whether the max number of tokens exceeded.
10996    optional bool native_exceeded_max_num_tokens = 15;
10997}
10998
10999/**
11000 * Logs detailed stats for AppSearch Initialize
11001 */
11002message AppSearchInitializeStatsReported {
11003    // The sampling interval for this specific type of stats
11004    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11005    optional int32 sampling_interval = 1;
11006
11007    // # of previous skipped sample for this specific type of stats
11008    // We can't push atoms too closely, so some samples might be skipped
11009    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11010    // For example, the true count of an event could be estimated as:
11011    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11012    optional int32 num_skipped_sample = 2;
11013
11014    // Package UID of the application.
11015    optional int32 uid = 3 [(is_uid) = true];
11016
11017    // Initialize status code
11018    // Needs to be sync with AppSearchResult#ResultCode in
11019    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11020    optional int32 status_code = 4;
11021
11022    // Overall time used for initialization, not including binder latency.
11023    optional int32 total_latency_millis = 5;
11024
11025    // Whether the initialize() detects desyncs.
11026    // Desync happens if we lose the visibility doc.
11027    optional bool has_desync = 6;
11028
11029    // Time used to read and process the schema and namespaces.
11030    optional int32 prepare_schema_and_namespaces_latency_millis = 7;
11031
11032    // Time used to read and process the visibility file.
11033    optional int32 prepare_visibility_file_latency_millis = 8;
11034
11035    // Overall time used for the native function call.
11036    optional int32 native_latency_millis = 9;
11037
11038    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
11039    optional int32 native_document_store_recovery_cause = 10;
11040
11041    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
11042    optional int32 native_index_restoration_cause = 11;
11043
11044    // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
11045    optional int32 native_schema_store_recovery_cause = 12;
11046
11047    // Time used to recover the document store.
11048    optional int32 native_document_store_recovery_latency_millis = 13;
11049
11050    // Time used to restore the index.
11051    optional int32 native_index_restoration_latency_millis = 14;
11052
11053    // Time used to recover the schema store.
11054    optional int32 native_schema_store_recovery_latency_millis = 15;
11055
11056    // Needs to be sync with DocumentStoreDataStatus in google3/third_party/icing/proto/logging.proto
11057    optional int32 native_document_store_data_status = 16;
11058
11059    // Number of documents currently in document store. Those may
11060    // include alive, deleted, and expired documents.
11061    optional int32 native_num_documents = 17;
11062
11063    // Number of schema types currently in the schema store.
11064    optional int32 native_num_schema_types = 18;
11065
11066    // Whether we had to reset the index, losing all data, during initialization.
11067    optional bool has_reset = 19;
11068
11069    // The status code of the reset operation if has_reset is true.
11070    // Needs to be sync with AppSearchResult#ResultCode in
11071    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11072    optional int32 reset_status_code = 20;
11073}
11074
11075/**
11076 * Logs detailed stats for querying in AppSearch
11077 */
11078message AppSearchQueryStatsReported {
11079    // The sampling interval for this specific type of stats
11080    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11081    optional int32 sampling_interval = 1;
11082
11083    // # of previous skipped sample for this specific type of stats
11084    // We can't push atoms too closely, so some samples might be skipped
11085    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11086    // For example, the true count of an event could be estimated as:
11087    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11088    optional int32 num_skipped_sample = 2;
11089
11090    // Package UID of the application.
11091    optional int32 uid = 3 [(is_uid) = true];
11092
11093    // Hash of the database name within AppSearch
11094    optional int32 database = 4;
11095
11096    // Needs to be sync with AppSearchResult#ResultCode in
11097    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11098    optional int32 status_code = 5;
11099
11100    // Overall time used for query including estimated binder latency
11101    optional int32 total_latency_millis = 6;
11102
11103    // Time used to rewrite the search spec.
11104    optional int32 rewrite_search_spec_latency_millis = 7;
11105
11106    // Time used to rewrite the search results.
11107    optional int32 rewrite_search_result_latency_millis = 8;
11108
11109    // Whether it is a global query.
11110    // Needs to be sync with QueryStats#VisibilityScope in
11111    // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/QueryStats.java
11112    optional int32 visibility_scope = 9;
11113
11114    // Overall time used for the native function call.
11115    optional int32 native_latency_millis = 10;
11116
11117    // Number of terms in the query string.
11118    optional int32 native_num_terms = 11;
11119
11120    // Length of the query string.
11121    optional int32 native_query_length = 12;
11122
11123    // Number of namespaces filtered.
11124    optional int32 native_num_namespaces_filtered = 13;
11125
11126    // Number of schema types filtered.
11127    optional int32 native_num_schema_types_filtered = 14;
11128
11129    // The requested number of results in one page.
11130    optional int32 native_requested_page_size = 15;
11131
11132    // The actual number of results returned in the current page.
11133    optional int32 native_num_results_returned_current_page = 16;
11134
11135    // Whether the function call is querying the first page. If it's
11136    // not, Icing will fetch the results from cache so that some steps
11137    // may be skipped.
11138    optional bool native_is_first_page = 17;
11139
11140    // Time used to parse the query, including 2 parts: tokenizing and
11141    // transforming tokens into an iterator tree.
11142    optional int32 native_parse_query_latency_millis = 18;
11143
11144    // Strategy of scoring and ranking.
11145    // Needs to be sync with RankingStrategy.Code in google3/third_party/icing/proto/scoring.proto
11146    optional int32 native_ranking_strategy = 19;
11147
11148    // Number of documents scored.
11149    optional int32 native_num_documents_scored = 20;
11150
11151    // Time used to score the raw results.
11152    optional int32 native_scoring_latency_millis = 21;
11153
11154    // Time used to rank the scored results.
11155    optional int32 native_ranking_latency_millis = 22;
11156
11157    // Time used to fetch the document protos. Note that it includes the
11158    // time to snippet if "native_num_results_with_snippets" is NOT zero.
11159    optional int32 native_document_retrieval_latency_millis = 23;
11160
11161    // How many snippets are calculated.
11162    optional int32 native_num_results_with_snippets = 24;
11163}
11164
11165/**
11166 * Logs detailed stats for remove in AppSearch
11167 */
11168message AppSearchRemoveStatsReported {
11169    // The sampling interval for this specific type of stats
11170    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11171    optional int32 sampling_interval = 1;
11172
11173    // # of previous skipped sample for this specific type of stats
11174    // We can't push atoms too closely, so some samples might be skipped
11175    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11176    // For example, the true count of an event could be estimated as:
11177    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11178    optional int32 num_previous_skipped_sample = 2;
11179
11180    // Package UID of the application.
11181    optional int32 uid = 3 [(is_uid) = true];
11182
11183    // Hash of the database name within AppSearch
11184    optional int32 database = 4;
11185
11186    // Needs to be sync with AppSearchResult#ResultCode in
11187    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11188    optional int32 status_code = 5;
11189
11190    // Overall time used for remove including the binder latency
11191    optional int32 total_latency_millis = 6;
11192
11193    // Overall time used for the native function call.
11194    optional int32 native_latency_millis = 7;
11195
11196    // Used to indicate what kind of delete(namespace, schemaType etc) calls deleteByQuery here.
11197    // Needs to be sync with external/icing/proto/icing/proto/logging.proto#DeleteStatsProto
11198    optional int32 native_delete_type = 8;
11199
11200    // Number of documents deleted by this call.
11201    optional int32 native_num_documents_deleted = 9;
11202}
11203
11204/**
11205 * Logs detailed stats for optimization in AppSearch.
11206 *
11207 * stats pushed from:
11208 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
11209 *
11210 * Next tag: 14
11211 */
11212message AppSearchOptimizeStatsReported {
11213    // The sampling interval for this specific type of stats
11214    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
11215    optional int32 sampling_interval = 1;
11216
11217    // # of previous skipped sample for this specific type of stats
11218    // We can't push atoms too closely, so some samples might be skipped
11219    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
11220    // For example, the true count of an event could be estimated as:
11221    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
11222    optional int32 num_previous_skipped_sample = 2;
11223
11224    // Needs to be sync with AppSearchResult#ResultCode in
11225    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
11226    optional int32 status_code = 3;
11227
11228    // Overall time used for remove including the binder latency
11229    optional int32 total_latency_millis = 4;
11230
11231    // Overall time used for the native function call.
11232    optional int32 native_latency_millis = 5;
11233
11234    // Time used to optimize the document store in millis.
11235    optional int32 native_document_store_optimize_latency_millis = 6;
11236
11237    // Time used to restore the index in millis.
11238    optional int32 native_index_restoration_latency_millis = 7;
11239
11240    // Number of documents before the optimization.
11241    optional int32 native_num_original_documents = 8;
11242
11243    // Number of documents deleted during the optimization.
11244    optional int32 native_num_deleted_documents = 9;
11245
11246    // Number of documents expired during the optimization.
11247    optional int32 native_num_expired_documents = 10;
11248
11249    // Size of storage in bytes before the optimization.
11250    optional int64 native_storage_size_before_bytes = 11;
11251
11252    // Size of storage in bytes after the optimization.
11253    optional int64 native_storage_size_after_bytes = 12;
11254
11255    // The amount of time in millis since the last optimization ran.
11256    optional int64 native_time_since_last_optimize_millis = 13;
11257}
11258
11259// Reports information in external/icing/proto/icing/proto/storage.proto#DocumentStorageInfoProto
11260// Next tag: 15
11261message AppSearchDocumentStorageInfo {
11262    // Total number of alive documents.
11263    optional int32 num_alive_documents = 1;
11264
11265    // Total number of deleted documents.
11266    optional int32 num_deleted_documents = 2;
11267
11268    // Total number of expired documents.
11269    optional int32 num_expired_documents = 3;
11270
11271    // Total size of the document store in bytes. Will be set to -1 if an IO error
11272    // is encountered while calculating this field.
11273    optional int64 document_store_size_bytes = 4;
11274
11275    // Total size of the ground truth in bytes. The ground truth may
11276    // include deleted or expired documents. Will be set to -1 if an IO error is
11277    // encountered while calculating this field.
11278    optional int64 document_log_size_bytes = 5;
11279
11280    // Size of the key mapper in bytes. Will be set to -1 if an IO error is
11281    // encountered while calculating this field.
11282    optional int64 key_mapper_size_bytes = 6;
11283
11284    // Size of the document id mapper in bytes. Will be set to -1 if an IO error
11285    // is encountered while calculating this field.
11286    optional int64 document_id_mapper_size_bytes = 7;
11287
11288    // Size of the score cache in bytes. Will be set to -1 if an IO error is
11289    // encountered while calculating this field.
11290    optional int64 score_cache_size_bytes = 8;
11291
11292    // Size of the filter cache in bytes. Will be set to -1 if an IO error is
11293    // encountered while calculating this field.
11294    optional int64 filter_cache_size_bytes = 9;
11295
11296    // Size of the corpus mapper in bytes. Will be set to -1 if an IO error is
11297    // encountered while calculating this field.
11298    optional int64 corpus_mapper_size_bytes = 10;
11299
11300    // Size of the corpus score cache in bytes. Will be set to -1 if an IO error
11301    // is encountered while calculating this field.
11302    optional int64 corpus_score_cache_size_bytes = 11;
11303
11304    // Size of the namespace id mapper in bytes. Will be set to -1 if an IO error
11305    // is encountered while calculating this field.
11306    optional int64 namespace_id_mapper_size_bytes = 12;
11307
11308    // Number of namespaces seen from the current documents.
11309    optional int32 num_namespaces = 13;
11310
11311    // Storage information of each namespace is not included due to that it has string field.
11312
11313    reserved 14;
11314}
11315
11316// Reports information in external/icing/proto/icing/proto/storage.proto#SchemaStoreStorageInfoProto
11317// Next tag: 5
11318message AppSearchSchemaStoreStorageInfo {
11319    // Size of the schema store in bytes. Will be set to -1 if an IO error is
11320    // encountered while calculating this field.
11321    optional int64 schema_store_size_bytes = 1;
11322
11323    // Total number of schema types.
11324    optional int32 num_schema_types = 2;
11325
11326    // Total number of all sections across all types
11327    optional int32 num_total_sections = 3;
11328
11329    // Total number of types at the current section limit.
11330    optional int32 num_schema_types_sections_exhausted = 4;
11331}
11332
11333// Reports information in external/icing/proto/icing/proto/storage.proto#IndexStorageInfoProto
11334// Next tag: 9
11335message AppSearchIndexStorageInfo {
11336    // Total size of the index in bytes. Will be set to -1 if an IO error is
11337    // encountered while calculating this field.
11338    optional int64 index_size_bytes = 1;
11339
11340    // Size of the lite index lexicon in bytes. Will be set to -1 if an IO error
11341    // is encountered while calculating this field.
11342    optional int64 lite_index_lexicon_size_bytes = 2;
11343
11344    // Size of the lite index hit buffer in bytes. Will be set to -1 if an IO
11345    // error is encountered while calculating this field.
11346    optional int64 lite_index_hit_buffer_size_bytes = 3;
11347
11348    // Size of the main index lexicon in bytes. Will be set to -1 if an IO error
11349    // is encountered while calculating this field.
11350    optional int64 main_index_lexicon_size_bytes = 4;
11351
11352    // Size of the main index storage in bytes. Will be set to -1 if an IO error
11353    // is encountered while calculating this field.
11354    optional int64 main_index_storage_size_bytes = 5;
11355
11356    // Size of one main index block in bytes.
11357    optional int64 main_index_block_size_bytes = 6;
11358
11359    // Number of main index blocks.
11360    optional int32 num_blocks = 7;
11361
11362    // Percentage of the main index blocks that are free, assuming
11363    // allocated blocks are fully used.
11364    optional float min_free_fraction = 8;
11365}
11366
11367/**
11368 * Pulls information about storage information per user from AppSearch
11369 *
11370 * Pulled from:
11371 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
11372 *
11373 * Next tag: 6
11374 */
11375message AppSearchStorageInfo {
11376    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
11377    // This is mainly used as a dimension for the metric, but it can also tell us if
11378    // the StorageInfo is for a primary user or secondary user.
11379    optional int32 user = 1;
11380
11381    // Total size of Icing’s storage in bytes. Will be set to -1 if an IO error is
11382    // encountered while calculating this field.
11383    optional int64 total_storage_size_bytes = 2;
11384
11385    // Storage information of the document store.
11386    optional AppSearchDocumentStorageInfo document_storage_info = 3
11387        [(android.os.statsd.log_mode) = MODE_BYTES];
11388
11389    // Storage information of the schema store.
11390    optional AppSearchSchemaStoreStorageInfo schema_store_storage_info = 4
11391        [(android.os.statsd.log_mode) = MODE_BYTES];
11392
11393    // Storage information of the index.
11394    optional AppSearchIndexStorageInfo index_storage_info = 5
11395        [(android.os.statsd.log_mode) = MODE_BYTES];
11396}
11397
11398/**
11399 * Reported when the RebootEscrow HAL has attempted to recover the escrowed
11400 * key to indicate whether it was successful or not.
11401 *
11402 * Logged from:
11403 *   frameworks/base/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
11404 */
11405message RebootEscrowRecoveryReported {
11406    // Type of the resume on reboot backend provider.
11407    enum ServiceType {
11408        UNKNOWN = 0;
11409        HAL = 1;
11410        SERVER_BASED = 2;
11411    }
11412
11413    // Whether the vbmeta digest of the current slot matches a precomputed value before reboot.
11414    enum VbmetaDigestStatus {
11415        MATCH_EXPECTED_SLOT = 0;
11416        MATCH_FALLBACK_SLOT = 1;
11417        MISMATCH = 2;
11418    }
11419
11420    optional bool successful = 1;
11421    // The error code for escrow data recovery failure
11422    optional int32 error_code = 2;
11423
11424    optional ServiceType type = 3;
11425
11426    // Number of retries to unwrap the escrow key asynchronously.
11427    optional int32 get_escrow_key_retry_count = 4;
11428
11429    // The duration between storing of reboot escrow key ->
11430    // use of reboot escrow key to unlock CE after reboot
11431    optional int32 duration_escrow_key_storage_to_unlock_seconds = 5;
11432
11433    optional VbmetaDigestStatus vbmeta_digest_status = 6;
11434
11435    // The duration between boot complete -> CE unlock
11436    optional int32 duration_boot_complete_to_unlock_seconds = 7;
11437}
11438
11439/**
11440 * Global display pipeline metrics reported by SurfaceFlinger.
11441 * Metrics exist beginning in Android 11.
11442 * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
11443 * That proto must be updated if this atom is updated.
11444 *
11445 * Pulled from:
11446 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
11447 */
11448message SurfaceflingerStatsGlobalInfo {
11449    // Aggregated refresh rate buckets that layers were presenting at. Buckets
11450    // are defined in SurfaceFlinger and are tracked per device.
11451    // Introduced in Android 12.
11452    // This is intended to be used as a dimenstion in collecting per-refresh rate
11453    // jank statistics.
11454    optional int32 display_refresh_rate_bucket = 18;
11455    // Aggregated render rate buckets that layers were overridden to run at.
11456    // Buckets are defined in SurfaceFlinger and are tracked per device.
11457    // Introduced in Android 12.
11458    // This is intended to be used as a dimension in collecting per-render rate
11459    // jank statistics.
11460    optional int32 render_rate_bucket = 21;
11461    // Total number of frames presented during the tracing period
11462    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11463    // using render_rate_bucket as a dimension.
11464    optional int64 total_frames = 1;
11465    // Total number of frames missed
11466    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11467    // using render_rate_bucket as a dimension.
11468    optional int64 missed_frames = 2;
11469    // Total number of frames that fell back to client composition
11470    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11471    // using render_rate_bucket as a dimension.
11472    optional int64 client_composition_frames = 3;
11473    // Total time the display was turned on
11474    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11475    // using render_rate_bucket as a dimension.
11476    optional int64 display_on_millis = 4;
11477    // Total time that was spent performing animations.
11478    // This is derived from the present-to-present layer histogram.
11479    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11480    // using render_rate_bucket as a dimension.
11481    optional int64 animation_millis = 5;
11482    // Total number of event connections tracked by SurfaceFlinger at the time
11483    // of this pull. If this number grows prohibitively large, then this can
11484    // cause jank due to resource contention.
11485    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11486    // using render_rate_bucket as a dimension.
11487    optional int32 event_connection_count = 6;
11488    // Set of timings measured from when SurfaceFlinger began compositing a
11489    // frame, until the frame was requested to be presented to the display. This
11490    // measures SurfaceFlinger's total CPU walltime on the critical path per
11491    // frame.
11492    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11493    // using render_rate_bucket as a dimension.
11494    optional FrameTimingHistogram frame_duration = 7
11495        [(android.os.statsd.log_mode) = MODE_BYTES];
11496    // Set of timings measured from when SurfaceFlinger first began using the
11497    // GPU to composite a frame, until the GPU has finished compositing that
11498    // frame. This measures the total additional time SurfaceFlinger needed to
11499    // perform due to falling back into GPU composition.
11500    // Note: This stat is not sliced by dimension. It will be duplicated for metrics
11501    // using render_rate_bucket as a dimension.
11502    optional FrameTimingHistogram render_engine_timing = 8
11503        [(android.os.statsd.log_mode) = MODE_BYTES];
11504    // Number of frames where SF saw a frame, based on its frame timeline.
11505    // Frame timelines may include transactions without updating buffer contents.
11506    // Introduced in Android 12.
11507    optional int32 total_timeline_frames = 9;
11508    // Number of frames where SF saw a janky frame.
11509    // Introduced in Android 12.
11510    optional int32 total_janky_frames = 10;
11511    // Number of janky frames where SF spent a long time on the CPU.
11512    // Introduced in Android 12.
11513    optional int32 total_janky_frames_with_long_cpu = 11;
11514    // Number of janky frames where SF spent a long time on the GPU.
11515    // Introduced in Android 12.
11516    optional int32 total_janky_frames_with_long_gpu = 12;
11517    // Number of janky frames where SF missed the frame deadline, but there
11518    // was not an attributed reason (e.g., maybe HWC missed?)
11519    // Introduced in Android 12.
11520    optional int32 total_janky_frames_sf_unattributed = 13;
11521    // Number of janky frames where the app missed the frame deadline, but
11522    // there was not an attributed reason
11523    // Introduced in Android 12.
11524    optional int32 total_janky_frames_app_unattributed = 14;
11525    // Number of janky frames that were caused because of scheduling errors in
11526    // SF that resulted in early present (e.g., SF sending a buffer to the
11527    // composition engine earlier than expected, resulting in a present that is
11528    // one vsync early)
11529    // Introduced in Android 12.
11530    optional int32 total_janky_frames_sf_scheduling = 15;
11531    // Number of frames that were classified as jank because of possible drift in
11532    // vsync predictions.
11533    // Introduced in Android 12.
11534    optional int32 total_jank_frames_sf_prediction_error = 16;
11535    // Number of janky frames where the app was in a buffer stuffed state (more
11536    // than one buffer ready to be presented at the same vsync). Usually caused
11537    // when the first frame is unusually long, the following frames enter into a
11538    // stuffed state.
11539    // Introduced in Android 12.
11540    optional int32 total_jank_frames_app_buffer_stuffing = 17;
11541    // Buckets of timings in ms by which SurfaceFlinger's deadline was missed
11542    // while latching and presenting frames.
11543    // Introduced in Android 12.
11544    optional FrameTimingHistogram sf_deadline_misses = 19
11545        [(android.os.statsd.log_mode) = MODE_BYTES];
11546    // Buckets of timings in ms by which the Vsync prediction drifted, when
11547    // compared to the actual hardware vsync.
11548    // Introduced in Android 12.
11549    optional FrameTimingHistogram sf_prediction_errors = 20
11550        [(android.os.statsd.log_mode) = MODE_BYTES];
11551
11552    // Next ID: 22
11553}
11554
11555/**
11556 * Per-layer display pipeline metrics reported by SurfaceFlinger.
11557 * Metrics exist beginning in Android 11.
11558 * The number of layers uploaded may be restricted due to size limitations.
11559 * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
11560 * That proto must be updated if this atom is updated.
11561 *
11562 * Pulled from:
11563 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
11564 */
11565message SurfaceflingerStatsLayerInfo {
11566    // UID of the application who submitted this layer for presentation
11567    // This is intended to be used as a dimension for surfacing rendering
11568    // statistics to applications.
11569    // Introduced in Android 12.
11570    optional int32 uid = 12 [(is_uid) = true];
11571    // Refresh rate bucket that the layer was presenting at. Buckets are
11572    // defined in SurfaceFlinger and are tracked per device.
11573    // Introduced in Android 12.
11574    // This is intended to be used as a dimension in collecting per-refresh rate
11575    // jank statistics
11576    optional int32 display_refresh_rate_bucket = 22;
11577    // Render rate bucket that the layer was submitting frames at. Buckets are
11578    // defined in SurfaceFlinger and are tracked per device.
11579    // Introduced in Android 12.
11580    // This is intended to be used as a dimension in collecting per-render rate
11581    // jank statistics.
11582    optional int32 render_rate_bucket = 23;
11583
11584    // Game modes are used only for integrating with GameManager.
11585    enum GameMode {
11586         GAME_MODE_UNSPECIFIED = 0;
11587         GAME_MODE_UNSUPPORTED = 1;
11588         GAME_MODE_STANDARD = 2;
11589         GAME_MODE_PERFORMANCE = 3;
11590         GAME_MODE_BATTERY = 4;
11591    }
11592
11593    // Game mode that the layer was running at. Used to track user engagement
11594    // in different modes. The modes are defined in GameManager.java
11595    // All non-game layers will have this field set to UNSUPPORTED.
11596    // Introduced in Android 12
11597    // This is intended to be used as a dimension in collecting per-game mode
11598    // fps and frame related metrics.
11599    optional GameMode game_mode = 26;
11600    // The layer for this set of metrics
11601    // In many scenarios the package name is included in the layer name, e.g.,
11602    // layers created by Window Manager. But this is not a guarantee - in the
11603    // general case layer names are arbitrary debug names.
11604    optional string layer_name = 1;
11605    // Total number of frames presented
11606    optional int64 total_frames = 2;
11607    // Total number of dropped frames while latching a buffer for this layer.
11608    optional int64 dropped_frames = 3;
11609    // Set of timings measured between successive presentation timestamps.
11610    optional FrameTimingHistogram present_to_present = 4
11611        [(android.os.statsd.log_mode) = MODE_BYTES];
11612    // Set of timings measured from when an app queued a buffer for
11613    // presentation, until the buffer was actually presented to the
11614    // display.
11615    optional FrameTimingHistogram post_to_present = 5
11616        [(android.os.statsd.log_mode) = MODE_BYTES];
11617    // Set of timings measured from when a buffer is ready to be presented,
11618    // until the buffer was actually presented to the display.
11619    optional FrameTimingHistogram acquire_to_present = 6
11620        [(android.os.statsd.log_mode) = MODE_BYTES];
11621    // Set of timings measured from when a buffer was latched by
11622    // SurfaceFlinger, until the buffer was presented to the display
11623    optional FrameTimingHistogram latch_to_present = 7
11624        [(android.os.statsd.log_mode) = MODE_BYTES];
11625    // Set of timings measured from the desired presentation to the actual
11626    // presentation time
11627    optional FrameTimingHistogram desired_to_present = 8
11628        [(android.os.statsd.log_mode) = MODE_BYTES];
11629    // Set of timings measured from when an app queued a buffer for
11630    // presentation, until the buffer was ready to be presented.
11631    optional FrameTimingHistogram post_to_acquire = 9
11632        [(android.os.statsd.log_mode) = MODE_BYTES];
11633    // Frames missed latch because the acquire fence didn't fire
11634    optional int64 late_acquire_frames = 10;
11635    // Frames latched early because the desired present time was bad
11636    optional int64 bad_desired_present_frames = 11;
11637    // Number of frames where SF saw a frame, based on its frame timeline.
11638    // Frame timelines may include transactions without updating buffer contents.
11639    // Introduced in Android 12.
11640    optional int32 total_timeline_frames = 13;
11641    // Number of frames where SF saw a janky frame.
11642    // Introduced in Android 12.
11643    optional int32 total_janky_frames = 14;
11644    // Number of janky frames where SF spent a long time on the CPU.
11645    // Introduced in Android 12.
11646    optional int32 total_janky_frames_with_long_cpu = 15;
11647    // Number of janky frames where SF spent a long time on the GPU.
11648    // Introduced in Android 12.
11649    optional int32 total_janky_frames_with_long_gpu = 16;
11650    // Number of janky frames where SF missed the frame deadline, but there
11651    // was not an attributed reason (e.g., maybe HWC missed?)
11652    // Introduced in Android 12.
11653    optional int32 total_janky_frames_sf_unattributed = 17;
11654    // Number of janky frames where the app missed the frame deadline, but
11655    // there was not an attributed reason
11656    // Introduced in Android 12.
11657    optional int32 total_janky_frames_app_unattributed = 18;
11658    // Number of janky frames that were caused because of scheduling errors in
11659    // SF that resulted in early present (e.g., SF sending a buffer to the
11660    // composition engine earlier than expected, resulting in a present that is
11661    // one vsync early)
11662    // Introduced in Android 12.
11663    optional int32 total_janky_frames_sf_scheduling = 19;
11664    // Number of frames that were classified as jank because of possible drift in
11665    // vsync predictions.
11666    // Introduced in Android 12.
11667    optional int32 total_jank_frames_sf_prediction_error = 20;
11668    // Number of janky frames where the app was in a buffer stuffed state (more
11669    // than one buffer ready to be presented at the same vsync). Usually caused
11670    // when the first frame is unusually long, the following frames enter into a
11671    // stuffed state.
11672    // Introduced in Android 12.
11673    optional int32 total_jank_frames_app_buffer_stuffing = 21;
11674
11675    /**
11676     * Encapsulates the FrameRateVote information sent by the application while
11677     * calling setFrameRate.
11678     * Metrics exist beginning in Android 12.
11679     */
11680    message SetFrameRateVote {
11681        // The desired frame rate the application wishes to run on.
11682        optional float frame_rate = 1;
11683
11684        enum FrameRateCompatibility {
11685            FRAME_RATE_UNDEFINED = 0;
11686            FRAME_RATE_DEFAULT = 1;
11687            FRAME_RATE_EXACT_OR_MULTIPLE = 2;
11688        }
11689
11690        // Specifies how to interpret the frame rate associated with the layer.
11691        // Defined in Layer.h
11692        optional FrameRateCompatibility frame_rate_compatibility = 2;
11693
11694        enum Seamlessness {
11695            SEAMLESS_UNDEFINED = 0;
11696            SEAMLESS_SHOULD_BE_SEAMLESS = 1;
11697            SEAMLESS_NOT_REQUIRED = 2;
11698        }
11699        // Indicates whether seamless refresh rate switch is required or not.
11700        optional Seamlessness seamlessness = 3;
11701    }
11702
11703    // The last frame rate vote set by the application.
11704    // Introduced in Android 12.
11705    optional SetFrameRateVote set_frame_rate_vote = 24
11706        [(android.os.statsd.log_mode) = MODE_BYTES];
11707    // Buckets of timings in ms by which the app deadline was missed while
11708    // submitting work for a frame.
11709    // Introduced in Android 12.
11710    optional FrameTimingHistogram app_deadline_misses = 25
11711        [(android.os.statsd.log_mode) = MODE_BYTES];
11712
11713    // Next ID: 27
11714}
11715
11716/**
11717 * Histogram of frame counts bucketed by time in milliseconds.
11718 * Because of size limitations, we hard-cap the number of buckets, with
11719 * buckets for corresponding to larger milliseconds being less precise.
11720 */
11721message FrameTimingHistogram {
11722    // Timings in milliseconds that describes a set of histogram buckets
11723    repeated int32 time_millis_buckets = 1;
11724    // Number of frames that match to each time_millis, i.e. the bucket
11725    // contents
11726    // It's required that len(time_millis) == len(frame_count)
11727    repeated int64 frame_counts = 2;
11728}
11729
11730/**
11731 * Janky event as reported by SurfaceFlinger.
11732 * This event is intended to be consumed by a Perfetto subscriber for
11733 * automated trace collection.
11734 *
11735 * Logged from:
11736 *    frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
11737 */
11738message DisplayJankReported {
11739    // Informational field for how long the janky event lasted in milliseconds
11740    optional int64 event_duration_millis = 1;
11741    // Number of frame deadlines missed, where SurfaceFlinger failed to update
11742    // the display on time.
11743    optional int32 present_deadlines_missed = 2;
11744}
11745
11746message CameraStreamProto {
11747    // The stream width (in pixels)
11748    optional int32 width = 1;
11749    // The stream height (in pixels)
11750    optional int32 height = 2;
11751    // The format of the stream
11752    optional int32 format = 3;
11753    // The dataspace of the stream
11754    optional int32 data_space = 4;
11755    // The usage flag of the stream
11756    optional int64 usage = 5;
11757
11758    // The number of requests for this stream
11759    optional int64 request_count = 6;
11760    // The number of buffer error for this stream
11761    optional int64 error_count = 7;
11762    // The capture latency of first request for this stream
11763    optional int32 first_capture_latency_millis = 8;
11764
11765    // The maximum number of hal buffers
11766    optional int32 max_hal_buffers = 9;
11767    // The maximum number of app buffers
11768    optional int32 max_app_buffers = 10;
11769
11770    // Type of stream histogram
11771    // 1: Capture latency: bin size in milliseconds
11772    enum HistogramType {
11773        UNKNOWN = 0;
11774        CAPTURE_LATENCY = 1;
11775    }
11776    optional HistogramType histogram_type = 11;
11777    // The boundary values between histogram bins
11778    // Expected number of fields: 9
11779    repeated float histogram_bins = 12;
11780    // The frame counts for each histogram bins
11781    // Expected number of fields: 10
11782    repeated int64 histogram_counts = 13;
11783}
11784
11785/**
11786 * Information about camera facing and API level usage.
11787 * Logged from:
11788 *   frameworks/base/services/core/java/com/android/server/camera/CameraServiceProxy.java
11789 */
11790message CameraActionEvent {
11791    // Camera session duration in milliseconds if action is SESSION.
11792    // 0 if action is OPEN or CLOSE.
11793    optional int64 duration_millis = 1;
11794
11795    // Camera API level used.
11796    // 1 for camera1 API, and 2 for camera2 API.
11797    optional int32 api_level = 2;
11798
11799    // Name of client package
11800    optional string package_name = 3;
11801
11802    // Camera facing
11803    enum Facing {
11804        UNKNOWN = 0;
11805        BACK = 1;
11806        FRONT = 2;
11807        EXTERNAL = 3;
11808    }
11809    optional Facing facing = 4;
11810
11811    // Camera ID
11812    optional string camera_id = 5;
11813
11814    // Camera action type
11815    enum Action {
11816        UNKNOWN_ACTION = 0;
11817        OPEN = 1;
11818        CLOSE = 2;
11819        SESSION = 3;
11820    }
11821    optional Action action = 6;
11822
11823    // Whether the client is accessing camera using ndk
11824    optional bool is_ndk = 7;
11825
11826    // Action OPEN: Open latency
11827    // Action CLOSE: Close latency
11828    // Action SESSION: Camera session creation duration.
11829    //                 If this entry is reusing an existing session, the value is -1.
11830    optional int32 latency_millis = 8;
11831
11832    // session type: 0 for normal mode, 1 for constrained high speed mode
11833    optional int32 operating_mode = 9;
11834
11835    // If actioh is SESSION: number of internal reconfigurations
11836    // Else: 0
11837    optional int32 internal_reconfig = 10;
11838
11839    // Number of requests for this capture session. Only applicable to SESSION
11840    // action.
11841    optional int64 request_count = 11;
11842    // Number of result errors. Only applicable to SESSION action.
11843    optional int64 result_error_count = 12;
11844    // Whether the device runs into error state.
11845    optional bool device_error = 13;
11846
11847    // If action is SESSION: Stream states
11848    // Else: stream_count = 0
11849    optional int32 stream_count = 14;
11850    optional CameraStreamProto stream_1 = 15 [(log_mode) = MODE_BYTES];
11851    optional CameraStreamProto stream_2 = 16 [(log_mode) = MODE_BYTES];
11852    optional CameraStreamProto stream_3 = 17 [(log_mode) = MODE_BYTES];
11853    optional CameraStreamProto stream_4 = 18 [(log_mode) = MODE_BYTES];
11854    optional CameraStreamProto stream_5 = 19 [(log_mode) = MODE_BYTES];
11855}
11856
11857/**
11858 * Logs when a compatibility change is affecting an app.
11859 *
11860 * Logged from:
11861 *   frameworks/base/core/java/android/app/AppCompatCallbacks.java and
11862 *   frameworks/base/services/core/java/com/android/server/compat/PlatformCompat.java
11863 */
11864message AppCompatibilityChangeReported {
11865    // The UID of the app being affected by the compatibilty change.
11866    optional int32 uid = 1 [(is_uid) = true];
11867
11868    // The ID of the change affecting the app.
11869    optional int64 change_id = 2;
11870
11871    enum State {
11872        UNKNOWN_STATE = 0;
11873        ENABLED = 1;
11874        DISABLED = 2;
11875        LOGGED = 3;
11876    }
11877
11878    // The state of the change - if logged from gating whether it was enabled or disabled, or just
11879    // logged otherwise.
11880    optional State state = 3;
11881
11882    enum Source {
11883        UNKNOWN_SOURCE = 0;
11884        APP_PROCESS = 1;
11885        SYSTEM_SERVER = 2;
11886    }
11887
11888    // Where it was logged from.
11889    optional Source source = 4;
11890
11891}
11892
11893/**
11894 * Logged from
11895 *     external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
11896 *     external/perfetto/src/tracing/service/tracing_service_impl.cc
11897 */
11898message PerfettoUploaded {
11899    // TODO(lalitm): many of the atoms below should be renamed to have a
11900    // "PERFETTO_CMD" prefix to make clear they are specific to perfetto_cmd.
11901    // This will be done after the server side is ready for this change.
11902    // Next id: 48.
11903    enum Event {
11904        PERFETTO_UNDEFINED = 0;
11905
11906        // Checkpoints inside perfetto_cmd before tracing is finished.
11907        PERFETTO_TRACE_BEGIN = 1;
11908        PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
11909        PERFETTO_ON_CONNECT = 3;
11910
11911        // Guardrails inside perfetto_cmd before tracing is finished.
11912        PERFETTO_ON_TIMEOUT = 16;
11913        PERFETTO_CMD_USER_BUILD_TRACING_NOT_ALLOWED = 43;
11914        PERFETTO_CMD_FAILED_TO_INIT_GUARDRAIL_STATE = 44;
11915        PERFETTO_CMD_INVALID_GUARDRAIL_STATE = 45;
11916        PERFETTO_CMD_HIT_UPLOAD_LIMIT = 46;
11917
11918        // Checkpoints inside traced.
11919        PERFETTO_TRACED_ENABLE_TRACING = 37;
11920        PERFETTO_TRACED_START_TRACING = 38;
11921        PERFETTO_TRACED_DISABLE_TRACING = 39;
11922        PERFETTO_TRACED_NOTIFY_TRACING_DISABLED = 40;
11923
11924        // Trigger checkpoints inside traced.
11925        // These atoms are special because, along with the UUID,
11926        // they log the trigger name.
11927        PERFETTO_TRACED_TRIGGER_START_TRACING = 41;
11928        PERFETTO_TRACED_TRIGGER_STOP_TRACING = 42;
11929
11930        // Guardrails inside traced.
11931        PERFETTO_TRACED_ENABLE_TRACING_EXISTING_TRACE_SESSION = 18;
11932        PERFETTO_TRACED_ENABLE_TRACING_TOO_LONG_TRACE = 19;
11933        PERFETTO_TRACED_ENABLE_TRACING_INVALID_TRIGGER_TIMEOUT = 20;
11934        PERFETTO_TRACED_ENABLE_TRACING_DURATION_WITH_TRIGGER = 21;
11935        PERFETTO_TRACED_ENABLE_TRACING_STOP_TRACING_WRITE_INTO_FILE = 22;
11936        PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_TRIGGER_NAME = 23;
11937        PERFETTO_TRACED_ENABLE_TRACING_INVALID_DEFERRED_START = 24;
11938        PERFETTO_TRACED_ENABLE_TRACING_INVALID_BUFFER_SIZE = 25;
11939        PERFETTO_TRACED_ENABLE_TRACING_BUFFER_SIZE_TOO_LARGE = 26;
11940        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_BUFFERS = 27;
11941        PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_SESSION_NAME = 28;
11942        PERFETTO_TRACED_ENABLE_TRACING_SESSION_NAME_TOO_RECENT = 29;
11943        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_SESSIONS_FOR_UID = 30;
11944        PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_CONCURRENT_SESSIONS = 31;
11945        PERFETTO_TRACED_ENABLE_TRACING_INVALID_FD_OUTPUT_FILE = 32;
11946        PERFETTO_TRACED_ENABLE_TRACING_FAILED_TO_CREATE_FILE = 33;
11947        PERFETTO_TRACED_ENABLE_TRACING_OOM = 34;
11948        PERFETTO_TRACED_ENABLE_TRACING_UNKNOWN_ERROR = 35;
11949        PERFETTO_TRACED_START_TRACING_INVALID_SESSION_STATE = 36;
11950        PERFETTO_TRACED_ENABLE_TRACING_INVALID_FILTER = 47;
11951
11952        // Checkpoints inside perfetto_cmd after tracing has finished.
11953        PERFETTO_ON_TRACING_DISABLED = 4;
11954        PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
11955        PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
11956        PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
11957
11958        // Guardrails inside perfetto_cmd after tracing has finished.
11959        PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
11960
11961        // Deprecated as "success" is misleading; it simply means we were
11962        // able to communicate with incidentd. Will be removed once
11963        // incidentd is properly instrumented.
11964        PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9 [deprecated = true];
11965
11966        // Deprecated as has the potential to be too spammy. Will be
11967        // replaced with a whole new atom proto which uses a count metric
11968        // instead of the event metric used for this proto.
11969        PERFETTO_TRIGGER_BEGIN = 12 [deprecated = true];
11970        PERFETTO_TRIGGER_SUCCESS = 13 [deprecated = true];
11971        PERFETTO_TRIGGER_FAILURE = 14  [deprecated = true];
11972
11973        // Deprecated as too coarse grained to be useful. Will be replaced
11974        // with better broken down atoms as we do with traced.
11975        PERFETTO_HIT_GUARDRAILS = 15 [deprecated = true];
11976
11977        // Contained status of Dropbox uploads. Removed as Perfetto no
11978        // longer supports uploading traces using Dropbox.
11979        reserved 5, 6, 7;
11980    }
11981
11982    // Which stage of the pipeline we are reporting from.
11983    optional Event event = 1;
11984
11985    // UUID matching the one set inside the SystemInfo trace packet.
11986    optional int64 trace_uuid_lsb = 2;
11987    optional int64 trace_uuid_msb = 3;
11988
11989    // For trigger checkpoints inside traced, contains the trigger name
11990    // associated with this trace UUID.
11991    optional string trigger_name = 4;
11992}
11993
11994/**
11995 * Logged from
11996 *     external/perfetto/src/tracing/service/tracing_service_impl.cc
11997 */
11998message PerfettoTrigger {
11999    enum Event {
12000        PERFETTO_UNDEFINED = 0;
12001
12002        PERFETTO_CMD_TRIGGER = 1;
12003        PERFETTO_CMD_TRIGGER_FAIL = 2;
12004
12005        PERFETTO_TRIGGER_PERFETTO_TRIGGER = 3;
12006        PERFETTO_TRIGGER_PERFETTO_TRIGGER_FAIL = 4;
12007
12008        PERFETTO_TRACED_LIMIT_PROBABILITY = 5;
12009        PERFETTO_TRACED_LIMIT_MAX_PER_24_H = 6;
12010
12011        PERFETTO_PROBES_PRODUCER_TRIGGER = 7;
12012        PERFETTO_PROBES_PRODUCER_TRIGGER_FAIL = 8;
12013    }
12014
12015    // The event which fired.
12016    optional Event event = 1;
12017
12018    // The name of the trigger which fired.
12019    optional string trigger_name = 2;
12020}
12021
12022/**
12023 * Pulls client metrics on data transferred via Vehicle Maps Service.
12024 * Metrics are keyed by uid + layer.
12025 *
12026 * Pulled from:
12027 *   packages/services/Car/service/src/com/android/car/stats/CarStatsService.java
12028 */
12029message VmsClientStats {
12030    // UID of the VMS client app
12031    optional int32 uid = 1 [(is_uid) = true];
12032
12033    // VMS layer definition
12034    optional int32 layer_type = 2;
12035    optional int32 layer_channel = 3;
12036    optional int32 layer_version = 4;
12037
12038    // Bytes and packets sent by the client for the layer
12039    optional int64 tx_bytes = 5;
12040    optional int64 tx_packets = 6;
12041
12042    // Bytes and packets received by the client for the layer
12043    optional int64 rx_bytes = 7;
12044    optional int64 rx_packets = 8;
12045
12046    // Bytes and packets dropped due to client error
12047    optional int64 dropped_bytes = 9;
12048    optional int64 dropped_packets = 10;
12049}
12050
12051/**
12052 * State of a all permission requested by a package - sampled
12053 * Pulled from: StatsCompanionService.java with data obtained from PackageManager API
12054*/
12055message DangerousPermissionStateSampled {
12056    // Name of the permission
12057    optional string permission_name = 1;
12058
12059    // Uid of the package
12060    optional int32 uid = 2 [(is_uid) = true];
12061
12062    // If the permission is granted to the uid
12063    optional bool is_granted = 3;
12064
12065    // Permission flags as per android.content.pm.PermissionFlags
12066    optional int32 permission_flags = 4;
12067
12068    // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
12069    optional int32 protection_flags = 5;
12070}
12071
12072/**
12073 * HWUI stats for a given app.
12074 */
12075message GraphicsStats {
12076    // The package name of the app
12077    optional string package_name = 1;
12078
12079    // The version code of the app
12080    optional int64 version_code = 2;
12081
12082    // The start & end timestamps in UTC as
12083    // milliseconds since January 1, 1970
12084    // Compatible with java.util.Date#setTime()
12085    optional int64 start_millis = 3;
12086
12087    optional int64 end_millis = 4;
12088
12089    // HWUI renders pipeline type: GL (1) or Vulkan (2).
12090    enum PipelineType {
12091        UNKNOWN = 0;
12092        GL = 1;
12093        VULKAN = 2;
12094    }
12095
12096    // HWUI renders pipeline type: GL or Vulkan.
12097    optional PipelineType pipeline = 5;
12098
12099    // Distinct frame count.
12100    optional int32 total_frames = 6;
12101
12102    // Number of "missed vsync" events.
12103    optional int32 missed_vsync_count = 7;
12104
12105    // Number of frames in triple-buffering scenario (high input latency)
12106    optional int32 high_input_latency_count = 8;
12107
12108    // Number of "slow UI thread" events.
12109    optional int32 slow_ui_thread_count = 9;
12110
12111    // Number of "slow bitmap upload" events.
12112    optional int32 slow_bitmap_upload_count = 10;
12113
12114    // Number of "slow draw" events.
12115    optional int32 slow_draw_count = 11;
12116
12117    // Number of frames that missed their deadline (aka, visibly janked)
12118    optional int32 missed_deadline_count = 12;
12119
12120    // The frame time histogram for the package
12121    optional FrameTimingHistogram cpu_histogram = 13
12122    [(android.os.statsd.log_mode) = MODE_BYTES];
12123
12124    // The gpu frame time histogram for the package
12125    optional FrameTimingHistogram gpu_histogram = 14
12126    [(android.os.statsd.log_mode) = MODE_BYTES];
12127
12128    // UI mainline module version.
12129    optional int64 version_ui_module = 15;
12130
12131    // If true, these are HWUI stats for up to a 24h period for a given app from today.
12132    // If false, these are HWUI stats for a 24h period for a given app from the last complete
12133    // day (yesterday). Stats from yesterday stay constant, while stats from today may change as
12134    // more apps are running / rendering.
12135    optional bool is_today = 16;
12136}
12137
12138/**
12139 * Message related to dangerous (runtime) app ops access
12140 */
12141message RuntimeAppOpAccess {
12142    // Uid of the package accessing app op
12143    optional int32 uid = 1 [(is_uid) = true];
12144
12145    // Name of the package accessing app op
12146    optional string package_name = 2;
12147
12148    // deprecated - set to empty string
12149    optional string op_deprecated = 3 [deprecated = true];
12150
12151    // attribution_tag; provided by developer when accessing related API, limited at 50 chars by
12152    // API. Attributions must be provided through manifest using <attribution> tag available in R
12153    // and above.
12154    optional string attribution_tag = 4;
12155
12156    // message related to app op access, limited to 600 chars by API
12157    optional string message = 5;
12158
12159    enum SamplingStrategy {
12160        DEFAULT = 0;
12161        UNIFORM = 1;
12162        RARELY_USED = 2;
12163        BOOT_TIME_SAMPLING = 3;
12164        UNIFORM_OPS = 4;
12165    }
12166
12167    // sampling strategy used to collect this message
12168    optional SamplingStrategy sampling_strategy = 6;
12169
12170    // operation id
12171    optional android.app.AppOpEnum op = 7 [default = APP_OP_NONE];
12172}
12173
12174/*
12175 * Logs userspace reboot outcome and duration.
12176 *
12177 * Logged from:
12178 *   frameworks/base/core/java/com/android/server/BootReceiver.java
12179 */
12180message UserspaceRebootReported {
12181    // Possible outcomes of userspace reboot.
12182    enum Outcome {
12183        // Default value in case platform failed to determine the outcome.
12184        OUTCOME_UNKNOWN = 0;
12185        // Userspace reboot succeeded (i.e. boot completed without a fall back to hard reboot).
12186        SUCCESS = 1;
12187        // Userspace reboot shutdown sequence was aborted.
12188        FAILED_SHUTDOWN_SEQUENCE_ABORTED = 2;
12189        // Remounting userdata into checkpointing mode failed.
12190        FAILED_USERDATA_REMOUNT = 3;
12191        // Device didn't finish booting before timeout and userspace reboot watchdog issued a hard
12192        // reboot.
12193        FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED = 4;
12194    }
12195    // Outcome of userspace reboot. Always set.
12196    optional Outcome outcome = 1;
12197    // Duration of userspace reboot in case it has a successful outcome.
12198    // Duration is measured as time between userspace reboot was initiated and until boot completed
12199    // (e.g. sys.boot_completed=1).
12200    optional int64 duration_millis = 2;
12201    // State of primary user's (user0) credential encryption storage.
12202    enum UserEncryptionState {
12203        // Default value.
12204        USER_ENCRYPTION_STATE_UNKNOWN = 0;
12205        // Credential encrypted storage is unlocked.
12206        UNLOCKED = 1;
12207        // Credential encrypted storage is locked.
12208        LOCKED = 2;
12209    }
12210    // State of primary user's encryption storage at the moment boot completed. Always set.
12211    optional UserEncryptionState user_encryption_state = 3;
12212}
12213
12214/*
12215 * Logs integrity check information during each install.
12216 *
12217 * Logged from:
12218 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
12219 */
12220message IntegrityCheckResultReported {
12221    optional string package_name = 1;
12222    optional string app_certificate_hash = 2;
12223    optional int64 version_code = 3;
12224    optional string installer_package_name = 4;
12225    enum Response {
12226        UNKNOWN = 0;
12227        ALLOWED = 1;
12228        REJECTED = 2;
12229        FORCE_ALLOWED = 3;
12230    }
12231    optional Response response = 5;
12232    // An estimate on the cause of the response. This will only be populated for
12233    // REJECTED and FORCE_ALLOWED
12234    optional bool caused_by_app_cert_rule = 6;
12235    optional bool caused_by_installer_rule = 7;
12236}
12237
12238/**
12239 * Logs the information about the rules and the provider whenever rules are
12240 * pushed into AppIntegrityManager.
12241 *
12242 * Logged from:
12243 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
12244 */
12245message IntegrityRulesPushed {
12246    optional bool success = 1;
12247    // Package name of the app that pushed the rules.
12248    optional string rule_provider = 2;
12249    // Version string of arbitrary format provided by the rule provider to
12250    // identify the rules.
12251    optional string rule_version = 3;
12252}
12253
12254/**
12255 * Logs when a cell broadcast message is received on the device.
12256 *
12257 * Logged from Cell Broadcast module and platform:
12258 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
12259 *   packages/apps/CellBroadcastReceiver/
12260 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/CellBroadcastServiceManager.java
12261 */
12262message CellBroadcastMessageReported {
12263    // The type of Cell Broadcast message
12264    enum CbType {
12265        UNKNOWN_TYPE = 0;
12266        GSM = 1;
12267        CDMA = 2;
12268        CDMA_SPC = 3;
12269    }
12270
12271    // The parts of the cell broadcast message pipeline
12272    enum ReportSource {
12273        UNKNOWN_SOURCE = 0;
12274        FRAMEWORK = 1;
12275        CB_SERVICE = 2;
12276        CB_RECEIVER_APP = 3;
12277    }
12278
12279    // GSM, CDMA, CDMA-SCP
12280    optional CbType type = 1;
12281
12282    // The source of the report
12283    optional ReportSource source = 2;
12284}
12285
12286/**
12287 * Logs when a cell broadcast message is filtered out, or otherwise intentionally not sent to CBR.
12288 *
12289 * Logged from CellBroadcastService module:
12290 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
12291 */
12292message CellBroadcastMessageFiltered {
12293    enum FilterReason {
12294        NOT_FILTERED = 0;
12295        DUPLICATE_MESSAGE = 1;
12296        GEOFENCED_MESSAGE = 2;
12297        AREA_INFO_MESSAGE = 3;
12298        DISABLED_BY_OEM = 4;
12299    }
12300
12301    // GSM, CDMA, CDMA-SCP
12302    optional CellBroadcastMessageReported.CbType type = 1;
12303
12304    // The source of the report
12305    optional FilterReason filter = 2;
12306}
12307
12308/**
12309 * Logs when an error occurs while handling a cell broadcast message;
12310 *
12311 * Logged from CellBroadcastService module:
12312 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
12313 */
12314message CellBroadcastMessageError {
12315    // The type of error raised when trying to handle a cell broadcast message
12316    enum ErrorType {
12317        UNKNOWN_TYPE = 0;
12318        CDMA_DECODING_ERROR = 1;
12319        CDMA_SCP_EMPTY = 2;
12320        CDMA_SCP_HANDLING_ERROR = 3;
12321        GSM_INVALID_HEADER_LENGTH = 4;
12322        GSM_UNSUPPORTED_HEADER_MESSAGE_TYPE = 5;
12323        GSM_UNSUPPORTED_HEADER_DATA_CODING_SCHEME = 6;
12324        GSM_INVALID_PDU = 7;
12325        GSM_INVALID_GEO_FENCING_DATA = 8;
12326        GSM_UMTS_INVALID_WAC = 9;
12327        FAILED_TO_INSERT_TO_DB = 10;
12328        UNEXPECTED_GEOMETRY_FROM_FWK = 11;
12329        UNEXPECTED_GSM_MESSAGE_TYPE_FROM_FWK = 12;
12330        UNEXPECTED_CDMA_MESSAGE_TYPE_FROM_FWK = 13;
12331        UNEXPECTED_CDMA_SCP_MESSAGE_TYPE_FROM_FWK = 14;
12332        NO_CONNECTION_TO_CB_SERVICE = 15;
12333    }
12334
12335    // What kind of error occurred
12336    optional ErrorType type = 1;
12337
12338    // Exception message (or log message) associated with the error (max 1000 chars)
12339    optional string exception_message = 2;
12340}
12341
12342/**
12343 * Logs when a TV Input Service Session changes tune state
12344 * This is atom ID 327.
12345 *
12346 * Logged from:
12347 *   frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
12348 */
12349message TifTuneStateChanged {
12350
12351    // Tv Input Service uid, TV Player uid
12352    repeated AttributionNode attribution_node = 1 [
12353        (state_field_option).primary_field_first_uid = true
12354    ];
12355    optional android.stats.tv.TifTuneState state = 2 [
12356        (state_field_option).exclusive_state = true,
12357        (state_field_option).default_state_value = 0,
12358        (state_field_option).nested = false
12359    ];
12360    // This a globally unique 128 bit random number created by TvInputManagerService when
12361    // android.media.tv.TvInputManager#createSession is called.
12362    // It is has no device or user association.
12363    // See android.media.tv.TvInputService.onCreateSession(java.lang.String, java.lang.String)
12364    // WARNING: Any changes to this field should be carefully reviewed for privacy.
12365    //          Inspect the code at
12366    //          framework/base/cmds/statsd/src/atoms.proto
12367    //               TifTuneState
12368    //          frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
12369    //              logTuneStateChanged
12370    //              BinderService.createSession
12371    //              SessionState.sessionId
12372    optional string tif_session_id = 3 [(state_field_option).primary_field = true];
12373    optional android.stats.tv.TifInputType type = 4;
12374    // The id of this TV Input, only unique to a given TV Input Service.
12375    // This is specifically NOT android.media.tv.TvInputInfo.getId()
12376    // which is a string that contains the package name of its TvInputService.
12377    optional int32 input_id = 5  [(state_field_option).primary_field = true];
12378    // The HDMI port id
12379    // Only valid when type == HDMI
12380    optional int32 hdmi_port = 6  [(state_field_option).primary_field = true];
12381}
12382
12383/**
12384 * Logs when a tune occurs through device's Frontend.
12385 * This is atom ID 276.
12386 *
12387 * Logged from:
12388 *   frameworks/base/media/java/android/media/tv/tuner/Tuner.java
12389 */
12390message TvTunerStateChanged {
12391    enum State {
12392        UNKNOWN = 0;
12393        TUNING = 1; // Signal is tuned
12394        LOCKED = 2;    // the signal is locked
12395        NOT_LOCKED = 3; // the signal isn’t locked.
12396        SIGNAL_LOST = 4; // the signal was locked, but is lost now.
12397        SCANNING = 5; // the signal is scanned
12398        SCAN_STOPPED = 6; // the scan is stopped.
12399    }
12400    // The uid of the application that sent this custom atom.
12401    optional int32 uid = 1 [(is_uid) = true];
12402    //  new state
12403    optional State state = 2;
12404}
12405
12406/**
12407 * Logs the status of a dvr playback or record.
12408 * This is atom ID 279.
12409 *
12410 * Logged from:
12411 *   frameworks/base/media/java/android/media/tv/tuner/dvr
12412 */
12413message TvTunerDvrStatus {
12414    enum Type {
12415        UNKNOWN_TYPE = 0;
12416        PLAYBACK = 1; // is a playback
12417        RECORD = 2; // is a record
12418    }
12419    enum State {
12420        UNKNOWN_STATE = 0;
12421        STARTED = 1; // DVR is started
12422        STOPPED = 2; // DVR is stopped
12423    }
12424    // The uid of the application that sent this custom atom.
12425    optional int32 uid = 1 [(is_uid) = true];
12426    // DVR type
12427    optional Type type = 2;
12428    //  DVR state
12429    optional State state = 3;
12430    //  Identify the segment of a record or playback
12431    optional int32 segment_id = 4;
12432    // indicate how many overflow or underflow happened between started to stopped
12433    optional int32 overflow_underflow_count = 5;
12434}
12435
12436/**
12437 * Logs when a cas session opened through MediaCas.
12438 * This is atom ID 280.
12439 *
12440 * Logged from:
12441 *   frameworks/base/media/java/android/media/MediaCas.java
12442 */
12443message TvCasSessionOpenStatus {
12444    enum State {
12445        UNKNOWN = 0;
12446        SUCCEEDED = 1; // indicate that the session is opened successfully.
12447        FAILED = 2; // indicate that the session isn’t opened successfully.
12448    }
12449    // The uid of the application that sent this custom atom.
12450    optional int32 uid = 1 [(is_uid) = true];
12451    //  Cas system Id
12452    optional int32 cas_system_id = 2;
12453    // State of the session
12454    optional State state = 3;
12455}
12456
12457/**
12458 * Logs for ContactsProvider general usage.
12459 * This is atom ID 301.
12460 *
12461 * Logged from:
12462 *   packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
12463 */
12464message ContactsProviderStatusReported {
12465    enum ApiType {
12466        UNKNOWN_API = 0;
12467        QUERY = 1;
12468        // INSERT includes insert and bulkInsert, and inserts triggered by applyBatch.
12469        INSERT = 2;
12470        // UPDATE and DELETE includes update/delete and the ones triggered by applyBatch.
12471        UPDATE = 3;
12472        DELETE = 4;
12473        CALL = 5;
12474    }
12475
12476    // Method called for ApiType.CALL
12477    enum MethodCall {
12478        UNKNOWN_METHOD = 0;
12479        ADD_SIM_ACCOUNTS = 1;
12480        REMOVE_SIM_ACCOUNTS = 2;
12481        GET_SIM_ACCOUNTS = 3;
12482    }
12483
12484    enum ResultType {
12485        UNKNOWN_RESULT = 0;
12486        SUCCESS = 1;
12487        FAIL = 2;
12488        ILLEGAL_ARGUMENT = 3;
12489        UNSUPPORTED_OPERATION = 4;
12490    }
12491
12492    enum CallerType {
12493        UNSPECIFIED_CALLER_TYPE = 0;
12494        CALLER_IS_SYNC_ADAPTER = 1;
12495        CALLER_IS_NOT_SYNC_ADAPTER = 2;
12496    }
12497
12498    enum TaskType {
12499        UNKNOWN_TASK = 0;
12500        DANGLING_CONTACTS_CLEANUP_TASK = 1;
12501    }
12502
12503    optional ApiType api_type = 1;
12504    // Defined in
12505    // packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
12506    optional int32 uri_type = 2;
12507    optional CallerType caller_type = 3;
12508    optional ResultType result_type = 4;
12509    optional int32 result_count = 5;
12510    optional int64 latency_micros = 6;
12511    optional TaskType task_type = 7;
12512    // Set when api_type == CALL
12513    optional MethodCall method_called = 8;
12514}
12515
12516/**
12517 * Logs when an app is frozen or unfrozen.
12518 *
12519 * Logged from:
12520 *   frameworks/base/services/core/java/com/android/server/am/CachedAppOptimizer.java
12521 */
12522message AppFreezeChanged {
12523    // The type of event.
12524    enum Action {
12525        UNKNOWN = 0;
12526        FREEZE_APP = 1;
12527        UNFREEZE_APP = 2;
12528    }
12529    optional Action action = 1;
12530
12531    // Pid of the process being frozen.
12532    optional int32 pid = 2;
12533
12534    // Name of the process being frozen.
12535    optional string process_name = 3;
12536
12537    // Time since last unfrozen.
12538    optional int64 time_unfrozen_millis = 4;
12539}
12540
12541/**
12542 * Pulls information for a single voice call.
12543 *
12544 * Each pull creates multiple atoms, one for each call. The sequence is randomized when pulled.
12545 *
12546 * Pulled from:
12547 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12548 */
12549message VoiceCallSession {
12550    // Bearer (IMS or CS) when the call started.
12551    optional android.telephony.CallBearerEnum bearer_at_start = 1;
12552
12553    // Bearer (IMS or CS) when the call ended.
12554    // The bearer may change during the call, e.g. due to SRVCC.
12555    optional android.telephony.CallBearerEnum bearer_at_end = 2;
12556
12557    // Direction of the call (incoming or outgoing).
12558    optional android.telephony.CallDirectionEnum direction = 3;
12559
12560    // Time spent setting up the call.
12561    optional android.telephony.CallSetupDurationEnum setup_duration = 4;
12562
12563    // Whether the call ended before the setup was completed.
12564    optional bool setup_failed = 5;
12565
12566    // IMS reason code or CS disconnect cause.
12567    // For IMS, see: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
12568    // For CS, see: frameworks/base/telephony/java/android/telephony/DisconnectCause.java
12569    optional int32 disconnect_reason_code = 6;
12570
12571    // IMS extra code or CS precise disconnect cause.
12572    // For IMS, this code is vendor-specific
12573    // For CS, see: frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java
12574    optional int32 disconnect_extra_code = 7;
12575
12576    // IMS extra message or CS vendor cause.
12577    optional string disconnect_extra_message = 8;
12578
12579    // Radio access technology (RAT) used when call started.
12580    optional android.telephony.NetworkTypeEnum rat_at_start = 9;
12581
12582    // Radio access technology (RAT) used when call terminated.
12583    optional android.telephony.NetworkTypeEnum rat_at_end = 10;
12584
12585    // Number of times RAT changed during the call.
12586    optional int64 rat_switch_count = 11;
12587
12588    // A bitmask of all codecs used during the call.
12589    // See: frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java
12590    optional int64 codec_bitmask = 12;
12591
12592    // Number of other calls going on during call setup, for the same SIM slot.
12593    optional int32 concurrent_call_count_at_start = 13;
12594
12595    // Number of other calls going on during call termination, for the same SIM slot.
12596    optional int32 concurrent_call_count_at_end = 14;
12597
12598    // Index of the SIM used, 0 for single-SIM devices.
12599    optional int32 sim_slot_index = 15;
12600
12601    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
12602    optional bool is_multi_sim = 16;
12603
12604    // Whether the call was made with an eSIM profile.
12605    optional bool is_esim = 17;
12606
12607    // Carrier ID of the SIM card.
12608    // See https://source.android.com/devices/tech/config/carrierid.
12609    optional int32 carrier_id = 18;
12610
12611    // Whether an SRVCC has been completed successfully for this call.
12612    optional bool srvcc_completed = 19;
12613
12614    // Number of SRVCC failures.
12615    optional int64 srvcc_failure_count = 20;
12616
12617    // Number of SRVCC cancellations.
12618    optional int64 srvcc_cancellation_count = 21;
12619
12620    // Whether the Real-Time Text (RTT) was ever used in the call (rather than whether RTT was
12621    // enabled in the dialer's settings).
12622    optional bool rtt_enabled = 22;
12623
12624    // Whether this was an emergency call.
12625    optional bool is_emergency = 23;
12626
12627    // Whether the call was performed while roaming.
12628    optional bool is_roaming = 24;
12629
12630    // A random number used as the dimension field to pull multiple atoms.
12631    optional int32 dimension = 25;
12632
12633    // Signal strength at the end of the call. This value is applicable to both cellular and WiFi.
12634    optional android.telephony.SignalStrengthEnum signal_strength_at_end = 26;
12635
12636    // Band at the end of the call. Value 0 is used if the band is unknown.
12637    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending on the RAT at
12638    // the end of the call.
12639    optional int32 band_at_end = 27;
12640
12641    // Time spent setting up the call in milliseconds.
12642    // The time is measured from dial to ringing for outgoing calls, and from answer to connected
12643    // for incoming calls.
12644    optional int32 setup_duration_millis = 28;
12645
12646    // Main codec quality. The codec quality was equal to or greater than this value for at least
12647    // 70% of the call.
12648    optional android.telephony.CodecQuality main_codec_quality = 29;
12649
12650    // Whether video was enabled at any point during the call.
12651    optional bool video_enabled = 30;
12652
12653    // Radio access technology (RAT) used when call is connected.
12654    optional android.telephony.NetworkTypeEnum rat_at_connected = 31;
12655
12656    // Whether the call was a conference call (applicable only for calls over IMS).
12657    optional bool is_multiparty = 32;
12658}
12659
12660/**
12661 * Pulls voice call radio access technology (RAT) usage.
12662 *
12663 * Each pull creates multiple atoms, one for each carrier/RAT, the order of which is irrelevant to
12664 * time. The atom will be skipped if not enough data is available.
12665 *
12666 * Pulled from:
12667 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12668 */
12669message VoiceCallRatUsage {
12670    // Carrier ID (https://source.android.com/devices/tech/config/carrierid).
12671    optional int32 carrier_id = 1;
12672
12673    // Radio access technology.
12674    optional android.telephony.NetworkTypeEnum rat = 2;
12675
12676    // Total duration that voice calls spent on this carrier and RAT, rounded to 5 minutes.
12677    optional int64 total_duration_seconds = 3;
12678
12679    // Total number of calls using this carrier and RAT.
12680    // A call is counted once even if it used the RAT multiple times.
12681    optional int64 call_count = 4;
12682}
12683
12684/**
12685 * Pulls amount of time spend in each cellular service state.
12686 *
12687 * Each pull creates multiple atoms, one for each SIM slot/carrier/RAT(including ENDC), the order of
12688 * which is irrelevant to time. If multi SIM settings changes during the period, durations will be
12689 * counted separately before and after the change. Airplane mode does not count towards durations.
12690 *
12691 * Pulled from:
12692 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12693 */
12694message CellularServiceState {
12695    // Radio access technology (RAT) for voice.
12696    // NETWORK_TYPE_UNKNOWN when the device is out of service.
12697    // NETWORK_TYPE_IWLAN when the device is using VoWiFi.
12698    optional android.telephony.NetworkTypeEnum voice_rat = 1;
12699
12700    // Radio access technology (RAT) for data.
12701    // NETWORK_TYPE_UNKNOWN when the device is out of service.
12702    // Only cellular RATs are valid and show where the device is camped.
12703    optional android.telephony.NetworkTypeEnum data_rat = 2;
12704
12705    // Whether the device was in roaming (domestic or international) for voice.
12706    optional android.telephony.RoamingTypeEnum voice_roaming_type = 3;
12707
12708    // Whether the device was in roaming (domestic or international) for data.
12709    optional android.telephony.RoamingTypeEnum data_roaming_type = 4;
12710
12711    // Whether the device is on LTE and has access to NR NSA, i.e. cell supports 5G (ENDC) and UE
12712    // registration (attach/TAU) indicates ENDC is not restricted.
12713    optional bool is_endc = 5;
12714
12715    // Index of the SIM used, 0 for single-SIM devices.
12716    optional int32 sim_slot_index = 6;
12717
12718    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
12719    optional bool is_multi_sim = 7;
12720
12721    // Carrier ID of the SIM card.
12722    // See https://source.android.com/devices/tech/config/carrierid.
12723    optional int32 carrier_id = 8;
12724
12725    // Total time spent in this service state, rounded to 5 minutes.
12726    optional int32 total_time_seconds = 9;
12727}
12728
12729/**
12730 * Pulls the number of times cellular data service state switches.
12731 *
12732 * Each pull creates multiple atoms, one for each RAT combination, the order of which is irrelevant
12733 * to time. Switches for different SIM slots, carrier IDs, or multi-SIM settings are counted
12734 * separately.
12735 *
12736 * Pulled from:
12737 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12738 */
12739message CellularDataServiceSwitch {
12740    // Cellular RAT of the DATA domain from where the switch occurred.
12741    optional android.telephony.NetworkTypeEnum rat_from = 1;
12742
12743    // Cellular RAT of the DATA domain to where the switch occurred.
12744    optional android.telephony.NetworkTypeEnum rat_to = 2;
12745
12746    // Index of the SIM used, 0 for single-SIM devices.
12747    optional int32 sim_slot_index = 3;
12748
12749    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
12750    optional bool is_multi_sim = 4;
12751
12752    // Carrier ID of the SIM card.
12753    // See https://source.android.com/devices/tech/config/carrierid.
12754    optional int32 carrier_id = 5;
12755
12756    // Number of switches from rat_from to rat_to.
12757    optional int32 switch_count = 6;
12758}
12759
12760/**
12761 * Pulls the number of active SIM slots and SIMs/eSIM profiles.
12762 *
12763 * Pulled from:
12764 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12765 */
12766message SimSlotState {
12767    // Number of active SIM slots (both physical and eSIM profiles) in the device.
12768    optional int32 active_slot_count = 1;
12769
12770    // Number of SIM cards (both physical and active eSIM profiles).
12771    // This number is always equal to or less than the number of active SIM slots.
12772    optional int32 sim_count = 2;
12773
12774    // Number of active eSIM profiles.
12775    // This number is always equal to or less than the number of SIMs.
12776    optional int32 esim_count = 3;
12777}
12778
12779/**
12780 * Pulls supported cellular radio access technologies.
12781 *
12782 * This atom reports the capabilities of the device, rather than the network it has access to.
12783 *
12784 * Pulled from:
12785 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12786 */
12787message SupportedRadioAccessFamily {
12788    // A bitmask of supported radio technologies.
12789    // See android.telephony.TelephonyManager.NetworkTypeBitMask.
12790    optional int64 network_type_bitmask = 1;
12791}
12792
12793/**
12794 * Pulls information about network requests.
12795 *
12796 * Pulled from:
12797 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12798 */
12799message TelephonyNetworkRequests {
12800    // Carrier ID of the SIM card.
12801    // See https://source.android.com/devices/tech/config/carrierid.
12802    optional int32 carrier_id = 1;
12803    // Number of times the enterprise capability was requested.
12804    optional int32 enterprise_request_count = 2;
12805    // Number of times the enterprise capability was released.
12806    optional int32 enterprise_release_count = 3;
12807}
12808
12809/**
12810 * Pulls information for a single incoming SMS.
12811 *
12812 * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
12813 *
12814 * Pulled from:
12815 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12816 */
12817message IncomingSms {
12818    // Format of the SMS (3GPP or 3GPP2).
12819    optional android.telephony.SmsFormatEnum sms_format = 1;
12820
12821    // Technology of the SMS (CS or IMS).
12822    optional android.telephony.SmsTechEnum sms_tech = 2;
12823
12824    // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
12825    optional android.telephony.NetworkTypeEnum rat = 3;
12826
12827    // Type the SMS.
12828    optional android.telephony.SmsTypeEnum sms_type = 4;
12829
12830    // Number of total parts.
12831    optional int32 total_parts = 5;
12832
12833    // Number of received parts (if smaller than total parts, the SMS was dropped).
12834    optional int32 received_parts = 6;
12835
12836    // Indicates if the incoming SMS was blocked.
12837    optional bool blocked = 7;
12838
12839    // Indicate a specific error handling the SMS
12840    optional android.telephony.SmsIncomingErrorEnum error = 8;
12841
12842    // Whether the SMS was received while roaming.
12843    optional bool is_roaming = 9;
12844
12845    // Index of the SIM used, 0 for single-SIM devices.
12846    optional int32 sim_slot_index = 10;
12847
12848    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
12849    optional bool is_multi_sim = 11;
12850
12851    // Whether the message was received with an eSIM profile.
12852    optional bool is_esim = 12;
12853
12854    // Carrier ID of the SIM card used for the SMS.
12855    // See https://source.android.com/devices/tech/config/carrierid.
12856    optional int32 carrier_id = 13;
12857
12858    // Random message ID.
12859    optional int64 message_id = 14;
12860}
12861
12862/**
12863 * Pulls information for a single outgoing SMS.
12864 *
12865 * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
12866 *
12867 * Pulled from:
12868 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12869 */
12870message OutgoingSms {
12871    // Format of the SMS (3GPP or 3GPP2).
12872    optional android.telephony.SmsFormatEnum sms_format = 1;
12873
12874    // Technology of the SMS (CS or IMS).
12875    optional android.telephony.SmsTechEnum sms_tech = 2;
12876
12877    // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
12878    optional android.telephony.NetworkTypeEnum rat = 3;
12879
12880    // Result of the SMS sending.
12881    optional android.telephony.SmsSendResultEnum send_result = 4;
12882
12883    // Error code
12884    // For IMS technology, see @SmsManager.Result in
12885    // http://cs/android/frameworks/base/telephony/java/android/telephony/SmsManager.java
12886    // For CS technology:
12887    //  - GSM format: see GsmSmsErrorCode (3GPP 27.005 clause 3.2.5)
12888    //  - CDMA format: see CdmaSmsErrorCode (3GPP2 N.S0005 (IS-41-C) Table 171)
12889    optional int32 error_code = 5;
12890
12891    // Whether the SMS was sent while roaming.
12892    optional bool is_roaming = 6;
12893
12894    // Whether the default SMS application generated the SMS (regardless of which application).
12895    optional bool is_from_default_app = 7;
12896
12897    // Index of the SIM used, 0 for single-SIM devices.
12898    optional int32 sim_slot_index = 8;
12899
12900    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
12901    optional bool is_multi_sim = 9;
12902
12903    // Whether the message was sent with an eSIM profile.
12904    optional bool is_esim = 10;
12905
12906    // Carrier ID of the SIM card used for the SMS.
12907    // See https://source.android.com/devices/tech/config/carrierid.
12908    optional int32 carrier_id = 11;
12909
12910    // Random message ID.
12911    optional int64 message_id = 12;
12912
12913    // Retry count: 0 for the first attempt and then increasing for each attempt.
12914    optional int32 retry_id = 13;
12915}
12916
12917/**
12918 * Logs information about usage of airplane mode.
12919 *
12920 * Logged from:
12921 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/AirplaneModeStats.java
12922 */
12923message AirplaneMode {
12924    // Status of airplane mode
12925    optional bool is_enabled = 1;
12926
12927    // When is_enabled is false, indicates if this was a very short airplane mode toggle
12928    // (i.e. airplane mode was disabled after less than 10 seconds from enablement).
12929    optional bool short_toggle = 2;
12930
12931    // Carrier ID of the SIM card.
12932    // See https://source.android.com/devices/tech/config/carrierid.
12933    optional int32 carrier_id = 3;
12934}
12935
12936/**
12937 * Logs information about modem restarts.
12938 *
12939 * Logged from:
12940 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/ModemRestartStats.java
12941 */
12942message ModemRestart {
12943    // Software version of the modem, as provided by android.os.Build.getRadioVersion().
12944    optional string baseband_version = 1;
12945
12946    // Reason of the modem restart, as provided in the modemReset indication of IRadio HAL.
12947    optional string reason = 2;
12948
12949    // Carrier ID of the first SIM card.
12950    // See https://source.android.com/devices/tech/config/carrierid.
12951    optional int32 carrier_id = 3;
12952}
12953
12954/**
12955 * Logs the SIM card details when the carrier ID match is not complete.
12956 *
12957 * The atom is pushed when a SIM card is initialized and the MCC/MNC is not present in the
12958 * carrier ID table, or the SIM card contains a GID1 value that is not present in the carrier ID
12959 * table. This atom is pushed only once for each type of SIM card.
12960 *
12961 * Logged from:
12962 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
12963 */
12964message CarrierIdMismatchReported {
12965    // Matched carrier ID. The value -1 is used if no match is found.
12966    optional int32 carrier_id = 1;
12967
12968    // MCC/MNC of the SIM card.
12969    optional string mcc_mnc = 2;
12970
12971    // Group identifier (level 1) of the SIM card.
12972    optional string gid1 = 3;
12973
12974    // SPN value of the SIM card.
12975    optional string spn = 4;
12976
12977    // First record of the PNN in the SIM card. This field is populated only if the SPN is missing
12978    // or empty.
12979    optional string pnn = 5;
12980}
12981
12982/**
12983 * Logs the version of the carrier ID matching table at first power up and when it is updated.
12984 *
12985 * Logged from:
12986 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
12987 */
12988message CarrierIdTableUpdated {
12989    // Version of the CarrierId matching table.
12990    optional int32 table_version = 1;
12991}
12992
12993/**
12994 * Pulls the version of the carrier ID matching table.
12995 *
12996 * Logged from:
12997 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
12998 */
12999message CarrierIdTableVersion {
13000    // Version of the CarrierId matching table.
13001    optional int32 table_version = 1;
13002}
13003
13004/**
13005 * Pulls information for a single data call session
13006 *
13007 * Each pull creates multiple atoms, one for each data call session.
13008 * The sequence is randomized when pulled.
13009 *
13010 * Pulled from:
13011 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13012 */
13013message DataCallSession {
13014    // A random number to be used as dimension to capture multiple atoms
13015    optional int32 dimension = 1;
13016
13017    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
13018    optional bool is_multi_sim = 2;
13019
13020    // Whether the call was made with an eSIM profile.
13021    optional bool is_esim = 3;
13022
13023    // Data profile of this call (for what purpose this call was made)
13024    optional android.telephony.DataProfileEnum profile = 4 [deprecated = true];
13025
13026    // APN type bitmask of the APN used:
13027    // @ApnType in frameworks/base/telephony/java/android/telephony/Annotation.java.
13028    optional int32 apn_type_bitmask = 5;
13029
13030    // Carrier ID of the SIM
13031    // See https://source.android.com/devices/tech/config/carrierid.
13032    optional int32 carrier_id = 6;
13033
13034    // Whether the subscription is roaming
13035    optional bool is_roaming = 7;
13036
13037    // Data RAT when the call ended, can be IWLAN for IMS/MMS, otherwise should be WWAN PS RAT.
13038    // In the case that the connection hasn't ended yet, this field holds the current RAT.
13039    // In the case the call ended due to Out Of Service (OOS),
13040    // this field should be the last known RAT.
13041    optional android.telephony.NetworkTypeEnum rat_at_end = 8;
13042
13043    // Was the data call ended due to OOS
13044    optional bool oos_at_end = 9;
13045
13046    // Number of RAT switches during the data call
13047    optional int64 rat_switch_count = 10;
13048
13049    // Whether the call is on an opportunistic subscription
13050    optional bool is_opportunistic = 11;
13051
13052    // Packet data protocol used
13053    optional android.telephony.ApnProtocolEnum ip_type = 12;
13054
13055    // Whether the data call terminated before being established
13056    optional bool setup_failed = 13;
13057
13058    // Reason why the data call terminated, as in RIL_DataCallFailCause from ril.h
13059    optional int32 failure_cause = 14;
13060
13061    // Suggested retry back-off timer value from RIL
13062    optional int32 suggested_retry_millis = 15;
13063
13064    // Why the data call was deactivated
13065    // Set by telephony for MO deactivations (unrelated to failure_cause)
13066    optional android.telephony.DataDeactivateReasonEnum deactivate_reason = 16;
13067
13068    // Duration of the data call, rounded into the closest 5 minutes.
13069    optional int64 duration_minutes = 17;
13070
13071    // Whether the data call is still connected when the atom is collected.
13072    optional bool ongoing = 18;
13073
13074    // Band at the end of the data call. Value 0 is used if the band is unknown.
13075    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
13076    // on the RAT at the end of the data call.
13077    optional int32 band_at_end = 19;
13078}
13079
13080/**
13081 * Logs data stall recovery event
13082 *
13083 * Logged from:
13084 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
13085 */
13086message DataStallRecoveryReported {
13087    // Carrier ID of the SIM
13088    // See https://source.android.com/devices/tech/config/carrierid.
13089    optional int32 carrier_id = 1;
13090
13091    // Data RAT when the stall happened
13092    optional android.telephony.NetworkTypeEnum rat = 2;
13093
13094    // Signal strength when stall happened
13095    optional android.telephony.SignalStrengthEnum signal_strength = 3;
13096
13097    // Action taken to recover
13098    optional android.telephony.DataStallRecoveryActionEnum action = 4;
13099
13100    // Whether the subscription is opportunistic
13101    optional bool is_opportunistic = 5;
13102
13103    // Whether the device is in multi-SIM mode
13104    optional bool is_multi_sim = 6;
13105
13106    // Band used when the stall/recovery took place.
13107    // Value 0 is used if the band is unknown.
13108    // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
13109    // on the RAT used at the time.
13110    optional int32 band = 7;
13111
13112    // Whether the data stall is recovered.
13113    optional bool recovered = 8;
13114
13115    // The elapsed time between start of the data stall and result of current action.
13116    optional int32 duration_millis = 9;
13117}
13118
13119/**
13120 * Pulls IMS registration terminations.
13121 *
13122 * Each pull generates multiple atoms, one for each termination condition happened during the day.
13123 *
13124 * Pulled from:
13125 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13126 */
13127message ImsRegistrationTermination {
13128    // Carrier ID of the SIM used for IMS registration.
13129    // See https://source.android.com/devices/tech/config/carrierid.
13130    optional int32 carrier_id = 1;
13131
13132    // Whether the device is in multi-SIM mode when the registration terminated.
13133    optional bool is_multi_sim = 2;
13134
13135    // Radio access technology (RAT) used by the registration when it terminated.
13136    // This can be IWLAN if IMS was registered over Wifi.
13137    optional android.telephony.NetworkTypeEnum rat_at_end = 3;
13138
13139    // Whether the IMS registration failed before it was established.
13140    optional bool setup_failed = 4;
13141
13142    // IMS reason code indicating the termination reason.
13143    // See: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
13144    optional int32 reason_code = 5;
13145
13146    // IMS extra code indicating the termination reason.
13147    optional int32 extra_code = 6;
13148
13149    // IMS extra message indicating the termination reason.
13150    // This string is truncated to 128 characters if its length exceeds the limit.
13151    optional string extra_message = 7;
13152
13153    // Total number of instances of registration termination that matches the above conditions.
13154    optional int32 count = 8;
13155}
13156
13157/**
13158 * Pulls IMS registration statistics.
13159 *
13160 * Each pull generates multiple atoms, one for each carrier, SIM slot, and radio access technology
13161 * (RAT) combination. Durations are aggregated from all registrations with matching criteria,
13162 * including ones that are currently active.
13163 *
13164 * Pulled from:
13165 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
13166 */
13167message ImsRegistrationStats {
13168    // Carrier ID of the SIM used for IMS registration.
13169    // See https://source.android.com/devices/tech/config/carrierid.
13170    optional int32 carrier_id = 1;
13171
13172    // Index of the SIM used, 0 for single-SIM devices.
13173    optional int32 sim_slot_index = 2;
13174
13175    // Radio access technology (RAT) used by the registration.
13176    // This can be IWLAN if IMS was registered over Wifi.
13177    optional android.telephony.NetworkTypeEnum rat = 3;
13178
13179    // Total time IMS was registered (connected time), rounded to 5 minutes.
13180    optional int32 registered_seconds = 4;
13181
13182    // Durations that each feature (Voice, Video, UT, SMS) is capable (supported/enabled by the
13183    // network/device) and available (registered and ready to use).
13184    // All durations are rounded to 5 minutes and should be equal to or shorter than
13185    // registered_seconds.
13186    optional int32 voice_capable_seconds = 5;
13187    optional int32 voice_available_seconds = 6;
13188    optional int32 sms_capable_seconds = 7;
13189    optional int32 sms_available_seconds = 8;
13190    optional int32 video_capable_seconds = 9;
13191    optional int32 video_available_seconds = 10;
13192    optional int32 ut_capable_seconds = 11;
13193    optional int32 ut_available_seconds = 12;
13194}
13195
13196/*
13197 * Logs information related to PIN storage and automatic PIN operations.
13198 *
13199 * Logged from:
13200 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/PinStorage.java
13201 */
13202message PinStorageEvent {
13203    // The type of event.
13204    enum Event {
13205        UNKNOWN = 0;
13206        // The PIN was verified automatically successfully.
13207        PIN_VERIFICATION_SUCCESS = 1;
13208        // The PIN was verified automatically unsuccessfully.
13209        PIN_VERIFICATION_FAILURE = 2;
13210        // The PIN(s) was cached, but discarded after reboot (e.g. SIM not present after reboot).
13211        CACHED_PIN_DISCARDED = 3;
13212        // The PIN(s) was stored to be used after unattended reboot.
13213        PIN_STORED_FOR_VERIFICATION = 4;
13214        // The PIN(s) is not available for storage and will be required after unattended reboot.
13215        PIN_REQUIRED_AFTER_REBOOT = 5;
13216        // The PIN was not verified automatically because the SIM card did not match.
13217        PIN_VERIFICATION_SKIPPED_SIM_CARD_MISMATCH = 6;
13218        // The available PINs after reboot does not match the number of stored PINs before reboot.
13219        PIN_COUNT_NOT_MATCHING_AFTER_REBOOT = 7;
13220        // Error while decrypting the PIN
13221        PIN_DECRYPTION_ERROR = 8;
13222        // Error while encrypting the PIN
13223        PIN_ENCRYPTION_ERROR = 9;
13224    }
13225    optional Event event = 1;
13226
13227    // Number of PINs stored or discarded.
13228    optional int32 number_of_pins = 2;
13229}
13230
13231/**
13232 * Logs flip to screen off events.
13233 *
13234 * Logged from:
13235 *   frameworks/opt/telephony/src/java/com/android/server/power/FaceDownDetector.java
13236 */
13237message FaceDownReported {
13238    enum Response{
13239        UNKNOWN = 1;
13240        // The phone was flipped before the screen turns off.
13241        UNFLIP = 2;
13242        // User interacts with the screen after a face down is detected.
13243        USER_INTERACTION = 3;
13244        // A flip leads to screen turning off. This is the expected outcome.
13245        SCREEN_OFF = 4;
13246    }
13247
13248    // Logs the action that occurs from a flip event, whether by user or system
13249    // action.
13250    optional Response face_down_response = 1;
13251
13252    // After a flip is detected, how long until a system or user action occurs.
13253    optional int64 millis_since_flip = 2;
13254
13255    // Difference between the flip time and when the timeout would otherwise
13256    // occur.
13257    optional int64 millis_until_normal_timeout = 3;
13258
13259    // How quickly the user turns the screen back on after a flip event.
13260    // A low value may indicate a false negative. Logged only when Response is
13261    // SCREEN_OFF.
13262    optional int64 millis_until_next_screen_on = 4;
13263}
13264
13265/**
13266 * Logs timeout extended events which occur from consecutive undims.
13267 *
13268 * Logged from:
13269 *   frameworks/opt/telephony/src/java/com/android/server/power/ScreenUndimDetector.java
13270 */
13271message TimeoutAutoExtendedReported {
13272    enum Outcome {
13273        UNKNOWN = 0;
13274        POWER_BUTTON = 1;
13275        TIMEOUT = 2;
13276    }
13277
13278    // Logs the action that occurs after timeout is extended from undim.
13279    optional Outcome outcome = 1;
13280    // Time from timeout extension to the outcome.
13281    optional int64 time_to_outcome_millis = 2;
13282    // Time of first interaction after undim if an interaction occurs.
13283    // -1 if no interaction occurs before screen turns off.
13284    optional int64 time_to_first_interaction_millis = 3;
13285}
13286
13287/**
13288 * Logs gnss stats from location service provider
13289 *
13290 * Pulled from:
13291 *  frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
13292 */
13293message GnssStats {
13294    // Number of location reports since boot
13295    optional int64 location_reports = 1;
13296
13297    // Total pulled reports of Location failures since boot
13298    optional int64 location_failure_reports = 2;
13299
13300    // Number of time to first fix reports since boot
13301    optional int64 time_to_first_fix_reports = 3;
13302
13303    // Total pulled reported time to first fix (in milli-seconds) since boot
13304    optional int64 time_to_first_fix_millis = 4;
13305
13306    // Number of position accuracy reports since boot
13307    optional int64 position_accuracy_reports = 5;
13308
13309    // Total pulled reported position accuracy (in meters) since boot
13310    optional int64 position_accuracy_meters = 6;
13311
13312    // Number of top 4 average CN0 reports since boot
13313    optional int64 top_four_average_cn0_reports = 7;
13314
13315    // Total pulled reported of top 4 average CN0 (dB-mHz) since boot
13316    optional int64 top_four_average_cn0_db_mhz = 8;
13317
13318    // Number of l5 top 4 average CN0 reports since boot
13319    optional int64 l5_top_four_average_cn0_reports = 9;
13320
13321    // Total pulled reported of l5 top 4 average CN0 (dB-mHz) since boot
13322    optional int64 l5_top_four_average_cn0_db_mhz = 10;
13323
13324    // Total number of sv status messages reports since boot
13325    optional int64 sv_status_reports = 11;
13326
13327    // Total number of sv status messages reports, where sv is used in fix since boot
13328    optional int64 sv_status_reports_used_in_fix = 12;
13329
13330    // Total number of L5 sv status messages reports since boot
13331    optional int64 l5_sv_status_reports = 13;
13332
13333    // Total number of L5 sv status messages reports, where sv is used in fix since boot
13334    optional int64 l5_sv_status_reports_used_in_fix = 14;
13335}
13336
13337/**
13338 * Logs power usage data from GNSS subsystem.
13339 *
13340 * Logged from:
13341 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
13342 */
13343message GnssPowerStats {
13344    // Relative precision of the alignment of the reported power stats measurement.
13345    optional int64 elapsed_realtime_uncertainty_nanos = 1;
13346
13347    // Total GNSS energy consumption in micro-joules (or micro Watt-seconds).
13348    optional int64 total_energy_micro_joule = 2;
13349
13350    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13351    // tracking signals of a single frequency band.
13352    optional int64 singleband_tracking_mode_energy_micro_joule = 3;
13353
13354    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13355    // tracking signals of multiple frequency bands.
13356    optional int64 multiband_tracking_mode_energy_micro_joule = 4;
13357
13358    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13359    // acquiring signals of a single frequency band.
13360    optional int64 singleband_acquisition_mode_energy_micro_joule = 5;
13361
13362    // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
13363    // acquiring signals of multiple frequency bands.
13364    optional int64 multiband_acquisition_mode_energy_micro_joule = 6;
13365
13366    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13367    // operating in each of the vendor-specific power modes. (Index 0)
13368    optional int64 vendor_specific_power_modes_energy_micro_joule_0 = 7;
13369
13370    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13371    // operating in each of the vendor-specific power modes. (Index 1)
13372    optional int64 vendor_specific_power_modes_energy_micro_joule_1 = 8;
13373
13374    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13375    // operating in each of the vendor-specific power modes. (Index 2)
13376    optional int64 vendor_specific_power_modes_energy_micro_joule_2 = 9;
13377
13378    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13379    // operating in each of the vendor-specific power modes. (Index 3)
13380    optional int64 vendor_specific_power_modes_energy_micro_joule_3 = 10;
13381
13382    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13383    // operating in each of the vendor-specific power modes. (Index 4)
13384    optional int64 vendor_specific_power_modes_energy_micro_joule_4 = 11;
13385
13386    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13387    // operating in each of the vendor-specific power modes. (Index 5)
13388    optional int64 vendor_specific_power_modes_energy_micro_joule_5 = 12;
13389
13390    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13391    // operating in each of the vendor-specific power modes. (Index 6)
13392    optional int64 vendor_specific_power_modes_energy_micro_joule_6 = 13;
13393
13394    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13395    // operating in each of the vendor-specific power modes. (Index 7)
13396    optional int64 vendor_specific_power_modes_energy_micro_joule_7 = 14;
13397
13398    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13399    // operating in each of the vendor-specific power modes. (Index 8)
13400    optional int64 vendor_specific_power_modes_energy_micro_joule_8 = 15;
13401
13402    // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
13403    // operating in each of the vendor-specific power modes. (Index 9)
13404    optional int64 vendor_specific_power_modes_energy_micro_joule_9 = 16;
13405}
13406
13407/**
13408 * Logs when an app is moved to a different standby bucket.
13409 *
13410 * Logged from:
13411 *   frameworks/base/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
13412 */
13413message AppStandbyBucketChanged {
13414    optional string package_name = 1;
13415
13416    // Should be 0, 10, 11, 12, etc. where 0 is the owner. See UserHandle for more documentation.
13417    optional int32 user_id = 2;
13418
13419    // These enum values match the constants defined in UsageStatsManager.java.
13420    enum Bucket {
13421        BUCKET_UNKNOWN = 0;
13422        BUCKET_EXEMPTED = 5;
13423        BUCKET_ACTIVE = 10;
13424        BUCKET_WORKING_SET = 20;
13425        BUCKET_FREQUENT = 30;
13426        BUCKET_RARE = 40;
13427        BUCKET_RESTRICTED = 45;
13428        BUCKET_NEVER = 50;
13429    }
13430    optional Bucket bucket = 3;
13431
13432    enum MainReason {
13433        MAIN_UNKNOWN = 0;
13434        MAIN_DEFAULT = 0x0100;
13435        MAIN_TIMEOUT = 0x0200;
13436        MAIN_USAGE = 0x0300;
13437        MAIN_FORCED_BY_USER = 0x0400;
13438        MAIN_PREDICTED = 0x0500;
13439        MAIN_FORCED_BY_SYSTEM = 0x0600;
13440    }
13441    optional MainReason main_reason = 4;
13442
13443    // A more detailed reason for the standby bucket change. The sub reason name is dependent on
13444    // the main reason. Values are one of the REASON_SUB_XXX constants defined in
13445    // UsageStatsManager.java.
13446    optional int32 sub_reason = 5;
13447}
13448
13449/**
13450* Reports a started sharesheet transaction.
13451*
13452* Logged from:
13453*   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java
13454*/
13455message SharesheetStarted {
13456    // The event_id (as for UiEventReported).
13457    optional int32 event_id = 1;
13458    // The calling app's package name.
13459    optional string package_name = 2;
13460    // An identifier to tie together multiple logs relating to the same share event
13461    optional int32 instance_id = 3;
13462    // The mime type of the share
13463    optional string mime_type = 4;
13464    // The number of direct targets the calling app is providing that will be shown.
13465    optional int32 num_app_provided_direct_targets = 5;
13466    // The number of app targets the calling app is providing that will be shown.
13467    optional int32 num_app_provided_app_targets = 6;
13468    // True if the share originates from the workprofile
13469    optional bool is_workprofile = 7;
13470
13471    enum SharesheetPreviewType {  // Constants from ChooserActivity.java
13472        CONTENT_PREVIEW_TYPE_UNKNOWN = 0;  // Default for proto 2 / 3 compatibility.
13473        CONTENT_PREVIEW_IMAGE = 1;  // The preview shown in the sharesheet is an image.
13474        CONTENT_PREVIEW_FILE = 2;  // The preview shown in the sharesheet is a file.
13475        CONTENT_PREVIEW_TEXT = 3;  // The preview shown in the sharesheet is text.
13476    }
13477    // How the sharesheet preview is presented.
13478    optional SharesheetPreviewType preview_type = 8;
13479
13480    enum ResolverActivityIntent { // Intents handled by ResolverActivity.java
13481        INTENT_DEFAULT = 0;
13482        INTENT_ACTION_VIEW = 1;
13483        INTENT_ACTION_EDIT = 2;
13484        INTENT_ACTION_SEND = 3;
13485        INTENT_ACTION_SENDTO = 4;
13486        INTENT_ACTION_SEND_MULTIPLE = 5;
13487        INTENT_ACTION_IMAGE_CAPTURE = 6;
13488        INTENT_ACTION_MAIN = 7;
13489    }
13490    // The intent being processed (only SEND and SEND_MULTIPLE are system sharesheet)
13491    optional ResolverActivityIntent intent_type = 9;
13492}
13493
13494/**
13495 * Reports a ranking selection event.
13496 *
13497 * Logged from:
13498 *   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java (sharesheet)
13499 */
13500message RankingSelected {
13501    // The event_id (as for UiEventReported).
13502    optional int32 event_id = 1;
13503    // The relevant app's package name (can be source or picked package).
13504    optional string package_name = 2;
13505    // An identifier to tie together multiple logs relating to the same share event.
13506    optional int32 instance_id = 3;
13507    // Which of the ranked targets got picked, default starting position 0.
13508    optional int32 position_picked = 4;
13509}
13510
13511/**
13512 * Logs when TvSettings UI is interacted at.
13513 *
13514 * Logged from: packages/apps/TvSettings
13515 */
13516message TvSettingsUIInteracted {
13517
13518    /** The UI action category */
13519    optional android.app.tvsettings.Action action = 1;
13520
13521    /** The ID of the entry that the users actioned on */
13522    optional android.app.tvsettings.ItemId item_id = 2;
13523}
13524
13525/**
13526 * Logs information about a package installation using package installer V2 APIs.
13527 *
13528 * Logged from:
13529 *      frameworks/base/services/core/java/com/android/server/pm/PackageInstallerSession.java
13530 */
13531message PackageInstallerV2Reported {
13532    // Whether this installation uses Incremental File System
13533    optional bool is_incremental = 1;
13534    // Name of the package that is intended to be installed
13535    optional string package_name = 2;
13536    // The duration between when the install was requested to when the install has completed
13537    optional int64 duration_millis = 3;
13538    // Installation result in final integer, which are SystemApi's.
13539    // Return_code 1 indicates success.
13540    // For full list, see frameworks/base/core/java/android/content/pm/PackageManager.java
13541    optional int32 return_code  = 4;
13542    // Total size of the APKs installed for this package
13543    optional int64 apks_size_bytes = 5;
13544    // UID of the package. -1 if the installation failed.
13545    optional int32 uid = 6 [(is_uid) = true];
13546}
13547
13548/**
13549 * Logs settings provider values.
13550 *
13551 * Use DeviceConfig.getProperties to get a list Setting key, query the data from content provider,
13552 * then write the value to proto.
13553 *
13554 */
13555message SettingSnapshot {
13556
13557    // Setting key
13558    optional string name = 1;
13559
13560    enum SettingsValueType {
13561        NOTASSIGNED = 0;
13562        ASSIGNED_BOOL_TYPE = 1;
13563        ASSIGNED_INT_TYPE = 2;
13564        ASSIGNED_FLOAT_TYPE = 3;
13565        ASSIGNED_STRING_TYPE = 4;
13566    };
13567    // Setting value type
13568    optional SettingsValueType type = 2;
13569
13570    optional bool bool_value = 3;
13571
13572    optional int32 int_value = 4;
13573
13574    optional float float_value = 5;
13575
13576    optional string str_value = 6;
13577
13578    // Android user index. 0 for primary user, 10, 11 for secondary or profile user
13579    optional int32 user_id = 7;
13580}
13581
13582/**
13583 * An event logged to indicate that a user journey is about to be performed. This atom includes
13584 * relevant information about the users involved in the journey. A UserLifecycleEventOccurred event
13585 * will immediately follow this atom which will describe the event(s) and its state.
13586 *
13587 * Logged from:
13588 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
13589 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
13590 */
13591message UserLifecycleJourneyReported {
13592    // An identifier to track a chain of user lifecycle events occurring (referenced in the
13593    // UserLifecycleEventOccurred atom)
13594    optional int64 session_id = 1;
13595
13596    // Indicates what type of user journey this session is related to
13597    enum Journey {
13598        UNKNOWN = 0; // Undefined user lifecycle journey
13599        USER_SWITCH_UI = 1; // A user switch journey where a UI is shown
13600        USER_SWITCH_FG = 2; // A user switch journey without a UI shown
13601        USER_START = 3; // A user start journey
13602        USER_CREATE = 4; // A user creation journey
13603    }
13604    optional Journey journey = 2;
13605    // Which user the journey is originating from - could be -1 for certain phases (eg USER_CREATE)
13606    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
13607    optional int32 origin_user = 3;
13608    // Which user the journey is targeting
13609    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
13610    optional int32 target_user = 4;
13611
13612    // What is the user type of the target user
13613    // These should be in sync with USER_TYPE_* flags defined in UserManager.java
13614    enum UserType {
13615        TYPE_UNKNOWN = 0;
13616        FULL_SYSTEM = 1;
13617        FULL_SECONDARY = 2;
13618        FULL_GUEST = 3;
13619        FULL_DEMO = 4;
13620        FULL_RESTRICTED = 5;
13621        PROFILE_MANAGED = 6;
13622        SYSTEM_HEADLESS = 7;
13623        PROFILE_CLONE = 8;
13624    }
13625    optional UserType user_type = 5;
13626    // What are the flags attached to the target user
13627    optional int32 user_flags = 6;
13628}
13629
13630/**
13631 * An event logged when a specific user lifecycle event is performed. These events should be
13632 * correlated with a UserLifecycleJourneyReported atom via the session_id.
13633 * Note: journeys can span over multiple events, hence some events may share a single session id.
13634 *
13635 * Logged from:
13636 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
13637 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
13638 */
13639message UserLifecycleEventOccurred {
13640    // An id which links back to user details (reported in the UserLifecycleJourneyReported atom)
13641    optional int64 session_id = 1;
13642    // The target user for this event (same as target_user in the UserLifecycleJourneyReported atom)
13643    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
13644    optional int32 user_id = 2;
13645
13646    enum Event {
13647        UNKNOWN = 0; // Indicates that the associated user journey timed-out or resulted in an error
13648        SWITCH_USER = 1; // Indicates that this is a user switch event
13649        START_USER = 2; // Indicates that this is a user start event
13650        CREATE_USER = 3; // Indicates that this is a user create event
13651        USER_RUNNING_LOCKED = 4; // Indicates that user is running in locked state
13652        UNLOCKING_USER = 5; // Indicates that this is a user unlocking event
13653        UNLOCKED_USER = 6; // Indicates that this is a user unlocked event
13654    }
13655    optional Event event = 3;
13656
13657    enum State {
13658        NONE = 0; // Indicates the associated event has no start/end defined
13659        BEGIN = 1;
13660        FINISH = 2;
13661    }
13662    optional State state = 4; // Represents the state of an event (beginning/ending)
13663}
13664
13665/**
13666 * Logs when accessibility shortcut clicked.
13667 *
13668 * Logged from:
13669 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
13670 */
13671message AccessibilityShortcutReported {
13672    // The accessibility feature(including installed a11y service, framework a11y feature,
13673    // and installed a11y activity) package name that is assigned to the accessibility shortcut.
13674    optional string package_name = 1;
13675
13676    // The definition of the accessibility shortcut.
13677    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
13678    optional android.stats.accessibility.ShortcutType shortcut_type = 2;
13679
13680    // The definition of the service status.
13681    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
13682    optional android.stats.accessibility.ServiceStatus service_status = 3;
13683}
13684
13685/**
13686 * Logs when accessibility service status changed.
13687 *
13688 * Logged from:
13689 *   packages/apps/Settings/src/com/android/settings/accessibility
13690 */
13691message AccessibilityServiceReported {
13692    // The accessibility service package name.
13693    optional string package_name = 1;
13694
13695    // The definition of the service status.
13696    // From frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto.
13697    optional android.stats.accessibility.ServiceStatus service_status = 2;
13698}
13699
13700/**
13701 * Logs when display wake up.
13702 *
13703 * Logged from:
13704 *   services/core/java/com/android/server/power/Notifier.java
13705 */
13706
13707message DisplayWakeReported {
13708    // Wake_up_reason code
13709    // If LOWORD(wake_up_reason) = 0
13710    //     reference to HIWORD(wake_up_reason) PowerManager.WAKE_REASON_XXX
13711    //     else reference wake_up_reason to
13712    //     services/core/java/com/android/server/power/Notifier.java#onWakeUp
13713    optional int32 wake_up_reason = 1;
13714}
13715
13716/**
13717 * Logs app usage events.
13718 */
13719message AppUsageEventOccurred {
13720    optional int32 uid = 1 [(is_uid) = true];
13721    optional string package_name = 2;
13722    optional string class_name = 3;
13723
13724    enum EventType {
13725        NONE = 0;
13726        MOVE_TO_FOREGROUND = 1;
13727        MOVE_TO_BACKGROUND = 2;
13728    }
13729    optional EventType event_type = 4;
13730}
13731
13732/*
13733 * Quality metrics logged when EVS cameras are active.
13734 *
13735 * Logged from:
13736 *  packages/services/Car/evs/manager/1.1/Enumerator.cpp
13737 */
13738message EvsUsageStatsReported {
13739
13740    // Camera identifier to distinguish the source camera device.  This is not
13741    // globally unique and therefore cannot be used to identify the user and/or
13742    // the device.
13743    optional int32 device_id = 1;
13744
13745    // Peak number of clients during the service
13746    optional int32 peak_num_clients = 2;
13747
13748    // Number of erroneous events during the service
13749    optional int32 num_errors = 3;
13750
13751    // Round trip latency of the very first frame
13752    optional int64 first_latency_millis = 4;
13753
13754    // Average frame round trip latency
13755    optional float avg_latency_millis = 5;
13756
13757    // Peak frame round trip latency
13758    optional int64 peak_latency_millis = 6;
13759
13760    // Total number of frames received
13761    optional int64 total_frames = 7;
13762
13763    // Number of frames ignored
13764    optional int64 ignored_frames = 8;
13765
13766    // Number of dropped frames to synchronize camera devices
13767    optional int64 dropped_frames_to_sync = 9;
13768
13769    // The duration of the service
13770    optional int64 duration_millis = 10;
13771}
13772
13773/**
13774 * Logs audio power usage stats.
13775 *
13776 * Pushed from:
13777 *  frameworks/av/services/mediametrics/AudioPowerUsage.cpp
13778 */
13779message AudioPowerUsageDataReported {
13780    /**
13781     * Device used for input/output
13782     *
13783     * All audio devices please refer to below file:
13784     * system/media/audio/include/system/audio-base.h
13785     *
13786     * Define our own enum values because we don't report all audio devices.
13787     * Currently, we only report built-in audio devices such as handset, speaker,
13788     * built-in mics, common audio devices such as wired headset, usb headset
13789     * and bluetooth devices.
13790     */
13791    enum AudioDevice {
13792        OUTPUT_EARPIECE         = 0x1; // handset
13793        OUTPUT_SPEAKER          = 0x2; // dual speaker
13794        OUTPUT_WIRED_HEADSET    = 0x4; // 3.5mm headset
13795        OUTPUT_USB_HEADSET      = 0x8; // usb headset
13796        OUTPUT_BLUETOOTH_SCO    = 0x10; // bluetooth sco
13797        OUTPUT_BLUETOOTH_A2DP   = 0x20; // a2dp
13798        OUTPUT_SPEAKER_SAFE     = 0x40; // bottom speaker
13799
13800        INPUT_DEVICE_BIT        = 0x40000000; // non-negative positive int32.
13801        INPUT_BUILTIN_MIC       = 0x40000001; // buildin mic
13802        INPUT_BUILTIN_BACK_MIC  = 0x40000002; // buildin back mic
13803        INPUT_WIRED_HEADSET_MIC = 0x40000004; // 3.5mm headset mic
13804        INPUT_USB_HEADSET_MIC   = 0x40000008; // usb headset mic
13805        INPUT_BLUETOOTH_SCO     = 0x40000010; // bluetooth sco mic
13806    }
13807    optional AudioDevice audio_device = 1;
13808
13809    // Duration of the audio in seconds
13810    optional int32 duration_secs = 2;
13811
13812    // Average volume (0 ... 1.0)
13813    optional float average_volume = 3;
13814
13815    enum AudioType {
13816        UNKNOWN_TYPE = 0;
13817        VOICE_CALL_TYPE = 1; // voice call
13818        VOIP_CALL_TYPE = 2; // voip call, including uplink and downlink
13819        MEDIA_TYPE = 3; // music and system sound
13820        RINGTONE_NOTIFICATION_TYPE = 4; // ringtone and notification
13821        ALARM_TYPE = 5; // alarm type
13822        // record type
13823        CAMCORDER_TYPE = 6; // camcorder
13824        RECORD_TYPE = 7;  // other recording
13825    }
13826    optional AudioType type = 4;
13827}
13828
13829/**
13830  * Pulls bytes transferred over WiFi and mobile networks sliced by uid, is_metered, and tag.
13831  *
13832  * Pulled from:
13833  *   StatsPullAtomService, which uses NetworkStatsService to query NetworkStats.
13834  */
13835message BytesTransferByTagAndMetered {
13836    optional int32 uid = 1 [(is_uid) = true];
13837
13838    optional bool is_metered = 2;
13839
13840    optional int32 tag = 3;
13841
13842    optional int64 rx_bytes = 4;
13843
13844    optional int64 rx_packets = 5;
13845
13846    optional int64 tx_bytes = 6;
13847
13848    optional int64 tx_packets = 7;
13849}
13850
13851/*
13852 * Logs when the Media Output Switcher finishes a media switch operation.
13853 *
13854 * Logged from:
13855 *  packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputMetricLogger.java
13856 */
13857message MediaOutputOpSwitchReported {
13858    // Source medium type before switching.
13859    optional android.app.settings.mediaoutput.MediumType source = 1;
13860
13861    // Target medium type after switching.
13862    optional android.app.settings.mediaoutput.MediumType target = 2;
13863
13864    // The result of switching.
13865    optional android.app.settings.mediaoutput.SwitchResult result = 3;
13866
13867    // The detail code of a switching result.
13868    optional android.app.settings.mediaoutput.SubResult subresult = 4;
13869
13870    /*
13871     * The package name of a pre-installed app, whose media session is being switched.
13872     */
13873    optional string media_session_package_name = 5;
13874
13875    // The amount of available wired devices when a switching is being performed.
13876    optional int32 available_wired_device_count = 6;
13877
13878    // The amount of available Bluetooth devices a switching is being performed.
13879    optional int32 available_bt_device_count = 7;
13880
13881    // The amount of available remote devices when a switching is being performed.
13882    optional int32 available_remote_device_count = 8;
13883
13884    // The amount of applied devices within a remote dynamic group after a switching is done.
13885    optional int32 applied_device_count_within_remote_group = 9;
13886}
13887
13888/**
13889 * Logs when the Assistant is invoked.
13890 *
13891 * Logged from:
13892 *   frameworks/base/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
13893 */
13894message AssistantInvocationReported {
13895
13896    // The event_id (as for UiEventReported).
13897    optional int32 event_id = 1;
13898
13899    // The registered Assistant's uid and package (as for UiEventReported).
13900    optional int32 uid = 2 [(is_uid) = true];
13901    optional string package_name = 3;
13902
13903    // An identifier used to disambiguate which logs refer to a particular invocation of the
13904    // Assistant  (as for UiEventReported).
13905    optional int32 instance_id = 4;
13906
13907    // The state of the device at the time of invocation.
13908    enum DeviceState {
13909        UNKNOWN_DEVICE_STATE = 0;
13910        AOD1 = 1;
13911        AOD2 = 2;
13912        BOUNCER = 3;
13913        UNLOCKED_LOCKSCREEN = 4;
13914        LAUNCHER_HOME = 5;
13915        LAUNCHER_OVERVIEW = 6;
13916        LAUNCHER_ALL_APPS = 7;
13917        APP_DEFAULT = 8;
13918        APP_IMMERSIVE = 9;
13919        APP_FULLSCREEN = 10;
13920    }
13921    optional DeviceState device_state = 5;
13922
13923    // Whether the Assistant handles were showing at the time of invocation.
13924    optional bool assistant_handles_showing = 6;
13925}
13926
13927/**
13928 * Logs when an AudioRecord finishes running on an audio device
13929 *
13930 * Logged from:
13931 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
13932 */
13933message MediametricsAudioRecordDeviceUsageReported {
13934    // The devices connected to this AudioRecord.
13935    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
13936    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
13937    // See audio_device_t in system/media/audio/include/system/audio-base.h
13938    optional string devices = 1;
13939
13940    // The name of the remote device attached to the device, typically available for USB or BT.
13941    // This may be empty for a fixed device, or separated by "|" if more than one.
13942    optional string device_names = 2;
13943
13944    // The amount of time spent in the device as measured by the active track in AudioFlinger.
13945    optional int64 device_time_nanos = 3;
13946
13947    // The audio data format used for encoding.
13948    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
13949    optional string encoding = 4;
13950
13951    // The client-server buffer framecount.
13952    // The framecount is generally between 960 - 48000 for PCM encoding.
13953    // The framecount represents raw buffer size in bytes for non-PCM encoding.
13954    optional int32 frame_count = 5;
13955
13956    // The number of audio intervals (contiguous, continuous playbacks).
13957    optional int32 interval_count = 6;
13958
13959    // The sample rate of the AudioRecord.
13960    // A number generally between 8000-96000 (frames per second).
13961    optional int32 sample_rate = 7;
13962
13963    // The audio input flags used to construct the AudioRecord.
13964    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
13965    optional string flags = 8;
13966
13967    // The santized package name of the audio client associated with the AudioRecord.
13968    // See getSanitizedPackageNameAndVersionCode() in
13969    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
13970    optional string package_name = 9;
13971
13972    // The selected device id (nonzero if a non-default device is selected)
13973    optional int32 selected_device_id = 10;
13974
13975    // The caller of the AudioRecord.
13976    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
13977    optional string caller = 11;
13978
13979    // The audio source for AudioRecord.
13980    // An enumeration from system/media/audio/include/system/audio-base.h audio_source_t
13981    optional string source = 12;
13982
13983    // Android S
13984    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
13985    // An empty string means no session id is set.
13986    optional string log_session_id = 13;
13987}
13988
13989/**
13990 * Logs when an AudioThread finishes running on an audio device
13991 *
13992 * Logged from:
13993 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
13994 */
13995message MediametricsAudioThreadDeviceUsageReported {
13996    // The devices connected to this audio thread.
13997    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
13998    // (for record threads):
13999    // See lookup<INPUT_DEVICE> in frameworks/av/services/mediametrics/AudioTypes.cpp
14000    // (for playback threads):
14001    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14002    // See audio_device_t in system/media/audio/include/system/audio-base.h
14003    optional string devices = 1;
14004
14005    // The name of the remote device attached to the device, typically available for USB or BT.
14006    // This may be empty for a fixed device, or separated by "|" if more than one.
14007    optional string device_names = 2;
14008
14009    // The amount of time spent in the device as measured by the active track in AudioFlinger.
14010    optional int64 device_time_nanos = 3;
14011
14012    // The audio data format used for encoding.
14013    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
14014    optional string encoding = 4;
14015
14016    // The framecount of the buffer delivered to (or from) the HAL.
14017    // The framecount is generally ~960 for PCM encoding.
14018    // The framecount represents raw buffer size in bytes for non-PCM encoding.
14019    optional int32 frame_count = 5;
14020
14021    // The number of audio intervals (contiguous, continuous playbacks).
14022    optional int32 interval_count = 6;
14023
14024    // The sample rate of the audio thread.
14025    // A number generally between 8000-96000 (frames per second).
14026    optional int32 sample_rate = 7;
14027
14028    // The audio flags used to construct the thread
14029    // (for record threads):
14030    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
14031    // (for playback threads):
14032    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
14033    optional string flags = 8;
14034
14035    // The number of underruns encountered for a playback thread or the
14036    // number of overruns encountered for a capture thread.
14037    optional int32 xruns = 9;
14038
14039    // The type of thread
14040    // A thread type enumeration from
14041    // frameworks/av/mediametrics/services/Translate.h
14042    optional string type = 10;
14043}
14044
14045/**
14046 * Logs when an AudioTrack finishes running on an audio device
14047 *
14048 * Logged from:
14049 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
14050 */
14051message MediametricsAudioTrackDeviceUsageReported {
14052    // The output devices connected to this AudioTrack.
14053    // A string OR of various output device categories, e.g. "DEVICE1|DEVICE2".
14054    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14055    // See audio_device_t in system/media/audio/include/system/audio-base.h
14056    optional string devices = 1;
14057
14058    // The name of the remote device attached to the device, typically available for USB or BT.
14059    // This may be empty for a fixed device, or separated by "|" if more than one.
14060    optional string device_names = 2;
14061
14062    // The amount of time spent in the device as measured by the active track in AudioFlinger.
14063    optional int64 device_time_nanos = 3;
14064
14065    // The audio data format used for encoding.
14066    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
14067    optional string encoding = 4;
14068
14069    // The client-server buffer framecount.
14070    // The framecount is generally between 960 - 48000 for PCM encoding.
14071    // The framecount represents raw buffer size in bytes for non-PCM encoding.
14072    // A static track (see traits) may have a very large framecount.
14073    optional int32 frame_count = 5;
14074
14075    // The number of audio intervals (contiguous, continuous playbacks).
14076    optional int32 interval_count = 6;
14077
14078    // The sample rate of the AudioTrack.
14079    // A number generally between 8000-96000 (frames per second).
14080    optional int32 sample_rate = 7;
14081
14082    // The audio flags used to construct the AudioTrack.
14083    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
14084    optional string flags = 8;
14085
14086    // The number of underruns encountered.
14087    optional int32 xruns = 9;
14088
14089    // The santized package name of the audio client associated with the AudioTrack.
14090    // See getSanitizedPackageNameAndVersionCode() in
14091    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
14092    optional string package_name = 10;
14093
14094    // The latency of the last sample in the buffer in milliseconds.
14095    optional float device_latency_millis = 11;
14096
14097    // The startup time in milliseconds from start() to sample played.
14098    optional float device_startup_millis = 12;
14099
14100    // The average volume of the track on the device [ 0.f - 1.f ]
14101    optional float device_volume = 13;
14102
14103    // The selected device id (nonzero if a non-default device is selected)
14104    optional int32 selected_device_id = 14;
14105
14106    // The stream_type category for the AudioTrack.
14107    // An enumeration from system/media/audio/include/system/audio-base.h audio_stream_type_t
14108    optional string stream_type = 15;
14109
14110    // The usage for the AudioTrack.
14111    // An enumeration from system/media/audio/include/system/audio-base.h audio_usage_t
14112    optional string usage = 16;
14113
14114    // The content type of the AudioTrack.
14115    // An enumeration from system/media/audio/include/system/audio-base.h audio_content_type_t
14116    optional string content_type = 17;
14117
14118    // The caller of the AudioTrack.
14119    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14120    optional string caller = 18;
14121
14122    // The traits of the AudioTrack.
14123    // A string OR of different traits, may be empty string.
14124    // Only "static" is supported for R.
14125    // See lookup<TRACK_TRAITS>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14126    optional string traits = 19;
14127
14128    // Android S
14129    // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
14130    // An empty string means no session id is set.
14131    optional string log_session_id = 20;
14132}
14133
14134/**
14135 * Logs the status of an audio device connection attempt.
14136 *
14137 * Logged from:
14138 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
14139 */
14140message MediametricsAudioDeviceConnectionReported {
14141    // The input devices represented by this report.
14142    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
14143    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14144    // See audio_device_t in system/media/audio/include/system/audio-base.h
14145    optional string input_devices = 1;
14146
14147    // The output devices represented by this report.
14148    // A string OR of various output device categories.
14149    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
14150    // See audio_device_t in system/media/audio/include/system/audio-base.h
14151    optional string output_devices = 2;
14152
14153    // The name of the remote device attached to the device, typically available for USB or BT.
14154    // This may be empty for a fixed device, or separated by "|" if more than one.
14155    optional string device_names = 3;
14156
14157    // The result of the audio device connection.
14158    // 0 indicates success: connection verified.
14159    // 1 indicates unknown: connection not verified or not known if diverted properly.
14160    // Other values indicate specific status.
14161    // See DeviceConnectionResult in frameworks/av/services/mediametrics/AudioTypes.h
14162    optional int32 result = 4;
14163
14164    // Average milliseconds of time to connect
14165    optional float time_to_connect_millis = 5;
14166
14167    // Number of connections if aggregated statistics, otherwise 1.
14168    optional int32 connection_count = 6;
14169}
14170
14171/**
14172 * Logs: i) creation of different types of cryptographic keys in the keystore,
14173 * ii) operations performed using the keys,
14174 * iii) attestation of the keys
14175 * Logged from: system/security/keystore/key_event_log_handler.cpp
14176 */
14177message KeystoreKeyEventReported {
14178
14179    enum Algorithm {
14180        /** Asymmetric algorithms. */
14181        RSA = 1;
14182        // 2 removed, do not reuse.
14183        EC = 3;
14184        /** Block cipher algorithms */
14185        AES = 32;
14186        TRIPLE_DES = 33;
14187        /** MAC algorithms */
14188        HMAC = 128;
14189    };
14190    /** Algorithm associated with the key */
14191    optional Algorithm algorithm = 1;
14192
14193    /** Size of the key */
14194    optional int32 key_size = 2;
14195
14196    enum KeyOrigin {
14197        /** Generated in keymaster.  Should not exist outside the TEE. */
14198        GENERATED = 0;
14199        /** Derived inside keymaster.  Likely exists off-device. */
14200        DERIVED = 1;
14201        /** Imported into keymaster.  Existed as cleartext in Android. */
14202        IMPORTED = 2;
14203        /** Keymaster did not record origin. */
14204        UNKNOWN = 3;
14205        /** Securely imported into Keymaster. */
14206        SECURELY_IMPORTED = 4;
14207    };
14208    /* Logs whether the key was generated, imported, securely imported, or derived.*/
14209    optional KeyOrigin key_origin = 3;
14210
14211    enum HardwareAuthenticatorType {
14212        NONE = 0;
14213        PASSWORD = 1;
14214        FINGERPRINT = 2;
14215        // Additional entries must be powers of 2.
14216    };
14217    /**
14218     * What auth types does this key require? If none,
14219     * then no auth required.
14220     */
14221    optional HardwareAuthenticatorType user_auth_type = 4;
14222
14223    /**
14224     * If user authentication is required, is the requirement time based? If it
14225     * is not time based then this field will not be used and the key is per
14226     * operation. Per operation keys must be user authenticated on each usage.
14227     */
14228    optional int32 user_auth_key_timeout_secs = 5;
14229
14230    /**
14231     * padding mode, digest, block_mode and purpose should ideally be repeated
14232     * fields. However, since statsd does not support repeated fields in
14233     * pushed atoms, they are represented using bitmaps.
14234     */
14235
14236    /** Track which padding mode is being used.*/
14237    optional int32 padding_mode_bitmap = 6;
14238
14239    /** Track which digest is being used. */
14240    optional int32 digest_bitmap = 7;
14241
14242    /** Track what block mode is being used (for encryption). */
14243    optional int32 block_mode_bitmap = 8;
14244
14245    /** Track what purpose is this key serving. */
14246    optional int32 purpose_bitmap = 9;
14247
14248    enum EcCurve {
14249        P_224 = 0;
14250        P_256 = 1;
14251        P_384 = 2;
14252        P_521 = 3;
14253    };
14254    /** Which ec curve was selected if elliptic curve cryptography is in use **/
14255    optional EcCurve ec_curve = 10;
14256
14257    enum KeyBlobUsageRequirements {
14258        STANDALONE = 0;
14259        REQUIRES_FILE_SYSTEM = 1;
14260    };
14261    /** Standalone or is a file system required */
14262    optional KeyBlobUsageRequirements key_blob_usage_reqs = 11;
14263
14264    enum Type {
14265        key_operation = 0;
14266        key_creation = 1;
14267        key_attestation = 2;
14268    }
14269    /** Key creation event, operation event or attestation event? */
14270    optional Type type = 12;
14271
14272    /** Was the key creation, operation, or attestation successful? */
14273    optional bool was_successful = 13;
14274
14275    /** Response code or error code */
14276    optional int32 error_code = 14;
14277}
14278
14279/**
14280 * Logs: key creation events with Algorithm, Origin, Error and Attestation info.
14281 * Logged from: system/security/keystore2/metrics.rs
14282 */
14283message Keystore2KeyCreationWithGeneralInfo {
14284
14285    // Algorithm associated with the key
14286    optional android.system.security.keystore2.Algorithm algorithm = 1;
14287
14288    // Size of the key, based on the algorithm used.
14289    optional int32 key_size = 2;
14290
14291    enum EcCurve {
14292        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14293        EC_CURVE_UNSPECIFIED = 0;
14294        P_224 = 1;
14295        P_256 = 2;
14296        P_384 = 3;
14297        P_521 = 4;
14298    };
14299    // Which ec curve was selected if elliptic curve cryptography is in use
14300    optional EcCurve ec_curve = 3;
14301
14302    enum KeyOrigin {
14303        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14304        ORIGIN_UNSPECIFIED = 0;
14305        // Generated in keymaster.  Should not exist outside the TEE.
14306        GENERATED = 1;
14307        // Derived inside keymaster.  Likely exists off-device.
14308        DERIVED = 2;
14309        // Imported into keymaster.  Existed as cleartext in Android.
14310        IMPORTED = 3;
14311        // Previously used for another purpose that is now obsolete.
14312        RESERVED = 4;
14313        // Securely imported into Keymaster.
14314        SECURELY_IMPORTED = 5;
14315    };
14316    // Logs whether the key was generated, imported, securely imported, or derived.
14317    optional KeyOrigin key_origin = 4;
14318
14319    /**
14320     * Response code (system/hardware/interfaces/keystore2/aidl/../ResponseCode.aidl)
14321     * or
14322     * error code (hardware/interfaces/security/keymint/aidl/../ErrorCode.aidl)
14323     */
14324    optional int32 error_code = 5;
14325
14326    // Indicates whether key attestation is requested in creation
14327    optional bool attestation_requested = 6;
14328
14329    // Count of a particular combination of field values of this atom
14330    optional int32 count = 7;
14331}
14332
14333/**
14334 * Logs: key creation events with authentication info.
14335 * Logged from: system/security/keystore2/metrics.rs
14336 */
14337message Keystore2KeyCreationWithAuthInfo {
14338
14339    enum HardwareAuthenticatorType {
14340        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14341        AUTH_TYPE_UNSPECIFIED = 0;
14342        NONE = 1;
14343        PASSWORD = 2;
14344        FINGERPRINT = 3;
14345        ANY = 5;
14346    };
14347    /**
14348     * What auth types does this key require? If none,
14349     * then no auth required.
14350     */
14351    optional HardwareAuthenticatorType user_auth_type = 1;
14352
14353    /**
14354     * If user authentication is required, is the requirement time based? If it
14355     * is time based then this field indicates the base 10 logarithm of time out in seconds.
14356     * Logarithm is taken in order to reduce the cardinaltiy.
14357     */
14358    optional int32 log_auth_timeout_seconds = 2;
14359
14360    // Security level of the Keymint instance which creates the key.
14361    optional android.system.security.keystore2.SecurityLevelEnum security_level = 3;
14362
14363    // Count of a particular combination of field values of this atom
14364    optional int32 count = 4;
14365}
14366
14367/**
14368 * Logs: key creation events with purpose and modes info.
14369 * Logged from: system/security/keystore2/metrics.rs
14370 */
14371message Keystore2KeyCreationWithPurposeAndModesInfo {
14372    // Algorithm associated with the key
14373    optional android.system.security.keystore2.Algorithm algorithm = 1;
14374
14375	/**
14376     * Track which purpose is being used.
14377     * Bitmap composition is given by KeyPurposeBitPosition enum
14378     * defined in system/security/keystore2/metrics.rs.
14379     */
14380    optional int32 purpose_bitmap = 2;
14381
14382    /**
14383     * Track which padding mode is being used.
14384     * Bitmap composition is given by PaddingModeBitPosition enum
14385     * defined in system/security/keystore2/metrics.rs.
14386     */
14387    optional int32 padding_mode_bitmap = 3;
14388
14389    /**
14390     * Track which digest is being used.
14391     * Bitmap composition is given by DigestBitPosition enum
14392     * defined in system/security/keystore2/metrics.rs.
14393     */
14394    optional int32 digest_bitmap = 4;
14395
14396    /**
14397     * Track which block mode is being used.
14398     * Bitmap composition is given by BlockModeBitPosition enum
14399     * defined in system/security/keystore2/metrics.rs.
14400     */
14401    optional int32 block_mode_bitmap = 5;
14402
14403    // Count of a particular combination of field values of this atom
14404    optional int32 count = 6;
14405}
14406
14407/**
14408 * Logs the atom id of the atoms associated with key creation/operation events, that have reached
14409 * the maximum storage limit allocated for different atom objects of that atom,
14410 * in keystore in-memory store.
14411 *
14412 * Size of the storage bucket for each atom is limited considering their expected cardinaltity.
14413 * This limit may exceed if the dimensions of the atoms take a large number of unexpected
14414 * combinations. This atom is used to track such cases.
14415 */
14416message Keystore2AtomWithOverflow {
14417
14418    // Atom id as defined in atoms.proto
14419    optional int32 atom_id = 1;
14420
14421    // Count of the objects of this atom type that have overflowed.
14422    optional int32 count = 2;
14423}
14424
14425/**
14426 * Logs: key operations events with purpose and modes info.
14427 * Logged from: system/security/keystore2/metrics.rs
14428 */
14429message Keystore2KeyOperationWithPurposeAndModesInfo {
14430
14431    enum KeyPurpose {
14432        // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
14433        KEY_PURPOSE_UNSPECIFIED = 0;
14434
14435        // Usable with RSA, 3DES and AES keys.
14436        ENCRYPT = 1;
14437
14438        // Usable with RSA, 3DES and AES keys.
14439        DECRYPT = 2;
14440
14441        // Usable with RSA, EC and HMAC keys.
14442        SIGN = 3;
14443
14444        // Usable with RSA, EC and HMAC keys.
14445        VERIFY = 4;
14446
14447        // 5 is reserved
14448        // Usable with RSA keys.
14449        WRAP_KEY = 6;
14450
14451        // Key Agreement, usable with EC keys.
14452        AGREE_KEY = 7;
14453
14454        // Usable as an attestation signing key.
14455        ATTEST_KEY = 8;
14456    }
14457    // Purpose of the key operation
14458    optional KeyPurpose purpose = 1;
14459
14460    /**
14461     * Track which padding mode is being used.
14462     * Bitmap composition is given by PaddingModeBitPosition enum
14463     * defined in system/security/keystore2/metrics.rs.
14464     */
14465    optional int32 padding_mode_bitmap = 2;
14466
14467    /**
14468     * Track which digest is being used.
14469     * Bitmap composition is given by DigestBitPosition enum
14470     * defined in system/security/keystore2/metrics.rs.
14471     */
14472    optional int32 digest_bitmap = 3;
14473
14474    /**
14475     * Track which block mode is being used.
14476     * Bitmap composition is given by BlockModeBitPosition enum
14477     * defined in system/security/keystore2/metrics.rs.
14478     */
14479    optional int32 block_mode_bitmap = 4;
14480
14481    // Count of a particular combination of field values of this atom
14482    optional int32 count = 5;
14483}
14484
14485/**
14486 * Logs key operations events with outcome, error_code, security level and whether the key is
14487 * upgraded during the operation.
14488 * Logged from: system/security/keystore2/metrics.rs
14489 */
14490message Keystore2KeyOperationWithGeneralInfo {
14491
14492    enum Outcome {
14493        OUTCOME_UNSPECIFIED = 0;
14494        DROPPED = 1;
14495        SUCCESS = 2;
14496        ABORT = 3;
14497        PRUNED = 4;
14498        ERROR = 5;
14499    }
14500    // Outcome of the operation
14501    optional Outcome outcome = 1;
14502
14503    // Response code or error code in case of error outcome
14504    optional int32 error_code = 2;
14505
14506    // Indicates whether the key was upgraded during the operation
14507    optional bool key_upgraded = 3;
14508
14509    // Security level of the Keymint instance which performs the operation.
14510    optional android.system.security.keystore2.SecurityLevelEnum security_level = 4;
14511
14512    // Count of a particular combination of field values of this atom
14513    optional int32 count = 5;
14514}
14515
14516/**
14517 * Logs: Keystore 2 storage statistics.
14518 * Logged from: system/security/keystore2
14519 */
14520message Keystore2StorageStats {
14521    enum Storage {
14522       STORAGE_UNSPECIFIED = 0;
14523       KEY_ENTRY = 1;
14524       KEY_ENTRY_ID_INDEX = 2;
14525       KEY_ENTRY_DOMAIN_NAMESPACE_INDEX = 3;
14526       BLOB_ENTRY = 4;
14527       BLOB_ENTRY_KEY_ENTRY_ID_INDEX = 5;
14528       KEY_PARAMETER = 6;
14529       KEY_PARAMETER_KEY_ENTRY_ID_INDEX = 7;
14530       KEY_METADATA = 8;
14531       KEY_METADATA_KEY_ENTRY_ID_INDEX = 9;
14532       GRANT = 10;
14533       AUTH_TOKEN = 11;
14534       BLOB_METADATA = 12;
14535       BLOB_METADATA_BLOB_ENTRY_ID_INDEX =13;
14536       METADATA = 14;
14537       DATABASE = 15;
14538       LEGACY_STORAGE = 16;
14539    }
14540    // Type of the storage (database table or legacy storage) of which the size is reported.
14541    optional Storage storage_type = 1;
14542    // Storage size in bytes
14543    optional int64 size = 2;
14544    // Unused space, in bytes. The total storage size may be larger, indicating
14545    // inefficiencies in the packing of data in the database.
14546    optional int64 unused_size = 3;
14547}
14548
14549/**
14550 * Logs Remote Key Provisioning (RKP) related error events.
14551 * Logged from: system/security/keystore2
14552 */
14553message RkpErrorStats {
14554
14555    enum RkpError {
14556        RKP_ERROR_UNSPECIFIED = 0;
14557        // The key pool is out of keys.
14558        OUT_OF_KEYS = 1;
14559        // Falling back to factory provisioned keys during hybrid mode.
14560        FALL_BACK_DURING_HYBRID = 2;
14561    }
14562    // Type of the error event
14563    optional RkpError rkp_error = 1;
14564
14565    // Count of a particular error occurred.
14566    optional int32 count = 2;
14567}
14568
14569/**
14570 * Logs: Status of the attestation key pool related to
14571 * Remote Key Provisioning (RKP).
14572 * Logged from: system/security/keystore2
14573 */
14574message RkpPoolStats {
14575    /**
14576     * Security level of the Keymint instance associated with the
14577     * attestation pool status.
14578     */
14579    optional android.system.security.keystore2.SecurityLevelEnum security_level = 1;
14580
14581    /**
14582     * The number of signed attestation certificate chains which are
14583     * expired.
14584     */
14585    optional int32 expiring = 2;
14586
14587    /**
14588     * The number of signed attestation certificate chains which have
14589     * not yet been assigned to an app.
14590     */
14591    optional int32 unassigned = 3;
14592
14593    /**
14594     * The number of signed attestation keys.
14595     */
14596    optional int32 attested = 4;
14597
14598    /**
14599     * The total number of attestation keys.
14600     */
14601    optional int32 total = 5;
14602
14603}
14604
14605/**
14606 * Logs: Number of keystore2 crashes per-boot cycle.
14607 * Logged from: system/security/keystore2
14608 */
14609message Keystore2CrashStats {
14610    optional int32 count_of_crash_events = 1;
14611}
14612
14613// Blob Committer stats
14614// Keep in sync between:
14615//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14616//     frameworks/base/cmds/statsd/src/atoms.proto
14617message BlobCommitterProto {
14618    // Committer app's uid
14619    optional int32 uid = 1 [(is_uid) = true];
14620
14621    // Unix epoch timestamp of the commit in milliseconds
14622    optional int64 commit_timestamp_millis = 2;
14623
14624    // Flags of what access types the committer has set for the Blob
14625    optional int32 access_mode = 3;
14626
14627    // Number of packages that have been whitelisted for ACCESS_TYPE_WHITELIST
14628    optional int32 num_whitelisted_package = 4;
14629}
14630
14631// Blob Leasee stats
14632// Keep in sync between:
14633//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14634//     frameworks/base/cmds/statsd/src/atoms.proto
14635message BlobLeaseeProto {
14636    // Leasee app's uid
14637    optional int32 uid = 1 [(is_uid) = true];
14638
14639    // Unix epoch timestamp for lease expiration in milliseconds
14640    optional int64 lease_expiry_timestamp_millis = 2;
14641}
14642
14643// List of Blob Committers
14644// Keep in sync between:
14645//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14646//     frameworks/base/cmds/statsd/src/atoms.proto
14647message BlobCommitterListProto {
14648    repeated BlobCommitterProto committer = 1;
14649}
14650
14651// List of Blob Leasees
14652// Keep in sync between:
14653//     frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
14654//     frameworks/base/cmds/statsd/src/atoms.proto
14655message BlobLeaseeListProto {
14656    repeated BlobLeaseeProto leasee = 1;
14657}
14658
14659/**
14660 * Logs the current state of a Blob committed with BlobStoreManager
14661 *
14662 * Pulled from:
14663 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
14664 */
14665message BlobInfo {
14666    // Id of the Blob
14667    optional int64 blob_id = 1;
14668
14669    // Size of the Blob data
14670    optional int64 size = 2;
14671
14672    // Unix epoch timestamp of the Blob's expiration in milliseconds
14673    optional int64 expiry_timestamp_millis = 3;
14674
14675    // List of committers of this Blob
14676    optional BlobCommitterListProto committers = 4 [(log_mode) = MODE_BYTES];
14677
14678    // List of leasees of this Blob
14679    optional BlobLeaseeListProto leasees = 5 [(log_mode) = MODE_BYTES];
14680}
14681
14682/**
14683 * Logs when the HDMI CEC active source changes.
14684 *
14685 * Logged from:
14686 *   frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
14687 */
14688message HdmiCecActiveSourceChanged {
14689    // The logical address of the active source.
14690    optional android.stats.hdmi.LogicalAddress active_source_logical_address = 1;
14691
14692    // The physical address of the active source. Consists of four hexadecimal nibbles.
14693    // Examples: 0x1234, 0x0000 (root device). 0xFFFF represents an unknown or invalid address.
14694    // See section 8.7 in the HDMI 1.4b spec for details.
14695    optional int32 active_source_physical_address = 2;
14696
14697    // The relationship between this device and the active source.
14698    optional android.stats.hdmi.PathRelationship local_relationship = 3;
14699}
14700
14701/**
14702 * Logs when an HDMI CEC message is sent or received.
14703 *
14704 * Logged from:
14705 *   frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
14706 */
14707message HdmiCecMessageReported {
14708    // The calling uid of the application that caused this atom to be written.
14709    optional int32 uid = 1 [(is_uid) = true];
14710
14711    // Whether a HDMI CEC message is sent from this device, to this device, or neither.
14712    optional android.stats.hdmi.MessageDirection direction = 2;
14713
14714    // The HDMI CEC logical address of the initiator.
14715    optional android.stats.hdmi.LogicalAddress initiator_logical_address = 3;
14716
14717    // The HDMI CEC logical address of the destination.
14718    optional android.stats.hdmi.LogicalAddress destination_logical_address = 4;
14719
14720    // The opcode of the message. Ranges from 0x00 to 0xFF.
14721    // For all values, see section "CEC 15 Message Descriptions" in the HDMI CEC 1.4b spec.
14722    optional int32 opcode = 5;
14723
14724    // The result of attempting to send the message on its final retransmission attempt.
14725    // Only applicable to outgoing messages; set to SEND_MESSAGE_RESULT_UNKNOWN otherwise.
14726    optional android.stats.hdmi.SendMessageResult send_message_result = 6;
14727
14728    // Fields specific to <User Control Pressed> messages
14729
14730    // The user control command that was received.
14731    optional android.stats.hdmi.UserControlPressedCommand user_control_pressed_command = 7;
14732
14733    // Fields specific to <Feature Abort> messages
14734
14735    // The opcode of the message that was feature aborted.
14736    // Set to 0x100 when unknown or not applicable.
14737    optional int32 feature_abort_opcode = 8;
14738
14739    // The reason for the feature abort.
14740    optional android.stats.hdmi.FeatureAbortReason feature_abort_reason = 9;
14741}
14742
14743/**
14744 * Logs when an auto rotate event occurs while smart auto rotate is enabled.
14745 */
14746message AutoRotateReported {
14747    enum Orientation {
14748        UNKNOWN = 0;
14749        DEPRECATED = 1;
14750        ROTATION_0 = 2;
14751        ROTATION_90 = 3;
14752        ROTATION_180 = 4;
14753        ROTATION_270 = 5;
14754        DISABLED = 6;
14755        UNAVAILABLE = 7;
14756        FAILURE = 8;
14757    }
14758
14759    // Orientation of the device when a rotation was detected.
14760    optional Orientation current_orientation = 1;
14761    // The orientation of the phone after rotation before going through the recommendation service.
14762    optional Orientation proposed_orientation = 2;
14763    // Orientation recommended by the smart autorotate service component outside of the platform. It
14764    // may or may not match the proposed_orientation. Can be disabled or unavailable if the
14765    // recommendation service is disabled or unavailable. Will be unknown if the service failed.
14766    optional Orientation recommended_orientation = 3;
14767    // Time taken to calculate the rotation recommendation.
14768    optional int64 recommendation_process_duration_millis = 4;
14769}
14770
14771/**
14772 * Logs when sensors only autorotate is triggered. Associated event can be a rotation preindication,
14773 * actual event or a "data ready to be pulled" indication. More info: go/autorotate-logging.
14774 *
14775 * Logged from:
14776 *    platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
14777 */
14778
14779message DeviceRotated {
14780  // Timestamp of the event in millis. We log the timestamp explicitly since
14781  // data logging will follow the event logging and all these
14782  // will be joined with other logs such as rotation button clicked.
14783  optional int64 timestamp_millis = 1;
14784  // Device orientation
14785  optional android.stats.wm.Orientation proposed_orientation = 2;
14786
14787  enum RotationEventType{
14788    UNKNOWN = 0;
14789    // An early indication of device might be rotated.
14790    PREINDICATION = 1;
14791    // Device rotation is detected.
14792    ACTUAL_EVENT = 2;
14793    // Device rotated and the data associated with it is ready to be pulled.
14794    // This happens after the ACTUAL_EVENT since some data after the event is
14795    // also useful.
14796    DATA_READY = 3;
14797  }
14798  optional RotationEventType rotation_event_type = 3;
14799}
14800
14801/**
14802 * Records the raw sensor data published by the device orientation debug sensor. The pull will be
14803 * configured to be conditioned on the {@code DeviceRotated} atom.
14804 *
14805 * Logged from:
14806 *     platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
14807 */
14808message DeviceRotatedData {
14809  // All the sensor data and timestamps used to calculate the orientation
14810  optional DeviceRotatedSensorData snapshot = 1 [(log_mode) = MODE_BYTES];
14811  // Resulting orientation
14812  optional android.stats.wm.Orientation proposed_orientation = 2;
14813}
14814
14815message DeviceRotatedSensorData {
14816  optional DeviceRotatedSensorHeader header = 1 [(log_mode) = MODE_BYTES];
14817  repeated DeviceRotatedSensorSample sample = 2 [(log_mode) = MODE_BYTES];
14818}
14819
14820message DeviceRotatedSensorHeader {
14821  optional int64 timestamp_base_millis = 1;
14822}
14823
14824message DeviceRotatedSensorSample{
14825  optional int32 timestamp_offset_millis = 1;
14826  enum SensorType {
14827    UNKNOWN = 0;
14828    ACCEL = 1;
14829    GYRO = 2;
14830  }
14831  optional SensorType sensor_type = 2;
14832  optional float x_value = 3;
14833  optional float y_value = 4;
14834  optional float z_value = 5;
14835}
14836
14837/**
14838  * Pushes TLS handshake counters from Conscrypt.
14839  * Pulled from:
14840  *   external/conscrypt/common/src/main/java/org/conscrypt/ConscryptEngineSocket.java
14841  *   external/conscrypt/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java
14842  */
14843message TlsHandshakeReported {
14844    optional bool success = 1;
14845
14846    optional android.stats.tls.Protocol protocol = 2;
14847
14848    optional android.stats.tls.CipherSuite cipher_suite = 3;
14849
14850    optional int32 handshake_duration_millis = 4;
14851}
14852
14853/**
14854 * Logs when a TextClassifier API is invoked.
14855 *
14856 * See frameworks/base/core/java/android/view/textclassifier/TextClassifier.java
14857 * Logged from: external/libtextclassifier/java/
14858 */
14859message TextClassifierApiUsageReported {
14860    enum ApiType {
14861        UNKNOWN_API = 0;
14862        SUGGEST_SELECTION = 1;
14863        CLASSIFY_TEXT = 2;
14864        GENERATE_LINKS = 3;
14865        DETECT_LANGUAGES = 4;
14866        SUGGEST_CONVERSATION_ACTIONS = 5;
14867    }
14868    optional ApiType api_type = 1;
14869
14870    enum ResultType {
14871        UNKNOWN_RESULT = 0;
14872        SUCCESS = 1;
14873        FAIL = 2;
14874    }
14875    optional ResultType result_type = 2;
14876    optional int64 latency_millis = 3;
14877    optional string session_id = 4;
14878}
14879
14880/**
14881 * Logs the current state of an application before it is killed.
14882 *
14883 * Pushed from:
14884 *  packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
14885 */
14886message KilledAppStatsReported {
14887    // Linux process uid for the package.
14888    optional int32 uid = 1 [(is_uid) = true];
14889
14890    // Name of the package that was killed.
14891    optional string package_name = 2;
14892
14893    // State of the application when it was killed.
14894    enum AppState {
14895        UNKNOWN_APP_STATE = 0;
14896        BACKGROUND = 1;
14897        FOREGROUND = 2;
14898    }
14899    optional AppState app_state = 3;
14900
14901    // System state indicating whether the system was in normal mode or garage mode.
14902    enum SystemState {
14903        UNKNOWN_SYSTEM_STATE = 0;
14904        USER_INTERACTION_MODE = 1;
14905        NO_USER_INTERACTION_MODE = 2;
14906    }
14907    optional SystemState system_state = 4;
14908
14909    // Reason for killing the application.
14910    // Keep in sync between:
14911    //   packages/services/Car/watchdog/server/src/ApplicationTerminator.h
14912    //   frameworks/base/cmds/statsd/src/atoms.proto
14913    enum KillReason {
14914        UNKNOWN_KILL_REASON = 0;
14915        KILLED_ON_ANR = 1;
14916        KILLED_ON_IO_OVERUSE = 2;
14917        KILLED_ON_MEMORY_OVERUSE = 3;
14918    }
14919    optional KillReason kill_reason = 5;
14920
14921    // Stats of the processes owned by the application when the application was killed.
14922    // The process stack traces are not collected when the application was killed due to IO_OVERUSE.
14923    optional ProcessStats process_stat = 6 [(log_mode) = MODE_BYTES];
14924
14925    // The application's I/O overuse stats logged only when the kill reason is KILLED_ON_IO_OVERUSE.
14926    optional IoOveruseStats io_overuse_stats = 7 [(log_mode) = MODE_BYTES];
14927}
14928
14929/**
14930 * Logs the I/O overuse stats for an application on detecting I/O overuse.
14931 *
14932 * Pushed from:
14933 *  packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
14934 */
14935message IoOveruseStatsReported {
14936    // Linux process uid for the package.
14937    optional int32 uid = 1 [(is_uid) = true];
14938
14939    // The application's I/O overuse stats.
14940    optional IoOveruseStats io_overuse_stats = 2 [(log_mode) = MODE_BYTES];
14941}
14942
14943/**
14944 * Logs I/O overuse stats for a package.
14945 *
14946 * Keep in sync between:
14947 *  packages/services/Car/cpp/watchdog/server/src/proto/statsd.proto
14948 *  frameworks/base/cmds/statsd/src/atoms.proto
14949 *
14950 * Logged from:
14951 *  packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
14952 */
14953message IoOveruseStats {
14954    enum Period {
14955        DAILY = 0;
14956        WEEKLY = 1;
14957    }
14958
14959    // Threshold and usage stats period.
14960    optional Period period = 1;
14961
14962    // Threshold in-terms of write bytes defined for the package.
14963    optional PerStateBytes threshold = 2;
14964
14965    // Number of write bytes in each state for the specified period.
14966    optional PerStateBytes written_bytes = 3;
14967};
14968
14969/**
14970 * Logs bytes attributed to each application and system states.
14971 *
14972 * Keep in sync between:
14973 *  packages/services/Car/watchdog/server/src/proto/statsd.proto
14974 *  frameworks/base/cmds/statsd/src/atoms.proto
14975 *
14976 * Logged from:
14977 *  packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
14978 */
14979message PerStateBytes {
14980    // Number of bytes attributed to the application foreground.
14981    optional int64 foreground_bytes = 1;
14982
14983    // Number of bytes attributed to the application background.
14984    optional int64 background_bytes = 2;
14985
14986    // Number of bytes attributed to the garage mode.
14987    optional int64 garage_mode_bytes = 3;
14988}
14989
14990/**
14991 * Logs each ProcessStat in ProcessStats.
14992 *
14993 * Keep in sync between:
14994 *  packages/services/Car/watchdog/server/src/proto/statsd.proto
14995 *  frameworks/base/cmds/statsd/src/atoms.proto
14996 *
14997 * Logged from:
14998 *  packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
14999 */
15000message ProcessStats {
15001    // Records the stats of the processes owned by an application.
15002    repeated ProcessStat process_stat = 1;
15003}
15004
15005/**
15006 * Logs a process's stats.
15007 *
15008 * Keep in sync between:
15009 *  packages/services/Car/watchdog/server/src/proto/statsd.proto
15010 *  frameworks/base/cmds/statsd/src/atoms.proto
15011 *
15012 * Logged from:
15013 *  packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
15014 */
15015message ProcessStat {
15016    // Command name of the process.
15017    optional string process_name = 1;
15018
15019    // Process uptime.
15020    optional uint64 uptime_milliseconds = 2;
15021
15022    // Number of major page faults caused by the process and its children.
15023    optional uint64 major_page_faults = 3;
15024
15025    // Peak virtual memory size in kb.
15026    optional uint64 vm_peak_kb = 4;
15027
15028    // Virtual memory size in kb.
15029    optional uint64 vm_size_kb = 5;
15030
15031    // Peak resident set size (high water mark) in kb.
15032    optional uint64 vm_hwm_kb = 6;
15033
15034    // Resident set size in kb.
15035    optional uint64 vm_rss_kb = 7;
15036}
15037
15038/*
15039 * pushes Media playback information.
15040 * Logged from
15041 *  frameworks/base/services/core/java/com/android/server/media/metrics/
15042 *      MediaMetricsManagerService.java
15043 */
15044message MediametricsPlaybackReported {
15045    optional int32 uid = 1 [(is_uid) = true];
15046
15047    // Randomly generated log session ID. A Base64 encoded hex string representing a
15048    // 128-bit integer.
15049    optional string log_session_id = 2;
15050    // The total length of the media in milliseconds. 0 for live contents.
15051    optional int64 media_duration_millis = 3;
15052    // Network, device, or mixed.
15053    optional android.stats.mediametrics.StreamSourceType stream_source = 4;
15054    // Stream type. DASH, HLS, etc
15055    optional android.stats.mediametrics.StreamType stream_type = 5;
15056    // Live, VOD, others
15057    optional android.stats.mediametrics.PlaybackType playback_type = 6;
15058    // DRM type
15059    optional android.stats.mediametrics.DrmType drm_type = 7;
15060    // Main, AD, others
15061    optional android.stats.mediametrics.ContentType content_type = 8;
15062    // Player name. E.g. ExoPlayer
15063    optional string player_name = 9;
15064    // Player version. E.g. 1.10.3e
15065    optional string player_version = 10;
15066    // Player related experiment IDs
15067    optional Experiments experiment_ids = 11 [(log_mode) = MODE_BYTES];
15068    // Number of frames played. Dropped frames included. -1 means unknown.
15069    optional int32 video_frames_played = 12;
15070    // Number of frames dropped. -1 means unknown.
15071    optional int32 video_frames_dropped = 13;
15072    // Number of audio underruns. -1 means unknown.
15073    optional int32 audio_underrun_count = 14;
15074    // Total number of bytes read from the network
15075    optional int64 network_bytes_read = 15;
15076    // Total number of bytes read from on-device sources
15077    optional int64 local_bytes_read = 16;
15078    // Total transfer spent reading from the network in ms.
15079    // For parallel requests, the overlapping time intervals are counted only once.
15080    optional int64 network_transfer_duration_millis = 17;
15081    // A session ID generated from DRM to distinguish different DRM sessions.
15082    optional string drm_session_id = 18;
15083}
15084
15085message MediaNetworkInfoChanged {
15086    // Randomly generated log session ID. A Base64 encoded hex string representing a
15087    // 128-bit integer.
15088    optional string log_session_id = 1;
15089    //  New network type
15090    optional android.stats.mediametrics.NetworkType type = 2;
15091    //  Network Start time, relative to playback creation time in millisecond.
15092    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15093    optional int64 time_since_playback_created_millis = 3;
15094}
15095
15096message MediaPlaybackStateChanged {
15097    // Randomly generated log session ID. A Base64 encoded hex string representing a
15098    // 128-bit integer.
15099    optional string log_session_id = 1;
15100    //  New playback state
15101    optional android.stats.mediametrics.PlaybackState playback_state = 2;
15102    //  State change time, relative to playback creation time in millisecond.
15103    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15104    optional int64 time_since_playback_created_millis = 3;
15105}
15106
15107message MediaPlaybackErrorReported {
15108    // Randomly generated log session ID. A Base64 encoded hex string representing a
15109    // 128-bit integer.
15110    optional string log_session_id = 1;
15111    //  A shortened call stack of the error
15112    optional string exception_stack = 2;
15113    //  Error code
15114    optional android.stats.mediametrics.PlaybackErrorCode error_code = 3;
15115    //  Sub-code of error type specified by the error code.
15116    optional int32 sub_error_code = 4;
15117    //  Error time, relative to playback creation time in millisecond.
15118    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15119    optional int64 time_since_playback_created_millis = 5;
15120}
15121
15122message MediaPlaybackTrackChanged {
15123    // Randomly generated log session ID. A Base64 encoded hex string representing a
15124    // 128-bit integer.
15125    optional string log_session_id = 1;
15126    //  The track is on or off after the change
15127    optional android.stats.mediametrics.TrackState state = 2;
15128    //  The reason of the track change
15129    optional android.stats.mediametrics.TrackChangeReason reason = 3;
15130    //  The MIME type of the container. E.g. video/mp4
15131    optional string container_mime_type = 4;
15132    //  The sample MIME type of the track. E.g. video/avc
15133    optional string sample_mime_type = 5;
15134
15135    //  Codec name
15136    optional string codec_name = 6;
15137    //  Bits per second. 0 means unknown.
15138    optional int32 bitrate = 7;
15139
15140    //  Track change time, relative to playback creation time in millisecond.
15141    //  It's in absolute time (e.g. always ticks even if the playback is paused).
15142    optional int64 time_since_playback_created_millis = 8;
15143
15144    //  Track type. Audio, Video, Text
15145    optional android.stats.mediametrics.TrackType type = 9;
15146    //  2-letter ISO 639-1 language code.
15147    optional string language = 10;
15148    //  IETF BCP 47 optional language region subtag based on a two-letter country code
15149    optional string language_region = 11;
15150    //  Number of channels
15151    optional int32 channel_count = 12;
15152    //  Samples per second
15153    optional int32 sample_rate = 13;
15154    //  The width of the video in pixels.
15155    optional int32 width = 14;
15156    //  The height of the video in pixels.
15157    optional int32 height = 15;
15158    //  Video frame rate in frames per second.
15159    optional float video_frame_rate = 16;
15160}
15161
15162message Experiments {
15163    // Experiment IDs sent by the player.
15164    repeated int64 experiments = 1;
15165}
15166
15167/**
15168 * Logs when a Wifi network scan happens.
15169 *
15170 * Logged from:
15171 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
15172 */
15173message WifiScanReported {
15174    enum Type {
15175        TYPE_UNKNOWN = 0;
15176
15177        // Single scan.
15178        TYPE_SINGLE = 1;
15179
15180        // Background scan (deprecated, should not happen).
15181        TYPE_BACKGROUND = 2;
15182    }
15183
15184    enum Result {
15185        RESULT_UNKNOWN = 0;
15186
15187        // Failed to start scan.
15188        RESULT_FAILED_TO_START = 1;
15189
15190        // The HAL reported a scan failure after the scan was started.
15191        RESULT_FAILED_TO_SCAN = 2;
15192
15193        // Scan succeeded.
15194        RESULT_SUCCESS = 3;
15195    }
15196
15197    enum Source {
15198        SOURCE_UNKNOWN = 0;
15199
15200        // No work source set - not possible to determine the origin.
15201        SOURCE_NO_WORK_SOURCE = 1;
15202
15203        // The Wifi stack.
15204        SOURCE_WIFI_STACK = 2;
15205
15206        // GMS on behalf of some other app.
15207        SOURCE_GMS = 3;
15208
15209        // Settings app.
15210        SOURCE_SETTINGS_APP = 4;
15211
15212        // Other app directly.
15213        SOURCE_OTHER_APP = 5;
15214    }
15215
15216    enum Importance {
15217        IMPORTANCE_UNKNOWN = 0;
15218
15219        // Foreground app. Corresponds to the value of
15220        // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND or less.
15221        IMPORTANCE_FOREGROUND = 1;
15222
15223        // Foreground service. Corresponds to the value of
15224        // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE
15225        IMPORTANCE_FOREGROUND_SERVICE = 2;
15226
15227        // Everything else.
15228        IMPORTANCE_BACKGROUND = 3;
15229    }
15230
15231    // Scan type
15232    optional Type type = 1;
15233
15234    // Outcome: success/failure
15235    optional Result result = 2;
15236
15237    // What initiated a scan.
15238    optional Source source = 3;
15239
15240    // Process importance of the initiator.
15241    // This is only available for non-system calls.
15242    optional Importance importance = 4;
15243
15244    // Time taken for the scan.
15245    optional int32 scan_duration_millis = 5;
15246
15247    // Count of found networks.
15248    optional int32 count_networks_found = 6;
15249}
15250
15251/**
15252 * Logs when a Wifi PNO (Preferred Network Offload) scan happens.
15253 *
15254 * Logged from:
15255 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
15256 */
15257message WifiPnoScanReported {
15258    enum State {
15259        UNKNOWN = 0;
15260
15261        // Scan started.
15262        STARTED = 1;
15263
15264        // Scan failed to start (e.g. bad request, unsupported by hardware, etc).
15265        FAILED_TO_START = 2;
15266
15267        // Scan completed and a network was found.
15268        // Note - due to implementation constraints, nothing is reported when a scan completes but
15269        // doesn't find any networks.
15270        FINISHED_NETWORKS_FOUND = 3;
15271
15272        // Scan failed.
15273        FAILED = 4;
15274    }
15275
15276    optional State state = 1;
15277}
15278
15279/**
15280 * Logs when the entitlement configuration of an IMS service is queried/updated.
15281 *
15282 * Logged from: ImsServiceEntitlement app
15283 */
15284message ImsServiceEntitlementUpdated {
15285    // The purpose of entitlement query/update
15286    enum Purpose {
15287        UNKNOWN_PURPOSE = 0;
15288
15289        // Initial service activation in foreground
15290        ACTIVATION = 1;
15291
15292        // Updating service configuration in foreground
15293        UPDATE = 2;
15294
15295        // Background polling for querying service entitlement
15296        POLLING = 3;
15297    }
15298
15299    // The IMS services
15300    enum ServiceType {
15301        UNKNOWN_SERVICE = 0;
15302        VOWIFI = 1;
15303        VOLTE = 2;
15304        SMSOIP = 3;
15305    }
15306
15307    // The result of activation
15308    enum AppResult {
15309        UNKNOWN_RESULT = 0;
15310        ENABLED = 1;
15311        DISABLED = 2;
15312        INCOMPATIBLE = 3;
15313        PROVISIONING = 4;
15314        SUCCESSFUL = 5;
15315        FAILED = 6;
15316        CANCELED = 7;
15317        TIMEOUT = 8;
15318        UNEXPECTED_RESULT = 9;
15319    }
15320
15321    // The Android carrier ID for the carrier providing the IMS service.
15322    // This may not be the actual carrier of the device, e.g. a MVNO
15323    // may use the IMS service of its MNO.
15324    optional int64 carrier_id = 1;
15325
15326    // The Android carrier ID of the actual carrier.
15327    // E.g. a MVNO may use its MNO's IMS service. In this case,
15328    // actual_carrier_id is the MVNO and carrier_id is the MNO.
15329    optional int64 actual_carrier_id = 2;
15330
15331    // The purpose of this query/update.
15332    optional Purpose purpose = 3;
15333
15334    // Which IMS service's entitlement status were queried/updated.
15335    optional ServiceType service_type = 4;
15336
15337    // Result of this query/update.
15338    optional AppResult app_result = 5;
15339
15340    // How long (in milliseconds) this query/update took.
15341    optional int64 duration_millis = 6;
15342}
15343
15344// Indicates which compile filter was used for the package being loaded in an ART session.
15345enum ArtCompileFilter {
15346    ART_COMPILATION_FILTER_ERROR = 1;
15347    ART_COMPILATION_FILTER_UNKNOWN = 2;
15348    ART_COMPILATION_FILTER_ASSUMED_VERIFIED = 3;
15349    ART_COMPILATION_FILTER_EXTRACT = 4;
15350    ART_COMPILATION_FILTER_VERIFY = 5;
15351    ART_COMPILATION_FILTER_QUICKEN = 6;
15352    ART_COMPILATION_FILTER_SPACE_PROFILE = 7;
15353    ART_COMPILATION_FILTER_SPACE = 8;
15354    ART_COMPILATION_FILTER_SPEED_PROFILE = 9;
15355    ART_COMPILATION_FILTER_SPEED = 10;
15356    ART_COMPILATION_FILTER_EVERYTHING_PROFILE = 11;
15357    ART_COMPILATION_FILTER_EVERYTHING = 12;
15358    ART_COMPILATION_FILTER_FAKE_RUN_FROM_APK = 13;
15359    ART_COMPILATION_FILTER_FAKE_RUN_FROM_APK_FALLBACK = 14;
15360    ART_COMPILATION_FILTER_FAKE_RUN_FROM_VDEX_FALLBACK = 15;
15361}
15362
15363enum ArtCompilationReason {
15364    ART_COMPILATION_REASON_ERROR = 1;
15365    ART_COMPILATION_REASON_UNKNOWN = 2;
15366    ART_COMPILATION_REASON_FIRST_BOOT = 3;
15367    ART_COMPILATION_REASON_BOOT = 4;
15368    ART_COMPILATION_REASON_INSTALL = 5;
15369    ART_COMPILATION_REASON_BG_DEXOPT = 6;
15370    ART_COMPILATION_REASON_AB_OTA = 7;
15371    ART_COMPILATION_REASON_INACTIVE = 8;
15372    ART_COMPILATION_REASON_SHARED = 9;
15373    ART_COMPILATION_REASON_INSTALL_WITH_DEX_METADATA = 10;
15374    ART_COMPILATION_REASON_POST_BOOT = 11;
15375    ART_COMPILATION_REASON_INSTALL_FAST = 12;
15376    ART_COMPILATION_REASON_INSTALL_BULK = 13;
15377    ART_COMPILATION_REASON_INSTALL_BULK_SECONDARY = 14;
15378    ART_COMPILATION_REASON_INSTALL_BULK_DOWNGRADED = 15;
15379    ART_COMPILATION_REASON_INSTALL_BULK_SECONDARY_DOWNGRADED = 16;
15380    ART_COMPILATION_REASON_BOOT_AFTER_OTA = 17;
15381    ART_COMPILATION_REASON_PREBUILT = 18;
15382    ART_COMPILATION_REASON_CMDLINE = 19;
15383}
15384
15385// Indicates which kind of measurement ART is reporting.
15386//
15387// Where it makes sense, the datum ID ends with the type of datum (counter or histogram) and the
15388// units.
15389// Note: Histograms are not yet reported by statsd.
15390enum ArtDatumId {
15391    ART_DATUM_INVALID = 0;
15392    ART_DATUM_GC_WORLD_STOP_TIME_AVG_MICROS = 1;
15393    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_TIME_HISTO_MILLIS = 2;
15394    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_COUNT = 3;
15395    ART_DATUM_GC_FULL_HEAP_COLLECTION_TIME_HISTO_MILLIS = 4;
15396    ART_DATUM_GC_FULL_HEAP_COLLECTION_COUNT = 5;
15397    ART_DATUM_JIT_METHOD_COMPILE_TIME_MICROS = 6;
15398    ART_DATUM_AOT_COMPILE_TIME = 7;
15399    ART_DATUM_CLASS_VERIFICATION_TIME_COUNTER_MICROS = 8;
15400    ART_DATUM_CLASS_LOADING_TIME_COUNTER_MICROS = 9;
15401
15402    // Metrics IDs for dex2oat.
15403    ART_DATUM_DEX2OAT_RESULT_CODE = 10;
15404    ART_DATUM_DEX2OAT_DEX_CODE_COUNTER_BYTES = 11;
15405    ART_DATUM_DEX2OAT_TOTAL_TIME_COUNTER_MILLIS = 12;
15406    ART_DATUM_DEX2OAT_VERIFY_DEX_FILE_TIME_COUNTER_MILLIS = 13;
15407    ART_DATUM_DEX2OAT_FAST_VERIFY_TIME_COUNTER_MILLIS = 14;
15408    ART_DATUM_DEX2OAT_RESOLVE_METHODS_AND_FIELDS_TIME_COUNTER_MILLIS = 15;
15409
15410    ART_DATUM_CLASS_VERIFICATION_COUNT = 16;
15411    ART_DATUM_GC_TOTAL_BYTES_ALLOCATED = 17;
15412    ART_DATUM_GC_TOTAL_METADATA_SIZE_BYTES = 18 [deprecated=true];
15413    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_THROUGHPUT_HISTO_MB_PER_SEC = 19;
15414    ART_DATUM_GC_FULL_HEAP_COLLECTION_THROUGHPUT_HISTO_MB_PER_SEC = 20;
15415    ART_DATUM_JIT_METHOD_COMPILE_COUNT = 21;
15416    ART_DATUM_GC_YOUNG_GENERATION_TRACING_THROUGHPUT_HISTO_MB_PER_SEC = 22;
15417    ART_DATUM_GC_FULL_HEAP_TRACING_THROUGHPUT_HISTO_MB_PER_SEC = 23;
15418    ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_THROUGHPUT_AVG_MB_PER_SEC = 24;
15419    ART_DATUM_GC_FULL_HEAP_COLLECTION_THROUGHPUT_AVG_MB_PER_SEC = 25;
15420    ART_DATUM_GC_YOUNG_GENERATION_TRACING_THROUGHPUT_AVG_MB_PER_SEC = 26;
15421    ART_DATUM_GC_FULL_HEAP_TRACING_THROUGHPUT_AVG_MB_PER_SEC = 27;
15422    ART_DATUM_GC_TOTAL_COLLECTION_TIME_MS = 28;
15423}
15424
15425// Indicates what class of thread the reported values apply to.
15426enum ArtThreadType {
15427    ART_THREAD_MAIN = 1;
15428    ART_THREAD_BACKGROUND = 2;
15429}
15430
15431// Indicates the type of dex metadata.
15432enum ArtDexMetadataType {
15433  ART_DEX_METADATA_TYPE_UNKNOWN = 0;
15434  ART_DEX_METADATA_TYPE_PROFILE = 1;
15435  ART_DEX_METADATA_TYPE_VDEX = 2;
15436  ART_DEX_METADATA_TYPE_PROFILE_AND_VDEX = 3;
15437  ART_DEX_METADATA_TYPE_NONE = 4;
15438  ART_DEX_METADATA_TYPE_ERROR = 5;
15439}
15440
15441// Indicates the type of the apk.
15442enum ArtApkType {
15443    ART_APK_TYPE_UNKNOWN = 0;
15444    ART_APK_TYPE_BASE = 1;
15445    ART_APK_TYPE_SPLIT = 2;
15446}
15447
15448// Indicates the ISA.
15449enum ArtIsa {
15450    ART_ISA_UNKNOWN = 0;
15451    ART_ISA_ARM = 1;
15452    ART_ISA_ARM64 = 2;
15453    ART_ISA_X86 = 3;
15454    ART_ISA_X86_64 = 4;
15455    ART_ISA_MIPS = 5;
15456    ART_ISA_MIPS64 = 6;
15457}
15458
15459message ArtDatumReported {
15460    // The session ID is used to correlate this report with others from the same ART instance.
15461    optional int64 session_id = 1;
15462
15463    // The UID of the app that ART is running on behalf of.
15464    optional int32 uid = 2 [(is_uid) = true];
15465
15466    // What compiler filter the APK or DEX file was compiled with.
15467    optional ArtCompileFilter compile_filter = 3;
15468
15469    // Why the package was compiled the way it was.
15470    optional ArtCompilationReason compilation_reason = 4;
15471
15472    // The number of milliseconds since the ART runtime instance was started.
15473    optional int64 timestamp_millis = 5;
15474
15475    // What kind of thread (UI or background) this metric corresponds to.
15476    optional ArtThreadType thread_type = 6;
15477
15478    // Which counter this is that is being reported.
15479    optional ArtDatumId kind = 7;
15480
15481    // The value of the counter.
15482    optional int64 value = 8;
15483
15484    // The type of dex metadata
15485    optional ArtDexMetadataType dex_metadata_type = 9;
15486
15487    // The type of the APK file.
15488    optional ArtApkType apk_type = 10;
15489
15490    // The ISA of the device.
15491    optional ArtIsa isa = 11;
15492}
15493
15494/**
15495 * Logged when a SIM-specific settings restore was attempted.
15496 *
15497 * Logged from:
15498 *    packages/providers/TelephonyProvider/src/com/android/providers/telephony/TelephonyProvider.java
15499 */
15500message SimSpecificSettingsRestored {
15501    optional android.telephony.SimSpecfifcSettingsRestoreResult result = 1;
15502
15503    // Indicates which restore flow was followed.
15504    optional android.telephony.SimSpecificSettingsRestoreCase restored_from_suw = 2;
15505
15506    // Indicates which criteria was used to match the inserted SIM to backed up
15507    // SIM. Only relevant when result is SUCCESS
15508    optional android.telephony.SimSpecificSettingsRestoreMatchingCriteria matching_criteria = 3;
15509}
15510
15511/**
15512 * The latency of Binder calls broken down by calling API and method name.
15513 * This is different from BinderCalls as it collects a histogram of the
15514 * latencies (to get more detailed data) not just the count, sum, and maximum.
15515 *
15516 * Logged from:
15517 * frameworks/base/core/java/com/android/internal/os/BinderLatencyObserver.java
15518 */
15519message BinderLatencyReported {
15520    message Dims {
15521        enum ProcessSource {
15522            UNKNOWN_PROCESS_SOURCE = 0;
15523            SYSTEM_SERVER = 1;
15524            TELEPHONY = 2;
15525            BLUETOOTH = 3;
15526        }
15527        enum ServiceClassName {
15528            UNKNOWN_CLASS = 0;
15529        }
15530        enum ServiceMethodName {
15531            UNKNOWN_METHOD = 0;
15532        }
15533
15534        // Required.
15535        optional ProcessSource process_source = 1;
15536
15537        // The class name of the API making the call to Binder. Enum value
15538        // is preferred as uses much less data to store.
15539        // This field does not contain PII.
15540        oneof service_class {
15541            ServiceClassName service_class_name_as_enum = 2;
15542            string service_class_name = 3;
15543        }
15544
15545        // Method name of the API call. It can also be a transaction code if we
15546        // cannot resolve it to a name. See Binder#getTransactionName. Enum value
15547        // is preferred as uses much less data to store.
15548        // This field does not contain PII.
15549        oneof service_method {
15550            ServiceMethodName service_method_name_as_enum = 4;
15551            string service_method_name = 5;
15552        }
15553    }
15554
15555    message ApiStats {
15556        // required.
15557        optional Dims dims = 1;
15558
15559        // Indicates the first bucket that had any data. Allows omitting any empty
15560        // buckets at the start of the bucket list and thus save on data size.
15561        optional int32 first_bucket_index = 2;
15562        // Stores the count of samples for each bucket. The number of buckets and
15563        // their sizes are controlled server side with a flag.
15564        repeated int32 buckets = 3;
15565    }
15566
15567    message RepeatedApiStats {
15568        repeated ApiStats api_stats = 1;
15569    }
15570
15571    // The binder latency data broken down by the dimensions specified above.
15572    // The message wrapper is used for the repeated field as top level repeated
15573    // fields are not allowed.
15574    // MODE_BYTES is used as nested messages are not allowed otherwise.
15575    // Required.
15576    optional RepeatedApiStats repeated_api_stats = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
15577
15578    // The fraction of samples that are recorded in the histogram.
15579    // Required.
15580    optional float sampling_rate = 2;
15581
15582    // Indicates how many shards the APIs are divided in - e.g. for 3 every
15583    // 3rd API will be included in the data for this shard.
15584    // Required.
15585    optional int32 sharding_modulo = 3;
15586
15587    // Params for histogram buckets.
15588    // The number of buckets the histogram should have.
15589    optional int32 bucket_count = 4;
15590
15591    // The size (upper bound) of the first bucket (used to avoid creating an
15592    // excessive amount of small buckets). E.g. for first_bucket_size of 5, the
15593    // first bucket will be [0, 5) and the second will be [5, 5 * scaleFactor).
15594    optional int32 first_bucket_size = 5;
15595
15596    // The rate in which each consecutive bucket increases (before rounding).
15597    // Implemented in: com.android.internal.os.BinderLatencyBuckets.
15598    optional float scale_factor = 6;
15599}
15600
15601/**
15602 * Log audio device types that are used for input/output.
15603 * Next Tag: 2
15604 */
15605message AudioDevice {
15606    // See audio_devices_t in system/media/audio/include/system/audio-hal-enums.h
15607    repeated int32 type = 1;
15608}
15609
15610/**
15611 * Track information about AAudio Stream
15612 * Logged from
15613 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
15614 */
15615message MediametricsAAudioStreamReported {
15616    // The implementation of aaudio.
15617    enum CallerPath {
15618        CALLER_PATH_UNKNOWN = 0;
15619        CALLER_PATH_LEGACY = 1;
15620        CALLER_PATH_MMAP = 2;
15621    }
15622    optional CallerPath path = 1;
15623
15624    // The direction of the stream.
15625    // See aaudio_direction_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
15626    // The Direction values are different from aaudio_direction_t to avoid having 0 at the first
15627    // value since first value will be used as default value.
15628    // See lookup<AAUDIO_DIRECTION> in frameworks/av/services/mediametrics/AudioTypes.cpp
15629    // for conversion from aaudio_direction_t to Direction.
15630    enum Direction {
15631        // The direction is unknown.
15632        DIRECTION_UNKNOWN = 0;
15633        // Audio data will travel out of the device.
15634        DIRECTION_OUTPUT = 1;
15635        // Audio data will travel into the device.
15636        DIRECTION_INPUT = 2;
15637    }
15638    optional Direction direction = 2;
15639
15640    // The amount read or written in one shot by the Mixer or DSP.
15641    optional int32 frames_per_burst = 3;
15642    // The number of frames that the buffer is used.
15643    optional int32 buffer_size = 4;
15644    // The allocated number of frames for the buffer.
15645    optional int32 buffer_capacity = 5;
15646    // The channel count of the aaudio stream.
15647    optional int32 channel_count = 6;
15648    // Total frames transferred (written or read)
15649    optional int64 total_frames_transferred = 7;
15650
15651    // The performance mode.
15652    // See aaudio_performance_mode_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
15653    enum PerformanceMode {
15654        // The performance mode is unknown.
15655        PERFORMANCE_MODE_UNKNOWN = 0;
15656        // No particular performance mode needs. Default.
15657        PERFORMANCE_MODE_NONE = 10;
15658        // Extending battery life is more important than low latency.
15659        PERFORMANCE_MODE_POWER_SAVING = 11;
15660        // Reducing latency is more important than battery life.
15661        PERFORMANCE_MODE_LOW_LATENCY = 12;
15662    }
15663    // The performance mode requested by the applications.
15664    optional PerformanceMode perf_mode_requested = 8;
15665    // The actual performance mode used by aaudio.
15666    optional PerformanceMode perf_mode_actual = 9;
15667
15668    // The mode requested for sharing the device
15669    // See aaudio_sharing_mode_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
15670    // The SharingMode values are different from aaudio_direction_t to avoid having 0 at the first
15671    // value since first value will be used as default value.
15672    // See lookup<AAUDIO_SHARING_MODE> in frameworks/av/services/mediametrics/AudioTypes.cpp
15673    // for conversion from aaudio_sharing_mode_t to SharingMode.
15674    enum SharingMode {
15675        // The sharing mode is unknown
15676        SHARING_MODE_UNKNOWN = 0;
15677        // This will be the only stream using a particular source or sink.
15678        SHARING_MODE_EXCLUSIVE = 1;
15679        // Multiple application will be mixed by the AAudio server.
15680        SHARING_MODE_SHARED = 2;
15681    }
15682    optional SharingMode sharing = 10;
15683
15684    // Approximate number of glitches.
15685    // Underrun on output stream. Overrun on input stream.
15686    optional int32 xrun_count = 11;
15687    // Devices that are used by the aaudio stream.
15688    optional AudioDevice types = 12 [(log_mode) = MODE_BYTES];
15689
15690    // Format request by the applications
15691    optional int32 format_app = 13;
15692    // Format processed by the framework
15693    optional int32 format_device = 14;
15694
15695    // Android S metric log session id, a Base64Url encoded string representing a 128-bit integer.
15696    optional string log_session_id = 15;
15697
15698    // The sample rate of the aaudio stream.
15699    optional int32 sample_rate = 16;
15700
15701    // The content type of the aaudio stream.
15702    // An enumeration from system/media/audio/include/system/audio-hal-enums.h audio_content_type_t
15703    enum ContentType {
15704        CONTENT_TYPE_UNKNOWN = 0;
15705        CONTENT_TYPE_SPEECH = 1;
15706        CONTENT_TYPE_MUSIC = 2;
15707        CONTENT_TYPE_MOVIE = 3;
15708        CONTENT_TYPE_SONIFICATION = 4;
15709        CONTENT_TYPE_INVALID = -1;
15710    }
15711    optional ContentType content_type = 17;
15712
15713    // The mode of sharing the device requested by the client.
15714    optional SharingMode sharing_requested = 18;
15715}
15716
15717/**
15718 * Logs media transcoding session ended events.
15719 *
15720 * Logged from:
15721 *   frameworks/av/media/libmediatranscoding/TranscoderWrapper.cpp
15722 */
15723message MediaTranscodingSessionEnded {
15724
15725    enum Reason {
15726        UNKNOWN = 0;       // Unused.
15727        FINISHED = 1;      // Transcoding session finished successfully.
15728        ERROR = 2;         // Transcoding session returned error while running.
15729        PAUSED = 3;        // Transcoding session was paused, potentially failed.
15730        CANCELLED = 4;     // Transcoding session was cancelled.
15731        START_FAILED = 5;  // Transcoding session failed to start.
15732        RESUME_FAILED = 6; // Transcoding session failed to resume.
15733        CREATE_FAILED = 7; // Transcoder instance failed to crate.
15734        CONFIG_SRC_FAILED = 8;    // Configure source failed.
15735        CONFIG_DST_FAILED = 9;    // Configure destination failed.
15736        CONFIG_TRACK_FAILED = 10; // Configure track failed.
15737        OPEN_SRC_FD_FAILED = 11;  // Open source fd failed.
15738        OPEN_DST_FD_FAILED = 12;  // Open destination fd failed.
15739        NO_TRACKS = 13;  // No tracks in source file.
15740    }
15741
15742    // Reason for logging the atom.
15743    optional Reason reason = 1;
15744
15745    // UID of client connecting to media transcoding service.
15746    optional int32 calling_uid = 2 [(is_uid) = true];
15747
15748    // Transcode session status flag (media_status_t).
15749    optional int32 transcode_status = 3;
15750
15751    // Transcode speed as framerate, if status is success.
15752    optional int32 transcode_fps = 4;
15753
15754    // Source video dimensions.
15755    optional int32 src_width = 5;
15756    optional int32 src_height = 6;
15757
15758    // Source video codec information.
15759    optional string src_codec_type = 7;
15760    optional int32 src_profile = 8;
15761    optional int32 src_level = 9;
15762
15763    // Source video framerate.
15764    optional int32 src_fps = 10;
15765
15766    // Source video duration.
15767    optional int32 src_duration_millis = 11;
15768
15769    // Whether source video is HDR.
15770    optional bool src_is_hdr = 12;
15771
15772    // Destination video dimensions.
15773    optional int32 dst_width = 13;
15774    optional int32 dst_height = 14;
15775
15776    // Destination video codec information.
15777    optional string dst_codec_type = 15;
15778
15779    // Whether destination video is HDR.
15780    optional bool dst_is_hdr = 16;
15781}
15782
15783/** Logs information about an unattended reboot that took place. This is logged
15784 *  after the next boot, when the device is first unlocked.
15785 *
15786 * Logged from:
15787 *   packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
15788 */
15789message UnattendedRebootOccurred {
15790
15791    // Time between the reboot readiness state checks starting, and the device
15792    // becoming reboot-ready.
15793    optional int64 time_until_reboot_ready_millis= 1;
15794
15795    // Time taken for the device to be unlocked (i.e. for the keyguard to be
15796    // gone) after an unattended reboot took place.
15797    optional int64 time_until_first_unlock_millis = 2;
15798
15799    // Number of times the reboot was blocked by the device being interactive.
15800    optional int32 times_blocked_by_interactivity = 3;
15801
15802    // Number of times the reboot was blocked by a callback registered by a
15803    // subsystem or a privileged app.
15804    optional int32 times_blocked_by_subsystems = 4;
15805
15806    // Number of times the reboot was blocked by background app activity.
15807    optional int32 times_blocked_by_app_activity = 5;
15808
15809    // Time until next user interaction with the device.
15810    optional int64 time_until_next_interaction_ms = 6;
15811}
15812
15813
15814/**
15815 * Logs information about an app uid or registered system component that has
15816 * been blocking the device from being reboot-ready for a long time.
15817 *
15818 * Logged from:
15819 *   packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
15820 */
15821message LongRebootBlockingReported {
15822
15823    enum RebootBlockReason {
15824        SYSTEM_COMPONENT = 1;
15825        APP_UID = 2;
15826    }
15827
15828    // The reason why the reboot has been blocked. This is either a system
15829    // component that has registered a callback, or an app UID running in the
15830    // background.
15831    optional RebootBlockReason reboot_block_reason = 1;
15832
15833    // Only one of the following two fields should be set, depending on the
15834    // RebootBlockReason.
15835
15836    // The name supplied by a system component when it registered a callback
15837    // to block the reboot.
15838    optional string component_name = 2;
15839
15840    // The uid of an app that is running in the background.
15841    optional int32 uid = 3;
15842}
15843
15844/**
15845 * Logs the magnification activated mode and its duration of the usage
15846 * when the magnification is disabled.
15847 *
15848 * Logged from:
15849 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
15850 */
15851message MagnificationUsageReported {
15852    // The definition of the magnification mode.
15853    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
15854    optional android.stats.accessibility.MagnificationMode activated_mode = 1;
15855
15856    // The duration of this magnification mode activation in milliseconds
15857    optional int64 duration_millis = 2;
15858}
15859
15860/**
15861 * Logs the magnification activated mode when IME dialog shows on the screen.
15862 *
15863 * Logged from:
15864 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
15865 */
15866message MagnificationModeWithImeOnReported {
15867    // The definition of the magnification mode.
15868    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
15869    optional android.stats.accessibility.MagnificationMode activated_mode = 1;
15870}
15871
15872/*
15873 * Reports a device controls user interaction
15874 *
15875 * Logged from:
15876 *   frameworks/base/packages/SystemUI/src/com/android/systemui/controls/ControlsMetricsLoggerImpl.kt
15877 */
15878message DeviceControlChanged {
15879    // The event_id
15880    optional int32 event_id = 1;
15881    // An identifier to tie together multiple logs relating to the same controls session
15882    optional int32 instance_id = 2;
15883    // The type of device the user has interacted with (android.service.controls.DeviceTypes)
15884    optional int32 device_type = 3;
15885    // The service app uid.
15886    optional int32 uid = 4 [(is_uid) = true];
15887    // Is the device locked while the action started
15888    optional bool is_locked = 5;
15889}
15890
15891/**
15892 * This metric is collected at the end of playback
15893 * as a pulled atom.
15894 *
15895 *   DrmHal::cleanup() {
15896 *     // ...
15897 *     reportFrameworkMetrics(reportPluginMetrics());
15898 *     // ...
15899 *   }
15900 * This proto should be kept in-sync with
15901 * frameworks/av/drm/libmediadrm/protos/metrics.proto.
15902 */
15903message DrmFrameworkMetrics {
15904
15905    // Attributes are associated with a recorded value. E.g. A counter may
15906    // represent a count of an operation returning a specific error code. The
15907    // error code will be an attribute.
15908    message Attributes {
15909        // Reserved for compatibility with logging proto.
15910        reserved 2 to 13;
15911
15912        // A general purpose error code where 0 means OK.
15913        optional int32 error_code = 1;
15914
15915        // Defined at ::android::hardware::drm::V1_0::KeyStatusType;
15916        optional uint32 key_status_type = 14;
15917
15918        // Defined at ::android::hardware::drm::V1_0::EventType;
15919        optional uint32 event_type = 15;
15920    }
15921
15922    // The Counter message is used to store a count value with an associated
15923    // Attribute.
15924    message Counter {
15925        optional uint64 count = 1;
15926        // Represents the attributes associated with this counter instance.
15927        optional Attributes attributes = 2;
15928    }
15929
15930    // The DistributionMetric is meant to capture the moments of a normally
15931    // distributed (or approximately normal) value.
15932    message DistributionMetric {
15933        optional float min = 1;
15934        optional float max = 2;
15935        optional float mean = 3;
15936        optional double variance = 4;
15937        optional uint64 operation_count = 5;
15938
15939        // Represents the attributes associated with this distribution metric
15940        // instance.
15941        optional Attributes attributes = 6;
15942    }
15943
15944    message SessionLifetime {
15945        // Start time of the session in milliseconds since epoch.
15946        optional uint64 start_time_millis = 1;
15947        // End time of the session in milliseconds since epoch.
15948        optional uint64 end_time_millis = 2;
15949    }
15950
15951    // The count of open session operations. Each instance has a specific error
15952    // code associated with it.
15953    repeated Counter open_session_counter = 1;
15954
15955    // The count of close session operations. Each instance has a specific error
15956    // code associated with it.
15957    repeated Counter close_session_counter = 2;
15958
15959    // Count and execution time of getKeyRequest calls.
15960    repeated DistributionMetric get_key_request_time_us = 3;
15961
15962    // Count and execution time of provideKeyResponse calls.
15963    repeated DistributionMetric provide_key_response_time_us = 4;
15964
15965    // Count of getProvisionRequest calls.
15966    repeated Counter get_provisioning_request_counter = 5;
15967
15968    // Count of provideProvisionResponse calls.
15969    repeated Counter provide_provisioning_response_counter = 6;
15970
15971    // Count of key status events broken out by status type.
15972    repeated Counter key_status_change_counter = 7;
15973
15974    // Count of events broken out by event type
15975    repeated Counter event_callback_counter = 8;
15976
15977    // Count getPropertyByteArray calls to retrieve the device unique id.
15978    repeated Counter get_device_unique_id_counter = 9;
15979
15980    message SessionLifetimeEntry {
15981        optional string session_id = 1;
15982        optional SessionLifetime session_lifetime = 2;
15983    }
15984    // Session ids to lifetime (start and end time) map.
15985    // Session ids are strings of hex-encoded byte arrays.
15986    // This field is equivalent to the map<string, SessionLifetime>
15987    // field in frameworks/av/drm/libmediadrm/protos/metrics.proto.
15988    repeated SessionLifetimeEntry session_lifetimes = 10;
15989}
15990
15991/**
15992 * The metric is collected at the end of playback
15993 * as a pulled atom MediaDrmActivityInfo.
15994 *
15995 * The framework_metrics is defined in
15996 * frameworks/av/drm/libmediadrm/protos/metrics.proto.
15997 *
15998 * The format of vendor_metrics is  MediaDrm plugin dependent.
15999 *
16000 *   DrmHal::cleanup() {
16001 *     // ...
16002 *     reportFrameworkMetrics(reportPluginMetrics());
16003 *     // ...
16004 *   }
16005 *
16006 * This pulled atom is then collected in
16007 * frameworks/av/services/mediametrics/MediaMetricsService.cpp.
16008 */
16009message MediaDrmActivityInfo {
16010    optional string package_name = 1;
16011    optional int64 package_version_code = 2;
16012
16013    // vendor+description tell about which DRM plugin is in use on this device
16014    optional string vendor = 3;
16015    optional string description = 4;
16016
16017    optional DrmFrameworkMetrics framework_metrics = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
16018    optional bytes vendor_metrics = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
16019}
16020
16021/*
16022 * Logged when hardware based user-configurable device state changes.
16023 *
16024 * Logged from:
16025 *     frameworks/base/services/core/java/com/android/server/devicestate/DeviceStateManagerService.java
16026 */
16027message DeviceStateChanged {
16028    optional int32 new_device_state = 1
16029            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
16030    optional bool boot_state = 2;
16031}
16032
16033/*
16034 * An obfuscated, canonical form time zone suggestion for metrics use.
16035 *
16036 * The suggestion's time zone IDs (which relate to location) are obfuscated by
16037 * mapping them to an ordinal. When the ordinal is assigned consistently across
16038 * several objects (i.e. so the same time zone ID is always mapped to the same
16039 * ordinal), this allows comparisons between those objects. For example, we can
16040 * answer "did these two suggestions agree?", "does the suggestion match the
16041 * device's current time zone?", without leaking knowledge of location. Ordinals
16042 * are also significantly more compact than full IANA TZDB IDs, albeit highly
16043 * unstable and of limited use.
16044 */
16045message MetricsTimeZoneSuggestion {
16046    enum Type {
16047        UNKNOWN = 0;
16048        CERTAIN = 1;
16049        UNCERTAIN = 2;
16050    }
16051    optional Type type = 1;
16052
16053    // The ordinals for time zone(s) in the suggestion. Always empty for
16054    // UNCERTAIN, and can be empty for CERTAIN, for example when the device is in
16055    // a disputed area / on an ocean.
16056    repeated int32 time_zone_ordinals = 2;
16057}
16058
16059/*
16060 * Logs a snapshot of time zone detector state.
16061 *
16062 * Logged from:
16063 * frameworks/base/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
16064 */
16065message TimeZoneDetectorState {
16066
16067    // True if telephony-based time zone detection is supported on the device.
16068    optional bool telephony_supported = 1;
16069
16070    // True if geo-based time zone detection is supported on the device.
16071    optional bool geo_supported = 2;
16072
16073    // The current user's master location setting value.
16074    optional bool location_enabled = 3;
16075
16076    // The current user's auto time zone detection enabled setting value.
16077    optional bool auto_detection_setting = 4;
16078
16079    // The current user's geo detection enabled setting.
16080    optional bool geo_detection_setting = 5;
16081
16082    enum DetectionMode {
16083        UNKNOWN = 0;
16084        MANUAL = 1;
16085        TELEPHONY = 2;
16086        GEO = 3;
16087    }
16088
16089    // The functional / behavioral state for how time zones are currently determined on the device.
16090    // Avoids needing to duplicate the logic used.
16091    optional DetectionMode detection_mode = 6;
16092
16093    // The device's current time zone ordinal (see MetricsTimeZoneSuggestion).
16094    optional int32 device_time_zone_ordinal = 7;
16095
16096    // The latest suggestion received from the user, e.g. via SettingsUI (non-persistent).
16097    optional MetricsTimeZoneSuggestion latest_manual_suggestion = 8
16098            [(log_mode) = MODE_BYTES];
16099
16100    // The latest telephony-derived suggestion (non-persistent).
16101    optional MetricsTimeZoneSuggestion latest_telephony_suggestion = 9
16102            [(log_mode) = MODE_BYTES];
16103
16104    // The latest geo-derived suggestion (non-persistent).
16105    optional MetricsTimeZoneSuggestion latest_geo_suggestion = 10
16106            [(log_mode) = MODE_BYTES];
16107}
16108
16109/*
16110 * Logs information about an individual location time zone provider's state.
16111 *
16112 * Logged from:
16113 * frameworks/base/services/core/java/com/android/server/location/timezone/ControllerImpl.java
16114 */
16115message LocationTimeZoneProviderStateChanged {
16116    // The index of the provider (primary = 0, secondary = 1)
16117    optional int32 provider_index = 1;
16118
16119    enum State {
16120        // A placeholder for unknown values.
16121        UNKNOWN = 0;
16122
16123        // The provider is initializing.
16124        INITIALIZING = 1;
16125
16126        // The provider is certain of the time zone.
16127        CERTAIN = 2;
16128
16129        // The provider is uncertain of the time zone.
16130        UNCERTAIN = 3;
16131
16132        // The provider has been stopped.
16133        STOPPED = 4;
16134
16135        // The provider has failed.
16136        PERM_FAILED = 5;
16137
16138        // The provider has been destroyed.
16139        DESTROYED = 6;
16140    }
16141
16142    // The state of the provider.
16143    optional State state = 2;
16144}
16145
16146/*
16147 * Reports fdtrack state change.
16148 *
16149 * Logged from:
16150 *   frameworks/base/services/java/com/android/server/SystemServer.java
16151 */
16152message FdtrackEventOccurred {
16153    enum FdtrackEventType {
16154      DISABLED = 1;
16155      ENABLED = 2;
16156
16157      // Aborting because we're above the abort threshold.
16158      ABORTING = 3;
16159    }
16160
16161    optional FdtrackEventType event = 1;
16162    optional int32 fd_count = 2;
16163}
16164
16165/**
16166 * Pushed when delivering a batch of alarms.
16167 *
16168 * Logged from:
16169 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
16170 */
16171message AlarmBatchDelivered {
16172    optional int32 num_alarms = 1;
16173    optional int32 wakeups = 2;
16174}
16175
16176/**
16177 * Pushed when an app schedules an alarm.
16178 *
16179 * Logged from:
16180 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
16181 */
16182message AlarmScheduled {
16183    optional int32 calling_uid = 1 [(is_uid) = true];
16184
16185    optional bool is_exact = 2;
16186    optional bool is_wakeup = 3;
16187    optional bool is_allow_while_idle = 4;
16188    optional bool is_alarm_clock = 5;
16189    optional bool is_repeating = 6;
16190
16191    enum ReasonCode {
16192        NOT_APPLICABLE = 0;
16193        PERMISSION = 1;
16194        ALLOW_LIST = 2;
16195        CHANGE_DISABLED = 3;
16196    }
16197    optional ReasonCode exact_alarm_allowed_reason = 7;
16198    optional bool is_rtc = 8;
16199    // The state of the callingUid, from frameworks/proto_logging/stats/enums/app/enums.proto.
16200    optional android.app.ProcessStateEnum calling_process_state = 9;
16201}
16202
16203/**
16204 * Logs statistics about pending alarms.
16205 *
16206 * Pulled from:
16207 * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
16208 */
16209message PendingAlarmInfo {
16210    optional int32 num_total = 1;
16211    optional int32 num_exact = 2;
16212    optional int32 num_wakeup = 3;
16213    optional int32 num_allow_while_idle = 4;
16214    optional int32 num_prioritized = 5;
16215    optional int32 num_foreground_service = 6;
16216    optional int32 num_activity = 7;
16217    optional int32 num_service = 8;
16218    optional int32 num_listener = 9;
16219    optional int32 num_indefinite_future = 10;
16220    optional int32 num_repeating = 11;
16221    optional int32 num_alarm_clock = 12;
16222    optional int32 num_rtc = 13;
16223}
16224
16225/*
16226 * Logs information about on-device refresh of ART AOT artifacts for boot classpath extensions
16227 * and system_server.
16228 *
16229 * Logged from:
16230 *   art/odrefresh/odrefresh.cc
16231 */
16232message OdrefreshReported {
16233    optional int64 art_apex_version = 1;
16234
16235    enum Trigger {
16236        // A placeholder for unknown values.
16237        TRIGGER_UNKNOWN = 0;
16238
16239        // ART apex version has changed since time artifacts were generated.
16240        TRIGGER_APEX_VERSION_MISMATCH = 1;
16241
16242        // Dex files on the boot classpath or system_server classpath have changed.
16243        TRIGGER_DEX_FILES_CHANGED = 2;
16244
16245        // Missing artifacts.
16246        TRIGGER_MISSING_ARTIFACTS = 3;
16247    }
16248
16249    optional Trigger trigger = 2;
16250
16251    enum Stage {
16252        // A placeholder for unknown values.
16253        STAGE_UNKNOWN = 0;
16254
16255        // Checking stage.
16256        STAGE_CHECK = 10;
16257
16258        // Preparation for compilation.
16259        STAGE_PREPARATION = 20;
16260
16261        // Compilation of primary boot classpath extensions.
16262        STAGE_PRIMARY_BOOT_CLASSPATH = 30;
16263
16264        // Compilation of secondary boot classpath extensions.
16265        STAGE_SECONDARY_BOOT_CLASSPATH = 40;
16266
16267        // Compilation of system_server classpath.
16268        STAGE_SYSTEM_SERVER_CLASSPATH = 50;
16269
16270        // All stages completed.
16271        STAGE_COMPLETE = 60;
16272    }
16273
16274    optional Stage stage_reached = 3;
16275
16276    enum Status {
16277        // A placeholder for unknown values.
16278        STATUS_UNKNOWN = 0;
16279
16280        // OK, no problems encountered.
16281        STATUS_OK = 1;
16282
16283        // Insufficient space.
16284        STATUS_NO_SPACE = 2;
16285
16286        // Storage operation failed.
16287        STATUS_IO_ERROR = 3;
16288
16289        // Dex2oat reported an error.
16290        STATUS_DEX2OAT_ERROR = 4;
16291
16292        // Time limit exceeded.
16293        STATUS_TIME_LIMIT_EXCEEDED = 5;
16294
16295        // Failure creating staging area.
16296        STATUS_STAGING_FAILED = 6;
16297
16298        // Installation of artifacts failed.
16299        STATUS_INSTALL_FAILED = 7;
16300    }
16301
16302    optional Status status = 4;
16303
16304    // Compilation time iof primary boot classpath extensions.
16305    optional int32 primary_bcp_compilation_seconds = 5;
16306
16307    // Compilation time of secondary boot classpath extensions.
16308    optional int32 secondary_bcp_compilation_seconds = 6;
16309
16310    // Compilation time of system_server classpath.
16311    optional int32 system_server_compilation_seconds = 7;
16312
16313    // Cache space at start of update.
16314    optional int32 cache_space_free_start_mib = 8;
16315
16316    // Cache space at end of update.
16317    optional int32 cache_space_free_end_mib = 9;
16318};
16319
16320/*
16321 * Logged when a package's user-level hibernation state changes.
16322 * Logged from:
16323 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
16324 */
16325 message UserLevelHibernationStateChanged {
16326    // Name of the package that had its hibernation state change.
16327    optional string package_name = 1;
16328
16329    // Android user id to which this event belongs. This can only be 0, 10, 11 and so on.
16330    optional int32 user_id = 2;
16331
16332    // New hibernation state. True if hibernating, false otherwise
16333    optional bool is_hibernating = 3;
16334}
16335
16336/*
16337 * Pull atom for the number of hibernated packages on the device for the given user.
16338 * Logged from:
16339 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
16340 */
16341message UserLevelHibernatedApps {
16342    // Total number of apps hibernated for the user
16343    optional int32 hibernated_app_count = 1;
16344
16345    // Android user id of the queried user which can only be 0, 10, 11 and so on.
16346    optional int32 user_id = 2;
16347}
16348
16349/**
16350 * Pull atom for total number of globally hibernated packages on the device and the storage savings
16351 * from these apps being hibernated.
16352 * Logged from:
16353 *   frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
16354 */
16355message GlobalHibernatedApps {
16356    // Total number of apps in global hibernation
16357    optional int32 hibernated_app_count = 1;
16358
16359    // Cumulative storage savings from apps being hibernated
16360    optional int64 storage_saved_mb = 2;
16361}
16362
16363/*
16364 * Report the event of app process kills.
16365 * Logged from:
16366 *   frameworks/base/services/core/java/com/android/server/am/AppExitInfoTracker.java
16367 */
16368message AppProcessDied {
16369    // Uid of the package of the dying process
16370    optional int32 uid = 1 [(is_uid) = true];
16371
16372    // Name of the dying process, it'll be omitted if the process name and package name are the same
16373    optional string process_name = 2;
16374
16375    // The reason code of why the process dies
16376    optional android.app.AppExitReasonCode reason = 3;
16377
16378    // The supplemental reason code of why the process dies
16379    optional android.app.AppExitSubReasonCode sub_reason = 4;
16380
16381    // The importance of the process when it dies
16382    optional android.app.Importance importance = 5;
16383
16384    // The last known PSS (in kB) of the process before it dies, could be 0.
16385    optional int32 pss = 6;
16386
16387    // The last known RSS (in kB) of the process before it dies, could be 0.
16388    optional int32 rss = 7;
16389}
16390
16391/**
16392 * Logs input event statistics.
16393 * Pulls the statistics.
16394 *
16395 * Logged from:
16396 *   frameworks/native/services/inputflinger
16397 */
16398message InputEventLatencySketch {
16399    /**
16400     * The 'bytes' field is the serialized KLL sketch. It is to be deserialized into an object of
16401     * KLL proto, which would then be converted into a KLL sketch. The KLL sketch is a histogram
16402     * of the data.
16403     *
16404     * The goal of this data is to identify the bottlenecks in processing of input events.
16405     * All sketches measure durations in a streaming fashion.
16406     * The units are "hundreds of microseconds", or 0.1 ms. They are chosen like this in order
16407     * to reduce the occupied space.
16408     * The start and end points for each value are described in the comments.
16409     *
16410     * We distinguish between 'DOWN' event latency (when the pointer first goes down), and 'MOVE'
16411     * event latency, which characterizes the scrolling experience.
16412     */
16413
16414    // -------------------------- DOWN event sketches ------ START ---------------------------------
16415    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16416    // End: the event was read in userspace (in EventHub)
16417    optional bytes event_to_read_100micros_down_sketch = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
16418    // Start: the event was read in EventHub
16419    // End: the event was send to the app via the InputChannel (written to the socket)
16420    optional bytes read_to_deliver_100micros_down_sketch = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
16421    // Start: the input event was sent to the app
16422    // End: the app consumed the input event
16423    optional bytes deliver_to_consume_100micros_down_sketch = 3 [(android.os.statsd.log_mode) = MODE_BYTES];
16424    // Start: the app consumed the event
16425    // End: the app's 'finishInputEvent' call was received in inputflinger
16426    // The end point can also be called "the app finished processing input event"
16427    optional bytes consume_to_finish_100micros_down_sketch = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
16428    // Start: the app consumed the input event
16429    // End: the app produced a buffer
16430    optional bytes consume_to_gpu_complete_100micros_down_sketch = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
16431    // Start: the app produced a buffer
16432    // End: the frame was shown on the display
16433    optional bytes gpu_complete_to_present_100micros_down_sketch = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
16434    // The end-to-end touch latency
16435    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16436    // End: the frame was presented on the display
16437    optional bytes end_to_end_100micros_down_sketch = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
16438    // -------------------------- DOWN event sketches ------ END -----------------------------------
16439
16440    // -------------------------- MOVE event sketches ------ START ---------------------------------
16441    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16442    // End: the event was read in userspace (in EventHub)
16443    optional bytes event_to_read_100micros_move_sketch = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
16444    // Start: the event was read in EventHub
16445    // End: the event was send to the app via the InputChannel (written to the socket)
16446    optional bytes read_to_deliver_100micros_move_sketch = 9 [(android.os.statsd.log_mode) = MODE_BYTES];
16447    // Start: the input event was sent to the app
16448    // End: the app consumed the input event
16449    optional bytes deliver_to_consume_100micros_move_sketch = 10 [(android.os.statsd.log_mode) = MODE_BYTES];
16450    // Start: the app consumed the event
16451    // End: the app's 'finishInputEvent' call was received in inputflinger
16452    // The end point can also be called "the app finished processing input event"
16453    optional bytes consume_to_finish_100micros_move_sketch = 11 [(android.os.statsd.log_mode) = MODE_BYTES];
16454    // Start: the app consumed the input event
16455    // End: the app produced a buffer
16456    optional bytes consume_to_gpu_complete_100micros_move_sketch = 12 [(android.os.statsd.log_mode) = MODE_BYTES];
16457    // Start: the app produced a buffer
16458    // End: the frame was shown on the display
16459    optional bytes gpu_complete_to_present_100micros_move_sketch = 13 [(android.os.statsd.log_mode) = MODE_BYTES];
16460    // The end-to-end touch latency
16461    // Start: the input event was created (touch events: the touch interrupt received in the driver)
16462    // End: the frame was presented on the display
16463    optional bytes end_to_end_100micros_move_sketch = 14 [(android.os.statsd.log_mode) = MODE_BYTES];
16464    // -------------------------- MOVE event sketches ------ END -----------------------------------
16465}
16466
16467// Each pull creates multiple atoms. One for each incremental package.
16468message InstalledIncrementalPackage {
16469    optional int32 uid = 1 [(is_uid) = true];
16470}
16471
16472/**
16473 * Memory management statistics pulled atom based on /proc/vmstat.
16474 * Logged from StatsPullAtomService.
16475 */
16476message VmStat {
16477    optional int32 oom_kill_count = 1;
16478}
16479
16480/**
16481* Log that the user has interacted with an app on the permission usage
16482* fragment.
16483* Logged from permission/debug/PermissionUsageV2Frament.kt
16484*/
16485message PermissionUsageFragmentInteraction {
16486    // id which identifies single session of user interacting with permission hub
16487    optional int64 session_id = 1;
16488
16489    enum Action {
16490        UNDEFINED = 0;
16491        OPEN = 1;
16492        LOCATION_ACCESS_TIMELINE_VIEWED = 2;
16493        CAMERA_ACCESS_TIMELINE_VIEWED = 3;
16494        MICROPHONE_ACCESS_TIMELINE_VIEWED = 4;
16495        SHOW_SYSTEM_CLICKED = 5;
16496        SEE_OTHER_PERMISSIONS_CLICKED = 6;
16497    }
16498
16499    // The action the user took to interact with the fragment
16500    optional Action action = 2;
16501}
16502
16503/**
16504* Log that the user has clicked on .
16505* Logged from permission/debug/PermissionDetailsFragment.kt
16506*/
16507message PermissionDetailsInteraction {
16508    // id which identifies single session of user interacting with permission details fragment.
16509    optional int64 session_id = 1;
16510
16511    // The name of a permission group whose details are viewed.
16512    optional string permission_group_name = 2;
16513
16514    enum Action {
16515        UNDEFINED = 0;
16516        SHOW_SYSTEM_CLICKED = 1;
16517        INFO_ICON_CLICKED = 2;
16518    }
16519
16520    // Package name for which the info icon was clicked.
16521    optional string package_name = 3;
16522
16523    // The action the user took to interact with the fragment
16524    optional Action action = 4;
16525}
16526
16527/**
16528* Log that the user has toggled the sensor privacy.
16529*/
16530message PrivacySensorToggleInteraction {
16531
16532    enum Sensor {
16533        SENSOR_UNKNOWN = 0;
16534        MICROPHONE = 1;
16535        CAMERA = 2;
16536
16537    }
16538
16539    // Sensor for which sensor privacy was toggled.
16540    optional Sensor sensor = 1;
16541
16542    enum Action {
16543        ACTION_UNKNOWN = 0;
16544        TOGGLE_ON = 1;
16545        TOGGLE_OFF = 2;
16546    }
16547
16548    // Action taken on sensor.
16549    optional Action action = 2;
16550
16551    enum Source {
16552        SOURCE_UNKNOWN = 0;
16553        DIALOG = 1;
16554        SETTINGS = 2;
16555        QS_TILE = 3;
16556    }
16557
16558    // Source for the toggling.
16559    optional Source source = 3;
16560
16561    // Amount of time a user spent in the previous sensor privacy state in minutes.
16562    optional int64 time_in_previous_state_in_mins = 4;
16563}
16564
16565message PrivacyToggleDialogInteraction {
16566
16567    enum Action {
16568        ACTION_UNKNOWN = 0;
16569        ENABLE = 1;
16570        CANCEL = 2;
16571    }
16572
16573    // Action taken on the toggle dialog.
16574    optional Action action = 1;
16575
16576    // Name of the package for which the dialog was shown.
16577    optional string package_name = 2;
16578}
16579