1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.os.statsd;
20option java_package = "com.android.os";
21option java_outer_classname = "AtomsProto";
22
23import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
24import "frameworks/base/core/proto/android/app/enums.proto";
25import "frameworks/base/core/proto/android/app/job/enums.proto";
26import "frameworks/base/core/proto/android/app/settings_enums.proto";
27import "frameworks/base/core/proto/android/app/media_output_enum.proto";
28import "frameworks/base/core/proto/android/app/tvsettings_enums.proto";
29import "frameworks/base/core/proto/android/bluetooth/a2dp/enums.proto";
30import "frameworks/base/core/proto/android/bluetooth/enums.proto";
31import "frameworks/base/core/proto/android/bluetooth/hci/enums.proto";
32import "frameworks/base/core/proto/android/bluetooth/hfp/enums.proto";
33import "frameworks/base/core/proto/android/bluetooth/smp/enums.proto";
34import "frameworks/base/core/proto/android/debug/enums.proto";
35import "frameworks/base/core/proto/android/hardware/biometrics/enums.proto";
36import "frameworks/base/core/proto/android/hardware/sensor/assist/enums.proto";
37import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
38import "frameworks/base/core/proto/android/os/enums.proto";
39import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
40import "frameworks/base/core/proto/android/server/enums.proto";
41import "frameworks/base/core/proto/android/server/job/enums.proto";
42import "frameworks/base/core/proto/android/server/location/enums.proto";
43import "frameworks/base/core/proto/android/service/procstats_enum.proto";
44import "frameworks/base/core/proto/android/service/usb.proto";
45import "frameworks/base/core/proto/android/stats/connectivity/network_stack.proto";
46import "frameworks/base/core/proto/android/stats/connectivity/tethering.proto";
47import "frameworks/base/core/proto/android/stats/dnsresolver/dns_resolver.proto";
48import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
49import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
50import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
51import "frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto";
52import "frameworks/base/core/proto/android/stats/enums.proto";
53import "frameworks/base/core/proto/android/stats/intelligence/enums.proto";
54import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
55import "frameworks/base/core/proto/android/stats/location/location_enums.proto";
56import "frameworks/base/core/proto/android/stats/mediametrics/mediametrics.proto";
57import "frameworks/base/core/proto/android/stats/mediaprovider/mediaprovider_enums.proto";
58import "frameworks/base/core/proto/android/stats/storage/storage_enums.proto";
59import "frameworks/base/core/proto/android/stats/style/style_enums.proto";
60import "frameworks/base/core/proto/android/stats/sysui/notification_enums.proto";
61import "frameworks/base/core/proto/android/telecomm/enums.proto";
62import "frameworks/base/core/proto/android/telephony/enums.proto";
63import "frameworks/base/core/proto/android/view/enums.proto";
64import "frameworks/base/core/proto/android/wifi/enums.proto";
65import "frameworks/base/core/proto/android/stats/textclassifier/textclassifier_enums.proto";
66import "frameworks/base/core/proto/android/stats/otaupdate/updateengine_enums.proto";
67
68/**
69 * The master atom class. This message defines all of the available
70 * raw stats log events from the Android system, also known as "atoms."
71 *
72 * This field contains a single oneof with all of the available messages.
73 * The stats-log-api-gen tool runs as part of the Android build and
74 * generates the android.util.StatsLog class, which contains the constants
75 * and methods that Android uses to log.
76 *
77 * This Atom class is not actually built into the Android system.
78 * Instead, statsd on Android constructs these messages synthetically,
79 * in the format defined here and in stats_log.proto.
80 */
81message Atom {
82    // Pushed atoms start at 2.
83    oneof pushed {
84        // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
85        BleScanStateChanged ble_scan_state_changed = 2
86                [(module) = "bluetooth", (module) = "statsdtest"];
87        ProcessStateChanged process_state_changed = 3 [(module) = "framework"];
88        BleScanResultReceived ble_scan_result_received = 4 [(module) = "bluetooth"];
89        SensorStateChanged sensor_state_changed =
90                5 [(module) = "framework", (module) = "statsdtest"];
91        GpsScanStateChanged gps_scan_state_changed = 6 [(module) = "framework"];
92        SyncStateChanged sync_state_changed = 7 [(module) = "framework", (module) = "statsdtest"];
93        ScheduledJobStateChanged scheduled_job_state_changed =
94                8 [(module) = "framework", (module) = "statsdtest"];
95        ScreenBrightnessChanged screen_brightness_changed =
96                9 [(module) = "framework", (module) = "statsdtest"];
97        WakelockStateChanged wakelock_state_changed =
98                10 [(module) = "framework", (module) = "statsdtest"];
99        LongPartialWakelockStateChanged long_partial_wakelock_state_changed =
100                11 [(module) = "framework"];
101        MobileRadioPowerStateChanged mobile_radio_power_state_changed =
102                12 [(module) = "framework", (truncate_timestamp) = true];
103        WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13 [(module) = "framework"];
104        ActivityManagerSleepStateChanged activity_manager_sleep_state_changed =
105                14 [(module) = "framework"];
106        MemoryFactorStateChanged memory_factor_state_changed = 15 [(module) = "framework"];
107        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16 [(module) = "framework"];
108        CachedKillReported cached_kill_reported = 17 [(module) = "framework"];
109        ProcessMemoryStatReported process_memory_stat_reported = 18 [(module) = "framework"];
110        LauncherUIChanged launcher_event = 19 [(module) = "sysui"];
111        BatterySaverModeStateChanged battery_saver_mode_state_changed =
112                20 [(module) = "framework", (module) = "statsdtest"];
113        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21 [(module) = "framework"];
114        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22 [(module) = "framework"];
115        AudioStateChanged audio_state_changed =
116                23 [(module) = "framework", (truncate_timestamp) = true];
117        MediaCodecStateChanged media_codec_state_changed = 24 [(module) = "framework"];
118        CameraStateChanged camera_state_changed = 25 [(module) = "framework"];
119        FlashlightStateChanged flashlight_state_changed = 26 [(module) = "framework"];
120        UidProcessStateChanged uid_process_state_changed =
121                27 [(module) = "framework", (module) = "statsdtest"];
122        ProcessLifeCycleStateChanged process_life_cycle_state_changed =
123                28 [(module) = "framework", (module) = "statsdtest"];
124        ScreenStateChanged screen_state_changed =
125                29 [(module) = "framework", (module) = "statsdtest"];
126        BatteryLevelChanged battery_level_changed =
127                30 [(module) = "framework", (module) = "statsdtest"];
128        ChargingStateChanged charging_state_changed = 31 [(module) = "framework"];
129        PluggedStateChanged plugged_state_changed = 32
130                [(module) = "framework", (module) = "statsdtest"];
131        InteractiveStateChanged interactive_state_changed = 33 [(module) = "framework"];
132        TouchEventReported touch_event_reported = 34;
133        WakeupAlarmOccurred wakeup_alarm_occurred = 35 [(module) = "framework"];
134        KernelWakeupReported kernel_wakeup_reported = 36 [(module) = "framework"];
135        WifiLockStateChanged wifi_lock_state_changed = 37 [(module) = "wifi"];
136        WifiSignalStrengthChanged wifi_signal_strength_changed = 38 [(module) = "wifi"];
137        WifiScanStateChanged wifi_scan_state_changed = 39 [(module) = "wifi"];
138        PhoneSignalStrengthChanged phone_signal_strength_changed =
139                40 [(module) = "framework", (truncate_timestamp) = true];
140        SettingChanged setting_changed = 41 [(module) = "framework"];
141        ActivityForegroundStateChanged activity_foreground_state_changed =
142                42 [(module) = "framework", (module) = "statsdtest"];
143        IsolatedUidChanged isolated_uid_changed =
144                43 [(module) = "framework", (module) = "statsd", (module) = "statsdtest"];
145        PacketWakeupOccurred packet_wakeup_occurred = 44 [(module) = "framework"];
146        WallClockTimeShifted wall_clock_time_shifted = 45 [(module) = "framework"];
147        AnomalyDetected anomaly_detected = 46 [(module) = "statsd"];
148        AppBreadcrumbReported app_breadcrumb_reported = 47 [(module) = "statsd"];
149        AppStartOccurred app_start_occurred = 48 [(module) = "framework", (module) = "statsdtest"];
150        AppStartCanceled app_start_canceled = 49 [(module) = "framework"];
151        AppStartFullyDrawn app_start_fully_drawn = 50 [(module) = "framework"];
152        LmkKillOccurred lmk_kill_occurred = 51 [(module) = "lmkd"];
153        PictureInPictureStateChanged picture_in_picture_state_changed = 52 [(module) = "framework"];
154        WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53 [(module) = "wifi"];
155        LmkStateChanged lmk_state_changed = 54 [(module) = "lmkd"];
156        AppStartMemoryStateCaptured app_start_memory_state_captured = 55 [(module) = "framework"];
157        ShutdownSequenceReported shutdown_sequence_reported = 56 [(module) = "framework"];
158        BootSequenceReported boot_sequence_reported = 57;
159        DaveyOccurred davey_occurred = 58 [(module) = "statsd"];
160        OverlayStateChanged overlay_state_changed =
161                59 [(module) = "framework", (module) = "statsdtest"];
162        ForegroundServiceStateChanged foreground_service_state_changed
163                = 60 [(module) = "framework"];
164        CallStateChanged call_state_changed =
165                61 [(module) = "telecom", (truncate_timestamp) = true];
166        KeyguardStateChanged keyguard_state_changed = 62 [(module) = "sysui"];
167        KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63 [(module) = "sysui"];
168        KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64 [(module) = "sysui"];
169        AppDied app_died = 65 [(module) = "framework"];
170        ResourceConfigurationChanged resource_configuration_changed = 66 [(module) = "framework"];
171        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67 [(module) = "framework"];
172        BluetoothConnectionStateChanged bluetooth_connection_state_changed =
173                68 [(module) = "bluetooth"];
174        GpsSignalQualityChanged gps_signal_quality_changed = 69 [(module) = "framework"];
175        UsbConnectorStateChanged usb_connector_state_changed = 70 [(module) = "framework"];
176        SpeakerImpedanceReported speaker_impedance_reported = 71;
177        HardwareFailed hardware_failed = 72;
178        PhysicalDropDetected physical_drop_detected = 73;
179        ChargeCyclesReported charge_cycles_reported = 74;
180        MobileConnectionStateChanged mobile_connection_state_changed = 75 [(module) = "telephony"];
181        MobileRadioTechnologyChanged mobile_radio_technology_changed = 76 [(module) = "telephony"];
182        UsbDeviceAttached usb_device_attached = 77 [(module) = "framework"];
183        AppCrashOccurred app_crash_occurred = 78 [(module) = "framework", (module) = "statsdtest"];
184        ANROccurred anr_occurred = 79 [(module) = "framework"];
185        WTFOccurred wtf_occurred = 80 [(module) = "framework"];
186        LowMemReported low_mem_reported = 81 [(module) = "framework"];
187        GenericAtom generic_atom = 82;
188        KeyValuePairsAtom key_value_pairs_atom = 83 [(module) = "framework", (module) = "statsd"];
189        VibratorStateChanged vibrator_state_changed = 84 [(module) = "framework"];
190        DeferredJobStatsReported deferred_job_stats_reported = 85 [(module) = "framework"];
191        ThermalThrottlingStateChanged thermal_throttling = 86 [deprecated=true];
192        BiometricAcquired biometric_acquired = 87 [(module) = "framework"];
193        BiometricAuthenticated biometric_authenticated = 88 [(module) = "framework"];
194        BiometricErrorOccurred biometric_error_occurred = 89 [(module) = "framework"];
195        UiEventReported ui_event_reported = 90 [(module) = "framework", (module) = "sysui"];
196        BatteryHealthSnapshot battery_health_snapshot = 91;
197        SlowIo slow_io = 92;
198        BatteryCausedShutdown battery_caused_shutdown = 93;
199        PhoneServiceStateChanged phone_service_state_changed = 94 [(module) = "framework"];
200        PhoneStateChanged phone_state_changed = 95 [(module) = "framework"];
201        UserRestrictionChanged user_restriction_changed = 96;
202        SettingsUIChanged settings_ui_changed = 97 [(module) = "settings"];
203        ConnectivityStateChanged connectivity_state_changed = 98 [(module) = "framework"];
204        // TODO: service state change is very noisy shortly after boot, as well
205        // as at other transitions - coming out of doze, device plugged in, etc.
206        // Consider removing this if it becomes a problem
207        ServiceStateChanged service_state_changed = 99 [(module) = "framework"];
208        ServiceLaunchReported service_launch_reported = 100 [(module) = "framework"];
209        FlagFlipUpdateOccurred flag_flip_update_occurred = 101 [(module) = "framework"];
210        BinaryPushStateChanged binary_push_state_changed = 102 [(module) = "statsd"];
211        DevicePolicyEvent device_policy_event = 103 [(module) = "framework"];
212        DocsUIFileOperationCanceledReported docs_ui_file_op_canceled = 104 [(module) = "docsui"];
213        DocsUIFileOperationCopyMoveModeReported docs_ui_file_op_copy_move_mode_reported =
214            105 [(module) = "docsui"];
215        DocsUIFileOperationFailureReported docs_ui_file_op_failure = 106 [(module) = "docsui"];
216        DocsUIFileOperationReported docs_ui_provider_file_op = 107 [(module) = "docsui"];
217        DocsUIInvalidScopedAccessRequestReported docs_ui_invalid_scoped_access_request =
218            108 [(module) = "docsui"];
219        DocsUILaunchReported docs_ui_launch_reported = 109 [(module) = "docsui"];
220        DocsUIRootVisitedReported docs_ui_root_visited = 110 [(module) = "docsui"];
221        DocsUIStartupMsReported docs_ui_startup_ms = 111 [(module) = "docsui"];
222        DocsUIUserActionReported docs_ui_user_action_reported = 112 [(module) = "docsui"];
223        WifiEnabledStateChanged wifi_enabled_state_changed = 113 [(module) = "framework"];
224        WifiRunningStateChanged wifi_running_state_changed = 114
225                [(module) = "framework", deprecated = true];
226        AppCompacted app_compacted = 115 [(module) = "framework"];
227        NetworkDnsEventReported network_dns_event_reported = 116 [(module) = "resolv"];
228        DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported =
229            117 [(module) = "docsui"];
230        DocsUIPickResultReported docs_ui_pick_result_reported = 118 [(module) = "docsui"];
231        DocsUISearchModeReported docs_ui_search_mode_reported = 119 [(module) = "docsui"];
232        DocsUISearchTypeReported docs_ui_search_type_reported = 120 [(module) = "docsui"];
233        DataStallEvent data_stall_event = 121 [(module) = "network_stack"];
234        RescuePartyResetReported rescue_party_reset_reported = 122 [(module) = "framework"];
235        SignedConfigReported signed_config_reported = 123 [(module) = "framework"];
236        GnssNiEventReported gnss_ni_event_reported = 124 [(module) = "framework"];
237        BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event =
238                125 [(module) = "bluetooth"];
239        BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed =
240                126 [(module) = "bluetooth"];
241        BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed =
242                127 [(module) = "bluetooth"];
243        AppDowngraded app_downgraded = 128 [(module) = "framework"];
244        AppOptimizedAfterDowngraded app_optimized_after_downgraded = 129;
245        LowStorageStateChanged low_storage_state_changed = 130 [(module) = "framework"];
246        GnssNfwNotificationReported gnss_nfw_notification_reported = 131 [(module) = "framework"];
247        GnssConfigurationReported gnss_configuration_reported = 132 [(module) = "framework"];
248        UsbPortOverheatEvent usb_port_overheat_event_reported = 133;
249        NfcErrorOccurred nfc_error_occurred = 134 [(module) = "nfc"];
250        NfcStateChanged nfc_state_changed = 135 [(module) = "nfc"];
251        NfcBeamOccurred nfc_beam_occurred = 136 [(module) = "nfc"];
252        NfcCardemulationOccurred nfc_cardemulation_occurred = 137 [(module) = "nfc"];
253        NfcTagOccurred nfc_tag_occurred = 138 [(module) = "nfc"];
254        NfcHceTransactionOccurred nfc_hce_transaction_occurred = 139 [(module) = "nfc"];
255        SeStateChanged se_state_changed = 140 [(module) = "secure_element"];
256        SeOmapiReported se_omapi_reported = 141 [(module) = "secure_element"];
257        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported =
258                142 [(module) = "framework"];
259        AttentionManagerServiceResultReported attention_manager_service_result_reported =
260                143 [(module) = "framework"];
261        AdbConnectionChanged adb_connection_changed = 144 [(module) = "framework"];
262        SpeechDspStatReported speech_dsp_stat_reported = 145;
263        UsbContaminantReported usb_contaminant_reported = 146 [(module) = "framework"];
264        WatchdogRollbackOccurred watchdog_rollback_occurred =
265                147 [(module) = "framework", (module) = "statsd"];
266        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected =
267                148 [(module) = "framework"];
268        BubbleUIChanged bubble_ui_changed = 149 [(module) = "sysui"];
269        ScheduledJobConstraintChanged scheduled_job_constraint_changed =
270                150 [(module) = "framework"];
271        BluetoothActiveDeviceChanged bluetooth_active_device_changed =
272                151 [(module) = "bluetooth"];
273        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed =
274                152 [(module) = "bluetooth"];
275        BluetoothA2dpCodecConfigChanged bluetooth_a2dp_codec_config_changed =
276                153 [(module) = "bluetooth"];
277        BluetoothA2dpCodecCapabilityChanged bluetooth_a2dp_codec_capability_changed =
278                154 [(module) = "bluetooth"];
279        BluetoothA2dpAudioUnderrunReported bluetooth_a2dp_audio_underrun_reported =
280                155 [(module) = "bluetooth"];
281        BluetoothA2dpAudioOverrunReported bluetooth_a2dp_audio_overrun_reported =
282                156 [(module) = "bluetooth"];
283        BluetoothDeviceRssiReported bluetooth_device_rssi_reported =
284                157 [(module) = "bluetooth"];
285        BluetoothDeviceFailedContactCounterReported
286                bluetooth_device_failed_contact_counter_reported = 158 [(module) = "bluetooth"];
287        BluetoothDeviceTxPowerLevelReported bluetooth_device_tx_power_level_reported =
288                159 [(module) = "bluetooth"];
289        BluetoothHciTimeoutReported bluetooth_hci_timeout_reported =
290                160 [(module) = "bluetooth"];
291        BluetoothQualityReportReported bluetooth_quality_report_reported =
292                161 [(module) = "bluetooth"];
293        BluetoothDeviceInfoReported bluetooth_device_info_reported =
294                162 [(module) = "bluetooth"];
295        BluetoothRemoteVersionInfoReported bluetooth_remote_version_info_reported =
296                163 [(module) = "bluetooth"];
297        BluetoothSdpAttributeReported bluetooth_sdp_attribute_reported =
298                164 [(module) = "bluetooth"];
299        BluetoothBondStateChanged bluetooth_bond_state_changed =
300                165 [(module) = "bluetooth"];
301        BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported =
302                166 [(module) = "bluetooth"];
303        BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported =
304                167 [(module) = "bluetooth"];
305        ScreenTimeoutExtensionReported screen_timeout_extension_reported =
306                168 [(module) = "framework"];
307        ProcessStartTime process_start_time = 169 [(module) = "framework"];
308        PermissionGrantRequestResultReported permission_grant_request_result_reported =
309                170 [(module) = "permissioncontroller"];
310        BluetoothSocketConnectionStateChanged bluetooth_socket_connection_state_changed = 171;
311        DeviceIdentifierAccessDenied device_identifier_access_denied =
312                172 [(module) = "telephony_common"];
313        BubbleDeveloperErrorReported bubble_developer_error_reported = 173 [(module) = "framework"];
314        AssistGestureStageReported assist_gesture_stage_reported = 174 [(module) = "sysui"];
315        AssistGestureFeedbackReported assist_gesture_feedback_reported = 175 [(module) = "sysui"];
316        AssistGestureProgressReported assist_gesture_progress_reported = 176 [(module) = "sysui"];
317        TouchGestureClassified touch_gesture_classified = 177 [(module) = "framework"];
318        HiddenApiUsed hidden_api_used = 178 [(module) = "framework"];
319        StyleUIChanged style_ui_changed = 179 [(module) = "sysui"];
320        PrivacyIndicatorsInteracted privacy_indicators_interacted =
321                180 [(module) = "permissioncontroller"];
322        AppInstallOnExternalStorageReported app_install_on_external_storage_reported =
323                181 [(module) = "framework"];
324        NetworkStackReported network_stack_reported = 182 [(module) = "network_stack"];
325        AppMovedStorageReported app_moved_storage_reported = 183 [(module) = "framework"];
326        BiometricEnrolled biometric_enrolled = 184 [(module) = "framework"];
327        SystemServerWatchdogOccurred system_server_watchdog_occurred = 185 [(module) = "framework"];
328        TombStoneOccurred tomb_stone_occurred = 186 [(module) = "framework"];
329        BluetoothClassOfDeviceReported bluetooth_class_of_device_reported =
330                187 [(module) = "bluetooth"];
331        IntelligenceEventReported intelligence_event_reported =
332                188 [(module) = "intelligence"];
333        ThermalThrottlingSeverityStateChanged thermal_throttling_severity_state_changed =
334                189 [(module) = "framework"];
335        RoleRequestResultReported role_request_result_reported =
336                190 [(module) = "permissioncontroller"];
337        MediametricsAudiopolicyReported mediametrics_audiopolicy_reported = 191;
338        MediametricsAudiorecordReported mediametrics_audiorecord_reported = 192;
339        MediametricsAudiothreadReported mediametrics_audiothread_reported = 193;
340        MediametricsAudiotrackReported mediametrics_audiotrack_reported = 194;
341        MediametricsCodecReported mediametrics_codec_reported = 195;
342        MediametricsDrmWidevineReported mediametrics_drm_widevine_reported = 196;
343        MediametricsExtractorReported mediametrics_extractor_reported = 197;
344        MediametricsMediadrmReported mediametrics_mediadrm_reported = 198;
345        MediametricsNuPlayerReported mediametrics_nuplayer_reported = 199;
346        MediametricsRecorderReported mediametrics_recorder_reported = 200;
347        MediametricsDrmManagerReported mediametrics_drmmanager_reported = 201;
348        CarPowerStateChanged car_power_state_changed = 203 [(module) = "car"];
349        GarageModeInfo garage_mode_info = 204 [(module) = "car"];
350        TestAtomReported test_atom_reported = 205 [(module) = "cts"];
351        ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported =
352                206 [(module) = "framework"];
353        ContentCaptureServiceEvents content_capture_service_events = 207 [(module) = "framework"];
354        ContentCaptureSessionEvents content_capture_session_events = 208 [(module) = "framework"];
355        ContentCaptureFlushed content_capture_flushed = 209 [(module) = "framework"];
356        LocationManagerApiUsageReported location_manager_api_usage_reported =
357                210 [(module) = "framework"];
358        ReviewPermissionsFragmentResultReported review_permissions_fragment_result_reported =
359                211 [(module) = "permissioncontroller"];
360        RuntimePermissionsUpgradeResult runtime_permissions_upgrade_result =
361                212 [(module) = "permissioncontroller"];
362        GrantPermissionsActivityButtonActions grant_permissions_activity_button_actions =
363                213 [(module) = "permissioncontroller"];
364        LocationAccessCheckNotificationAction location_access_check_notification_action =
365                214 [(module) = "permissioncontroller"];
366        AppPermissionFragmentActionReported app_permission_fragment_action_reported =
367                215 [(module) = "permissioncontroller"];
368        AppPermissionFragmentViewed app_permission_fragment_viewed =
369                216 [(module) = "permissioncontroller"];
370        AppPermissionsFragmentViewed app_permissions_fragment_viewed =
371                217 [(module) = "permissioncontroller"];
372        PermissionAppsFragmentViewed permission_apps_fragment_viewed =
373                218  [(module) = "permissioncontroller"];
374        TextSelectionEvent text_selection_event = 219  [(module) = "textclassifier"];
375        TextLinkifyEvent text_linkify_event = 220  [(module) = "textclassifier"];
376        ConversationActionsEvent conversation_actions_event = 221  [(module) = "textclassifier"];
377        LanguageDetectionEvent language_detection_event = 222  [(module) = "textclassifier"];
378        ExclusionRectStateChanged exclusion_rect_state_changed = 223 [(module) = "framework"];
379        BackGesture back_gesture_reported_reported = 224 [(module) = "sysui"];
380        UpdateEngineUpdateAttemptReported update_engine_update_attempt_reported = 225;
381        UpdateEngineSuccessfulUpdateReported update_engine_successful_update_reported = 226;
382        CameraActionEvent camera_action_event = 227 [(module) = "framework"];
383        AppCompatibilityChangeReported app_compatibility_change_reported =
384                228 [(module) = "framework"];
385        PerfettoUploaded perfetto_uploaded = 229 [(module) = "perfetto"];
386        VmsClientConnectionStateChanged vms_client_connection_state_changed =
387                230 [(module) = "car"];
388        MediaProviderScanOccurred media_provider_scan_occurred = 233 [(module) = "mediaprovider"];
389        MediaContentDeleted media_content_deleted = 234 [(module) = "mediaprovider"];
390        MediaProviderPermissionRequested media_provider_permission_requested =
391            235 [(module) = "mediaprovider"];
392        MediaProviderSchemaChanged media_provider_schema_changed = 236 [(module) = "mediaprovider"];
393        MediaProviderIdleMaintenanceFinished media_provider_idle_maintenance_finished =
394            237 [(module) = "mediaprovider"];
395        RebootEscrowRecoveryReported reboot_escrow_recovery_reported = 238 [(module) = "framework"];
396        BootTimeEventDuration boot_time_event_duration_reported = 239 [(module) = "framework"];
397        BootTimeEventElapsedTime boot_time_event_elapsed_time_reported =
398                240 [(module) = "framework"];
399        BootTimeEventUtcTime boot_time_event_utc_time_reported = 241;
400        BootTimeEventErrorCode boot_time_event_error_code_reported = 242 [(module) = "framework"];
401        UserspaceRebootReported userspace_reboot_reported = 243 [(module) = "framework"];
402        NotificationReported notification_reported = 244 [(module) = "framework"];
403        NotificationPanelReported notification_panel_reported = 245 [(module) = "sysui"];
404        NotificationChannelModified notification_channel_modified = 246 [(module) = "framework"];
405        IntegrityCheckResultReported integrity_check_result_reported = 247 [(module) = "framework"];
406        IntegrityRulesPushed integrity_rules_pushed = 248 [(module) = "framework"];
407        CellBroadcastMessageReported cb_message_reported =
408            249 [(module) = "cellbroadcast"];
409        CellBroadcastMessageError cb_message_error =
410            250 [(module) = "cellbroadcast"];
411        WifiHealthStatReported wifi_health_stat_reported = 251 [(module) = "wifi"];
412        WifiFailureStatReported wifi_failure_stat_reported = 252 [(module) = "wifi"];
413        WifiConnectionResultReported wifi_connection_result_reported = 253 [(module) = "wifi"];
414        AppFreezeChanged app_freeze_changed = 254 [(module) = "framework"];
415        SnapshotMergeReported snapshot_merge_reported = 255;
416        ForegroundServiceAppOpSessionEnded foreground_service_app_op_session_ended =
417            256  [(module) = "framework"];
418        DisplayJankReported display_jank_reported = 257;
419        AppStandbyBucketChanged app_standby_bucket_changed = 258 [(module) = "framework"];
420        SharesheetStarted sharesheet_started = 259 [(module) = "framework"];
421        RankingSelected ranking_selected = 260 [(module) = "framework", (module) = "sysui"];
422        TvSettingsUIInteracted tvsettings_ui_interacted = 261 [(module) = "tv_settings"];
423        LauncherStaticLayout launcher_snapshot = 262 [(module) = "sysui"];
424        PackageInstallerV2Reported package_installer_v2_reported = 263 [(module) = "framework"];
425        UserLifecycleJourneyReported user_lifecycle_journey_reported = 264 [(module) = "framework"];
426        UserLifecycleEventOccurred user_lifecycle_event_occurred = 265 [(module) = "framework"];
427        AccessibilityShortcutReported accessibility_shortcut_reported =
428            266 [(module) = "framework"];
429        AccessibilityServiceReported accessibility_service_reported = 267 [(module) = "settings"];
430        DocsUIDragAndDropReported docs_ui_drag_and_drop_reported = 268 [(module) = "docsui"];
431        AppUsageEventOccurred app_usage_event_occurred = 269 [(module) = "framework"];
432        AutoRevokeNotificationClicked auto_revoke_notification_clicked =
433            270 [(module) = "permissioncontroller"];
434        AutoRevokeFragmentAppViewed auto_revoke_fragment_app_viewed =
435            271 [(module) = "permissioncontroller"];
436        AutoRevokedAppInteraction auto_revoked_app_interaction =
437            272 [(module) = "permissioncontroller", (module) = "settings"];
438        AppPermissionGroupsFragmentAutoRevokeAction
439            app_permission_groups_fragment_auto_revoke_action =
440            273 [(module) = "permissioncontroller"];
441        EvsUsageStatsReported evs_usage_stats_reported = 274 [(module) = "evs"];
442        AudioPowerUsageDataReported audio_power_usage_data_reported = 275;
443        TvTunerStateChanged tv_tuner_state_changed = 276 [(module) = "framework"];
444        MediaOutputOpSwitchReported mediaoutput_op_switch_reported =
445            277 [(module) = "settings"];
446        CellBroadcastMessageFiltered cb_message_filtered =
447            278 [(module) = "cellbroadcast"];
448        TvTunerDvrStatus tv_tuner_dvr_status = 279 [(module) = "framework"];
449        TvCasSessionOpenStatus tv_cas_session_open_status =
450            280 [(module) = "framework"];
451        AssistantInvocationReported assistant_invocation_reported = 281 [(module) = "framework"];
452        DisplayWakeReported display_wake_reported = 282 [(module) = "framework"];
453        CarUserHalModifyUserRequestReported car_user_hal_modify_user_request_reported =
454            283 [(module) = "car"];
455        CarUserHalModifyUserResponseReported car_user_hal_modify_user_response_reported =
456            284 [(module) = "car"];
457        CarUserHalPostSwitchResponseReported car_user_hal_post_switch_response_reported =
458            285 [(module) = "car"];
459        CarUserHalInitialUserInfoRequestReported car_user_hal_initial_user_info_request_reported =
460            286 [(module) = "car"];
461        CarUserHalInitialUserInfoResponseReported car_user_hal_initial_user_info_response_reported =
462            287 [(module) = "car"];
463        CarUserHalUserAssociationRequestReported car_user_hal_user_association_request_reported =
464            288 [(module) = "car"];
465        CarUserHalSetUserAssociationResponseReported car_user_hal_set_user_association_response_reported =
466            289 [(module) = "car"];
467        NetworkIpProvisioningReported network_ip_provisioning_reported =
468            290 [(module) = "network_stack"];
469        NetworkDhcpRenewReported network_dhcp_renew_reported = 291 [(module) = "network_stack"];
470        NetworkValidationReported network_validation_reported = 292 [(module) = "network_stack"];
471        NetworkStackQuirkReported network_stack_quirk_reported = 293 [(module) = "network_stack"];
472        MediametricsAudioRecordDeviceUsageReported mediametrics_audiorecorddeviceusage_reported =
473            294;
474        MediametricsAudioThreadDeviceUsageReported mediametrics_audiothreaddeviceusage_reported =
475            295;
476        MediametricsAudioTrackDeviceUsageReported mediametrics_audiotrackdeviceusage_reported =
477            296;
478        MediametricsAudioDeviceConnectionReported mediametrics_audiodeviceconnection_reported =
479            297;
480        BlobCommitted blob_committed = 298 [(module) = "framework"];
481        BlobLeased blob_leased = 299 [(module) = "framework"];
482        BlobOpened blob_opened = 300 [(module) = "framework"];
483        ContactsProviderStatusReported contacts_provider_status_reported = 301;
484        KeystoreKeyEventReported keystore_key_event_reported = 302;
485        NetworkTetheringReported  network_tethering_reported =
486            303 [(module) = "network_tethering"];
487        ImeTouchReported ime_touch_reported = 304 [(module) = "sysui"];
488
489        // StatsdStats tracks platform atoms with ids upto 500.
490        // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
491    }
492
493    // Pulled events will start at field 10000.
494    // Next: 10084
495    oneof pulled {
496        WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
497        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
498        MobileBytesTransfer mobile_bytes_transfer =
499                10002 [(module) = "framework", (truncate_timestamp) = true];
500        MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg =
501                10003 [(module) = "framework", (truncate_timestamp) = true];
502        BluetoothBytesTransfer bluetooth_bytes_transfer = 10006 [(module) = "framework"];
503        KernelWakelock kernel_wakelock = 10004 [(module) = "framework"];
504        SubsystemSleepState subsystem_sleep_state = 10005 [(module) = "statsdtest"];
505        CpuTimePerFreq cpu_time_per_freq = 10008 [(module) = "framework"];
506        CpuTimePerUid cpu_time_per_uid = 10009 [(module) = "framework", (module) = "statsdtest"];
507        CpuTimePerUidFreq cpu_time_per_uid_freq =
508                10010 [(module) = "framework", (module) = "statsd"];
509        WifiActivityInfo wifi_activity_info = 10011 [(module) = "framework"];
510        ModemActivityInfo modem_activity_info = 10012 [(module) = "framework"];
511        BluetoothActivityInfo bluetooth_activity_info = 10007 [(module) = "framework"];
512        ProcessMemoryState process_memory_state = 10013 [(module) = "framework"];
513        SystemElapsedRealtime system_elapsed_realtime = 10014 [(module) = "framework"];
514        SystemUptime system_uptime = 10015 [(module) = "framework"];
515        CpuActiveTime cpu_active_time = 10016 [(module) = "framework", (module) = "statsdtest"];
516        CpuClusterTime cpu_cluster_time = 10017 [(module) = "framework"];
517        DiskSpace disk_space = 10018 [deprecated=true, (module) = "statsdtest"];
518        RemainingBatteryCapacity remaining_battery_capacity = 10019 [(module) = "framework"];
519        FullBatteryCapacity full_battery_capacity = 10020 [(module) = "framework"];
520        Temperature temperature = 10021 [(module) = "framework", (module) = "statsdtest"];
521        BinderCalls binder_calls = 10022 [(module) = "framework", (module) = "statsd"];
522        BinderCallsExceptions binder_calls_exceptions = 10023 [(module) = "framework"];
523        LooperStats looper_stats = 10024 [(module) = "framework", (module) = "statsd"];
524        DiskStats disk_stats = 10025 [(module) = "framework"];
525        DirectoryUsage directory_usage = 10026 [(module) = "framework"];
526        AppSize app_size = 10027 [(module) = "framework"];
527        CategorySize category_size = 10028 [(module) = "framework"];
528        ProcStats proc_stats = 10029 [(module) = "framework"];
529        BatteryVoltage battery_voltage = 10030 [(module) = "framework"];
530        NumFingerprintsEnrolled num_fingerprints_enrolled = 10031 [(module) = "framework"];
531        DiskIo disk_io = 10032 [(module) = "framework"];
532        PowerProfile power_profile = 10033 [(module) = "framework"];
533        ProcStatsPkgProc proc_stats_pkg_proc = 10034 [(module) = "framework"];
534        ProcessCpuTime process_cpu_time = 10035 [(module) = "framework"];
535        CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037 [(module) = "framework"];
536        OnDevicePowerMeasurement on_device_power_measurement = 10038;
537        DeviceCalculatedPowerUse device_calculated_power_use = 10039 [(module) = "framework"];
538        DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid =
539                10040 [(module) = "framework"];
540        DeviceCalculatedPowerBlameOther device_calculated_power_blame_other =
541                10041 [(module) = "framework"];
542        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042 [(module) = "framework"];
543        BatteryLevel battery_level = 10043 [(module) = "framework"];
544        BuildInformation build_information = 10044 [(module) = "framework"];
545        BatteryCycleCount battery_cycle_count = 10045 [(module) = "framework"];
546        DebugElapsedClock debug_elapsed_clock = 10046 [(module) = "framework"];
547        DebugFailingElapsedClock debug_failing_elapsed_clock = 10047 [(module) = "framework"];
548        NumFacesEnrolled num_faces_enrolled = 10048 [(module) = "framework"];
549        RoleHolder role_holder = 10049 [(module) = "framework"];
550        DangerousPermissionState dangerous_permission_state = 10050 [(module) = "framework"];
551        TrainInfo train_info = 10051 [(module) = "statsd"];
552        TimeZoneDataInfo time_zone_data_info = 10052 [(module) = "framework"];
553        ExternalStorageInfo external_storage_info = 10053 [(module) = "framework"];
554        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
555        GpuStatsAppInfo gpu_stats_app_info = 10055;
556        SystemIonHeapSize system_ion_heap_size = 10056 [deprecated = true, (module) = "framework"];
557        AppsOnExternalStorageInfo apps_on_external_storage_info = 10057 [(module) = "framework"];
558        FaceSettings face_settings = 10058 [(module) = "framework"];
559        CoolingDevice cooling_device = 10059 [(module) = "framework"];
560        AppOps app_ops = 10060 [(module) = "framework"];
561        ProcessSystemIonHeapSize process_system_ion_heap_size = 10061 [(module) = "framework"];
562        SurfaceflingerStatsGlobalInfo surfaceflinger_stats_global_info = 10062;
563        SurfaceflingerStatsLayerInfo surfaceflinger_stats_layer_info = 10063;
564        ProcessMemorySnapshot process_memory_snapshot = 10064 [(module) = "framework"];
565        VmsClientStats vms_client_stats = 10065 [(module) = "car"];
566        NotificationRemoteViews notification_remote_views = 10066 [(module) = "framework"];
567        DangerousPermissionStateSampled dangerous_permission_state_sampled =
568                10067 [(module) = "framework"];
569        GraphicsStats graphics_stats = 10068;
570        RuntimeAppOpAccess runtime_app_op_access = 10069 [(module) = "framework"];
571        IonHeapSize ion_heap_size = 10070 [(module) = "framework"];
572        PackageNotificationPreferences package_notification_preferences =
573                10071 [(module) = "framework"];
574        PackageNotificationChannelPreferences package_notification_channel_preferences =
575                10072 [(module) = "framework"];
576        PackageNotificationChannelGroupPreferences package_notification_channel_group_preferences =
577                10073 [(module) = "framework"];
578        GnssStats gnss_stats = 10074 [(module) = "framework"];
579        AttributedAppOps attributed_app_ops = 10075 [(module) = "framework"];
580        VoiceCallSession voice_call_session = 10076 [(module) = "telephony"];
581        VoiceCallRatUsage voice_call_rat_usage = 10077 [(module) = "telephony"];
582        SimSlotState sim_slot_state = 10078 [(module) = "telephony"];
583        SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
584        SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
585        BlobInfo blob_info = 10081 [(module) = "framework"];
586        DataUsageBytesTransfer data_usage_bytes_transfer = 10082 [(module) = "framework"];
587        BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered =
588                10083 [(module) = "framework"];
589        DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"];
590        GeneralExternalStorageAccessStats general_external_storage_access_stats =
591            10085 [(module) = "mediaprovider"];
592    }
593
594    // DO NOT USE field numbers above 100,000 in AOSP.
595    // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
596    // Field numbers 200,000 and above are reserved for future use; do not use them at all.
597
598    reserved 10036;
599}
600
601/**
602 * This proto represents a node of an attribution chain.
603 * Note: All attribution chains are represented as a repeated field of type
604 * AttributionNode. It is understood that in such arrays, the order is that
605 * of calls, that is [A, B, C] if A calls B that calls C.
606 */
607message AttributionNode {
608    // The uid for a given element in the attribution chain.
609    optional int32 uid = 1;
610
611    // The (optional) string tag for an element in the attribution chain. If the
612    // element has no tag, it is encoded as an empty string.
613    optional string tag = 2;
614}
615
616message KeyValuePair {
617    optional int32 key = 1;
618    oneof value {
619        int32 value_int = 2;
620        int64 value_long = 3;
621        string value_str = 4;
622        float value_float = 5;
623    }
624}
625
626message KeyValuePairsAtom {
627    optional int32 uid = 1;
628    repeated KeyValuePair pairs = 2;
629}
630
631/*
632 * *****************************************************************************
633 * Below are all of the individual atoms that are logged by Android via statsd.
634 *
635 * RULES:
636 *   - The field ids for each atom must start at 1, and count upwards by 1.
637 *     Skipping field ids is not allowed.
638 *   - These form an API, so renaming, renumbering or removing fields is
639 *     not allowed between android releases.  (This is not currently enforced,
640 *     but there will be a tool to enforce this restriction).
641 *   - The types must be built-in protocol buffer types, namely, no sub-messages
642 *     are allowed (yet).  The bytes type is also not allowed.
643 *   - The CamelCase name of the message type should match the
644 *     underscore_separated name as defined in Atom.
645 *   - If an atom represents work that can be attributed to an app, there can
646 *     be exactly one AttributionChain field. It must be field number 1.
647 *   - A field that is a uid should be a string field, tagged with the [xxx]
648 *     annotation. The generated code on android will be represented by UIDs,
649 *     and those UIDs will be translated in xxx to those strings.
650 *
651 * CONVENTIONS:
652 *   - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
653 *   - If there is a UID, it goes first. Think in an object-oriented fashion.
654 * *****************************************************************************
655 */
656
657/**
658 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
659 * Logs when the Thermal service HAL notifies the throttling start/stop events.
660 *
661 * Logged from:
662 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
663 */
664message ThermalThrottlingStateChanged {
665    // The type of temperature being reported (CPU, GPU, SKIN, etc)
666    optional android.os.TemperatureTypeEnum sensor_type = 1;
667
668    // Throttling state, this field is DEPRECATED
669    enum State {
670        UNKNOWN = 0;
671        START = 1; // START indicated that throttling was triggered.
672        STOP = 2; // STOP indicates that throttling was cleared.
673    }
674    optional State state = 2;
675
676    optional float temperature = 3;
677}
678
679/**
680 * Logs when the screen state changes.
681 *
682 * Logged from:
683 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
684 */
685message ScreenStateChanged {
686    // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
687    optional android.view.DisplayStateEnum state = 1
688            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
689}
690
691/**
692 * Logs that the process state of the uid, as determined by ActivityManager
693 * (i.e. the highest process state of that uid's processes) has changed.
694 *
695 * Logged from:
696 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
697 */
698message UidProcessStateChanged {
699    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
700
701    // The state, from frameworks/base/core/proto/android/app/enums.proto.
702    optional android.app.ProcessStateEnum state = 2
703            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
704}
705
706/**
707 * Logs process state change of a process, as per the activity manager.
708 *
709 * Logged from:
710 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
711 */
712message ProcessStateChanged {
713    optional int32 uid = 1;
714    optional string process_name = 2;
715    optional string package_name = 3;
716    // TODO: remove this when validation is done
717    optional int64 version = 5;
718    // The state, from frameworks/base/core/proto/android/app/enums.proto.
719    optional android.app.ProcessStateEnum state = 4;
720}
721
722/**
723 * Logs when ActivityManagerService sleep state is changed.
724 *
725 * Logged from:
726 *   frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
727 */
728message ActivityManagerSleepStateChanged {
729    // TODO: import frameworks proto
730    enum State {
731        UNKNOWN = 0;
732        ASLEEP = 1;
733        AWAKE = 2;
734    }
735    optional State state = 1
736            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
737}
738
739/**
740 * Logs when system memory state changes.
741 *
742 * Logged from:
743 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
744 */
745message MemoryFactorStateChanged {
746    // TODO: import frameworks proto
747    enum State {
748        MEMORY_UNKNOWN = 0;
749        NORMAL = 1;     // normal.
750        MODERATE = 2;   // moderate memory pressure.
751        LOW = 3;        // low memory.
752        CRITICAL = 4;   // critical memory.
753
754    }
755    optional State factor = 1 [(state_field_option).exclusive_state = true];
756}
757
758/**
759 * Logs when app is using too much cpu, according to ActivityManagerService.
760 *
761 * Logged from:
762 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
763 */
764message ExcessiveCpuUsageReported {
765    optional int32 uid = 1;
766    optional string process_name = 2;
767    optional string package_name = 3;
768    // package version. TODO: remove this when validation is done
769    optional int64 version = 4;
770}
771
772/**
773 * Logs when a cached process is killed, along with its pss.
774 *
775 * Logged from:
776 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
777 */
778message CachedKillReported {
779    optional int32 uid = 1;
780    optional string process_name = 2;
781    optional string package_name = 3;
782    // TODO: remove this when validation is done
783    optional int64 version = 5;
784    optional int64 pss = 4;
785}
786
787/**
788 * Logs the change in wifi health.
789 *
790 * Logged from:
791 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiDataStall.java
792 */
793message WifiHealthStatReported {
794    enum Band {
795        UNKNOWN = 0;
796        // All of 2.4GHz band
797        BAND_2G = 1;
798        // Frequencies in the range of [5150, 5250) GHz
799        BAND_5G_LOW = 2;
800        // Frequencies in the range of [5250, 5725) GHz
801        BAND_5G_MIDDLE = 3;
802        // Frequencies in the range of [5725, 5850) GHz
803        BAND_5G_HIGH = 4;
804        // Frequencies in the range of [5925, 6425) GHz
805        BAND_6G_LOW = 5;
806        // Frequencies in the range of [6425, 6875) GHz
807        BAND_6G_MIDDLE = 6;
808        // Frequencies in the range of [6875, 7125) GHz
809        BAND_6G_HIGH = 7;
810    }
811    // duration this stat is obtained over in milliseconds
812    optional int32 duration_millis = 1;
813    // whether wifi is classified as sufficient for the user's data traffic, determined
814    // by whether the calculated throughput exceeds the average demand within |duration_millis|
815    optional bool is_sufficient = 2;
816    // whether cellular data is available
817    optional bool is_cell_data_available = 3;
818    // the Band bucket the connected network is on
819    optional Band band = 4;
820}
821
822/**
823 * Logged when wifi detects a significant change in connection failure rate.
824 *
825 * Logged from: frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiHealthMonitor.java
826 *
827 */
828message WifiFailureStatReported {
829    enum AbnormalityType {
830        UNKNOWN = 0;
831        SIGNIFICANT_INCREASE = 1;
832        SIGNIFICANT_DECREASE = 2;
833        SIMPLY_HIGH = 3;
834    }
835    enum FailureType {
836        FAILURE_UNKNOWN = 0;
837        FAILURE_CONNECTION = 1;
838        FAILURE_ASSOCIATION_REJECTION = 2;
839        FAILURE_ASSOCIATION_TIMEOUT = 3;
840        FAILURE_AUTHENTICATION = 4;
841        FAILURE_NON_LOCAL_DISCONNECTION = 5;
842        FAILURE_SHORT_CONNECTION_DUE_TO_NON_LOCAL_DISCONNECTION = 6;
843    }
844    // Reason for uploading this stat
845    optional AbnormalityType abnormality_type = 1;
846    // The particular type of failure
847    optional FailureType failure_type = 2;
848    // How many times we have encountered this combination of AbnormalityType and FailureType
849    optional int32 failure_count = 3;
850}
851
852/**
853 * Logs whether a wifi connection is successful and reasons for failure if it isn't.
854 *
855 * Logged from:
856 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
857 */
858message WifiConnectionResultReported {
859    enum FailureCode {
860        FAILURE_UNKNOWN = 0;
861        FAILURE_ASSOCIATION_TIMEOUT = 1;
862        FAILURE_ASSOCIATION_REJECTION = 2;
863        FAILURE_AUTHENTICATION_GENERAL = 3;
864        FAILURE_AUTHENTICATION_EAP = 4;
865        FAILURE_DHCP = 5;
866        FAILURE_NETWORK_DISCONNECTION = 6;
867        FAILURE_ROAM_TIMEOUT = 7;
868    }
869    // true represents a successful connection
870    optional bool connection_result = 1;
871    // reason for the connection failure
872    optional FailureCode failure_code = 2;
873    // scan rssi before the connection attempt
874    optional int32 rssi = 3;
875}
876
877/**
878 * Logs when memory stats of a process is reported.
879 *
880 * Logged from:
881 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
882 */
883message ProcessMemoryStatReported {
884    optional int32 uid = 1;
885    optional string process_name = 2;
886    optional string package_name = 3;
887    //TODO: remove this when validation is done
888    optional int64 version = 9;
889    optional int64 pss = 4;
890    optional int64 uss = 5;
891    optional int64 rss = 6;
892    enum Type {
893        ADD_PSS_INTERNAL_SINGLE = 0;
894        ADD_PSS_INTERNAL_ALL_MEM = 1;
895        ADD_PSS_INTERNAL_ALL_POLL = 2;
896        ADD_PSS_EXTERNAL = 3;
897        ADD_PSS_EXTERNAL_SLOW = 4;
898    }
899    optional Type type = 7;
900    optional int64 duration_millis = 8;
901}
902
903/**
904 * Logs that a process started, finished, crashed, or ANRed.
905 *
906 * Logged from:
907 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
908 */
909message ProcessLifeCycleStateChanged {
910    optional int32 uid = 1 [(is_uid) = true];
911
912    // The process name (usually same as the app name).
913    optional string process_name = 2;
914
915    // What lifecycle state the process changed to.
916    // This enum is specific to atoms.proto.
917    enum State {
918        FINISHED = 0;
919        STARTED = 1;
920        CRASHED = 2;
921    }
922    optional State state = 3;
923}
924
925/**
926 * Logs when the ble scan state changes.
927 *
928 * Logged from:
929 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
930 */
931message BleScanStateChanged {
932    repeated AttributionNode attribution_node = 1
933            [(state_field_option).primary_field_first_uid = true];
934
935    enum State {
936        OFF = 0;
937        ON = 1;
938        // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
939        RESET = 2;
940    }
941    optional State state = 2 [
942        (state_field_option).exclusive_state = true,
943        (state_field_option).default_state_value = 0 /* State.OFF */,
944        (state_field_option).trigger_state_reset_value = 2 /* State.RESET */,
945        (state_field_option).nested = true
946    ];
947
948    // Does the scan have a filter.
949    optional bool is_filtered = 3 [(state_field_option).primary_field = true];
950    // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
951    optional bool is_first_match = 4 [(state_field_option).primary_field = true];
952    // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
953    optional bool is_opportunistic = 5 [(state_field_option).primary_field = true];
954}
955
956/**
957 * Logs reporting of a ble scan finding results.
958 *
959 * Logged from:
960 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
961 */
962// TODO: Consider also tracking per-scanner-id.
963message BleScanResultReceived {
964    repeated AttributionNode attribution_node = 1;
965
966    // Number of ble scan results returned.
967    optional int32 num_results = 2;
968}
969
970/**
971 * Logs when a sensor state changes.
972 *
973 * Logged from:
974 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
975 */
976message SensorStateChanged {
977    repeated AttributionNode attribution_node = 1;
978
979    // The id (int) of the sensor.
980    optional int32 sensor_id = 2;
981
982    enum State {
983        OFF = 0;
984        ON = 1;
985    }
986    optional State state = 3;
987}
988
989/**
990 * Logs when GPS state changes.
991 *
992 * Logged from:
993 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
994 */
995message GpsScanStateChanged {
996    repeated AttributionNode attribution_node = 1;
997
998    enum State {
999        OFF = 0;
1000        ON = 1;
1001    }
1002    optional State state = 2;
1003}
1004
1005/**
1006 * Logs when GPS signal quality.
1007 *
1008 * Logged from:
1009 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
1010 */
1011message GpsSignalQualityChanged {
1012    optional android.server.location.GpsSignalQualityEnum level = 1;
1013}
1014
1015
1016/**
1017 * Logs when a sync manager sync state changes.
1018 *
1019 * Logged from:
1020 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1021 */
1022message SyncStateChanged {
1023    repeated AttributionNode attribution_node = 1;
1024
1025    // Name of the sync (as named in the app). Can be chosen at run-time.
1026    optional string sync_name = 2;
1027
1028    enum State {
1029        OFF = 0;
1030        ON = 1;
1031    }
1032    optional State state = 3;
1033}
1034
1035/*
1036 * Deferred job stats.
1037 *
1038 * Logged from:
1039 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
1040*/
1041message DeferredJobStatsReported {
1042    repeated AttributionNode attribution_node = 1;
1043
1044    // Number of jobs deferred.
1045    optional int32 num_jobs_deferred = 2;
1046
1047    // Time since the last job runs.
1048    optional int64 time_since_last_job_millis = 3;
1049}
1050
1051/**
1052 * Logs when a job scheduler job state changes.
1053 *
1054 * Logged from:
1055 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1056 */
1057message ScheduledJobStateChanged {
1058    repeated AttributionNode attribution_node = 1;
1059
1060    // Name of the job (as named in the app)
1061    optional string job_name = 2;
1062
1063    enum State {
1064        FINISHED = 0;
1065        STARTED = 1;
1066        SCHEDULED = 2;
1067    }
1068    optional State state = 3;
1069
1070    // The reason a job has stopped.
1071    // This is only applicable when the state is FINISHED.
1072    // The default value is STOP_REASON_UNKNOWN.
1073    optional android.app.job.StopReasonEnum stop_reason = 4;
1074
1075    // The standby bucket of the app that scheduled the job. These match the framework constants
1076    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
1077    // already assigned 0.
1078    enum Bucket {
1079        UNKNOWN = -1;
1080        ACTIVE = 0;
1081        WORKING_SET = 1;
1082        FREQUENT = 2;
1083        RARE = 3;
1084        NEVER = 4;
1085        RESTRICTED = 5;
1086    }
1087    optional Bucket standby_bucket = 5 [default = UNKNOWN];
1088
1089    // The job id (as assigned by the app).
1090    optional int32 job_id = 6;
1091
1092    // One flag for each of the API constraints defined by Jobscheduler. Does not include implcit
1093    // constraints as they are always assumed to be set.
1094    optional bool has_charging_constraint = 7;
1095    optional bool has_battery_not_low_constraint = 8;
1096    optional bool has_storage_not_low_constraint = 9;
1097    optional bool has_timing_delay_constraint = 10;
1098    optional bool has_deadline_constraint = 11;
1099    optional bool has_idle_constraint = 12;
1100    optional bool has_connectivity_constraint = 13;
1101    optional bool has_content_trigger_constraint = 14;
1102}
1103
1104/**
1105 * Logs when the audio state changes.
1106 *
1107 * Logged from:
1108 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1109 */
1110message AudioStateChanged {
1111    repeated AttributionNode attribution_node = 1;
1112
1113    enum State {
1114        OFF = 0;
1115        ON = 1;
1116        // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
1117        RESET = 2;
1118    }
1119    optional State state = 2;
1120}
1121
1122/**
1123 * Logs when the video codec state changes.
1124 *
1125 * Logged from:
1126 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1127 */
1128message MediaCodecStateChanged {
1129    repeated AttributionNode attribution_node = 1;
1130
1131    enum State {
1132        OFF = 0;
1133        ON = 1;
1134        // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
1135        RESET = 2;
1136    }
1137    optional State state = 2;
1138}
1139
1140/**
1141 * Logs when the flashlight state changes.
1142 *
1143 * Logged from:
1144 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1145 */
1146message FlashlightStateChanged {
1147    repeated AttributionNode attribution_node = 1;
1148
1149    enum State {
1150        OFF = 0;
1151        ON = 1;
1152        // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
1153        RESET = 2;
1154    }
1155    optional State state = 2;
1156}
1157
1158/**
1159 * Logs when the camera state changes.
1160 *
1161 * Logged from:
1162 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1163 */
1164message CameraStateChanged {
1165    repeated AttributionNode attribution_node = 1;
1166
1167    enum State {
1168        OFF = 0;
1169        ON = 1;
1170        // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
1171        RESET = 2;
1172    }
1173    optional State state = 2;
1174}
1175
1176/**
1177 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
1178 *
1179 * Logged from:
1180 *   TODO
1181 */
1182message WakelockStateChanged {
1183    repeated AttributionNode attribution_node = 1
1184            [(state_field_option).primary_field_first_uid = true];
1185
1186    // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
1187    // From frameworks/base/core/proto/android/os/enums.proto.
1188    optional android.os.WakeLockLevelEnum type = 2 [(state_field_option).primary_field = true];
1189
1190    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
1191    optional string tag = 3 [(state_field_option).primary_field = true];
1192
1193    enum State {
1194        RELEASE = 0;
1195        ACQUIRE = 1;
1196        CHANGE_RELEASE = 2;
1197        CHANGE_ACQUIRE = 3;
1198    }
1199    optional State state = 4 [
1200        (state_field_option).exclusive_state = true,
1201        (state_field_option).default_state_value = 0,
1202        (state_field_option).nested = true
1203    ];
1204}
1205
1206/**
1207 * Logs when a partial wakelock is considered 'long' (over 1 min).
1208 *
1209 * Logged from:
1210 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1211 */
1212message LongPartialWakelockStateChanged {
1213    repeated AttributionNode attribution_node = 1;
1214
1215    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
1216    optional string tag = 2;
1217
1218    // TODO: I have no idea what this is.
1219    optional string history_tag = 3;
1220
1221    enum State {
1222        OFF = 0;
1223        ON = 1;
1224    }
1225    optional State state = 4;
1226}
1227
1228/**
1229 * Logs when the device is interactive, according to the PowerManager Notifier.
1230 *
1231 * Logged from:
1232 *   frameworks/base/services/core/java/com/android/server/power/Notifier.java
1233 */
1234message InteractiveStateChanged {
1235    enum State {
1236        OFF = 0;
1237        ON = 1;
1238    }
1239    optional State state = 1;
1240}
1241
1242/**
1243 * Logs Battery Saver state change.
1244 *
1245 * Logged from:
1246 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1247 */
1248message BatterySaverModeStateChanged {
1249    enum State {
1250        OFF = 0;
1251        ON = 1;
1252    }
1253    optional State state = 1
1254            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1255}
1256
1257/**
1258 * Logs Doze mode state change.
1259 *
1260 * Logged from:
1261 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1262 */
1263message DeviceIdleModeStateChanged {
1264    optional android.server.DeviceIdleModeEnum state = 1
1265            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1266}
1267
1268
1269/**
1270 * Logs state change of Doze mode including maintenance windows.
1271 *
1272 * Logged from:
1273 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1274 */
1275message DeviceIdlingModeStateChanged {
1276    optional android.server.DeviceIdleModeEnum state = 1
1277            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1278}
1279
1280/**
1281 * Logs screen brightness level.
1282 *
1283 * Logged from:
1284 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1285 */
1286message ScreenBrightnessChanged {
1287    // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
1288    optional int32 level = 1;
1289}
1290
1291/**
1292 * Logs battery level (percent full, from 0 to 100).
1293 *
1294 * Logged from:
1295 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1296 */
1297message BatteryLevelChanged {
1298    // Battery level. Should be in [0, 100].
1299    optional int32 battery_level = 1;
1300}
1301
1302/**
1303 * Logs change in charging status of the device.
1304 *
1305 * Logged from:
1306 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1307 */
1308message ChargingStateChanged {
1309    // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
1310    optional android.os.BatteryStatusEnum state = 1
1311            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1312}
1313
1314/**
1315 * Logs whether the device is plugged in, and what power source it is using.
1316 *
1317 * Logged from:
1318 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1319 */
1320message PluggedStateChanged {
1321    // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
1322    optional android.os.BatteryPluggedStateEnum state = 1
1323            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
1324}
1325
1326/**
1327 * Logs when an app's wakeup alarm fires.
1328 *
1329 * Logged from:
1330 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1331 */
1332message WakeupAlarmOccurred {
1333    repeated AttributionNode attribution_node = 1;
1334
1335    // Name of the wakeup alarm.
1336    optional string tag = 2;
1337
1338    // Name of source package (for historical reasons, since BatteryStats tracked it).
1339    optional string package_name = 3;
1340
1341    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
1342    optional AppStandbyBucketChanged.Bucket app_standby_bucket = 4;
1343}
1344
1345/**
1346 * Logs when an an app causes the mobile radio to change state.
1347 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
1348 *
1349 * Logged from:
1350 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1351 */
1352message MobileRadioPowerStateChanged {
1353    repeated AttributionNode attribution_node = 1;
1354
1355    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
1356    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1357}
1358
1359/**
1360 * Logs when an an app causes the wifi radio to change state.
1361 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
1362 *
1363 * Logged from:
1364 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1365 */
1366message WifiRadioPowerStateChanged {
1367    repeated AttributionNode attribution_node = 1;
1368
1369    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
1370    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1371}
1372
1373/**
1374 * Logs kernel wakeup reasons and aborts.
1375 *
1376 * Logged from:
1377 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1378 */
1379message KernelWakeupReported {
1380    // Name of the kernel wakeup reason (or abort).
1381    optional string wakeup_reason_name = 1;
1382
1383    // Duration (in microseconds) for the wake-up interrupt to be serviced.
1384    optional int64 duration_micros = 2;
1385}
1386
1387/**
1388 * Logs when Wifi is toggled on/off.
1389 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
1390 *
1391 * Logged from:
1392 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1393 */
1394message WifiEnabledStateChanged {
1395    enum State {
1396        OFF = 0;
1397        ON = 1;
1398    }
1399    optional State state = 1;
1400}
1401
1402/**
1403 * This atom is deprecated starting in R.
1404 *
1405 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
1406 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
1407 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
1408 *
1409 * Logged from:
1410 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1411 */
1412message WifiRunningStateChanged {
1413    repeated AttributionNode attribution_node = 1;
1414
1415    enum State {
1416        OFF = 0;
1417        ON = 1;
1418    }
1419    optional State state = 2;
1420}
1421
1422/**
1423 * Logs wifi locks held by an app.
1424 *
1425 * Logged from:
1426 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1427 */
1428message WifiLockStateChanged {
1429    repeated AttributionNode attribution_node = 1;
1430
1431    enum State {
1432        OFF = 0;
1433        ON = 1;
1434    }
1435    optional State state = 2;
1436
1437    // WifiLock type, from frameworks/base/core/proto/android/wifi/enums.proto.
1438    optional android.net.wifi.WifiModeEnum mode = 3;
1439}
1440
1441/**
1442 * Logs wifi signal strength changes.
1443 *
1444 * Logged from:
1445 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
1446 */
1447message WifiSignalStrengthChanged {
1448    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1449    optional android.telephony.SignalStrengthEnum signal_strength = 1;
1450}
1451
1452/**
1453 * Logs wifi scans performed by an app.
1454 *
1455 * Logged from:
1456 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
1457 */
1458message WifiScanStateChanged {
1459    repeated AttributionNode attribution_node = 1;
1460
1461    enum State {
1462        OFF = 0;
1463        ON = 1;
1464    }
1465    optional State state = 2;
1466}
1467
1468/**
1469 * Logs wifi multicast locks held by an app
1470 *
1471 * Logged from:
1472 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
1473 */
1474message WifiMulticastLockStateChanged {
1475    repeated AttributionNode attribution_node = 1;
1476
1477    enum State {
1478        OFF = 0;
1479        ON = 1;
1480    }
1481    optional State state = 2;
1482
1483    optional string tag = 3;
1484}
1485
1486/**
1487 * Logs shutdown reason and duration on next boot.
1488 *
1489 * Logged from:
1490 *   frameworks/base/core/java/com/android/server/BootReceiver.java
1491 */
1492message ShutdownSequenceReported {
1493    // True if shutdown is for a reboot. Default: false if we do not know.
1494    optional bool reboot = 1;
1495
1496    // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
1497    optional string reason = 2;
1498
1499    // Beginning of shutdown time in ms using wall clock time since unix epoch.
1500    // Default: 0 if no start time received.
1501    optional int64 start_time_millis = 3;
1502
1503    // Duration of shutdown in ms. Default: 0 if no duration received.
1504    optional int64 duration_millis = 4;
1505}
1506
1507
1508/**
1509 * Logs boot reason and duration.
1510 *
1511 * Logged from:
1512 *   system/core/bootstat/bootstat.cpp
1513 */
1514message BootSequenceReported {
1515    // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
1516    // Default: "<EMPTY>" if not available.
1517    optional string bootloader_reason = 1;
1518
1519    // Reason for system boot. Eg. bootloader, reboot,userrequested
1520    // Default: "<EMPTY>" if not available.
1521    optional string system_reason = 2;
1522
1523    // End of boot time in ms from unix epoch using system wall clock.
1524    optional int64 end_time_millis = 3;
1525
1526    // Total boot duration in ms.
1527    optional int64 total_duration_millis = 4;
1528
1529    // Bootloader duration in ms.
1530    optional int64 bootloader_duration_millis = 5;
1531
1532    // Time since last boot in ms. Default: 0 if not available.
1533    optional int64 time_since_last_boot = 6;
1534}
1535
1536
1537/**
1538 * Logs call state and disconnect cause (if applicable).
1539 *
1540 * Logged from:
1541 *   packages/services/Telecomm/src/com/android/server/telecom/Call.java
1542 */
1543message CallStateChanged {
1544    // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1545    // From frameworks/base/core/proto/android/telecomm/enums.proto.
1546    optional android.telecom.CallStateEnum call_state = 1;
1547
1548    // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1549    // This value is only applicable when the call_state is DISCONNECTED, and
1550    // should always be UNKNOWN if the call_state is not DISCONNECTED.
1551    // From frameworks/base/core/proto/android/telecomm/enums.proto.
1552    optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1553
1554    // True if the call is self-managed, which are apps that use the
1555    // telecom infrastructure to make their own calls.
1556    optional bool self_managed = 3;
1557
1558    // True if call is external. External calls are calls on connected Wear
1559    // devices but show up in Telecom so the user can pull them onto the device.
1560    optional bool external_call = 4;
1561}
1562
1563/**
1564 * Logs keyguard state. The keyguard is the lock screen.
1565 *
1566 * Logged from:
1567 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1568 */
1569message KeyguardStateChanged {
1570    enum State {
1571        UNKNOWN = 0;
1572        // The keyguard is hidden when the phone is unlocked.
1573        HIDDEN = 1;
1574        // The keyguard is shown when the phone is locked (screen turns off).
1575        SHOWN= 2;
1576        // The keyguard is occluded when something is overlaying the keyguard.
1577        // Eg. Opening the camera while on the lock screen.
1578        OCCLUDED = 3;
1579    }
1580    optional State state = 1;
1581}
1582
1583/**
1584 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1585 * prompts the user to enter a password (pattern, pin, etc).
1586 *
1587 * Logged from:
1588 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1589 */
1590
1591message KeyguardBouncerStateChanged {
1592    enum State {
1593        UNKNOWN = 0;
1594        // Bouncer is hidden, either as a result of successfully entering the
1595        // password, screen timing out, or user going back to lock screen.
1596        HIDDEN = 1;
1597        // This is when the user is being prompted to enter the password.
1598        SHOWN = 2;
1599    }
1600    optional State state = 1;
1601}
1602
1603/**
1604 * Logs the result of entering a password into the keyguard bouncer.
1605 *
1606 * Logged from:
1607 *   frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1608 */
1609message KeyguardBouncerPasswordEntered {
1610    enum BouncerResult {
1611        UNKNOWN = 0;
1612        // The password entered was incorrect.
1613        FAILURE = 1;
1614        // The password entered was correct.
1615        SUCCESS = 2;
1616    }
1617    optional BouncerResult result = 1;
1618}
1619
1620/*
1621 * Logs changes to the configuration of the device. The configuration is defined
1622 * in frameworks/base/core/java/android/content/res/Configuration.java
1623 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1624 * Please go there to interpret the possible values each field can be.
1625 *
1626 * Logged from:
1627 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1628 */
1629message ResourceConfigurationChanged {
1630    // Bit mask of color capabilities of the screen.
1631    // Contains information about the color gamut and hdr mode of the screen.
1632    // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1633    optional int32 color_mode = 1;
1634
1635    // The target screen density being rendered to.
1636    // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1637    optional int32 density_dpi = 2;
1638
1639    // Current user preference for the scaling factor for fonts,
1640    // relative to the base density scaling.
1641    // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1642    optional float font_scale = 3;
1643
1644    // Flag indicating whether the hard keyboard is hidden.
1645    // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1646    optional int32 hard_keyboard_hidden = 4;
1647
1648    // The type of keyboard attached to the device.
1649    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1650    optional int32 keyboard = 5;
1651
1652    // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1653    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1654    optional int32 keyboard_hidden = 6;
1655
1656    // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1657    // 0 if undefined.
1658    // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1659    optional int32 mcc = 7;
1660
1661    // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1662    // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1663    // MNC_ZERO symbol defined in Configuration.java.
1664    // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1665    optional int32 mnc = 8;
1666
1667    // The kind of navigation available on the device.
1668    // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1669    optional int32 navigation = 9;
1670
1671    // Flag indicating whether the navigation is available.
1672    // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1673    optional int32 navigation_hidden = 10;
1674
1675    // Overall orientation of the screen.
1676    // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1677    optional int32 orientation = 11;
1678
1679    // The current height of the available screen space, in dp units.
1680    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1681    optional int32 screen_height_dp = 12;
1682
1683    // Bit mask of overall layout of the screen.
1684    // Contains information about screen size, whether the screen is wider/taller
1685    // than normal, whether the screen layout is right-tl-left or left-to-right,
1686    // and whether the screen has a rounded shape.
1687    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1688    optional int32 screen_layout = 13;
1689
1690    // Current width of the available screen space, in dp units.
1691    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1692    optional int32 screen_width_dp = 14;
1693
1694    // The smallest screen size an application will see in normal operation.
1695    // This is the smallest value of both screenWidthDp and screenHeightDp
1696    // in portrait and landscape.
1697    // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1698    optional int32 smallest_screen_width_dp = 15;
1699
1700    // The type of touch screen attached to the device.
1701    // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1702    optional int32 touchscreen = 16;
1703
1704    // Bit mask of the ui mode.
1705    // Contains information about the overall ui mode of the device.
1706    // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1707    // Also contains information about whether the device is in night mode.
1708    // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1709    optional int32 ui_mode = 17;
1710}
1711
1712
1713/**
1714 * Logs changes in the connection state of the mobile radio.
1715 *
1716 * Logged from:
1717 *    frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1718 */
1719message MobileConnectionStateChanged {
1720    // States are from the state machine DataConnection.java.
1721    enum State {
1722        UNKNOWN = 0;
1723        // The connection is inactive, or disconnected.
1724        INACTIVE = 1;
1725        // The connection is being activated, or connecting.
1726        ACTIVATING = 2;
1727        // The connection is active, or connected.
1728        ACTIVE = 3;
1729        // The connection is disconnecting.
1730        DISCONNECTING = 4;
1731        // The connection is disconnecting after creating a connection.
1732        DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1733    }
1734    optional State state  = 1;
1735    // For multi-sim phones, this distinguishes between the sim cards.
1736    optional int32 sim_slot_index = 2;
1737    // Used to identify the connection. Starts at 0 and increments by 1 for
1738    // every new network created. Resets whenever the device reboots.
1739    optional int32 data_connection_id = 3;
1740    // A bitmask for the capabilities of this connection.
1741    // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1742    // Default value (if we have no information): 0
1743    optional int64 capabilities = 4;
1744    // If this connection has internet.
1745    // This just checks if the DEFAULT bit of capabilities is set.
1746    optional bool has_internet = 5;
1747}
1748
1749/**
1750 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1751 *
1752 * Logged from:
1753 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1754 */
1755message MobileRadioTechnologyChanged {
1756    optional android.telephony.NetworkTypeEnum state = 1;
1757    // For multi-sim phones, this distinguishes between the sim cards.
1758    optional int32 sim_slot_index = 2;
1759}
1760
1761/**
1762 * Logs the VID and PID of any connected USB devices.
1763 *
1764 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1765 *
1766 * Logged by Vendor.
1767 */
1768message UsbDeviceAttached {
1769    optional int32 vid = 1;
1770    optional int32 pid = 2;
1771    optional bool has_audio = 3;
1772    optional bool has_hid = 4;
1773    optional bool has_storage = 5;
1774    enum State {
1775        STATE_DISCONNECTED = 0;
1776        STATE_CONNECTED = 1;
1777    }
1778    optional State state = 6;
1779    optional int64 last_connect_duration_millis = 7;
1780}
1781
1782
1783/**
1784 * Logs when Bluetooth is enabled and disabled.
1785 *
1786 * Logged from:
1787 *   services/core/java/com/android/server/BluetoothManagerService.java
1788 */
1789message BluetoothEnabledStateChanged {
1790    repeated AttributionNode attribution_node = 1;
1791    // Whether or not bluetooth is enabled on the device.
1792    enum State {
1793        UNKNOWN = 0;
1794        ENABLED = 1;
1795        DISABLED = 2;
1796    }
1797    optional State state = 2;
1798    // The reason for being enabled/disabled.
1799    // Eg. Airplane mode, crash, application request.
1800    optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1801    // If the reason is an application request, this will be the package name.
1802    optional string pkg_name = 4;
1803}
1804
1805/**
1806 * Logs when profiles on a Bluetooth device connects and disconnects.
1807 *
1808 * Logged from:
1809 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
1810 *
1811 * Next Tag: 6
1812 */
1813message BluetoothConnectionStateChanged {
1814    // The state of the connection.
1815    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1816    optional android.bluetooth.ConnectionStateEnum state = 1;
1817    // An identifier that can be used to match connect and disconnect events.
1818    // Currently is last two bytes of a hash of a device level ID and
1819    // the mac address of the bluetooth device that is connected.
1820    // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
1821    optional int32 obfuscated_id = 2 [deprecated = true];
1822    // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1823    // From android.bluetooth.BluetoothAdapter.java
1824    // Default: 0 when not used
1825    optional int32 bt_profile = 3;
1826    // An identifier that can be used to match events for this device.
1827    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1828    // Salt: Randomly generated 256 bit value
1829    // Hash algorithm: HMAC-SHA256
1830    // Size: 32 byte
1831    // Default: null or empty if the device identifier is not known
1832    optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
1833    // An identifier that can be used to match events for this device.
1834    // The incremental identifier is locally generated and guaranteed not derived
1835    // from any globally unique hardware id.
1836    // For paired devices, it stays consistent between Bluetooth toggling for the
1837    // same remote device.
1838    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1839    // session for the same remote device.
1840    // Default: 0 if the device's metric id is unknown.
1841    optional int32 metric_id = 5;
1842}
1843
1844/**
1845 * Logs when a Bluetooth device connects and disconnects over ACL
1846 *
1847 * Logged from:
1848 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1849 *
1850 * Next Tag: 4
1851 */
1852message BluetoothAclConnectionStateChanged {
1853    // An identifier that can be used to match events for this device.
1854    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1855    // Salt: Randomly generated 256 bit value
1856    // Hash algorithm: HMAC-SHA256
1857    // Size: 32 byte
1858    // Default: null or empty if the device identifier is not known
1859    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1860    // The state of the connection.
1861    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1862    optional android.bluetooth.ConnectionStateEnum state = 2;
1863    // An identifier that can be used to match events for this device.
1864    // The incremental identifier is locally generated and guaranteed not derived
1865    // from any globally unique hardware id.
1866    // For paired devices, it stays consistent between Bluetooth toggling for the
1867    // same remote device.
1868    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1869    // session for the same remote device.
1870    // Default: 0 if the device's metric id is unknown.
1871    optional int32 metric_id = 3;
1872}
1873
1874/**
1875 * Logs when a Bluetooth device connects and disconnects over SCO
1876 *
1877 * Logged from:
1878 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
1879 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
1880 *
1881 * Next Tag: 5
1882 */
1883message BluetoothScoConnectionStateChanged {
1884    // An identifier that can be used to match events for this device.
1885    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1886    // Salt: Randomly generated 256 bit value
1887    // Hash algorithm: HMAC-SHA256
1888    // Size: 32 byte
1889    // Default: null or empty if the device identifier is not known
1890    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1891    // The state of the connection.
1892    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1893    optional android.bluetooth.ConnectionStateEnum state = 2;
1894    // Codec used for this SCO connection
1895    // Default: UNKNOWN
1896    optional android.bluetooth.hfp.ScoCodec codec = 3;
1897    // An identifier that can be used to match events for this device.
1898    // The incremental identifier is locally generated and guaranteed not derived
1899    // from any globally unique hardware id.
1900    // For paired devices, it stays consistent between Bluetooth toggling for the
1901    // same remote device.
1902    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1903    // session for the same remote device.
1904    // Default: 0 if the device's metric id is unknown.
1905    optional int32 metric_id = 4;
1906}
1907
1908/**
1909 * Logged when active device of a profile changes
1910 *
1911 * Logged from:
1912 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1913 *     packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetService.java
1914 *     packages/apps/Bluetooth/src/com/android/bluetooth/hearingaid/HearingAidService.java
1915 */
1916message BluetoothActiveDeviceChanged {
1917    // The profile whose active device has changed. Eg. A2DP, HEADSET, HEARING_AID
1918    // From android.bluetooth.BluetoothProfile
1919    optional int32 bt_profile = 1;
1920    // An identifier that can be used to match events for this new active device.
1921    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1922    // Salt: Randomly generated 256 bit value
1923    // Hash algorithm: HMAC-SHA256
1924    // Size: 32 byte
1925    // Default: null or empty if there is no active device for this profile
1926    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
1927    // An identifier that can be used to match events for this device.
1928    // The incremental identifier is locally generated and guaranteed not derived
1929    // from any globally unique hardware id.
1930    // For paired devices, it stays consistent between Bluetooth toggling for the
1931    // same remote device.
1932    // For unpaired devices, it stays consistent within the same Bluetooth adapter
1933    // session for the same remote device.
1934    // Default: 0 if the device's metric id is unknown.
1935    optional int32 metric_id = 3;
1936}
1937
1938// Logs when there is an event affecting Bluetooth device's link layer connection.
1939// - This event is triggered when there is a related HCI command or event
1940// - Users of this metrics can deduce Bluetooth device's connection state from these events
1941// - HCI commands are logged before the command is sent, after receiving command status, and after
1942//   receiving command complete
1943// - HCI events are logged when they arrive
1944//
1945// Low level log from system/bt
1946//
1947// Bluetooth classic commands:
1948// - CMD_CREATE_CONNECTION
1949// - CMD_DISCONNECT
1950// - CMD_CREATE_CONNECTION_CANCEL
1951// - CMD_ACCEPT_CONNECTION_REQUEST
1952// - CMD_REJECT_CONNECTION_REQUEST
1953// - CMD_SETUP_ESCO_CONNECTION
1954// - CMD_ACCEPT_ESCO_CONNECTION
1955// - CMD_REJECT_ESCO_CONNECTION
1956// - CMD_ENH_SETUP_ESCO_CONNECTION
1957// - CMD_ENH_ACCEPT_ESCO_CONNECTION
1958//
1959// Bluetooth low energy commands:
1960// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
1961// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
1962// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
1963// - CMD_BLE_CLEAR_WHITE_LIST
1964// - CMD_BLE_ADD_WHITE_LIST
1965// - CMD_BLE_REMOVE_WHITE_LIST
1966//
1967// Bluetooth classic events:
1968// - EVT_CONNECTION_COMP
1969// - EVT_CONNECTION_REQUEST
1970// - EVT_DISCONNECTION_COMP
1971// - EVT_ESCO_CONNECTION_COMP
1972// - EVT_ESCO_CONNECTION_CHANGED
1973//
1974// Bluetooth low energy meta events:
1975// - BLE_EVT_CONN_COMPLETE_EVT
1976// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
1977//
1978// Next tag: 10
1979message BluetoothLinkLayerConnectionEvent {
1980    // An identifier that can be used to match events for this device.
1981    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1982    // Salt: Randomly generated 256 bit value
1983    // Hash algorithm: HMAC-SHA256
1984    // Size: 32 byte
1985    // Default: null or empty if the device identifier is not known
1986    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1987    // Connection handle of this connection if available
1988    // Range: 0x0000 - 0x0EFF (12 bits)
1989    // Default: 0xFFFF if the handle is unknown
1990    optional int32 connection_handle = 2;
1991    // Direction of the link
1992    // Default: DIRECTION_UNKNOWN
1993    optional android.bluetooth.DirectionEnum direction = 3;
1994    // Type of this link
1995    // Default: LINK_TYPE_UNKNOWN
1996    optional android.bluetooth.LinkTypeEnum type = 4;
1997
1998    // Reason metadata for this link layer connection event, rules for interpretation:
1999    // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
2000    //    EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
2001    // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
2002    //    set and valid, ignore hci_ble_event
2003
2004    // HCI command associated with this event
2005    // Default: CMD_UNKNOWN
2006    optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
2007    // HCI event associated with this event
2008    // Default: EVT_UNKNOWN
2009    optional android.bluetooth.hci.EventEnum hci_event = 6;
2010    // HCI BLE meta event associated with this event
2011    // Default: BLE_EVT_UNKNOWN
2012    optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
2013    // HCI command status code if this is triggerred by hci_cmd
2014    // Default: STATUS_UNKNOWN
2015    optional android.bluetooth.hci.StatusEnum cmd_status = 8;
2016    // HCI reason code associated with this event
2017    // Default: STATUS_UNKNOWN
2018    optional android.bluetooth.hci.StatusEnum reason_code = 9;
2019    // An identifier that can be used to match events for this device.
2020    // The incremental identifier is locally generated and guaranteed not derived
2021    // from any globally unique hardware id.
2022    // For paired devices, it stays consistent between Bluetooth toggling for the
2023    // same remote device.
2024    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2025    // session for the same remote device.
2026    // Default: 0 if the device's metric id is unknown.
2027    optional int32 metric_id = 10;
2028}
2029
2030/**
2031 * Logs when a module is rolled back by Watchdog.
2032 *
2033 * Logged from: Rollback Manager
2034 */
2035message WatchdogRollbackOccurred {
2036    enum RollbackType {
2037        UNKNOWN = 0;
2038        ROLLBACK_INITIATE = 1;
2039        ROLLBACK_SUCCESS = 2;
2040        ROLLBACK_FAILURE = 3;
2041        ROLLBACK_BOOT_TRIGGERED = 4;
2042    }
2043    optional RollbackType rollback_type = 1;
2044
2045    optional string package_name = 2;
2046
2047    optional int32 package_version_code = 3;
2048
2049    enum RollbackReasonType {
2050        REASON_UNKNOWN = 0;
2051        REASON_NATIVE_CRASH = 1;
2052        REASON_EXPLICIT_HEALTH_CHECK = 2;
2053        REASON_APP_CRASH = 3;
2054        REASON_APP_NOT_RESPONDING = 4;
2055        REASON_NATIVE_CRASH_DURING_BOOT = 5;
2056    }
2057    optional RollbackReasonType rollback_reason = 4;
2058
2059    // Set by RollbackPackageHealthObserver to be the package that is failing when a rollback
2060    // is initiated. Empty if the package is unknown.
2061    optional string failing_package_name = 5;
2062
2063    optional TrainExperimentIds experiment_ids = 6 [(log_mode) = MODE_BYTES];
2064}
2065
2066/**
2067 * Logs when there is a change in Bluetooth A2DP playback state
2068 *
2069 * Logged from:
2070 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2071 */
2072message BluetoothA2dpPlaybackStateChanged {
2073    // An identifier that can be used to match events for this device.
2074    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2075    // Salt: Randomly generated 256 bit value
2076    // Hash algorithm: HMAC-SHA256
2077    // Size: 32 byte
2078    // Default: null or empty if the device identifier is not known
2079    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2080    // Current playback state
2081    // Default: PLAYBACK_STATE_UNKNOWN
2082    optional android.bluetooth.a2dp.PlaybackStateEnum playback_state = 2;
2083    // Current audio coding mode
2084    // Default: AUDIO_CODING_MODE_UNKNOWN
2085    optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
2086    // An identifier that can be used to match events for this device.
2087    // The incremental identifier is locally generated and guaranteed not derived
2088    // from any globally unique hardware id.
2089    // For paired devices, it stays consistent between Bluetooth toggling for the
2090    // same remote device.
2091    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2092    // session for the same remote device.
2093    // Default: 0 if the device's metric id is unknown.
2094    optional int32 metric_id = 4;
2095}
2096
2097/**
2098 * Logs when there is a change in A2DP codec config for a particular remote device
2099 *
2100 * Logged from:
2101 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
2102 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2103 */
2104message BluetoothA2dpCodecConfigChanged {
2105    // An identifier that can be used to match events for this device.
2106    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2107    // Salt: Randomly generated 256 bit value
2108    // Hash algorithm: HMAC-SHA256
2109    // Size: 32 byte
2110    // Default: null or empty if the device identifier is not known
2111    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2112    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
2113    // Default SOURCE_CODEC_TYPE_INVALID
2114    optional int32 codec_type = 2;
2115    // Codec priroity, the higher the more preferred, -1 for disabled
2116    // Default: CODEC_PRIORITY_DEFAULT
2117    optional int32 codec_priority = 3;
2118    // Sample rate in Hz as defined by various SAMPLE_RATE_* constants in BluetoothCodecConfig
2119    // Default: SAMPLE_RATE_NONE
2120    optional int32 sample_rate = 4;
2121    // Bits per sample as defined by various BITS_PER_SAMPLE_* constants in BluetoothCodecConfig
2122    // Default: BITS_PER_SAMPLE_NONE
2123    optional int32 bits_per_sample = 5;
2124    // Channel mode as defined by various CHANNEL_MODE_* constants in BluetoothCodecConfig
2125    // Default: CHANNEL_MODE_NONE
2126    optional int32 channel_mode = 6;
2127    // Codec specific values
2128    // Default 0
2129    optional int64 codec_specific_1 = 7;
2130    optional int64 codec_specific_2 = 8;
2131    optional int64 codec_specific_3 = 9;
2132    optional int64 codec_specific_4 = 10;
2133    // An identifier that can be used to match events for this device.
2134    // The incremental identifier is locally generated and guaranteed not derived
2135    // from any globally unique hardware id.
2136    // For paired devices, it stays consistent between Bluetooth toggling for the
2137    // same remote device.
2138    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2139    // session for the same remote device.
2140    // Default: 0 if the device's metric id is unknown.
2141    optional int32 metric_id = 11;
2142}
2143
2144/**
2145 * Logs when there is a change in selectable A2DP codec capability for a paricular remote device
2146 * Each codec's capability is logged separately due to statsd restriction
2147 *
2148 * Logged from:
2149 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
2150 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
2151 */
2152message BluetoothA2dpCodecCapabilityChanged {
2153    // An identifier that can be used to match events for this device.
2154    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2155    // Salt: Randomly generated 256 bit value
2156    // Hash algorithm: HMAC-SHA256
2157    // Size: 32 byte
2158    // Default: null or empty if the device identifier is not known
2159    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2160    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
2161    // Default SOURCE_CODEC_TYPE_INVALID
2162    optional int32 codec_type = 2;
2163    // Codec priroity, the higher the more preferred, -1 for disabled
2164    // Default: CODEC_PRIORITY_DEFAULT
2165    optional int32 codec_priority = 3;
2166    // A bit field of supported sample rates as defined by various SAMPLE_RATE_* constants
2167    // in BluetoothCodecConfig
2168    // Default: empty and SAMPLE_RATE_NONE for individual item
2169    optional int32 sample_rate = 4;
2170    // A bit field of supported bits per sample as defined by various BITS_PER_SAMPLE_* constants
2171    // in BluetoothCodecConfig
2172    // Default: empty and BITS_PER_SAMPLE_NONE for individual item
2173    optional int32 bits_per_sample = 5;
2174    // A bit field of supported channel mode as defined by various CHANNEL_MODE_* constants in
2175    // BluetoothCodecConfig
2176    // Default: empty and CHANNEL_MODE_NONE for individual item
2177    optional int32 channel_mode = 6;
2178    // Codec specific values
2179    // Default 0
2180    optional int64 codec_specific_1 = 7;
2181    optional int64 codec_specific_2 = 8;
2182    optional int64 codec_specific_3 = 9;
2183    optional int64 codec_specific_4 = 10;
2184    // An identifier that can be used to match events for this device.
2185    // The incremental identifier is locally generated and guaranteed not derived
2186    // from any globally unique hardware id.
2187    // For paired devices, it stays consistent between Bluetooth toggling for the
2188    // same remote device.
2189    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2190    // session for the same remote device.
2191    // Default: 0 if the device's metric id is unknown.
2192    optional int32 metric_id = 11;
2193}
2194
2195/**
2196 * Logs when A2DP failed to read from PCM source.
2197 * This typically happens when audio HAL cannot supply A2DP with data fast enough for encoding.
2198 *
2199 * Logged from:
2200 *     system/bt
2201 */
2202message BluetoothA2dpAudioUnderrunReported {
2203    // An identifier that can be used to match events for this device.
2204    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2205    // Salt: Randomly generated 256 bit value
2206    // Hash algorithm: HMAC-SHA256
2207    // Size: 32 byte
2208    // Default: null or empty if the device identifier is not known
2209    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2210    // Encoding interval in nanoseconds
2211    // Default: 0
2212    optional int64 encoding_interval_nanos = 2;
2213    // Number of bytes of PCM data that could not be read from the source
2214    // Default: 0
2215    optional int32 num_missing_pcm_bytes = 3;
2216    // An identifier that can be used to match events for this device.
2217    // The incremental identifier is locally generated and guaranteed not derived
2218    // from any globally unique hardware id.
2219    // For paired devices, it stays consistent between Bluetooth toggling for the
2220    // same remote device.
2221    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2222    // session for the same remote device.
2223    // Default: 0 if the device's metric id is unknown.
2224    optional int32 metric_id = 4;
2225}
2226
2227/**
2228 * Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit
2229 * buffer queue is full and we have to drop data
2230 *
2231 * Logged from:
2232 *     system/bt
2233 */
2234message BluetoothA2dpAudioOverrunReported {
2235    // An identifier that can be used to match events for this device.
2236    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2237    // Salt: Randomly generated 256 bit value
2238    // Hash algorithm: HMAC-SHA256
2239    // Size: 32 byte
2240    // Default: null or empty if the device identifier is not known
2241    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2242    // Encoding interval in nanoseconds
2243    // Default: 0
2244    optional int64 encoding_interval_nanos = 2;
2245    // Number of buffers dropped in this event
2246    // Each buffer is encoded in one encoding interval and consists of multiple encoded frames
2247    // Default: 0
2248    optional int32 num_dropped_buffers = 3;
2249    // Number of encoded buffers dropped in this event
2250    // Default 0
2251    optional int32 num_dropped_encoded_frames = 4;
2252    // Number of encoded bytes dropped in this event
2253    // Default: 0
2254    optional int32 num_dropped_encoded_bytes = 5;
2255    // An identifier that can be used to match events for this device.
2256    // The incremental identifier is locally generated and guaranteed not derived
2257    // from any globally unique hardware id.
2258    // For paired devices, it stays consistent between Bluetooth toggling for the
2259    // same remote device.
2260    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2261    // session for the same remote device.
2262    // Default: 0 if the device's metric id is unknown.
2263    optional int32 metric_id = 6;
2264}
2265
2266/**
2267 * Logs when we receive reports regarding a device's RSSI value
2268 *
2269 * Logged from:
2270 *     system/bt
2271 */
2272message BluetoothDeviceRssiReported {
2273    // An identifier that can be used to match events for this device.
2274    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2275    // Salt: Randomly generated 256 bit value
2276    // Hash algorithm: HMAC-SHA256
2277    // Size: 32 byte
2278    // Default: null or empty if the device identifier is not known
2279    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2280    // Connection handle of this connection if available
2281    // Range: 0x0000 - 0x0EFF (12 bits)
2282    // Default: 0xFFFF if the handle is unknown
2283    optional int32 connection_handle = 2;
2284    // HCI command status code if this is triggerred by hci_cmd
2285    // Default: STATUS_UNKNOWN
2286    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2287    // BR/EDR
2288    //   Range: -128 ≤ N ≤ 127 (signed integer)
2289    //   Units: dB
2290    // LE:
2291    //   Range: -127 to 20, 127 (signed integer)
2292    //   Units: dBm
2293    // Invalid when an out of range value is reported
2294    optional int32 rssi = 4;
2295    // An identifier that can be used to match events for this device.
2296    // The incremental identifier is locally generated and guaranteed not derived
2297    // from any globally unique hardware id.
2298    // For paired devices, it stays consistent between Bluetooth toggling for the
2299    // same remote device.
2300    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2301    // session for the same remote device.
2302    // Default: 0 if the device's metric id is unknown.
2303    optional int32 metric_id = 5;
2304}
2305
2306/**
2307 * Logs when we receive reports regarding how many consecutive failed contacts for a connection
2308 *
2309 * Logged from:
2310 *     system/bt
2311 */
2312message BluetoothDeviceFailedContactCounterReported {
2313    // An identifier that can be used to match events for this device.
2314    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2315    // Salt: Randomly generated 256 bit value
2316    // Hash algorithm: HMAC-SHA256
2317    // Size: 32 byte
2318    // Default: null or empty if the device identifier is not known
2319    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2320    // Connection handle of this connection if available
2321    // Range: 0x0000 - 0x0EFF (12 bits)
2322    // Default: 0xFFFF if the handle is unknown
2323    optional int32 connection_handle = 2;
2324    // HCI command status code if this is triggerred by hci_cmd
2325    // Default: STATUS_UNKNOWN
2326    optional android.bluetooth.hci.StatusEnum cmd_status = 3;
2327    // Number of consecutive failed contacts for a connection corresponding to the Handle
2328    // Range: uint16_t, 0-0xFFFF
2329    // Default: 0xFFFFF
2330    optional int32 failed_contact_counter = 4;
2331    // An identifier that can be used to match events for this device.
2332    // The incremental identifier is locally generated and guaranteed not derived
2333    // from any globally unique hardware id.
2334    // For paired devices, it stays consistent between Bluetooth toggling for the
2335    // same remote device.
2336    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2337    // session for the same remote device.
2338    // Default: 0 if the device's metric id is unknown.
2339    optional int32 metric_id = 5;
2340}
2341
2342/**
2343 * Logs when we receive reports regarding the tranmit power level used for a specific connection
2344 *
2345 * Logged from:
2346 *     system/bt
2347 */
2348message BluetoothDeviceTxPowerLevelReported {
2349    // An identifier that can be used to match events for this device.
2350    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2351    // Salt: Randomly generated 256 bit value
2352    // Hash algorithm: HMAC-SHA256
2353    // Size: 32 byte
2354    // Default: null or empty if the device identifier is not known
2355    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2356    // Connection handle of this connection if available
2357    // Range: 0x0000 - 0x0EFF (12 bits)
2358    // Default: 0xFFFF if the handle is unknown
2359    optional int32 connection_handle = 2;
2360    // HCI command status code if this is triggered by hci_cmd
2361    // Default: STATUS_UNKNOWN
2362    optional android.bluetooth.hci.StatusEnum hci_status = 3;
2363    // Range: -30 ≤ N ≤ 20
2364    // Units: dBm
2365    // Invalid when an out of range value is reported
2366    optional int32 transmit_power_level = 4;
2367    // An identifier that can be used to match events for this device.
2368    // The incremental identifier is locally generated and guaranteed not derived
2369    // from any globally unique hardware id.
2370    // For paired devices, it stays consistent between Bluetooth toggling for the
2371    // same remote device.
2372    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2373    // session for the same remote device.
2374    // Default: 0 if the device's metric id is unknown.
2375    optional int32 metric_id = 5;
2376}
2377
2378/**
2379 * Logs when Bluetooth controller failed to reply with command status within a timeout period after
2380 * receiving an HCI command from the host
2381 *
2382 * Logged from: system/bt
2383 */
2384message BluetoothHciTimeoutReported {
2385    // HCI command associated with this event
2386    // Default: CMD_UNKNOWN
2387    optional android.bluetooth.hci.CommandEnum hci_command = 1;
2388}
2389
2390/**
2391 * Logs when we receive Bluetooth Link Quality Report event from the controller
2392 * See Android Bluetooth HCI specification for more details
2393 *
2394 * Note: all count and bytes field are counted since last event
2395 *
2396 * Logged from: system/bt
2397 */
2398message BluetoothQualityReportReported {
2399    // Quality report ID
2400    // Original type: uint8_t
2401    // Default: BQR_ID_UNKNOWN
2402    optional android.bluetooth.hci.BqrIdEnum quality_report_id = 1;
2403    // Packet type of the connection
2404    // Original type: uint8_t
2405    // Default: BQR_PACKET_TYPE_UNKNOWN
2406    optional android.bluetooth.hci.BqrPacketTypeEnum packet_types = 2;
2407    // Connection handle of the connection
2408    // Original type: uint16_t
2409    optional int32 connection_handle = 3;
2410    // Performing Role for the connection
2411    // Original type: uint8_t
2412    optional int32 connection_role = 4;
2413    // Current Transmit Power Level for the connection. This value is the same as the controller's
2414    // response to the HCI_Read_Transmit_Power_Level HCI command
2415    // Original type: uint8_t
2416    optional int32 tx_power_level = 5;
2417    // Received Signal Strength Indication (RSSI) value for the connection. This value is an
2418    // absolute receiver signal strength value
2419    // Original type: int8_t
2420    optional int32 rssi = 6;
2421    // Signal-to-Noise Ratio (SNR) value for the connection. It is the average SNR of all the
2422    // channels used by the link currently
2423    // Original type: uint8_t
2424    optional int32 snr = 7;
2425    // Indicates the number of unused channels in AFH_channel_map
2426    // Original type: uint8_t
2427    optional int32 unused_afh_channel_count = 8;
2428    // Indicates the number of the channels which are interfered and quality is bad but are still
2429    // selected for AFH
2430    // Original type: uint8_t
2431    optional int32 afh_select_unideal_channel_count = 9;
2432    // Current Link Supervision Timeout Setting
2433    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2434    // Original type: uint16_t
2435    optional int32 lsto = 10;
2436    // Piconet Clock for the specified Connection_Handle. This value is the same as the controller's
2437    // response to HCI_Read_Clock HCI command with the parameter "Which_Clock" of
2438    // 0x01 (Piconet Clock)
2439    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2440    // Original type: uint32_t
2441    optional int64 connection_piconet_clock = 11;
2442    // The count of retransmission
2443    // Original type: uint32_t
2444    optional int64 retransmission_count = 12;
2445    // The count of no RX
2446    // Original type: uint32_t
2447    optional int64 no_rx_count = 13;
2448    // The count of NAK (Negative Acknowledge)
2449    // Original type: uint32_t
2450    optional int64 nak_count = 14;
2451    // Controller timestamp of last TX ACK
2452    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2453    // Original type: uint32_t
2454    optional int64 last_tx_ack_timestamp = 15;
2455    // The count of Flow-off (STOP)
2456    // Original type: uint32_t
2457    optional int64 flow_off_count = 16;
2458    // Controller timestamp of last Flow-on (GO)
2459    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2460    // Original type: uint32_t
2461    optional int64 last_flow_on_timestamp = 17;
2462    // Buffer overflow count (how many bytes of TX data are dropped) since the last event
2463    // Original type: uint32_t
2464    optional int64 buffer_overflow_bytes = 18;
2465    // Buffer underflow count (in byte) since last event
2466    // Original type: uint32_t
2467    optional int64 buffer_underflow_bytes = 19;
2468}
2469
2470/**
2471 * Logs when a Bluetooth device's manufacturer information is learnt by the Bluetooth stack
2472 *
2473 * Notes:
2474 * - Each event can be partially filled as we might learn different pieces of device
2475 *   information at different time
2476 * - Multiple device info events can be combined to give more complete picture
2477 * - When multiple device info events tries to describe the same information, the
2478 *   later one wins
2479 *
2480 * Logged from:
2481 *     packages/apps/Bluetooth
2482 */
2483message BluetoothDeviceInfoReported {
2484    // An identifier that can be used to match events for this device.
2485    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2486    // Salt: Randomly generated 256 bit value
2487    // Hash algorithm: HMAC-SHA256
2488    // Size: 32 byte
2489    // Default: null or empty if the device identifier is not known
2490    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2491    // Where is this device info obtained from
2492    optional android.bluetooth.DeviceInfoSrcEnum source_type = 2;
2493    // Name of the data source
2494    // For EXTERNAL: package name of the data source
2495    // For INTERNAL: null for general case, component name otherwise
2496    optional string source_name = 3;
2497    // Name of the manufacturer of this device
2498    optional string manufacturer = 4;
2499    // Model of this device
2500    optional string model = 5;
2501    // Hardware version of this device
2502    optional string hardware_version = 6;
2503    // Software version of this device
2504    optional string software_version = 7;
2505    // An identifier that can be used to match events for this device.
2506    // The incremental identifier is locally generated and guaranteed not derived
2507    // from any globally unique hardware id.
2508    // For paired devices, it stays consistent between Bluetooth toggling for the
2509    // same remote device.
2510    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2511    // session for the same remote device.
2512    // Default: 0 if the device's metric id is unknown.
2513    optional int32 metric_id = 8;
2514}
2515
2516/**
2517 * Logs when we receive Bluetooth Read Remote Version Information Complete Event from the remote
2518 * device, as documented by the Bluetooth Core HCI specification
2519 * Reference: https://www.bluetooth.com/specifications/bluetooth-core-specification
2520 * Vol 2, Part E, Page 1118
2521 *
2522 * Logged from:
2523 *     system/bt
2524 */
2525message BluetoothRemoteVersionInfoReported {
2526    // Connection handle of the connection
2527    // Original type: uint16_t
2528    optional int32 connection_handle = 1;
2529    // HCI command status code
2530    // Default: STATUS_UNKNOWN
2531    optional android.bluetooth.hci.StatusEnum hci_status = 2;
2532    // 1 byte Version of current LMP in the remote controller
2533    optional int32 lmp_version = 3;
2534    // 2 bytes LMP manufacturer code of the remote controller
2535    // https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
2536    optional int32 lmp_manufacturer_code = 4;
2537    // 4 bytes subversion of the LMP in the remote controller
2538    optional int32 lmp_subversion = 5;
2539}
2540
2541/**
2542 * Logs when certain Bluetooth SDP attributes are discovered
2543 * Constant definitions are from:
2544 *     https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
2545 *
2546 * Current logged attributes:
2547 * - BluetoothProfileDescriptorList
2548 * - Supported Features Bitmask
2549 *
2550 * Logged from:
2551 *     system/bt
2552 */
2553message BluetoothSdpAttributeReported {
2554    // An identifier that can be used to match events for this device.
2555    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2556    // Salt: Randomly generated 256 bit value
2557    // Hash algorithm: HMAC-SHA256
2558    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2559    // Short form UUIDs used to identify Bluetooth protocols, profiles, and service classes
2560    // Original type: uint16_t
2561    optional int32 protocol_uuid = 2;
2562    // Short form UUIDs used to identify Bluetooth SDP attribute types
2563    // Original type: uint16_t
2564    optional int32 attribute_id = 3;
2565    // Attribute value for the particular attribute
2566    optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
2567    // An identifier that can be used to match events for this device.
2568    // The incremental identifier is locally generated and guaranteed not derived
2569    // from any globally unique hardware id.
2570    // For paired devices, it stays consistent between Bluetooth toggling for the
2571    // same remote device.
2572    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2573    // session for the same remote device.
2574    // Default: 0 if the device's metric id is unknown.
2575    optional int32 metric_id = 5;
2576}
2577
2578/**
2579 * Logs when bond state of a Bluetooth device changes
2580 *
2581 * Logged from:
2582 *     frameworks/base/core/java/android/bluetooth/BluetoothDevice.java
2583 *     packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2584 */
2585message BluetoothBondStateChanged {
2586    // An identifier that can be used to match events for this device.
2587    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2588    // Salt: Randomly generated 256 bit value
2589    // Hash algorithm: HMAC-SHA256
2590    // Size: 32 byte
2591    // Default: null or empty if the device identifier is not known
2592    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2593    // Preferred transport type to remote dual mode device
2594    // Default: TRANSPORT_AUTO means no preference
2595    optional android.bluetooth.TransportTypeEnum transport = 2;
2596    // The type of this Bluetooth device (Classic, LE, or Dual mode)
2597    // Default: UNKNOWN
2598    optional android.bluetooth.DeviceTypeEnum type = 3;
2599    // Current bond state (NONE, BONDING, BONDED)
2600    // Default: BOND_STATE_UNKNOWN
2601    optional android.bluetooth.BondStateEnum bond_state = 4;
2602    // Bonding sub state
2603    // Default: BOND_SUB_STATE_UNKNOWN
2604    optional android.bluetooth.BondSubStateEnum bonding_sub_state = 5;
2605    // Unbond Reason
2606    // Default: UNBOND_REASON_UNKNOWN
2607    optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
2608    // An identifier that can be used to match events for this device.
2609    // The incremental identifier is locally generated and guaranteed not derived
2610    // from any globally unique hardware id.
2611    // For paired devices, it stays consistent between Bluetooth toggling for the
2612    // same remote device.
2613    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2614    // session for the same remote device.
2615    // Default: 0 if the device's metric id is unknown.
2616    optional int32 metric_id = 7;
2617}
2618
2619/**
2620 * Logs there is an event related Bluetooth classic pairing
2621 *
2622 * Logged from:
2623 *     system/bt
2624 */
2625message BluetoothClassicPairingEventReported {
2626    // An identifier that can be used to match events for this device.
2627    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2628    // Salt: Randomly generated 256 bit value
2629    // Hash algorithm: HMAC-SHA256
2630    // Size: 32 byte
2631    // Default: null or empty if the device identifier is not known
2632    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2633    // Connection handle of this connection if available
2634    // Range: 0x0000 - 0x0EFF (12 bits)
2635    // Default: 0xFFFF if the handle is unknown
2636    optional int32 connection_handle = 2;
2637    // HCI command associated with this event
2638    // Default: CMD_UNKNOWN
2639    optional android.bluetooth.hci.CommandEnum hci_cmd = 3;
2640    // HCI event associated with this event
2641    // Default: EVT_UNKNOWN
2642    optional android.bluetooth.hci.EventEnum hci_event = 4;
2643    // HCI command status code if this is triggerred by hci_cmd
2644    // Default: STATUS_UNKNOWN
2645    optional android.bluetooth.hci.StatusEnum cmd_status = 5;
2646    // HCI reason code associated with this event
2647    // Default: STATUS_UNKNOWN
2648    optional android.bluetooth.hci.StatusEnum reason_code = 6;
2649    // A status value related to this specific event
2650    // Default: 0
2651    optional int64 event_value = 7;
2652    // An identifier that can be used to match events for this device.
2653    // The incremental identifier is locally generated and guaranteed not derived
2654    // from any globally unique hardware id.
2655    // For paired devices, it stays consistent between Bluetooth toggling for the
2656    // same remote device.
2657    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2658    // session for the same remote device.
2659    // Default: 0 if the device's metric id is unknown.
2660    optional int32 metric_id = 8;
2661}
2662
2663/**
2664 * Logs when there is an event related to Bluetooth Security Manager Protocol (SMP)
2665 *
2666 * Logged from:
2667 *     system/bt
2668 */
2669message BluetoothSmpPairingEventReported {
2670    // An identifier that can be used to match events for this device.
2671    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2672    // Salt: Randomly generated 256 bit value
2673    // Hash algorithm: HMAC-SHA256
2674    // Size: 32 byte
2675    // Default: null or empty if the device identifier is not known
2676    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2677    // SMP command sent or received over L2CAP
2678    // Default: CMD_UNKNOWN
2679    optional android.bluetooth.smp.CommandEnum smp_command = 2;
2680    // Whether this command is sent or received
2681    // Default: DIRECTION_UNKNOWN
2682    optional android.bluetooth.DirectionEnum direction = 3;
2683    // SMP failure reason code
2684    // Default: PAIRING_FAIL_REASON_DEFAULT
2685    optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
2686    // An identifier that can be used to match events for this device.
2687    // The incremental identifier is locally generated and guaranteed not derived
2688    // from any globally unique hardware id.
2689    // For paired devices, it stays consistent between Bluetooth toggling for the
2690    // same remote device.
2691    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2692    // session for the same remote device.
2693    // Default: 0 if the device's metric id is unknown.
2694    optional int32 metric_id = 5;
2695}
2696
2697/**
2698 * Logs when a Bluetooth socket’s connection state changed
2699 *
2700 * Logged from:
2701 *   system/bt
2702 */
2703message BluetoothSocketConnectionStateChanged {
2704    // An identifier that can be used to match events for this device.
2705    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2706    // Salt: Randomly generated 256 bit value
2707    // Hash algorithm: HMAC-SHA256
2708    // Size: 32 byte
2709    // Default: null or empty if this is a server listener socket
2710    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2711    // Temporary port of this socket for the current connection or session only
2712    // Default 0 when unknown or don't care
2713    optional int32 port = 2;
2714    // Socket type as mentioned in
2715    // frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
2716    // Default: SOCKET_TYPE_UNKNOWN
2717    optional android.bluetooth.SocketTypeEnum type = 3;
2718    // Socket connection state
2719    // Default: SOCKET_CONNECTION_STATE_UNKNOWN
2720    optional android.bluetooth.SocketConnectionstateEnum state = 4;
2721    // Number of bytes sent to remote device during this connection
2722    optional int64 tx_bytes = 5;
2723    // Number of bytes received from remote device during this connection
2724    optional int64 rx_bytes = 6;
2725    // Socket owner's UID
2726    optional int32 uid = 7 [(is_uid) = true];
2727    // Server port of this socket, if any. When both |server_port| and |port| fields are populated,
2728    // |port| must be spawned by |server_port|
2729    // Default 0 when unknown or don't care
2730    optional int32 server_port = 8;
2731    // Whether this is a server listener socket
2732    optional android.bluetooth.SocketRoleEnum is_server = 9;
2733    // An identifier that can be used to match events for this device.
2734    // The incremental identifier is locally generated and guaranteed not derived
2735    // from any globally unique hardware id.
2736    // For paired devices, it stays consistent between Bluetooth toggling for the
2737    // same remote device.
2738    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2739    // session for the same remote device.
2740    // Default: 0 if the device's metric id is unknown.
2741    optional int32 metric_id = 10;
2742}
2743
2744/**
2745 * Logs when Class of Device (CoD) value is learnt for a device during pairing or connection
2746 *
2747 * Logged from:
2748 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2749 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
2750 *
2751 */
2752message BluetoothClassOfDeviceReported {
2753    // An identifier that can be used to match events for this device.
2754    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2755    // Salt: Randomly generated 256 bit value
2756    // Hash algorithm: HMAC-SHA256
2757    // Size: 32 byte
2758    // Default: null or empty if this is a server listener socket
2759    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2760    // Class of Device (CoD) value including both Major, Minor device class and service class
2761    // Defined in: https://www.bluetooth.com/specifications/assigned-numbers/baseband
2762    // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
2763    // Default: 0
2764    optional int32 class_of_device = 2;
2765    // An identifier that can be used to match events for this device.
2766    // The incremental identifier is locally generated and guaranteed not derived
2767    // from any globally unique hardware id.
2768    // For paired devices, it stays consistent between Bluetooth toggling for the
2769    // same remote device.
2770    // For unpaired devices, it stays consistent within the same Bluetooth adapter
2771    // session for the same remote device.
2772    // Default: 0 if the device's metric id is unknown.
2773    optional int32 metric_id = 3;
2774}
2775
2776/**
2777 * Logs when something is plugged into or removed from the USB-C connector.
2778 *
2779 * Logged from:
2780 *  UsbService
2781 */
2782message UsbConnectorStateChanged {
2783    enum State {
2784        STATE_DISCONNECTED = 0;
2785        STATE_CONNECTED = 1;
2786    }
2787    optional State state = 1
2788            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
2789    optional string id = 2 [(state_field_option).primary_field = true];
2790    // Last active session in ms.
2791    // 0 when the port is in connected state.
2792    optional int64 last_connect_duration_millis = 3;
2793}
2794
2795/**
2796 * Logs the reported speaker impedance.
2797 *
2798 * Logged from:
2799 *  Vendor audio implementation.
2800 */
2801message SpeakerImpedanceReported {
2802    optional int32 speaker_location = 1;
2803    optional int32 impedance = 2;
2804}
2805
2806/**
2807 * Logs the report of a failed hardware.
2808 *
2809 * Logged from:
2810 *  Vendor HALs.
2811 *
2812 */
2813message HardwareFailed {
2814    enum HardwareType {
2815        HARDWARE_FAILED_UNKNOWN = 0;
2816        HARDWARE_FAILED_MICROPHONE = 1;
2817        HARDWARE_FAILED_CODEC = 2;
2818        HARDWARE_FAILED_SPEAKER = 3;
2819        HARDWARE_FAILED_FINGERPRINT = 4;
2820    }
2821    optional HardwareType hardware_type = 1;
2822
2823   /**
2824    * hardware_location allows vendors to differentiate between multiple instances of
2825    * the same hardware_type.  The specific locations are vendor defined integers,
2826    * referring to board-specific numbering schemes.
2827    */
2828    optional int32 hardware_location = 2;
2829
2830    /**
2831     * failure_code is specific to the HardwareType of the failed hardware.
2832     * It should use one of the enum values defined below.
2833     */
2834    enum HardwareErrorCode {
2835        UNKNOWN = 0;
2836        COMPLETE = 1;
2837        SPEAKER_HIGH_Z = 2;
2838        SPEAKER_SHORT = 3;
2839        FINGERPRINT_SENSOR_BROKEN = 4;
2840        FINGERPRINT_TOO_MANY_DEAD_PIXELS = 5;
2841        DEGRADE = 6;
2842    }
2843    optional int32 failure_code = 3;
2844}
2845
2846/**
2847 * Log an event when the device has been physically dropped.
2848 * Reported from the /vendor partition.
2849 */
2850message PhysicalDropDetected {
2851    // Confidence that the event was actually a drop, 0 -> 100
2852    optional int32 confidence_pctg = 1;
2853    // Peak acceleration of the drop, in 1/1000s of a g.
2854    optional int32 accel_peak_thousandths_g = 2;
2855    // Duration of freefall in ms
2856    optional int32 freefall_time_millis = 3;
2857}
2858
2859/**
2860 * Log bucketed battery charge cycles.
2861 *
2862 * Each bucket represents cycles of the battery past
2863 * a given charge point.  For example, if 10 cycle buckets are
2864 * initialized, bucket 1 is the lowest 1/10th of the battery,
2865 * and bucket 10 is 100%.
2866 *
2867 * Logged from:
2868 * /sys/class/power_supply/bms/cycle_count, via Vendor.
2869 */
2870message ChargeCyclesReported {
2871    optional int32 cycle_bucket_1 = 1;
2872    optional int32 cycle_bucket_2 = 2;
2873    optional int32 cycle_bucket_3 = 3;
2874    optional int32 cycle_bucket_4 = 4;
2875    optional int32 cycle_bucket_5 = 5;
2876    optional int32 cycle_bucket_6 = 6;
2877    optional int32 cycle_bucket_7 = 7;
2878    optional int32 cycle_bucket_8 = 8;
2879    optional int32 cycle_bucket_9 = 9;
2880    optional int32 cycle_bucket_10 = 10;
2881}
2882
2883/**
2884 * Log battery health snapshot.
2885 *
2886 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
2887 * are snapshotted periodically over 24hrs.
2888 */
2889message BatteryHealthSnapshot {
2890    enum BatterySnapshotType {
2891        UNKNOWN = 0;
2892        MIN_TEMP = 1;         // Snapshot at min batt temp over 24hrs.
2893        MAX_TEMP = 2;         // Snapshot at max batt temp over 24hrs.
2894        MIN_RESISTANCE = 3;   // Snapshot at min batt resistance over 24hrs.
2895        MAX_RESISTANCE = 4;   // Snapshot at max batt resistance over 24hrs.
2896        MIN_VOLTAGE = 5;      // Snapshot at min batt voltage over 24hrs.
2897        MAX_VOLTAGE = 6;      // Snapshot at max batt voltage over 24hrs.
2898        MIN_CURRENT = 7;      // Snapshot at min batt current over 24hrs.
2899        MAX_CURRENT = 8;      // Snapshot at max batt current over 24hrs.
2900        MIN_BATT_LEVEL = 9;   // Snapshot at min battery level (SoC) over 24hrs.
2901        MAX_BATT_LEVEL = 10;  // Snapshot at max battery level (SoC) over 24hrs.
2902        AVG_RESISTANCE = 11;  // Snapshot at average battery resistance over 24hrs.
2903    }
2904    optional BatterySnapshotType type = 1;
2905    // Temperature, in 1/10ths of degree C.
2906    optional int32 temperature_deci_celsius = 2;
2907    // Voltage Battery Voltage, in microVolts.
2908    optional int32 voltage_micro_volt = 3;
2909    // Current Battery current, in microAmps.
2910    optional int32 current_micro_amps = 4;
2911    // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
2912    optional int32 open_circuit_micro_volt = 5;
2913    // Resistance Battery Resistance, in microOhms.
2914    optional int32 resistance_micro_ohm = 6;
2915    // Level Battery Level, as % of full.
2916    optional int32 level_percent = 7;
2917}
2918
2919/**
2920 * Log slow I/O operations on the primary storage.
2921 */
2922message SlowIo {
2923    // Classifications of IO Operations.
2924    enum IoOperation {
2925        UNKNOWN = 0;
2926        READ = 1;
2927        WRITE = 2;
2928        UNMAP = 3;
2929        SYNC = 4;
2930    }
2931    optional IoOperation operation = 1;
2932
2933    // The number of slow IO operations of this type over 24 hours.
2934    optional int32 count = 2;
2935}
2936
2937/**
2938 * Log battery caused shutdown with the last recorded voltage.
2939 */
2940message BatteryCausedShutdown {
2941    // The last recorded battery voltage prior to shutdown.
2942    optional int32 last_recorded_micro_volt = 1;
2943}
2944
2945/**
2946 * Logs when ThermalService receives throttling events.
2947 *
2948 * Logged from:
2949 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
2950 */
2951message ThermalThrottlingSeverityStateChanged {
2952    // The type of temperature being reported (CPU, GPU, SKIN, etc)
2953    optional android.os.TemperatureTypeEnum sensor_type = 1;
2954
2955    // The name of the temperature source. Eg. CPU0
2956    optional string sensor_name = 2;
2957
2958    // Temperature in tenths of a degree C.
2959    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
2960    optional int32 temperature_deci_celsius = 3;
2961
2962    // Relative severity of the throttling, see enum definition.
2963    optional android.os.ThrottlingSeverityEnum severity = 4;
2964}
2965
2966/**
2967 * Logs the duration of a davey (jank of >=700ms) when it occurs
2968 *
2969 * Logged from:
2970 *   frameworks/base/libs/hwui/JankTracker.cpp
2971 */
2972message DaveyOccurred {
2973    // The UID that logged this atom.
2974    optional int32 uid = 1 [(is_uid) = true];
2975
2976    // Amount of time it took to render the frame. Should be >=700ms.
2977    optional int64 jank_duration_millis = 2;
2978}
2979
2980/**
2981 * Logs phone signal strength changes.
2982 *
2983 * Logged from:
2984 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2985 */
2986message PhoneSignalStrengthChanged {
2987    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
2988    optional android.telephony.SignalStrengthEnum signal_strength = 1;
2989}
2990
2991
2992/**
2993 * Logs when the phone state, sim state or signal strength changes
2994 *
2995 * Logged from:
2996 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2997 */
2998message PhoneServiceStateChanged {
2999    optional android.telephony.ServiceStateEnum state = 1;
3000    optional android.telephony.SimStateEnum sim_state = 2;
3001    optional android.telephony.SignalStrengthEnum signal_strength = 3;
3002}
3003
3004/**
3005 * Logs when the phone becomes on or off.
3006 *
3007 * Logged from:
3008 *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
3009 */
3010message PhoneStateChanged {
3011    enum State {
3012        OFF = 0;
3013        ON = 1;
3014    }
3015    optional State state = 1;
3016}
3017
3018message BackGesture {
3019    enum BackType {
3020        DEFAULT_BACK_TYPE = 0;
3021        COMPLETED = 1;
3022        COMPLETED_REJECTED = 2; // successful because coming from rejected area
3023        INCOMPLETE_EXCLUDED = 3; // would have been successful but in the exclusion area
3024        INCOMPLETE = 4;  // Unsuccessful, for reasons other than below.
3025        INCOMPLETE_FAR_FROM_EDGE = 5;  // Unsuccessful, far from the edge.
3026        INCOMPLETE_MULTI_TOUCH = 6;  // Unsuccessful, multi touch.
3027        INCOMPLETE_LONG_PRESS = 7;  // Unsuccessful, long press.
3028        INCOMPLETE_VERTICAL_MOVE = 8;  // Unsuccessful, move vertically.
3029    }
3030    optional BackType type = 1;
3031
3032    optional int32 y_coordinate = 2 [deprecated = true]; // y coordinate for ACTION_DOWN event
3033    optional int32 start_x = 4;  // X coordinate for ACTION_DOWN event.
3034    optional int32 start_y = 5;  // Y coordinate for ACTION_DOWN event.
3035    optional int32 end_x = 6;   // X coordinate for ACTION_MOVE event.
3036    optional int32 end_y = 7;  // Y coordinate for ACTION_MOVE event.
3037    optional int32 left_boundary = 8;  // left edge width + left inset
3038    optional int32 right_boundary = 9;  // screen width - (right edge width + right inset)
3039
3040    enum WindowHorizontalLocation {
3041        DEFAULT_LOCATION = 0;
3042        LEFT = 1;
3043        RIGHT = 2;
3044    }
3045    optional WindowHorizontalLocation x_location = 3 [deprecated = true];
3046}
3047
3048message ExclusionRectStateChanged {
3049    optional string component_name = 1;    // if not available, simply packageName
3050    optional int32 requested_height = 2;   // px
3051    optional int32 rejected_height = 3;    // px
3052
3053    enum WindowHorizontalLocation {
3054        DEFAULT_LOCATION = 0;
3055        LEFT = 1;
3056        RIGHT = 2;
3057    }
3058    optional WindowHorizontalLocation x_location = 4;
3059    optional bool landscape = 5;
3060    optional bool splitscreen = 6;
3061    optional int32 duration_millis = 7;
3062}
3063
3064/**
3065 * Logs when IME is on.
3066 *
3067 * Logged from: /packages/SystemUI/src/com/android/systemui/
3068                statusbar/phone/NavigationBarView.java
3069 *
3070 */
3071message ImeTouchReported {
3072    optional int32 x_coordinate = 1;  // X coordinate for ACTION_DOWN event.
3073    optional int32 y_coordinate = 2;  // Y coordinate for ACTION_DOWN event.
3074}
3075
3076/**
3077 * Logs when Launcher (HomeScreen) UI has changed or was interacted.
3078 *
3079 * Logged from:
3080 *   packages/apps/Launcher3
3081 */
3082message LauncherUIChanged {
3083    optional android.stats.launcher.LauncherAction action = 1 [deprecated = true];
3084    optional android.stats.launcher.LauncherState src_state = 2;
3085    optional android.stats.launcher.LauncherState dst_state = 3;
3086    optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES, deprecated = true];
3087    optional bool is_swipe_up_enabled = 5 [deprecated = true];
3088
3089    // The event id (e.g., app launch, drag and drop, long press)
3090    optional int32 event_id = 6;
3091    // The event's source or target id (e.g., icon, task, button)
3092    optional int32 target_id = 7;
3093    // If the target needs to be tracked, use this id field
3094    optional int32 instance_id = 8;
3095    optional int32 uid = 9 [(is_uid) = true];
3096    optional string package_name = 10;
3097    optional string component_name = 11;
3098
3099    // (x, y) coordinate and the index information of the target on the container
3100    optional int32 grid_x = 12 [default = -1];
3101    optional int32 grid_y = 13 [default = -1];
3102    optional int32 page_id = 14 [default = -2];
3103
3104    // e.g., folder icon's (x, y) location and index information on the workspace
3105    optional int32 grid_x_parent = 15 [default = -1];
3106    optional int32 grid_y_parent = 16 [default = -1];
3107    optional int32 page_id_parent = 17 [default = -2];
3108
3109    // e.g., SEARCHBOX_ALLAPPS, FOLDER_WORKSPACE
3110    optional int32 hierarchy = 18;
3111
3112    optional bool is_work_profile = 19;
3113
3114    // Used to store the predicted rank of the target
3115    optional int32 rank = 20 [default = -1];
3116
3117    // e.g., folderLabelState can be captured in the following two fields
3118    optional int32 from_state = 21;
3119    optional int32 to_state = 22;
3120
3121    // e.g., autofilled or suggested texts that are not user entered
3122    optional string edittext = 23;
3123
3124    // e.g., number of contents inside a container (e.g., icons inside a folder)
3125    optional int32 cardinality = 24;
3126}
3127
3128/**
3129 * Used for snapshot of the HomeScreen UI elements
3130 *
3131 * Logged from:
3132 *   packages/apps/Launcher3
3133 */
3134message LauncherStaticLayout {
3135    // The event id (e.g., snapshot, drag and drop)
3136    optional int32 event_id = 1;
3137    // The event's source or target id (e.g., icon, shortcut, widget)
3138    optional int32 target_id = 2;
3139    // If the target needs to be tracked, use this id field
3140    optional int32 instance_id = 3;
3141    optional int32 uid = 4 [(is_uid) = true];
3142    optional string package_name = 5;
3143    optional string component_name = 6;
3144
3145    // (x, y) coordinate and the index information of the target on the container
3146    optional int32 grid_x = 7 [default = -1];
3147    optional int32 grid_y = 8 [default = -1];
3148    optional int32 page_id = 9 [default = -2];
3149
3150    // e.g., folder icon's (x, y) location and index information on the workspace
3151    // e.g., when used with widgets target, use these values for (span_x, span_y)
3152    optional int32 grid_x_parent = 10 [default = -1];
3153    optional int32 grid_y_parent = 11 [default = -1];
3154    optional int32 page_id_parent = 12 [default = -2];
3155
3156    // UNKNOWN = 0
3157    // HOTSEAT = 1
3158    // WORKSPACE = 2
3159    // FOLDER_HOTSEAT = 3
3160    // FOLDER_WORKSPACE = 4
3161    optional int32 hierarchy = 13;
3162
3163    optional bool is_work_profile = 14;
3164
3165    // e.g., PIN, WIDGET TRAY, APPS TRAY, PREDICTION
3166    optional int32 origin = 15;
3167
3168    // e.g., number of icons inside a folder
3169    optional int32 cardinality = 16;
3170
3171    // e.g., (x, y) span of the widget inside homescreen grid system
3172    optional int32 span_x = 17 [default = 1];
3173    optional int32 span_y = 18 [default = 1];
3174}
3175
3176/**
3177 * Logs when Wallpaper or ThemePicker UI has changed.
3178 *
3179 * Logged from:
3180 *   packages/apps/ThemePicker
3181 *   packages/apps/WallpaperPicker2
3182 */
3183message StyleUIChanged {
3184    optional android.stats.style.Action action = 1;
3185    optional int32 color_package_hash = 2;
3186    optional int32 font_package_hash  = 3;
3187    optional int32 shape_package_hash = 4;
3188    optional int32 clock_package_hash = 5;
3189    optional int32 launcher_grid = 6;
3190    optional int32 wallpaper_category_hash = 7;
3191    optional int32 wallpaper_id_hash = 8;
3192    optional int32 color_preference = 9;
3193    optional android.stats.style.LocationPreference location_preference = 10;
3194}
3195
3196/**
3197 * Logs when Settings UI has changed.
3198 *
3199 * Logged from:
3200 *   packages/apps/Settings
3201 */
3202message SettingsUIChanged {
3203    /**
3204     * Where this SettingsUIChange event comes from. For example, if
3205     * it's a PAGE_VISIBLE event, where the page is opened from.
3206     */
3207    optional android.app.settings.PageId attribution = 1;
3208
3209    /**
3210     * What the UI action is.
3211     */
3212    optional android.app.settings.Action action = 2;
3213
3214    /**
3215     * Where the action is happening
3216     */
3217    optional android.app.settings.PageId page_id = 3;
3218
3219    /**
3220     * What preference changed in this event.
3221     */
3222    optional string changed_preference_key = 4;
3223
3224    /**
3225     * The new value of the changed preference.
3226     */
3227    optional int64 changed_preference_int_value = 5;
3228}
3229
3230/**
3231 * Logs basic timing information about touch events.
3232 * Reported at most every 5 minutes while device is being interacted with.
3233 *
3234 * Logged from:
3235 *   frameworks/native/services/inputflinger
3236 */
3237message TouchEventReported {
3238    /**
3239     * The fields latency_{min|max|mean|stdev} represent minimum, maximum, mean,
3240     * and the standard deviation of the time spent processing touchscreen events
3241     * in the kernel and inputflinger. The units are microseconds.
3242     *
3243     * On supported devices, the starting point is taken during the hard interrupt inside the
3244     * kernel touch driver. On all other devices, the starting point is taken inside
3245     * the kernel's input event subsystem upon receipt of the input event.
3246     * The ending point is taken inside InputDispatcher, just after the input event
3247     * is sent to the app.
3248     */
3249    // Minimum value
3250    optional float latency_min_micros = 1;
3251    // Maximum value
3252    optional float latency_max_micros = 2;
3253    // Average value
3254    optional float latency_mean_micros = 3;
3255    // Standard deviation
3256    optional float latency_stdev_micros = 4;
3257    // Number of touch events (input_event) in this report
3258    optional int32 count = 5;
3259}
3260
3261/**
3262 * Logs gesture classification and timing information for touch events.
3263 *
3264 * Logged from:
3265 *   frameworks/base/core/java/android/view/GestureDetector.java
3266 *   frameworks/base/core/java/android/view/View.java
3267 */
3268message TouchGestureClassified {
3269    // The source of the classification (e.g. Java class name).
3270    optional string source = 1;
3271
3272    enum Classification {
3273        UNKNOWN_CLASSIFICATION = 0;
3274        SINGLE_TAP = 1;
3275        DOUBLE_TAP = 2;
3276        LONG_PRESS = 3;
3277        DEEP_PRESS = 4;
3278        SCROLL = 5;
3279    }
3280    // The classification of the gesture.
3281    optional Classification classification = 2;
3282
3283    // The interval from the start of a touch event stream until the
3284    // classification was made.
3285    optional int32 latency_millis = 3;
3286
3287    // The distance from the location of the first touch event to the
3288    // location of the touch event when the classification was made.
3289    optional float displacement_px = 4;
3290}
3291
3292/**
3293 * Logs that a setting was updated.
3294 * Logged from:
3295 *   frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
3296 * The tag and is_default allow resetting of settings to default values based on the specified
3297 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
3298 */
3299message SettingChanged {
3300    // The name of the setting.
3301    optional string setting = 1;
3302
3303    // The change being imposed on this setting. May represent a number, eg "3".
3304    optional string value = 2;
3305
3306    // The new value of this setting. For most settings, this is same as value. For some settings,
3307    // value is +X or -X where X represents an element in a set. For example, if the previous value
3308    // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
3309    // The +/- feature is currently only used for location_providers_allowed.
3310    optional string new_value = 3;
3311
3312    // The previous value of this setting.
3313    optional string prev_value = 4;
3314
3315    // The tag used with the is_default for resetting sets of settings. This is generally null.
3316    optional string tag = 5;
3317
3318    // True if this setting with tag should be resettable.
3319    optional bool is_default = 6;
3320
3321    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
3322    optional int32 user = 7;
3323
3324    enum ChangeReason {
3325        UPDATED = 1; // Updated can be an insertion or an update.
3326        DELETED = 2;
3327    }
3328    optional ChangeReason reason = 8;
3329}
3330
3331/**
3332 * Logs activity going to foreground or background
3333 *
3334 * Logged from:
3335  *   frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
3336 */
3337message ActivityForegroundStateChanged {
3338    optional int32 uid = 1 [(is_uid) = true];
3339    optional string pkg_name = 2;
3340    optional string class_name = 3;
3341
3342    enum State {
3343        BACKGROUND = 0;
3344        FOREGROUND = 1;
3345    }
3346    optional State state = 4;
3347}
3348
3349/**
3350 * Logs when a volume entered low Storage state.
3351 * Logged from:
3352 *      frameworks/base/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
3353 */
3354message LowStorageStateChanged {
3355    // Volume that ran out of storage.
3356    optional string volume_description = 1;
3357
3358    enum State {
3359        UNKNOWN = 0;
3360        OFF = 1;
3361        ON = 2;
3362    }
3363    optional State state = 2;
3364}
3365
3366/**
3367 * Logs when an app is downgraded.
3368 * Logged from:
3369 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
3370 */
3371message AppDowngraded {
3372    optional string package_name = 1;
3373    // Size of the package (all data) before being downgraded.
3374    optional int64 size_in_bytes_before = 2;
3375    // Size of the package (all data) after being downgraded.
3376    optional int64 size_in_bytes_after = 3;
3377
3378    optional bool aggressive = 4;
3379}
3380
3381/**
3382 * Logs when an app is optimized after being downgraded.
3383 * Logged from:
3384 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
3385 */
3386message AppOptimizedAfterDowngraded {
3387    optional string package_name = 1;
3388}
3389
3390/**
3391 * Logs whenever an app is installed on external storage.
3392 * Logged from:
3393        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
3394 */
3395message AppInstallOnExternalStorageReported {
3396    // The type of external storage.
3397    optional android.stats.storage.ExternalStorageType storage_type = 1;
3398    // The name of the package that is installed on the sd card.
3399    optional string package_name = 2;
3400}
3401
3402/**
3403 * Logs when an app crashes.
3404 * Logged from:
3405 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3406 */
3407message AppCrashOccurred {
3408    optional int32 uid = 1 [(is_uid) = true];
3409
3410    optional string event_type = 2;
3411
3412    // The name of the process.
3413    // system_server if it is not by an app
3414    optional string process_name = 3;
3415
3416    // The pid if available. -1 means not available.
3417    optional int32 pid = 4;
3418
3419    optional string package_name = 5;
3420
3421    enum InstantApp {
3422        UNAVAILABLE = 0;
3423        FALSE = 1;
3424        TRUE = 2;
3425    }
3426    optional InstantApp is_instant_app = 6;
3427
3428    enum ForegroundState {
3429        UNKNOWN = 0;
3430        BACKGROUND = 1;
3431        FOREGROUND = 2;
3432    }
3433    optional ForegroundState foreground_state = 7;
3434
3435    optional android.server.ErrorSource error_source = 8;
3436}
3437
3438/**
3439 * Logs when a WTF (What a Terrible Failure) happened.
3440 * Logged from:
3441 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3442 */
3443message WTFOccurred {
3444    optional int32 uid = 1 [(is_uid) = true];
3445
3446    optional string tag = 2;
3447
3448    // The name of the process.
3449    // system_server if it is not by an app
3450    optional string process_name = 3;
3451
3452    // The pid if available. -1 means not available.
3453    optional int32 pid = 4;
3454
3455    optional android.server.ErrorSource error_source = 5;
3456}
3457
3458/**
3459 * Logs when system server reports low memory.
3460 * Logged from:
3461 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3462 */
3463message LowMemReported {
3464}
3465
3466/**
3467 * Logs when an app ANR (App Not Responding) occurs.
3468 * Logged from:
3469 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
3470 */
3471message ANROccurred {
3472    optional int32 uid = 1 [(is_uid) = true];
3473
3474    optional string process_name = 2;
3475
3476    optional string short_component_name = 3;
3477
3478    optional string reason = 4;
3479
3480    enum InstantApp {
3481        UNAVAILABLE = 0;
3482        FALSE = 1;
3483        TRUE = 2;
3484    }
3485    optional InstantApp is_instant_app = 5;
3486
3487    enum ForegroundState {
3488        UNKNOWN = 0;
3489        BACKGROUND = 1;
3490        FOREGROUND = 2;
3491    }
3492    optional ForegroundState foreground_state = 6;
3493
3494    optional android.server.ErrorSource error_source = 7;
3495
3496    optional string package_name = 8;
3497}
3498
3499/**
3500 * Logs when the vibrator state changes.
3501 * Logged from:
3502 *      frameworks/base/services/core/java/com/android/server/VibratorService.java
3503 */
3504message VibratorStateChanged {
3505    repeated AttributionNode attribution_node = 1;
3506
3507    enum State {
3508        OFF = 0;
3509        ON = 1;
3510    }
3511    optional State state = 2;
3512
3513    // Duration (in milliseconds) requested to keep the vibrator on.
3514    // Only applicable for State == ON.
3515    optional int64 duration_millis = 3;
3516}
3517
3518/*
3519 * Allows other apps to push events into statsd.
3520 * Logged from:
3521 *      frameworks/base/core/java/android/util/StatsLog.java
3522 */
3523message AppBreadcrumbReported {
3524    // The uid of the application that sent this custom atom.
3525    optional int32 uid = 1 [(is_uid) = true];
3526
3527    // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
3528    optional int32 label = 2;
3529
3530    // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
3531    // predicates for the metrics).
3532    enum State {
3533        UNKNOWN = 0;
3534        UNSPECIFIED = 1;  // For events that are known to not represent START/STOP.
3535        STOP = 2;
3536        START = 3;
3537    }
3538    optional State state = 3;
3539}
3540
3541/**
3542 * Logs the wall-clock time when a significant wall-clock time shift occurs.
3543 * For example, this could be due to the user manually changing the time.
3544 *
3545 * Logged from:
3546 *   frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
3547 */
3548message WallClockTimeShifted {
3549    // New wall-clock time in milliseconds, according to System.currentTimeMillis().
3550    optional int64 wall_clock_timestamp_millis = 1;
3551}
3552
3553/**
3554 * Logs when statsd detects an anomaly.
3555 *
3556 * Logged from:
3557 *   frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
3558 */
3559message AnomalyDetected {
3560    // Uid that owns the config whose anomaly detection alert fired.
3561    optional int32 config_uid = 1 [(is_uid) = true];
3562
3563    // Id of the config whose anomaly detection alert fired.
3564    optional int64 config_id = 2;
3565
3566    // Id of the alert (i.e. name of the anomaly that was detected).
3567    optional int64 alert_id = 3;
3568}
3569
3570message AppStartOccurred {
3571    // The uid if available. -1 means not available.
3572    optional int32 uid = 1 [(is_uid) = true];
3573
3574    // The app package name.
3575    optional string pkg_name = 2;
3576
3577    enum TransitionType {
3578        UNKNOWN = 0;
3579        WARM = 1;
3580        HOT = 2;
3581        COLD = 3;
3582    }
3583    // The transition type.
3584    optional TransitionType type = 3;
3585
3586    // The activity name.
3587    optional string activity_name = 4;
3588
3589    // The name of the calling app. Empty if not set.
3590    optional string calling_pkg_name = 5;
3591
3592    // Whether the app is an instant app.
3593    optional bool is_instant_app = 6;
3594
3595    // Device uptime when activity started.
3596    optional int64 activity_start_millis = 7;
3597
3598    optional android.app.AppTransitionReasonEnum reason = 8;
3599
3600    optional int32 transition_delay_millis = 9;
3601    // -1 if not set.
3602    optional int32 starting_window_delay_millis = 10;
3603    // -1 if not set.
3604    optional int32 bind_application_delay_millis = 11;
3605    optional int32 windows_drawn_delay_millis = 12;
3606
3607    // Empty if not set.
3608    optional string launch_token = 13;
3609
3610    // The compiler filter used when when the package was optimized.
3611    optional int32 package_optimization_compilation_filter = 14;
3612
3613    // The reason why the package was optimized.
3614    optional int32 package_optimization_compilation_reason = 15;
3615}
3616
3617message AppStartCanceled {
3618    // The uid if available. -1 means not available.
3619    optional int32 uid = 1 [(is_uid) = true];
3620
3621    // The app package name.
3622    optional string pkg_name = 2;
3623
3624    enum TransitionType {
3625        UNKNOWN = 0;
3626        WARM = 1;
3627        HOT = 2;
3628        COLD = 3;
3629    }
3630    // The transition type.
3631    optional TransitionType type = 3;
3632
3633    // The activity name.
3634    optional string activity_name = 4;
3635}
3636
3637message AppStartFullyDrawn {
3638    // The uid if available. -1 means not available.
3639    optional int32 uid = 1 [(is_uid) = true];
3640
3641    // The app package name.
3642    optional string pkg_name = 2;
3643
3644    enum TransitionType {
3645        UNKNOWN = 0;
3646        WITH_BUNDLE = 1;
3647        WITHOUT_BUNDLE = 2;
3648    }
3649    // The transition type.
3650    optional TransitionType type = 3;
3651
3652    // The activity name.
3653    optional string activity_name = 4;
3654
3655    optional bool transition_process_running = 5;
3656
3657    // App startup time (until call to Activity#reportFullyDrawn()).
3658    optional int64 app_startup_time_millis = 6;
3659}
3660
3661/**
3662 * Logs a picture-in-picture action
3663 * Logged from:
3664 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3665 *      frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
3666 *      frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
3667 */
3668message PictureInPictureStateChanged {
3669    // -1 if it is not available
3670    optional int32 uid = 1 [(is_uid) = true];
3671
3672    optional string short_name = 2;
3673
3674    enum State {
3675        ENTERED = 1;
3676        EXPANDED_TO_FULL_SCREEN = 2;
3677        MINIMIZED = 3;
3678        DISMISSED = 4;
3679    }
3680    optional State state = 3;
3681}
3682
3683/**
3684 * Logs overlay action
3685 * Logged from:
3686 *     services/core/java/com/android/server/wm/Session.java
3687 */
3688message OverlayStateChanged {
3689    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];
3690
3691    optional string package_name = 2 [(state_field_option).primary_field = true];
3692
3693    optional bool using_alert_window = 3;
3694
3695    enum State {
3696        ENTERED = 1;
3697        EXITED = 2;
3698    }
3699    optional State state = 4
3700            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
3701}
3702
3703/**
3704 * Logs foreground service starts and stops.
3705 * Note that this is not when a service starts or stops, but when it is
3706 * considered foreground.
3707 * Logged from
3708 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
3709 */
3710message ForegroundServiceStateChanged {
3711    optional int32 uid = 1 [(is_uid) = true];
3712    // package_name + "/" + class_name
3713    optional string short_name = 2;
3714
3715    enum State {
3716        ENTER = 1;
3717        EXIT = 2;
3718    }
3719    optional State state = 3;
3720
3721    // Whether the fgs is allowed while-in-use permissions, i.e. is considered 'in-use' to the user.
3722    // (If the fgs was started while the app wasn't TOP it usually will be denied these permissions)
3723    optional bool allow_while_in_use_permission = 4;
3724}
3725
3726/**
3727 * Logs the number of times a uid accesses a sensitive AppOp during a foreground service session.
3728 * A foreground service session is any continuous period during which the uid holds at least one
3729 * foreground service; the atom will be pushed when the uid no longer holds any foreground services.
3730 * Accesses initiated while the uid is in the TOP state are ignored.
3731 * Sessions with no attempted accesses are not logged.
3732 * Logged from
3733 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
3734 */
3735message ForegroundServiceAppOpSessionEnded {
3736    optional int32 uid = 1 [(is_uid) = true];
3737
3738    // The operation's name.
3739    // Only following four ops are logged
3740    // COARSE_LOCATION = 0
3741    // FINE_LOCATION = 1
3742    // CAMERA = 26
3743    // RECORD_AUDIO = 27
3744    optional android.app.AppOpEnum app_op_name = 2 [default = APP_OP_NONE];
3745
3746    // The uid's permission mode for accessing the AppOp during this fgs session.
3747    enum Mode {
3748        MODE_UNKNOWN = 0;
3749        MODE_ALLOWED = 1; // Always allowed
3750        MODE_IGNORED = 2; // Denied
3751        MODE_FOREGROUND = 3; // Allow-while-in-use (or allowed-one-time)
3752    }
3753    optional Mode app_op_mode = 3;
3754
3755    // Number of times this AppOp was requested and allowed.
3756    optional int32 count_ops_accepted = 4;
3757    // Number of times this AppOp was requested but denied.
3758    optional int32 count_ops_rejected = 5;
3759}
3760
3761/**
3762 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
3763 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
3764 * attributed back to the parent (host) uid. One example is Chrome.
3765 *
3766 * Logged from:
3767 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3768 */
3769message IsolatedUidChanged {
3770    // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
3771    // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
3772    // This field is ignored when event == REMOVED.
3773    optional int32 parent_uid = 1;
3774
3775    optional int32 isolated_uid = 2;
3776
3777    // We expect an isolated uid to be removed before if it's used for another parent uid.
3778    enum Event {
3779        REMOVED = 0;
3780        CREATED = 1;
3781    }
3782    optional Event event = 3;
3783}
3784
3785/*
3786 * Logs the reception of an incoming network packet causing the main system to wake up for
3787 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
3788 * and processed by WakeupController.cpp.
3789 */
3790message PacketWakeupOccurred {
3791    // The uid owning the socket into which the packet was delivered, or -1 if the packet was
3792    // delivered nowhere.
3793    optional int32 uid = 1 [(is_uid) = true];
3794    // The interface name on which the packet was received.
3795    optional string iface = 2;
3796    // The ethertype value of the packet.
3797    optional int32 ethertype = 3;
3798    // String representation of the destination MAC address of the packet.
3799    optional string destination_hardware_address = 4;
3800    // String representation of the source address of the packet if this was an IP packet.
3801    optional string source_ip = 5;
3802    // String representation of the destination address of the packet if this was an IP packet.
3803    optional string destination_ip = 6;
3804    // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
3805    // field if this was an IPv6 packet. The range of possible values is the same for both IP
3806    // families.
3807    optional int32 ip_next_header = 7;
3808    // The source port if this was a TCP or UDP packet.
3809    optional int32 source_port = 8;
3810    // The destination port if this was a TCP or UDP packet.
3811    optional int32 destination_port = 9;
3812}
3813
3814/*
3815 * Logs the memory stats for an app on startup.
3816 * Logged from:
3817 *     frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3818 */
3819message AppStartMemoryStateCaptured {
3820    // The uid if available. -1 means not available.
3821    optional int32 uid = 1 [(is_uid) = true];
3822
3823    // The process name.
3824    optional string process_name = 2;
3825
3826    // The activity name.
3827    optional string activity_name = 3;
3828
3829    // # of page-faults
3830    optional int64 page_fault = 4;
3831
3832    // # of major page-faults
3833    optional int64 page_major_fault = 5;
3834
3835    // RSS
3836    optional int64 rss_in_bytes = 6;
3837
3838    // CACHE
3839    optional int64 cache_in_bytes = 7;
3840
3841    // SWAP
3842    optional int64 swap_in_bytes = 8;
3843}
3844
3845/*
3846 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
3847 * for LMK event.
3848 * Logged from:
3849 *      system/core/lmkd/lmkd.c
3850 */
3851message LmkStateChanged {
3852    enum State {
3853        UNKNOWN = 0;
3854        START = 1;
3855        STOP = 2;
3856    }
3857    optional State state = 1;
3858}
3859
3860/*
3861 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
3862 * Logged from:
3863 *      system/core/lmkd/lmkd.c
3864 */
3865message LmkKillOccurred {
3866    // The uid if available. -1 means not available.
3867    optional int32 uid = 1 [(is_uid) = true];
3868
3869    // The process name.
3870    optional string process_name = 2;
3871
3872    // oom adj score.
3873    optional int32 oom_adj_score = 3;
3874
3875    // # of page-faults
3876    optional int64 page_fault = 4;
3877
3878    // # of major page-faults
3879    optional int64 page_major_fault = 5;
3880
3881    // RSS
3882    optional int64 rss_in_bytes = 6;
3883
3884    // CACHE
3885    optional int64 cache_in_bytes = 7;
3886
3887    // SWAP
3888    optional int64 swap_in_bytes = 8;
3889
3890    // The elapsed real time of start of the process.
3891    optional int64 process_start_time_nanos = 9;
3892
3893    // Min oom adj score considered by lmkd.
3894    optional int32 min_oom_score = 10;
3895}
3896
3897/*
3898 * Logs when the ActivityManagerService detects that an app died.
3899 *
3900 * Logged from:
3901 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3902 */
3903message AppDied {
3904    // timestamp(elapsedRealtime) of record creation
3905    optional uint64 timestamp_millis = 1 [(state_field_option).exclusive_state = true];
3906}
3907
3908/**
3909 * An atom for generic metrics logging. Available from Android Q.
3910 */
3911message GenericAtom {
3912    // The uid of the application that sent this custom atom.
3913    optional int32 uid = 1 [(is_uid) = true];
3914
3915    // An event_id indicates the type of event.
3916    optional android.stats.EventType event_id = 2;
3917}
3918
3919/**
3920 * Atom for simple logging of user interaction and impression events, such as "the user touched
3921 * this button" or "this dialog was displayed".
3922 * Keep the UI event stream clean: don't use for system or background events.
3923 * Log using the UiEventLogger wrapper - don't write with the StatsLog API directly.
3924 *
3925 * Logged from:
3926 *   frameworks/base/services/core/java/com/android/server/
3927 *   frameworks/base/packages/SystemUI/src/com/android/systemui/
3928 */
3929message UiEventReported {
3930    // The event_id.
3931    optional int32 event_id = 1;
3932    // The event's source or target uid and package, if applicable.
3933    // For example, the package posting a notification, or the destination package of a share.
3934    optional int32 uid = 2 [(is_uid) = true];
3935    optional string package_name = 3;
3936    // An identifier used to disambiguate which logs refer to a particular instance of some
3937    // UI element. Useful when there might be multiple instances simultaneously active.
3938    optional int32 instance_id = 4;
3939}
3940
3941/**
3942 * Reports a notification was created or updated.
3943 *
3944 * Logged from:
3945 *   frameworks/base/services/core/java/com/android/server/notification/
3946 */
3947message NotificationReported {
3948    // The event_id (as for UiEventReported).
3949    optional int32 event_id = 1;
3950    // The notifying app's uid and package.
3951    optional int32 uid = 2 [(is_uid) = true];
3952    optional string package_name = 3;
3953    // A small system-assigned identifier for the notification.
3954    // Locally probably-unique, but expect collisions across users and/or days.
3955    optional int32 instance_id = 4;
3956    optional int32 notification_id_hash = 5;  // Small hash of the app-assigned notif ID + tag
3957    optional int32 channel_id_hash = 6;  // Small hash of app-assigned channel ID
3958
3959    // Grouping information
3960    optional int32 group_id_hash = 7;  // Small hash of the group ID of the notification
3961    optional int32 group_instance_id = 8;  // Instance_id of the group-summary notification
3962    optional bool is_group_summary = 9;  // Tags the group-summary notification
3963
3964    // Attributes
3965    optional string category = 10;   // App-assigned notification category (API-defined strings)
3966    optional int32 style = 11;       // App-assigned notification style
3967    optional int32 num_people = 12;  // Number of Person records attached to the notification
3968
3969    // Ordering, importance and interruptiveness
3970
3971    optional int32 position = 13;    // Position in NotificationManager's list
3972
3973    optional android.stats.sysui.NotificationImportance importance = 14;
3974    optional int32 alerting = 15;    // Bitfield, 1=buzz 2=beep 4=blink
3975
3976    enum NotificationImportanceExplanation {
3977        IMPORTANCE_EXPLANATION_UNKNOWN = 0;
3978        IMPORTANCE_EXPLANATION_APP = 1;     // App-specified channel importance.
3979        IMPORTANCE_EXPLANATION_USER = 2;    // User-specified channel importance.
3980        IMPORTANCE_EXPLANATION_ASST = 3;    // Notification Assistant override.
3981        IMPORTANCE_EXPLANATION_SYSTEM = 4;  // System override.
3982        // Like _APP, but based on pre-channels priority signal.
3983        IMPORTANCE_EXPLANATION_APP_PRE_CHANNELS = 5;
3984    }
3985
3986    optional NotificationImportanceExplanation importance_source = 16;
3987    optional android.stats.sysui.NotificationImportance importance_initial = 17;
3988    optional NotificationImportanceExplanation importance_initial_source = 18;
3989    optional android.stats.sysui.NotificationImportance importance_asst = 19;
3990    optional int32 assistant_hash = 20;
3991    optional float assistant_ranking_score = 21;
3992}
3993
3994message Notification {
3995    // The notifying app's uid and package.
3996    optional int32 uid = 1 [(is_uid) = true];
3997    optional string package_name = 2;
3998    // A small system-assigned identifier for the notification.
3999    optional int32 instance_id = 3;
4000
4001    // Grouping information.
4002    optional int32 group_instance_id = 4;
4003    optional bool is_group_summary = 5;
4004
4005    // The section of the shade that the notification is in.
4006    // See NotificationSectionsManager.PriorityBucket.
4007    enum NotificationSection {
4008        SECTION_UNKNOWN = 0;
4009        SECTION_HEADS_UP = 1;
4010        SECTION_MEDIA_CONTROLS = 2;
4011        SECTION_PEOPLE = 3;
4012        SECTION_ALERTING = 4;
4013        SECTION_SILENT = 5;
4014    }
4015    optional NotificationSection section = 6;
4016}
4017
4018message NotificationList {
4019    repeated Notification notifications = 1;  // An ordered sequence of notifications.
4020}
4021
4022/**
4023 * Reports a notification panel was displayed, e.g. from the lockscreen or status bar.
4024 *
4025 * Logged from:
4026 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/
4027 */
4028message NotificationPanelReported {
4029    // The event_id (as for UiEventReported).
4030    optional int32 event_id = 1;
4031    optional int32 num_notifications = 2;
4032    // The notifications in the panel, in the order that they appear there.
4033    optional NotificationList notifications = 3 [(log_mode) = MODE_BYTES];
4034}
4035
4036/**
4037 * Reports a notification channel, or channel group, was created, updated, or deleted.
4038 *
4039 * Logged from:
4040 *   frameworks/base/services/core/java/com/android/server/notification/
4041 */
4042message NotificationChannelModified {
4043    // The event_id (as for UiEventReported).
4044    optional int32 event_id = 1;
4045    // The notifying app's uid and package.
4046    optional int32 uid = 2 [(is_uid) = true];
4047    optional string package_name = 3;
4048    // Hash of app-assigned notification channel ID or channel-group ID
4049    optional int32 channel_id_hash = 4;
4050    // Previous importance setting, if applicable
4051    optional android.stats.sysui.NotificationImportance old_importance = 5;
4052    // New importance setting
4053    optional android.stats.sysui.NotificationImportance importance = 6;
4054}
4055
4056
4057/**
4058 * Logs when a biometric acquire event occurs.
4059 *
4060 * Logged from:
4061 *   frameworks/base/services/core/java/com/android/server/biometrics
4062 */
4063message BiometricAcquired {
4064    // Biometric modality that was acquired.
4065    optional android.hardware.biometrics.ModalityEnum modality = 1;
4066    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java.
4067    optional int32 user = 2;
4068    // If this acquire is for a crypto operation. e.g. Secure purchases, unlock password storage.
4069    optional bool is_crypto = 3;
4070    // Action that the device is performing. Acquired messages are only expected for enroll and
4071    // authenticate. Other actions may indicate an error.
4072    optional android.hardware.biometrics.ActionEnum action = 4;
4073    // The client that this acquisition was received for.
4074    optional android.hardware.biometrics.ClientEnum client = 5;
4075    // Acquired constants, e.g. ACQUIRED_GOOD. See constants defined by <Biometric>Manager.
4076    optional int32 acquire_info = 6;
4077    // Vendor-specific acquire info. Valid only if acquire_info == ACQUIRED_VENDOR.
4078    optional int32 acquire_info_vendor = 7;
4079    // Dictates if this message should trigger additional debugging.
4080    optional bool debug = 8;
4081}
4082
4083/**
4084 * Logs when a biometric authentication event occurs.
4085 *
4086 * Logged from:
4087 *   frameworks/base/services/core/java/com/android/server/biometrics
4088 */
4089message BiometricAuthenticated {
4090    // Biometric modality that was used.
4091    optional android.hardware.biometrics.ModalityEnum modality = 1;
4092    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
4093    optional int32 user = 2;
4094    // If this authentication is for a crypto operation. e.g. Secure purchases, unlock password
4095    // storage.
4096    optional bool is_crypto = 3;
4097    // The client that this acquisition was received for.
4098    optional android.hardware.biometrics.ClientEnum client = 4;
4099    // If authentication requires user confirmation. See BiometricPrompt's
4100    // setRequireConfirmation(bool) method.
4101    optional bool require_confirmation = 5;
4102
4103    enum State {
4104        UNKNOWN = 0;
4105        REJECTED = 1;
4106        PENDING_CONFIRMATION = 2;
4107        CONFIRMED = 3;
4108    }
4109
4110    // State of the current auth attempt.
4111    optional State state = 6;
4112    // Time it took to authenticate. For BiometricPrompt where setRequireConfirmation(false) is
4113    // specified and supported by the biometric modality, this is from the first ACQUIRED_GOOD to
4114    // AUTHENTICATED. for setRequireConfirmation(true), this is from PENDING_CONFIRMATION to
4115    // CONFIRMED.
4116    optional int64 latency_millis = 7;
4117    // Dictates if this message should trigger additional debugging.
4118    optional bool debug = 8;
4119}
4120
4121/**
4122 * Logs when a biometric error occurs.
4123 *
4124 * Logged from:
4125 *   frameworks/base/services/core/java/com/android/server/biometrics
4126 */
4127message BiometricErrorOccurred {
4128    // Biometric modality that was used.
4129    optional android.hardware.biometrics.ModalityEnum modality = 1;
4130    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
4131    optional int32 user = 2;
4132    // If this error is for a crypto operation. e.g. Secure purchases, unlock password storage.
4133    optional bool is_crypto = 3;
4134    // Action that the device is performing.
4135    optional android.hardware.biometrics.ActionEnum action = 4;
4136    // The client that this acquisition was received for.
4137    optional android.hardware.biometrics.ClientEnum client = 5;
4138    // Error constants. See constants defined by <Biometric>Manager. Enums won't work since errors
4139    // are unique to modality.
4140    optional int32 error_info = 6;
4141    // Vendor-specific error info. Valid only if acquire_info == ACQUIRED_VENDOR. These are defined
4142    // by the vendor and not specified by the HIDL interface.
4143    optional int32 error_info_vendor = 7;
4144    // Dictates if this message should trigger additional debugging.
4145    optional bool debug = 8;
4146    // Time spent during the authentication attempt.
4147    optional int64 latency_millis = 9;
4148}
4149
4150/**
4151 * Logs when a system health issue is detected.
4152 * Logged from:
4153 *   frameworks/base/services/core/java/com/android/server/biometrics
4154 */
4155message BiometricSystemHealthIssueDetected {
4156    // Biometric modality.
4157    optional android.hardware.biometrics.ModalityEnum modality = 1;
4158    // Type of issue detected.
4159    optional android.hardware.biometrics.IssueEnum issue = 2;
4160    // Dictates if this message should trigger additional debugging.
4161    optional bool debug = 3;
4162}
4163
4164/**
4165 * Logs when a biometric enrollment occurs.
4166 *
4167 * Logged from:
4168 *   frameworks/base/services/core/java/com/android/server/biometrics
4169 */
4170message BiometricEnrolled {
4171    // Biometric modality that was used.
4172    optional android.hardware.biometrics.ModalityEnum modality = 1;
4173    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
4174    optional int32 user = 2;
4175    // The amount of time the enrollment took in milliseconds.
4176    optional int64 latency_millis = 3;
4177    // Whether or not the enrollment was successful.
4178    optional bool success = 4;
4179}
4180
4181/*
4182 * Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
4183 */
4184message FlagFlipUpdateOccurred {
4185    // If the event is from a flag config package, specify the package name.
4186    optional string flag_flip_package_name = 1;
4187
4188    // The order id of the package
4189    optional int64 order_id = 2;
4190}
4191
4192/**
4193 * Potential experiment ids that goes with a train install.
4194 * Should be kept in sync with experiment_ids.proto.
4195 */
4196message TrainExperimentIds {
4197    repeated int64 experiment_id = 1;
4198}
4199
4200/*
4201 * Logs when a binary push state changes.
4202 * Logged by the installer via public api.
4203 */
4204message BinaryPushStateChanged {
4205    // Name of the train.
4206    optional string train_name = 1;
4207    // Version code for a "train" of packages that need to be installed atomically
4208    optional int64 train_version_code = 2;
4209    // After installation of this package, device requires a restart.
4210    optional bool requires_staging = 3;
4211    // Rollback should be enabled for this install.
4212    optional bool rollback_enabled = 4;
4213    // Requires low latency monitoring if possible.
4214    optional bool requires_low_latency_monitor = 5;
4215
4216    enum State {
4217        UNKNOWN = 0;
4218        INSTALL_REQUESTED = 1;
4219        INSTALL_STARTED = 2;
4220        INSTALL_STAGED_NOT_READY = 3;
4221        INSTALL_STAGED_READY = 4;
4222        INSTALL_SUCCESS = 5;
4223        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
4224        // and INSTALL_FAILURE_COMMIT.
4225        INSTALL_FAILURE = 6  [deprecated = true];
4226        // This enum is for installs that are manually cancelled via the Manual Update UI.
4227        INSTALL_CANCELLED = 7;
4228        INSTALLER_ROLLBACK_REQUESTED = 8;
4229        INSTALLER_ROLLBACK_INITIATED = 9;
4230        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
4231        INSTALLER_ROLLBACK_STAGED = 11;
4232        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
4233        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
4234        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
4235        INSTALLER_ROLLBACK_SUCCESS = 15;
4236        INSTALLER_ROLLBACK_FAILURE = 16;
4237        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
4238        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
4239        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
4240        INSTALL_STAGED_CANCEL_REQUESTED = 20;
4241        INSTALL_STAGED_CANCEL_SUCCESS = 21;
4242        INSTALL_STAGED_CANCEL_FAILURE = 22;
4243        INSTALL_FAILURE_DOWNLOAD = 23;
4244        INSTALL_FAILURE_STATE_MISMATCH = 24;
4245        INSTALL_FAILURE_COMMIT = 25;
4246        REBOOT_TRIGGERED = 26;
4247    }
4248    optional State state = 6;
4249    // Possible experiment ids for monitoring this push.
4250    optional TrainExperimentIds experiment_ids = 7 [(log_mode) = MODE_BYTES];
4251    // user id
4252    optional int32 user_id = 8;
4253    optional int32 reason = 9;
4254    // Whether or not this is a rollback event
4255    optional bool is_rollback = 10;
4256}
4257
4258/* Test atom, is not logged anywhere */
4259message TestAtomReported {
4260    repeated AttributionNode attribution_node = 1;
4261    optional int32 int_field = 2;
4262    optional int64 long_field = 3;
4263    optional float float_field = 4;
4264    optional string string_field = 5;
4265    optional bool boolean_field = 6;
4266    enum State {
4267        UNKNOWN = 0;
4268        OFF = 1;
4269        ON = 2;
4270    }
4271    optional State state = 7;
4272    optional TrainExperimentIds bytes_field = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
4273}
4274
4275/** Represents USB port overheat event. */
4276message UsbPortOverheatEvent {
4277    /* Temperature of USB port at USB plug event, in 1/10ths of degree C. */
4278    optional int32 plug_temperature_deci_c = 1;
4279
4280    /* Maximum temperature of USB port during overheat event, in 1/10ths of degree C. */
4281    optional int32 max_temperature_deci_c = 2;
4282
4283    /* Time between USB plug event and overheat threshold trip, in seconds. */
4284    optional int32 time_to_overheat_secs = 3;
4285
4286    /* Time between overheat threshold trip and hysteresis, in seconds. */
4287    optional int32 time_to_hysteresis_secs = 4;
4288
4289    /* Time between hysteresis and active mitigation ending, in seconds. */
4290    optional int32 time_to_inactive_secs = 5;
4291};
4292
4293/**
4294 * Logs total effective full charge and discharge cycles on a battery.
4295 * Here are some examples of one effective cycle:
4296 *   1) the battery charges from 0% to 100% and drains back to 0%,
4297 *   2) charging from 50% to 100% and draining back to 50% twice.
4298 * Pulled from:
4299 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
4300 */
4301message BatteryCycleCount {
4302    /* Number of total charge and discharge cycles on the system battery. */
4303    optional int32 cycle_count = 1;
4304}
4305
4306/**
4307 * Logs that external storage is mounted and information about it, the storage type (sd card/usb/
4308 * others), its type (public or private) and the size in bytes.
4309 * Pulled from:
4310 *   StatsCompanionService
4311 */
4312
4313message ExternalStorageInfo {
4314
4315    enum VolumeType {
4316        UNKNOWN = 0;
4317        PUBLIC = 1;
4318        PRIVATE = 2;
4319        OTHER = 3;
4320    }
4321
4322    // The type of external storage.
4323    optional android.stats.storage.ExternalStorageType storage_type = 1;
4324    // Type of the volume: TYPE_PUBLIC if portable and TYPE_PRIVATE if internal.
4325    optional VolumeType volume_type = 2;
4326    // Total size of the sd card in bytes.
4327    optional int64 size_bytes = 3;
4328}
4329
4330/*
4331 * Logs when a connection becomes available and lost.
4332 * Logged in StatsCompanionService.java
4333 */
4334message ConnectivityStateChanged {
4335  // Id of the network.
4336  optional int32 net_id = 1;
4337
4338  enum State {
4339    UNKNOWN = 0;
4340    CONNECTED = 1;
4341    DISCONNECTED = 2;
4342  }
4343  // Connected state of a network.
4344  optional State state = 2;
4345}
4346
4347/**
4348 * Logs when a service starts and stops.
4349 * Logged from:
4350 *   services/core/java/com/android/server/am/ActiveServices.java
4351 */
4352message ServiceStateChanged {
4353
4354    optional int32 uid = 1 [(is_uid) = true];
4355
4356    optional string package_name = 2;
4357
4358    optional string service_name = 3;
4359
4360    enum State {
4361        START = 1;
4362        STOP = 2;
4363    }
4364
4365    optional State state = 4;
4366}
4367
4368/**
4369 * Logs when a service is launched.
4370 * Logged from:
4371 *   services/core/java/com/android/server/am/ActiveServices.java
4372 */
4373message ServiceLaunchReported {
4374
4375    optional int32 uid = 1 [(is_uid) = true];
4376
4377    optional string package_name = 2;
4378
4379    optional string service_name = 3;
4380}
4381
4382/**
4383 * Logs when a hidden API is used.
4384 *
4385 * Logged from:
4386 *     libcore/libart/src/main/java/dalvik/system/VMRuntime.java
4387 */
4388message HiddenApiUsed {
4389    // The uid of the app making the hidden access.
4390    optional int32 uid = 1 [(is_uid) = true];
4391
4392    // Signature of the method or field accessed.
4393    optional string signature = 2;
4394
4395    enum AccessMethod {
4396        NONE = 0;
4397        REFLECTION = 1;
4398        JNI = 2;
4399        LINKING = 3;
4400    }
4401
4402    // Type of access.
4403    optional AccessMethod access_method = 3;
4404
4405    // Whether the access was prevented or not.
4406    optional bool access_denied = 4;
4407}
4408
4409/**
4410 * Logs user interaction with the Privacy Indicators added in Q. In particular:
4411 * - When user sees privacy chip
4412 * - When user clicks privacy chip
4413 * - How does the user exit the Privacy Dialog
4414 * Logged from:
4415 *   packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
4416 */
4417message PrivacyIndicatorsInteracted {
4418
4419    enum Type {
4420        UNKNOWN = 0;
4421        CHIP_VIEWED = 1;
4422        CHIP_CLICKED = 2;
4423        DIALOG_PRIVACY_SETTINGS = 3;
4424        DIALOG_DISMISS = 4;
4425        DIALOG_LINE_ITEM = 5;
4426    }
4427
4428    optional Type type = 1 [(state_field_option).exclusive_state = true];
4429
4430    // Used if the type is LINE_ITEM
4431    optional string package_name = 2;
4432}
4433
4434/**
4435 * Logs information about a package that is moved from the internal to external storage and vice
4436 * versa.
4437 * It logs the package name, the type of the external storage where the package is installed
4438 * (if moved to external storage, or UNKNOWN if moved to internal storage),
4439 * and the move type: if it's from internal to external or the other way around.
4440 *
4441 * Logged from:
4442        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
4443 */
4444message AppMovedStorageReported {
4445    enum MoveType {
4446        UNKNOWN = 0;
4447        TO_EXTERNAL = 1;
4448        TO_INTERNAL = 2;
4449    }
4450    // The type of the external storage.
4451    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
4452    // The type of move.
4453    optional MoveType move_type = 2;
4454    // The name of the package that was moved.
4455    optional string package_name = 3;
4456}
4457
4458/**
4459 * Logs when system server watchdog occurs.
4460 * Logged from:
4461 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
4462 */
4463message SystemServerWatchdogOccurred {
4464    optional string subject = 1;
4465}
4466
4467/**
4468 * Logs when new file added to tombstones.
4469 * Logged from:
4470 *      frameworks/base/core/java/com/android/server/BootReceiver.java
4471 */
4472message TombStoneOccurred {
4473}
4474
4475/*
4476 * Information about a role request
4477 *
4478 * Logged from:
4479 *   packages/apps/PermissionController/src/com/android/packageinstaller/role/ui/RequestRoleFragment.java
4480 */
4481message RoleRequestResultReported {
4482    // UID of application requesting the role
4483    optional int32 requesting_uid = 1;
4484
4485    // Package name of application requesting the role
4486    optional string requesting_package_name = 2;
4487
4488    // The role to be granted
4489    optional string role_name = 3;
4490
4491    // The count of applications qualifying for the role
4492    optional int32 qualifying_count = 4;
4493
4494    // UID of application current granted the role
4495    optional int32 current_uid = 5;
4496
4497    // Package name of application current granted the role
4498    optional string current_package_name = 6;
4499
4500    // UID of another application that user chose to grant the role to, instead of the requesting
4501    // application
4502    optional int32 granted_another_uid = 7;
4503
4504    // Package name of another application that user chose to grant the role to, instead of the
4505    // requesting application
4506    optional string granted_another_package_name = 8;
4507
4508    enum Result {
4509        UNDEFINED = 0;
4510        // role request was ignored
4511        IGNORED = 1;
4512        // role request was ignored because it's already granted
4513        IGNORED_ALREADY_GRANTED = 2;
4514        // role request was ignored because the application isn't qualified
4515        IGNORED_NOT_QUALIFIED = 3;
4516        // role request was ignored because user said it should be always denied
4517        IGNORED_USER_ALWAYS_DENIED = 4;
4518        // role was granted by user action
4519        USER_GRANTED = 5;
4520        // role was denied by user action
4521        USER_DENIED = 6;
4522        // role was denied by user granting another application the role
4523        USER_DENIED_GRANTED_ANOTHER = 7;
4524        // role was denied and set to be always denied by the user
4525        USER_DENIED_WITH_ALWAYS = 8;
4526    }
4527    // The result of the role request
4528    optional Result result = 9;
4529}
4530
4531/**
4532 * Logs when a Vehicle Maps Service client's connection state has changed
4533 *
4534 * Logged from:
4535 *   packages/services/Car/service/src/com/android/car/stats/VmsClientLog.java
4536 */
4537message VmsClientConnectionStateChanged {
4538    // The UID of the VMS client app
4539    optional int32 uid = 1 [(is_uid) = true];
4540
4541    enum State {
4542        UNKNOWN = 0;
4543        // Attempting to connect to the client
4544        CONNECTING = 1;
4545        // Client connection established
4546        CONNECTED = 2;
4547        // Client connection closed unexpectedly
4548        DISCONNECTED = 3;
4549        // Client connection closed by VMS
4550        TERMINATED = 4;
4551        // Error establishing the client connection
4552        CONNECTION_ERROR = 5;
4553    }
4554
4555    optional State state  = 2;
4556}
4557
4558message MimeTypes {
4559    repeated string mime_types = 1;
4560}
4561
4562/**
4563 * Logs statistics regarding accesses to external storage.
4564 * All stats are normalized for one day period.
4565 *
4566 * Logged from:
4567 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
4568 */
4569message GeneralExternalStorageAccessStats {
4570    optional int32 uid = 1 [(is_uid) = true];
4571    // Total number of accesses like creation, open, delete and rename/update.
4572    // Includes file path and ContentResolver accesses
4573    optional uint32 total_accesses = 2;
4574    // Number of file path accesses, as opposed to file path and ContentResolver.
4575    optional uint32 file_path_accesses = 3;
4576    // Number of accesses on secondary volumes like SD cards.
4577    // Includes file path and ContentResolver accesses
4578    optional uint32 secondary_storage_accesses = 4;
4579    // Comma-separated list of mime types that were accessed.
4580    optional MimeTypes mime_types_accessed = 5;
4581}
4582
4583/**
4584 * Logs when MediaProvider has successfully finished scanning a storage volume.
4585 *
4586 * Logged from:
4587 *   packages/providers/MediaProvider/src/com/android/providers/media/scan/ModernMediaScanner.java
4588 */
4589message MediaProviderScanOccurred {
4590    enum Reason {
4591        // Scan triggered due to unknown reason
4592        UNKNOWN = 0;
4593        // Scan triggered due to storage volume being mounted
4594        MOUNTED = 1;
4595        // Scan triggered due to explicit user action or app request
4596        DEMAND = 2;
4597        // Scan triggered due to idle maintenance
4598        IDLE = 3;
4599    }
4600
4601    // Volume type that this event pertains to
4602    optional android.stats.mediaprovider.VolumeType volume_type = 1;
4603    // Reason why this scan was triggered
4604    optional Reason reason = 2;
4605    // Total number of files scanned
4606    optional int64 item_count = 3;
4607    // Duration of scan, normalized per file
4608    optional float normalized_duration_millis = 4;
4609    // Number of database inserts, normalized per file
4610    optional float normalized_insert_count = 5;
4611    // Number of database updates, normalized per file
4612    optional float normalized_update_count = 6;
4613    // Number of database deletes, normalized per file
4614    optional float normalized_delete_count = 7;
4615}
4616
4617/**
4618 * Logs when an app has asked MediaProvider to delete media belonging to the user.
4619 *
4620 * Logged from:
4621 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
4622 */
4623message MediaContentDeleted {
4624    // Volume type that this event pertains to
4625    optional android.stats.mediaprovider.VolumeType volume_type = 1;
4626    // UID of app that requested deletion
4627    optional int32 uid = 2 [(is_uid) = true];
4628    // Number of items that were deleted
4629    optional int32 item_count = 3;
4630}
4631
4632/**
4633 * Logs when an app has asked MediaProvider to grant them access to media belonging to the user.
4634 *
4635 * Logged from:
4636 *   packages/providers/MediaProvider/src/com/android/providers/media/PermissionActivity.java
4637 */
4638message MediaProviderPermissionRequested {
4639    enum Result {
4640        UNKNOWN = 0;
4641        USER_GRANTED = 1;
4642        AUTO_GRANTED = 2;
4643        USER_DENIED = 3;
4644        USER_DENIED_WITH_PREJUDICE = 4;
4645        AUTO_DENIED = 5;
4646    }
4647
4648    // Volume type that this event pertains to
4649    optional android.stats.mediaprovider.VolumeType volume_type = 1;
4650    // UID of app that requested permission
4651    optional int32 uid = 2 [(is_uid) = true];
4652    // Number of items that were requested
4653    optional int32 item_count = 3;
4654    // Result of this request
4655    optional Result result = 4;
4656}
4657
4658/**
4659 * Logs when MediaProvider has finished upgrading or downgrading its database schema.
4660 *
4661 * Logged from:
4662 *   packages/providers/MediaProvider/src/com/android/providers/media/DatabaseHelper.java
4663 */
4664message MediaProviderSchemaChanged {
4665    // Volume type that this event pertains to
4666    optional android.stats.mediaprovider.VolumeType volume_type = 1;
4667    // Old database version code
4668    optional int32 version_from = 2;
4669    // New database version code
4670    optional int32 version_to = 3;
4671    // Total number of files in database
4672    optional int64 item_count = 4;
4673    // Duration of schema change, normalized per file
4674    optional float normalized_duration_millis = 5;
4675}
4676
4677/**
4678 * Logs when MediaProvider has finished an idle maintenance job.
4679 *
4680 * Logged from:
4681 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
4682 */
4683message MediaProviderIdleMaintenanceFinished {
4684    // Volume type that this event pertains to
4685    optional android.stats.mediaprovider.VolumeType volume_type = 1;
4686
4687    // Total number of files in database
4688    optional int64 item_count = 2;
4689    // Duration of idle maintenance, normalized per file
4690    optional float normalized_duration_millis = 3;
4691    // Number of thumbnails found to be stale, normalized per file
4692    optional float normalized_stale_thumbnails = 4;
4693    // Number of items found to be expired, normalized per file
4694    optional float normalized_expired_media = 5;
4695}
4696
4697/**
4698 * Represents boot time event with duration in ms.
4699 *
4700 * Logged from: bootstat and various system server components. Check each enums for details.
4701 */
4702message BootTimeEventDuration {
4703    enum DurationEvent {
4704        UNKNOWN = 0;
4705        // Bootloader time excluding BOOTLOADER_UI_WAIT + boot complete time. Logged from bootstat.
4706        ABSOLUTE_BOOT_TIME = 1;
4707        // Bootloader's 1st stage execution time.
4708        // Logged from bootstat.
4709        BOOTLOADER_FIRST_STAGE_EXEC = 2;
4710        // Bootloader's 1st stage loading time.
4711        // Logged from bootstat.
4712        BOOTLOADER_FIRST_STAGE_LOAD = 3;
4713        // Bootloader's kernel loading time.
4714        // Logged from bootstat.
4715        BOOTLOADER_KERNEL_LOAD = 4;
4716        // Bootloader's 2nd stage execution time.
4717        // Logged from bootstat.
4718        BOOTLOADER_SECOND_STAGE_EXEC = 5;
4719        // Bootloader's 2nd stage loading time.
4720        // Logged from bootstat.
4721        BOOTLOADER_SECOND_STAGE_LOAD = 6;
4722        // Duration for Bootloader to show unlocked device's warning UI. This should not happen
4723        // for locked device.
4724        // Logged from bootstat.
4725        BOOTLOADER_UI_WAIT = 7;
4726        // Total time spend in bootloader. This is the sum of all BOOTLOADER_* listed above.
4727        // Logged from bootstat.
4728        BOOTLOADER_TOTAL = 8;
4729        // Shutdown duration inside init for the reboot before the current boot up.
4730        // Logged from f/b/services/.../BootReceiver.java.
4731        SHUTDOWN_DURATION = 9;
4732        // Total time for mounting of disk devices during bootup.
4733        // Logged from f/b/services/.../BootReceiver.java.
4734        MOUNT_DEFAULT_DURATION = 10;
4735        // Total time for early stage mounting of disk devices during bootup.
4736        // Logged from f/b/services/.../BootReceiver.java.
4737        MOUNT_EARLY_DURATION = 11;
4738        // Total time for late stage mounting of disk devices during bootup.
4739        // Logged from f/b/services/.../BootReceiver.java.
4740        MOUNT_LATE_DURATION = 12;
4741        // Average time to scan non-system app after OTA
4742        // Logged from f/b/services/.../PackageManagerService.java
4743        OTA_PACKAGE_MANAGER_INIT_TIME = 13;
4744        // Time to initialize Package manager after OTA
4745        // Logged from f/b/services/.../PackageManagerService.java
4746        OTA_PACKAGE_MANAGER_DATA_APP_AVG_SCAN_TIME = 14;
4747        // Time to scan all system app from Package manager after OTA
4748        // Logged from f/b/services/.../PackageManagerService.java
4749        OTA_PACKAGE_MANAGER_SYSTEM_APP_AVG_SCAN_TIME = 15;
4750        // Init's total time for cold boot stage.
4751        // Logged from bootstat.
4752        COLDBOOT_WAIT = 16;
4753        // Init's total time for initializing selinux.
4754        // Logged from bootstat.
4755        SELINUX_INIT = 17;
4756        // Time since last factory reset.
4757        // Logged from bootstat.
4758        FACTORY_RESET_TIME_SINCE_RESET = 18;
4759        // Init's total time spent for completing the 1st stage.
4760        // Logged from bootstat.
4761        ANDROID_INIT_STAGE_1 = 19;
4762    }
4763
4764    // Type of the event.
4765    optional DurationEvent event = 1;
4766    // Duration of the event in ms.
4767    optional int64 duration_millis = 2;
4768}
4769
4770/**
4771 * Represents the start of specific boot time event during bootup in ms. This is usually a time
4772 * since boot-up.
4773 *
4774 * Logged from: bootstat and various system server components. Check each enums for details.
4775 */
4776message BootTimeEventElapsedTime {
4777    enum ElapsedTimeEvent {
4778        UNKNOWN = 0;
4779        // Time when init starts 1st stage. Logged from bootstat.
4780        ANDROID_INIT_STAGE_1 = 1;
4781        // Time when sys.boot_completed prop is set.
4782        // Logged from bootstat.
4783        BOOT_COMPLETE = 2;
4784        // BOOT_COMPLETE for encrypted device.
4785        BOOT_COMPLETE_ENCRYPTION = 3;
4786        // BOOT_COMPLETE for device with no encryption.
4787        BOOT_COMPLETE_NO_ENCRYPTION = 4;
4788        // Adjusted BOOT_COMPLETE for encrypted device extracting decryption time.
4789        BOOT_COMPLETE_POST_DECRYPT = 5;
4790        // BOOT_COMPLETE after factory reset.
4791        FACTORY_RESET_BOOT_COMPLETE = 6;
4792        // BOOT_COMPLETE_NO_ENCRYPTION after factory reset.
4793        FACTORY_RESET_BOOT_COMPLETE_NO_ENCRYPTION = 7;
4794        // BOOT_COMPLETE_POST_DECRYPT after factory reset.
4795        FACTORY_RESET_BOOT_COMPLETE_POST_DECRYPT = 8;
4796        // BOOT_COMPLETE after OTA.
4797        OTA_BOOT_COMPLETE = 9;
4798        // BOOT_COMPLETE_NO_ENCRYPTION after OTA.
4799        OTA_BOOT_COMPLETE_NO_ENCRYPTION = 10;
4800        // BOOT_COMPLETE_POST_DECRYPT after OTA.
4801        OTA_BOOT_COMPLETE_POST_DECRYPT = 11;
4802        // Time when the system starts sending LOCKED_BOOT_COMPLETED broadcast.
4803        // Logged from  f/b/services/.../UserController.java
4804        FRAMEWORK_LOCKED_BOOT_COMPLETED = 12;
4805        // Time when the system starts sending BOOT_COMPLETED broadcast.
4806        // Logged from  f/b/services/.../UserController.java
4807        FRAMEWORK_BOOT_COMPLETED = 13;
4808        // Time when the package manager starts init.
4809        // Logged from f/b/services/.../SystemServer.java
4810        PACKAGE_MANAGER_INIT_START = 14;
4811        // Time when package manager is ready
4812        // Logged from f/b/services/.../SystemServer.java
4813        PACKAGE_MANAGER_INIT_READY = 15;
4814        // Represents the time when user has entered unlock credential for system with user pin.
4815        // Logged from bootstat.
4816        POST_DECRYPT = 16;
4817        // Represents the start of zygote's init.
4818        // Logged from zygote itself.
4819        ZYGOTE_INIT_START = 17;
4820        // Represents the start of secondary zygote's init.
4821        // TODO: add logging to zygote
4822        SECONDARY_ZYGOTE_INIT_START = 18;
4823        // Represents the start of system server's init.
4824        // Logged from f/b/services/.../SystemServer.java
4825        SYSTEM_SERVER_INIT_START = 19;
4826        // Represents the completion of system server's init.
4827        // Logged from f/b/services/.../SystemServer.java
4828        SYSTEM_SERVER_READY = 20;
4829        // Represents the start of launcher during boot-up.
4830        // TODO: add logging
4831        LAUNCHER_START = 21;
4832        // Represents the completion of launcher's initial rendering. User can use other apps from
4833        // launcher from this point.
4834        // TODO: add logging
4835        LAUNCHER_SHOWN = 22;
4836    }
4837
4838    // Type of the event.
4839    optional ElapsedTimeEvent event = 1;
4840    // Time since bootup for the event.
4841    // It should be acquired from SystemClock elapsedRealtime() call or equivalent.
4842    optional int64 time_millis = 2;
4843}
4844
4845/**
4846 * Boot time events with UTC time.
4847 *
4848 * Logged from: bootstat and various system server components. Check each enums for details.
4849 */
4850message BootTimeEventUtcTime {
4851    enum UtcTimeEvent {
4852        UNKNOWN = 0;
4853        // Time of the bootstat's marking of 1st boot after the last factory reset.
4854        // Logged from bootstat.
4855        FACTORY_RESET_RESET_TIME = 1;
4856        // The time when bootstat records FACTORY_RESET_* events. This is close to
4857        // BOOT_COMPLETE time for the current bootup.
4858        // Logged from bootstat.
4859        FACTORY_RESET_CURRENT_TIME = 2;
4860        // DUplicate of FACTORY_RESET_RESET_TIME added for debugging purpose.
4861        // Logged from bootstat.
4862        FACTORY_RESET_RECORD_VALUE = 3;
4863    }
4864
4865    // Type of the event.
4866    optional UtcTimeEvent event = 1;
4867    // UTC time for the event.
4868    optional int64 utc_time_secs = 2;
4869}
4870
4871/**
4872 * Boot time events representing specific error code during bootup.
4873 * Meaning of error code can be different per each event type.
4874 *
4875 * Logged from: bootstat and various system server components. Check each enums for details.
4876 */
4877message BootTimeEventErrorCode {
4878    enum ErrorCodeEvent {
4879        UNKNOWN = 0;
4880        // Linux error code for time() call to get the current UTC time.
4881        // Logged from bootstat.
4882        FACTORY_RESET_CURRENT_TIME_FAILURE = 1;
4883        // Represents UmountStat before the reboot for the current boot up. Error codes defined
4884        // as UMOUNT_STAT_* from init/reboot.cpp.
4885        // Logged from f/b/services/.../BootReceiver.java.
4886        SHUTDOWN_UMOUNT_STAT = 2;
4887        // Reprepsents fie system mounting error code of /data partition for the current boot.
4888        // Error codes defined as combination of FsStatFlags from system/core/fs_mgr/fs_mgr.cpp.
4889        // Logged from f/b/services/.../BootReceiver.java.
4890        FS_MGR_FS_STAT_DATA_PARTITION = 3;
4891    }
4892
4893    // Type of the event.
4894    optional ErrorCodeEvent event = 1;
4895    // error code defined per each event type.
4896    // For example, this can have a value of FsStatFlags.FS_STAT_FULL_MOUNT_FAILED for the event of
4897    // FS_MGR_FS_STAT.
4898    optional int32 error_code = 2;
4899}
4900
4901/**
4902 * Collects Virtual A/B statistics related to the use of dm-snapshot performed
4903 * after an OTA.
4904 *
4905 * Logged from:
4906 *  - system/update_engine/cleanup_previous_update_action.cc
4907 */
4908message SnapshotMergeReported {
4909    // Keep in sync with
4910    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
4911    enum UpdateState {
4912        // No update or merge is in progress.
4913        NONE = 0;
4914        // An update is applying; snapshots may already exist.
4915        INITIATED = 1;
4916        // An update is pending, but has not been successfully booted yet.
4917        UNVERIFIED = 2;
4918        // The kernel is merging in the background.
4919        MERGING = 3;
4920        // Post-merge cleanup steps could not be completed due to a transient
4921        // error, but the next reboot will finish any pending operations.
4922        MERGE_NEEDS_REBOOT = 4;
4923        // Merging is complete, and needs to be acknowledged.
4924        MERGE_COMPLETED = 5;
4925        // Merging failed due to an unrecoverable error.
4926        MERGE_FAILED = 6;
4927        // The update was implicitly cancelled, either by a rollback or a flash
4928        // operation via fastboot. This state can only be returned by WaitForMerge.
4929        CANCELLED = 7;
4930    };
4931
4932    // Status of the update after the merge attempts.
4933    optional UpdateState final_state = 1;
4934
4935    // Time to complete a merge operation in milliseconds.
4936    // A negative value corresponds to the case in which the merge operation
4937    // was interrupted and resumed (e.g. in case of a system reboot during the
4938    // merge).
4939    optional int64 duration_millis = 2;
4940
4941    // Number of reboots that occurred after issuing and before completing the
4942    // merge of all the snapshot devices.
4943    optional int32 intermediate_reboots = 3;
4944
4945    // The device has been upgraded to Virtual A/B.
4946    optional bool is_vab_retrofit = 4;
4947
4948    // Space that has been temporarily allocated in the /data partition
4949    // containing the dm-snapshot's copy-on-write data generated during a
4950    // Virtual A/B update.
4951    optional int64 cow_file_size_bytes = 5;
4952}
4953
4954/**
4955 * Event representing when BlobStoreManager.Session#commit() is called
4956 *
4957 * Logged from:
4958 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
4959 */
4960message BlobCommitted {
4961    // Uid of the Blob committer
4962    optional int32 uid = 1 [(is_uid) = true];
4963
4964    // Id of the Blob committed
4965    optional int64 blob_id = 2;
4966
4967    // Size of the Blob
4968    optional int64 size = 3;
4969
4970    enum Result {
4971        UNKNOWN = 0;
4972        // Commit Succeeded
4973        SUCCESS = 1;
4974        // Commit Failed: Error occurred during commit
4975        ERROR_DURING_COMMIT = 2;
4976        // Commit Failed: Digest of the data did not match Blob digest
4977        DIGEST_MISMATCH = 3;
4978        // Commit Failed: Allowed count limit exceeded
4979        COUNT_LIMIT_EXCEEDED = 4;
4980    }
4981    optional Result result = 4;
4982}
4983
4984/**
4985 * Event representing when BlobStoreManager#acquireLease() is called
4986 *
4987 * Logged from:
4988 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
4989 */
4990message BlobLeased{
4991    // Uid of the Blob leasee
4992    optional int32 uid = 1 [(is_uid) = true];
4993
4994    // Id of the Blob leased or 0 if the Blob does not exist
4995    optional int64 blob_id = 2;
4996
4997    // Size of the Blob or 0 if the Blob does not exist
4998    optional int64 size = 3;
4999
5000    enum Result {
5001        UNKNOWN = 0;
5002        // Lease Succeeded
5003        SUCCESS = 1;
5004        // Lease Failed: Blob does not exist
5005        BLOB_DNE = 2;
5006        // Lease Failed: Leasee does not have access to the Blob
5007        ACCESS_NOT_ALLOWED = 3;
5008        // Lease Failed: Leasee requested an invalid expiry duration
5009        LEASE_EXPIRY_INVALID = 4;
5010        // Lease Failed: Leasee has exceeded the total data lease limit
5011        DATA_SIZE_LIMIT_EXCEEDED = 5;
5012        // Leasee Failed: Allowed count limit exceeded
5013        COUNT_LIMIT_EXCEEDED = 6;
5014    }
5015    optional Result result = 4;
5016}
5017
5018/**
5019 * Event representing when BlobStoreManager#openBlob() is called
5020 *
5021 * Logged from:
5022 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
5023 */
5024message BlobOpened{
5025    // Uid of the Blob opener
5026    optional int32 uid = 1 [(is_uid) = true];
5027
5028    // Id of the Blob opened or 0 if the Blob does not exist
5029    optional int64 blob_id = 2;
5030
5031    // Size of the Blob or 0 if the Blob does not exist
5032    optional int64 size = 3;
5033
5034    enum Result {
5035        UNKNOWN = 0;
5036        // Open Succeeded
5037        SUCCESS = 1;
5038        // Open Failed: Blob does not exist
5039        BLOB_DNE = 2;
5040        // Open Failed: Opener does not have access to the Blob
5041        ACCESS_NOT_ALLOWED = 3;
5042    }
5043    optional Result result = 4;
5044}
5045
5046//////////////////////////////////////////////////////////////////////
5047// Pulled atoms below this line //
5048//////////////////////////////////////////////////////////////////////
5049
5050/**
5051 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
5052 *
5053 * Pulled from:
5054 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
5055 */
5056message WifiBytesTransfer {
5057    optional int32 uid = 1 [(is_uid) = true];
5058
5059    optional int64 rx_bytes = 2;
5060
5061    optional int64 rx_packets = 3;
5062
5063    optional int64 tx_bytes = 4;
5064
5065    optional int64 tx_packets = 5;
5066}
5067
5068/**
5069 * Pulls bytes transferred via wifi (separated by foreground and background usage).
5070 *
5071 * Pulled from:
5072 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
5073 */
5074message WifiBytesTransferByFgBg {
5075    optional int32 uid = 1 [(is_uid) = true];
5076
5077    // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
5078    optional bool is_foreground = 2;
5079
5080    optional int64 rx_bytes = 3;
5081
5082    optional int64 rx_packets = 4;
5083
5084    optional int64 tx_bytes = 5;
5085
5086    optional int64 tx_packets = 6;
5087}
5088
5089/**
5090 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
5091 *
5092 * Pulled from:
5093 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
5094 */
5095message MobileBytesTransfer {
5096    optional int32 uid = 1 [(is_uid) = true];
5097
5098    optional int64 rx_bytes = 2;
5099
5100    optional int64 rx_packets = 3;
5101
5102    optional int64 tx_bytes = 4;
5103
5104    optional int64 tx_packets = 5;
5105}
5106
5107/**
5108 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
5109 *
5110 * Pulled from:
5111 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
5112 */
5113message MobileBytesTransferByFgBg {
5114    optional int32 uid = 1 [(is_uid) = true];
5115
5116    // 1 denotes foreground and 0 denotes background. This is called Set in
5117    // NetworkStats.
5118    optional bool is_foreground = 2;
5119
5120    optional int64 rx_bytes = 3;
5121
5122    optional int64 rx_packets = 4;
5123
5124    optional int64 tx_bytes = 5;
5125
5126    optional int64 tx_packets = 6;
5127}
5128
5129/**
5130 * Used for pull network statistics via mobile|wifi networks, and sliced by interesting dimensions.
5131 * Note that the data is expected to be sliced into more dimensions in future. In other words,
5132 * the caller must not assume any row of data is one full report when filtering with a set of
5133 * matching conditions, because future data may represent with multiple rows what is currently
5134 * represented by one.
5135 * To avoid being broken by future slicing, callers must take care to aggregate rows even if they
5136 * query all the existing columns.
5137 *
5138 * Pulled from:
5139 *   StatsPullAtomService (using NetworkStatsService to get NetworkStats)
5140 */
5141message DataUsageBytesTransfer {
5142    // State of this record. Should be NetworkStats#SET_DEFAULT or NetworkStats#SET_FOREGROUND to
5143    // indicate the foreground state, or NetworkStats#SET_ALL to indicate the record is for all
5144    // states combined, not including debug states. See NetworkStats#SET_*.
5145    optional int32 state = 1;
5146
5147    optional int64 rx_bytes = 2;
5148
5149    optional int64 rx_packets = 3;
5150
5151    optional int64 tx_bytes = 4;
5152
5153    optional int64 tx_packets = 5;
5154
5155    // Radio Access Technology (RAT) type of this record, should be one of
5156    // TelephonyManager#NETWORK_TYPE_* constants, or NetworkTemplate#NETWORK_TYPE_ALL to indicate
5157    // the record is for all rat types combined.
5158    optional int32 rat_type = 6;
5159
5160    // Mcc/Mnc read from sim if the record is for a specific subscription, null indicates the
5161    // record is combined across subscriptions.
5162    optional string sim_mcc = 7;
5163    optional string sim_mnc = 8;
5164
5165    // Allows mobile virtual network operators (MVNOs) to be identified with individual IDs.
5166    // See TelephonyManager#getSimCarrierId.
5167    optional int32 carrier_id = 9;
5168
5169    // Enumeration of opportunistic states with an additional ALL state indicates the record is
5170    // combined regardless of the boolean value in its field.
5171    enum DataSubscriptionState {
5172        UNKNOWN = 0; // For server side backward compatibility.
5173        ALL = 1;
5174        OPPORTUNISTIC = 2;
5175        NOT_OPPORTUNISTIC = 3;
5176    }
5177    // Mark whether the subscription is an opportunistic data subscription, and ALL indicates the
5178    // record is combined across opportunistic data subscriptions.
5179    // See {@link SubscriptionManager#setOpportunistic}.
5180    optional DataSubscriptionState opportunistic_data_sub = 10;
5181
5182    // Indicate whether NR is connected, server side could use this with RAT type to determine if
5183    // the record is for 5G NSA (Non Stand Alone) mode, where the primary cell is still LTE and
5184    // network allocates a secondary 5G cell so telephony reports RAT = LTE along with NR state as
5185    // connected.
5186    optional bool is_nr_connected = 11;
5187}
5188
5189/**
5190 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
5191 *
5192 * Pulled from:
5193 *   StatsCompanionService
5194 */
5195message BluetoothBytesTransfer {
5196    optional int32 uid = 1 [(is_uid) = true];
5197
5198    optional int64 rx_bytes = 2;
5199
5200    optional int64 tx_bytes = 3;
5201}
5202
5203/**
5204 * Pulls the kernel wakelock durations. This atom is adapted from
5205 * android/internal/os/KernelWakelockStats.java
5206 *
5207 * Pulled from:
5208 *   StatsCompanionService using KernelWakelockReader.
5209 */
5210message KernelWakelock {
5211    optional string name = 1;
5212
5213    optional int32 count = 2;
5214
5215    optional int32 version = 3;
5216
5217    optional int64 time_micros = 4;
5218}
5219
5220/**
5221 * Pulls low power state information. If power.stats HAL is not available, this
5222 * includes platform and subsystem sleep state information,
5223 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
5224 * as defined in:
5225 *   hardware/interfaces/power/1.0/types.hal
5226 *   hardware/interfaces/power/1.1/types.hal
5227 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
5228 * as defined in:
5229 *   hardware/interfaces/power/stats/1.0/types.hal
5230 */
5231message SubsystemSleepState {
5232    // Subsystem name
5233    optional string subsystem_name = 1;
5234    // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
5235    // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
5236    // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
5237    //    powerEntityStateName from the corresponding PowerEntityStateInfo.
5238    optional string subname = 2;
5239    // The number of times it entered, or voted for entering the sleep state
5240    optional uint64 count = 3;
5241    // The length of time spent in, or spent voting for, the sleep state
5242    optional uint64 time_millis = 4;
5243}
5244
5245/**
5246 * Pulls on-device power measurement information.
5247 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
5248 * Pulled from:
5249 *   frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
5250 */
5251message OnDevicePowerMeasurement {
5252    // Name of the subsystem (to which the rail belongs).
5253    optional string subsystem_name = 1;
5254
5255    // Rail name. The rail lies within the subsystem.
5256    optional string rail_name = 2;
5257
5258    // Time (in ms since boot) at which the rail energy value was measured.
5259    // This may differ slightly from the time that statsd logs this information.
5260    optional uint64 measurement_timestamp_millis = 3;
5261
5262    // Accumulated energy used via the rail since device boot in uWs.
5263    optional uint64 energy_microwatt_secs = 4;
5264}
5265
5266/**
5267 * Pulls Cpu time per frequency.
5268 * Pulls the time the cpu spend on the frequency index. Frequency index
5269 * starts from highest to lowest. The value should be monotonically
5270 * increasing since boot. However, if there is a cpu
5271 * hotplug event, the value would be reset as well.
5272 */
5273message CpuTimePerFreq {
5274    optional uint32 cluster = 1;
5275    optional uint32 freq_index = 2;
5276    optional uint64 time_millis = 3;
5277}
5278
5279/**
5280 * Pulls Cpu Time Per Uid.
5281 * Note that isolated process uid time should be attributed to host uids.
5282 */
5283message CpuTimePerUid {
5284    optional int32 uid = 1 [(is_uid) = true];
5285    optional uint64 user_time_micros = 2;
5286    optional uint64 sys_time_micros = 3;
5287}
5288
5289/**
5290 * Pulls Cpu Time Per Uid per frequency.
5291 * Note that isolated process uid time should be attributed to host uids.
5292 * For each uid, we order the time by descending frequencies.
5293 */
5294message CpuTimePerUidFreq {
5295    optional int32 uid = 1 [(is_uid) = true];
5296    optional uint32 freq_index = 2;
5297    optional uint64 time_millis = 3;
5298}
5299
5300/**
5301 * Pulls Wifi Controller Activity Energy Info
5302 */
5303message WifiActivityInfo {
5304    // timestamp(wall clock) of record creation
5305    optional uint64 timestamp_millis = 1;
5306    // stack reported state
5307    // TODO: replace this with proto enum
5308    optional int32 stack_state = 2;
5309    // tx time in millis
5310    optional uint64 controller_tx_time_millis = 3;
5311    // rx time in millis
5312    optional uint64 controller_rx_time_millis = 4;
5313    // idle time in millis
5314    optional uint64 controller_idle_time_millis = 5;
5315    // product of current(mA), voltage(V) and time(ms)
5316    optional uint64 controller_energy_used = 6;
5317}
5318
5319/**
5320 * Pulls Modem Activity Energy Info
5321 */
5322message ModemActivityInfo {
5323    // timestamp(wall clock) of record creation
5324    optional uint64 timestamp_millis = 1;
5325    // sleep time in millis.
5326    optional uint64 sleep_time_millis = 2;
5327    // idle time in millis
5328    optional uint64 controller_idle_time_millis = 3;
5329    /**
5330     * Tx power index
5331     * index 0 = tx_power < 0dBm
5332     * index 1 = 0dBm < tx_power < 5dBm
5333     * index 2 = 5dBm < tx_power < 15dBm
5334     * index 3 = 15dBm < tx_power < 20dBm
5335     * index 4 = tx_power > 20dBm
5336     */
5337    // tx time in ms at power level 0
5338    optional uint64 controller_tx_time_pl0_millis = 4;
5339    // tx time in ms at power level 1
5340    optional uint64 controller_tx_time_pl1_millis = 5;
5341    // tx time in ms at power level 2
5342    optional uint64 controller_tx_time_pl2_millis = 6;
5343    // tx time in ms at power level 3
5344    optional uint64 controller_tx_time_pl3_millis = 7;
5345    // tx time in ms at power level 4
5346    optional uint64 controller_tx_time_pl4_millis = 8;
5347    // rx time in ms at power level 5
5348    optional uint64 controller_rx_time_millis = 9;
5349    // product of current(mA), voltage(V) and time(ms)
5350    optional uint64 energy_used = 10 [deprecated=true];
5351}
5352
5353/**
5354 * Pulls Bluetooth Activity Energy Info
5355 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
5356 */
5357message BluetoothActivityInfo {
5358    // timestamp(wall clock) of record creation
5359    optional uint64 timestamp_millis = 1;
5360    // bluetooth stack state
5361    optional int32 bluetooth_stack_state = 2;
5362    // tx time in millis
5363    optional uint64 controller_tx_time_millis = 3;
5364    // rx time in millis
5365    optional uint64 controller_rx_time_millis = 4;
5366    // idle time in millis
5367    optional uint64 controller_idle_time_millis = 5;
5368    // product of current(mA), voltage(V) and time(ms)
5369    optional uint64 energy_used = 6;
5370}
5371
5372/*
5373 * Logs the memory stats for a process.
5374 *
5375 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
5376 */
5377message ProcessMemoryState {
5378    // The uid if available. -1 means not available.
5379    optional int32 uid = 1 [(is_uid) = true];
5380
5381    // The process name.
5382    // Usually package name, "system" for system server.
5383    // Provided by ActivityManagerService.
5384    optional string process_name = 2;
5385
5386    // Current OOM score adjustment. Value read from ProcessRecord.
5387    optional int32 oom_adj_score = 3;
5388
5389    // # of page-faults
5390    optional int64 page_fault = 4;
5391
5392    // # of major page-faults
5393    optional int64 page_major_fault = 5;
5394
5395    // RSS
5396    // Value is read from memory.stat, field total_rss if per-app memory
5397    // cgroups are enabled. Otherwise, value from /proc/pid/stat.
5398    optional int64 rss_in_bytes = 6;
5399
5400    // CACHE
5401    // Value is read from memory.stat, field total_cache if per-app memory
5402    // cgroups are enabled. Otherwise, 0.
5403    optional int64 cache_in_bytes = 7;
5404
5405    // SWAP
5406    // Value is read from memory.stat, field total_swap if per-app memory
5407    // cgroups are enabled. Otherwise, 0.
5408    optional int64 swap_in_bytes = 8;
5409
5410    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always -1.
5411    optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
5412
5413    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
5414    optional int64 start_time_nanos = 10 [deprecated = true];
5415
5416    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
5417    optional int32 anon_rss_and_swap_in_kilobytes = 11 [deprecated = true];
5418}
5419
5420/*
5421 * Logs the memory high-water mark for a process.
5422 *
5423 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
5424 * and for selected native processes.
5425 *
5426 * Pulling this atom resets high-water mark counters for all processes.
5427 */
5428message ProcessMemoryHighWaterMark {
5429    // The uid if available. -1 means not available.
5430    optional int32 uid = 1 [(is_uid) = true];
5431
5432    // The process name.
5433    // Usually package name or process cmdline.
5434    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
5435    optional string process_name = 2;
5436
5437    // Deprecated: use rss_high_water_mark_in_kilobytes instead. This field is
5438    // computed by converting kilobytes to bytes.
5439    optional int64 rss_high_water_mark_in_bytes = 3 [deprecated = true];
5440
5441    // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
5442    // /proc/PID/status.
5443    optional int32 rss_high_water_mark_in_kilobytes = 4;
5444}
5445
5446/*
5447 * Logs the memory stats for a process.
5448 *
5449 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService)
5450 * and for selected native processes.
5451 */
5452message ProcessMemorySnapshot {
5453    // The uid if available. -1 means not available.
5454    optional int32 uid = 1 [(is_uid) = true];
5455
5456    // The process name.
5457    // Usually package name or process cmdline.
5458    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
5459    optional string process_name = 2;
5460
5461    // The pid of the process.
5462    // Allows to disambiguate instances of the process.
5463    optional int32 pid = 3;
5464
5465    // The current OOM score adjustment value.
5466    // Read from ProcessRecord for managed processes.
5467    // Placeholder -1001 (OOM_SCORE_ADJ_MIN - 1, outside of allowed range) for native ones.
5468    optional int32 oom_score_adj = 4;
5469
5470    // The current RSS of the process.
5471    // VmRSS from /proc/pid/status.
5472    optional int32 rss_in_kilobytes = 5;
5473
5474    // The current anon RSS of the process.
5475    // RssAnon from /proc/pid/status.
5476    optional int32 anon_rss_in_kilobytes = 6;
5477
5478    // The current swap size of the process.
5479    // VmSwap from /proc/pid/status.
5480    optional int32 swap_in_kilobytes = 7;
5481
5482    // The sum of rss_in_kilobytes and swap_in_kilobytes.
5483    optional int32 anon_rss_and_swap_in_kilobytes = 8;
5484}
5485
5486/*
5487 * Elapsed real time from SystemClock.
5488 */
5489message SystemElapsedRealtime {
5490    optional uint64 time_millis = 1;
5491}
5492
5493/*
5494 * Up time from SystemClock.
5495 */
5496message SystemUptime {
5497    // Milliseconds since the system was booted.
5498    // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
5499    // for external input).
5500    // It is not affected by clock scaling, idle, or other power saving mechanisms.
5501    optional uint64 uptime_millis = 1;
5502}
5503
5504/*
5505 * Reads from /proc/uid_concurrent_active_time which has the format:
5506 * active: X (X is # cores)
5507 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
5508 * [uid1]: [time-0] [time-1] [time-2] ... ...
5509 * ...
5510 * Time-N means the CPU time a UID spent running concurrently with N other processes.
5511 * The file contains a monotonically increasing count of time for a single boot.
5512 */
5513message CpuActiveTime {
5514    optional int32 uid = 1 [(is_uid) = true];
5515    optional uint64 time_millis = 2;
5516}
5517
5518/**
5519 * Reads from /proc/uid_concurrent_policy_time which has the format:
5520 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
5521 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
5522 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
5523 * ...
5524 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
5525 * The file contains a monotonically increasing count of time for a single boot.
5526 */
5527message CpuClusterTime {
5528    optional int32 uid = 1 [(is_uid) = true];
5529    optional int32 cluster_index = 2;
5530    optional uint64 time_millis = 3;
5531}
5532
5533/*
5534 * Pulls free disk space, for data, system partition and temporary directory.
5535 */
5536message DiskSpace {
5537    // available bytes in data partition
5538    optional uint64 data_available_bytes = 1;
5539    // available bytes in system partition
5540    optional uint64 system_available_bytes = 2;
5541    // available bytes in download cache or temp directories
5542    optional uint64 temp_available_bytes = 3;
5543}
5544
5545/**
5546 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
5547 *
5548 * Pulled from StatsCompanionService.java
5549 */
5550message RemainingBatteryCapacity {
5551    optional int32 charge_micro_ampere_hour = 1;
5552}
5553
5554/**
5555 * Pulls battery capacity, which is the battery capacity when full in uAh.
5556 * Pulled from:
5557 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
5558 */
5559message FullBatteryCapacity {
5560    optional int32 capacity_micro_ampere_hour = 1;
5561}
5562
5563/**
5564 * Pulls battery voltage.
5565 * Pulled from:
5566 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
5567 */
5568message BatteryVoltage {
5569    // The voltage of the battery, in millivolts.
5570    optional int32 voltage_millivolt = 1;
5571}
5572
5573/**
5574 * Pulls battery level (percent full, from 0 to 100).
5575 *
5576 * Pulled from:
5577 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
5578 */
5579message BatteryLevel {
5580    // Battery level. Should be in [0, 100].
5581    optional int32 battery_level = 1;
5582}
5583
5584/**
5585 * Pulls the temperature of various parts of the device.
5586 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
5587 *
5588 * Pulled from StatsCompanionService.java
5589 */
5590message Temperature {
5591    // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
5592    optional android.os.TemperatureTypeEnum sensor_location = 1;
5593
5594    // The name of the temperature source. Eg. CPU0
5595    optional string sensor_name = 2;
5596
5597    // Temperature in tenths of a degree C.
5598    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
5599    optional int32 temperature_deci_celsius = 3;
5600
5601    // Relative severity of the throttling, see enum definition.
5602    optional android.os.ThrottlingSeverityEnum severity = 4;
5603}
5604
5605/**
5606 * Pulls the statistics of calls to Binder.
5607 *
5608 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
5609 * config on the device.
5610 *
5611 * Next tag: 15
5612 */
5613message BinderCalls {
5614    // UID of the process responsible for the binder transaction. It will be set if the process
5615    // executing the binder transaction attribute the transaction to another uid using
5616    // Binder.setThreadWorkSource().
5617    //
5618    // If not set, the value will be -1.
5619    optional int32 uid = 1 [(is_uid) = true];
5620    // UID of the process executing the binder transaction.
5621    optional int32 direct_caller_uid = 14;
5622    // Fully qualified class name of the API call.
5623    //
5624    // This is a system server class name.
5625    //
5626    // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
5627    // gets recycled and we have isolated uids, we might attribute the data incorrectly.
5628    // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
5629    // commonly used APIs.
5630    optional string service_class_name = 2;
5631    // Method name of the API call. It can also be a transaction code if we cannot
5632    // resolve it to a name. See Binder#getTransactionName.
5633    //
5634    // This is a system server method name.
5635    optional string service_method_name = 3;
5636    // Total number of API calls.
5637    optional int64 call_count = 4;
5638    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
5639    optional bool screen_interactive = 13;
5640    // Total number of API calls we have data recorded for. If we collected data for all the calls,
5641    // call_count will be equal to recorded_call_count.
5642    //
5643    // If recorded_call_count is different than call_count, it means data collection has been
5644    // sampled. All the fields below will be sampled in this case.
5645    optional int64 recorded_call_count = 12;
5646    // Number of exceptions thrown by the API.
5647    optional int64 recorded_exception_count = 5;
5648    // Total latency of all API calls.
5649    // Average can be computed using total_latency_micros / recorded_call_count.
5650    optional int64 recorded_total_latency_micros = 6;
5651    // Maximum latency of one API call.
5652    optional int64 recorded_max_latency_micros = 7;
5653    // Total CPU usage of all API calls.
5654    // Average can be computed using total_cpu_micros / recorded_call_count.
5655    // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
5656    optional int64 recorded_total_cpu_micros = 8;
5657    // Maximum CPU usage of one API call.
5658    optional int64 recorded_max_cpu_micros = 9;
5659    // Maximum parcel reply size of one API call.
5660    optional int64 recorded_max_reply_size_bytes = 10;
5661    // Maximum parcel request size of one API call.
5662    optional int64 recorded_max_request_size_bytes = 11;
5663}
5664
5665/**
5666 * Pulls the statistics of exceptions during calls to Binder.
5667 *
5668 * Binder stats are cumulative from boot unless somebody reset the data using
5669 * > adb shell dumpsys binder_calls_stats --reset
5670 */
5671message BinderCallsExceptions {
5672    // Exception class name, e.g. java.lang.IllegalArgumentException.
5673    //
5674    // This is an exception class name thrown by the system server.
5675    optional string exception_class_name = 1;
5676    // Total number of exceptions.
5677    optional int64 exception_count = 2;
5678}
5679
5680/**
5681 * Pulls the statistics of message dispatching on HandlerThreads.
5682 *
5683 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
5684 * config on the device.
5685 *
5686 * Next tag: 11
5687 */
5688message LooperStats {
5689    // The uid that made a call to the System Server and caused the message to be enqueued.
5690    optional int32 uid = 1 [(is_uid) = true];
5691
5692    // Fully qualified class name of the handler target class.
5693    //
5694    // This field does not contain PII. This is a system server class name.
5695    optional string handler_class_name = 2;
5696
5697    // The name of the thread that runs the Looper.
5698    //
5699    // This field does not contain PII. This is a system server thread name.
5700    optional string looper_thread_name = 3;
5701
5702    // The name of the dispatched message.
5703    //
5704    // This field does not contain PII. This is a system server constant or class
5705    // name.
5706    optional string message_name = 4;
5707
5708    // Total number of successfully dispatched messages.
5709    optional int64 message_count = 5;
5710
5711    // Total number of messages that failed dispatching.
5712    optional int64 exception_count = 6;
5713
5714    // Total number of processed messages we have data recorded for. If we
5715    // collected data for all the messages, message_count will be equal to
5716    // recorded_message_count.
5717    //
5718    // If recorded_message_count is different than message_count, it means data
5719    // collection has been sampled. The fields below will be sampled in this case.
5720    optional int64 recorded_message_count = 7;
5721
5722    // Total latency of all processed messages.
5723    // Average can be computed using recorded_total_latency_micros /
5724    // recorded_message_count.
5725    optional int64 recorded_total_latency_micros = 8;
5726
5727    // Total CPU usage of all processed message.
5728    // Average can be computed using recorded_total_cpu_micros /
5729    // recorded_message_count. Total can be computed using
5730    // recorded_total_cpu_micros / recorded_message_count * message_count.
5731    optional int64 recorded_total_cpu_micros = 9;
5732
5733    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
5734    optional bool screen_interactive = 10;
5735
5736    // Max recorded CPU usage of all processed messages.
5737    optional int64 recorded_max_cpu_micros = 11;
5738
5739    // Max recorded latency of all processed messages.
5740    optional int64 recorded_max_latency_micros = 12;
5741
5742    // Total number of messages we tracked the dispatching delay for. If we
5743    // collected data for all the messages, message_count will be equal to
5744    // recorded_delay_message_count.
5745    //
5746    // If recorded_delay_message_count is different than message_count, it means data
5747    // collection has been sampled or/and not all messages specified the target dispatch time.
5748    // The fields below will be sampled in this case.
5749    optional int64 recorded_delay_message_count = 13;
5750
5751    // Total dispatching delay of all processed messages.
5752    // Calculated as a difference between the target dispatching time (Message.when)
5753    // and the actual dispatching time.
5754    // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
5755    optional int64 recorded_total_delay_millis = 14;
5756
5757    // Max dispatching delay of all processed messages.
5758    // Calculated as a difference between the target dispatching time (Message.when)
5759    // and the actual dispatching time.
5760    optional int64 recorded_max_delay_millis = 15;
5761}
5762
5763/**
5764 * Pulls disk information, such as write speed and latency.
5765 */
5766message DiskStats {
5767    // Time taken to open, write 512B to, and close a file.
5768    // -1 if error performing the check.
5769    optional int64 data_write_latency_millis = 1;
5770
5771    optional bool file_based_encryption = 2;
5772
5773    // Recent disk write speed in kB/s.
5774    // -1 if error querying storageed.
5775    // 0 if data is unavailable.
5776    optional int32 recent_disk_write_speed = 3;
5777}
5778
5779
5780/**
5781 * Free and total bytes of the Data, Cache, and System partition.
5782 */
5783message DirectoryUsage {
5784    enum Directory {
5785        UNKNOWN = 0;
5786        DATA = 1;
5787        CACHE = 2;
5788        SYSTEM = 3;
5789    }
5790    optional Directory directory = 1;
5791    optional int64 free_bytes = 2;
5792    optional int64 total_bytes = 3;
5793}
5794
5795
5796/**
5797 * Size of an application: apk size, data size, and cache size.
5798 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
5799 * Information is only reported for apps with the primary user (user 0).
5800 * Sizes are aggregated by package name.
5801 */
5802message AppSize {
5803    // Including uids will involve modifying diskstats logic.
5804    optional string package_name = 1;
5805    // App size in bytes. -1 if unavailable.
5806    optional int64 app_size_bytes = 2;
5807    // App data size in bytes. -1 if unavailable.
5808    optional int64 app_data_size_bytes = 3;
5809    // App cache size in bytes. -1 if unavailable.
5810    optional int64 app_cache_size_bytes = 4;
5811    // Time that the cache file was produced.
5812    // Uses System.currentTimeMillis(), which is wall clock time.
5813    optional int64 cache_time_millis = 5;
5814}
5815
5816
5817/**
5818 * Size of a particular category. Eg: photos, videos.
5819 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
5820 */
5821message CategorySize {
5822    enum Category {
5823        UNKNOWN = 0;
5824        APP_SIZE = 1;
5825        APP_DATA_SIZE = 2;
5826        APP_CACHE_SIZE = 3;
5827        PHOTOS = 4;
5828        VIDEOS = 5;
5829        AUDIO = 6;
5830        DOWNLOADS = 7;
5831        SYSTEM = 8;
5832        OTHER = 9;
5833    }
5834    optional Category category = 1;
5835    // Category size in bytes.
5836    optional int64 size_bytes = 2;
5837    // Time that the cache file was produced.
5838    // Uses System.currentTimeMillis(), which is wall clock time.
5839    optional int64 cache_time_millis = 3;
5840}
5841
5842/**
5843 * Pulls per uid I/O stats. The stats are cumulative since boot.
5844 *
5845 * Read/write bytes are I/O events from a storage device
5846 * Read/write chars are data requested by read/write syscalls, and can be
5847 *   satisfied by caching.
5848 *
5849 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
5850 */
5851message DiskIo {
5852    optional int32 uid = 1 [(is_uid) = true];
5853    optional int64 fg_chars_read = 2;
5854    optional int64 fg_chars_write = 3;
5855    optional int64 fg_bytes_read = 4;
5856    optional int64 fg_bytes_write = 5;
5857    optional int64 bg_chars_read = 6;
5858    optional int64 bg_chars_write = 7;
5859    optional int64 bg_bytes_read = 8;
5860    optional int64 bg_bytes_write = 9;
5861    optional int64 fg_fsync = 10;
5862    optional int64 bg_fsync= 11;
5863}
5864
5865
5866/**
5867 * Pulls the number of fingerprints for each user.
5868 *
5869 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
5870 */
5871message NumFingerprintsEnrolled {
5872    // The associated user. Eg: 0 for owners, 10+ for others.
5873    // Defined in android/os/UserHandle.java
5874    optional int32 user = 1;
5875    // Number of fingerprints registered to that user.
5876    optional int32 num_fingerprints_enrolled = 2;
5877}
5878
5879/**
5880 * Pulls the number of faces for each user.
5881 *
5882 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
5883 */
5884message NumFacesEnrolled {
5885    // The associated user. Eg: 0 for owners, 10+ for others.
5886    // Defined in android/os/UserHandle.java
5887    optional int32 user = 1;
5888    // Number of faces registered to that user.
5889    optional int32 num_faces_enrolled = 2;
5890}
5891/**
5892 * A mapping of role holder -> role
5893 */
5894message RoleHolder {
5895    // uid of the role holder
5896    optional int32 uid = 1 [(is_uid) = true];
5897
5898    // package name of the role holder
5899    optional string package_name = 2;
5900
5901    // the role held
5902    optional string role = 3;
5903}
5904
5905message AggStats {
5906    // These are all in byte resolution.
5907    optional int64 min = 1 [deprecated = true];
5908    optional int64 average = 2 [deprecated = true];
5909    optional int64 max = 3 [deprecated = true];
5910
5911    // These are all in kilobyte resolution. Can fit in int32, so smaller on the wire than the above
5912    // int64 fields.
5913    optional int32 mean_kb = 4;
5914    optional int32 max_kb = 5;
5915}
5916
5917// A reduced subset of process states; reducing the number of possible states allows more
5918// aggressive device-side aggregation of statistics and hence reduces metric upload size.
5919enum ProcessStateAggregated {
5920    PROCESS_STATE_UNKNOWN = 0;
5921    // Persistent system process.
5922    PROCESS_STATE_PERSISTENT = 1;
5923    // Top activity; actually any visible activity.
5924    PROCESS_STATE_TOP = 2;
5925    // Process binding to top or a foreground service.
5926    PROCESS_STATE_BOUND_TOP_OR_FGS = 3;
5927    // Processing running a foreground service.
5928    PROCESS_STATE_FGS = 4;
5929    // Important foreground process (ime, wallpaper, etc).
5930    PROCESS_STATE_IMPORTANT_FOREGROUND = 5;
5931    // Important background process.
5932    PROCESS_STATE_BACKGROUND = 6;
5933    // Process running a receiver.
5934    PROCESS_STATE_RECEIVER = 7;
5935    // All kinds of cached processes.
5936    PROCESS_STATE_CACHED = 8;
5937}
5938
5939// Next tag: 13
5940message ProcessStatsStateProto {
5941    optional android.service.procstats.ScreenState screen_state = 1;
5942
5943    optional android.service.procstats.MemoryState memory_state = 2 [deprecated = true];
5944
5945    // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
5946    // and not frameworks/base/core/java/android/app/ActivityManager.java
5947    optional android.service.procstats.ProcessState process_state = 3 [deprecated = true];
5948
5949    optional ProcessStateAggregated process_state_aggregated = 10;
5950
5951    // Millisecond uptime duration spent in this state
5952    optional int64 duration_millis = 4 [deprecated = true];
5953    // Same as above, but with minute resolution so it fits into an int32.
5954    optional int32 duration_minutes = 11;
5955
5956    // Millisecond elapsed realtime duration spent in this state
5957    optional int64 realtime_duration_millis = 9 [deprecated = true];
5958    // Same as above, but with minute resolution so it fits into an int32.
5959    optional int32 realtime_duration_minutes = 12;
5960
5961    // # of samples taken
5962    optional int32 sample_size = 5;
5963
5964    // PSS is memory reserved for this process
5965    optional AggStats pss = 6 [deprecated = true];
5966
5967    // USS is memory shared between processes, divided evenly for accounting
5968    optional AggStats uss = 7 [deprecated = true];
5969
5970    // RSS is memory resident for this process
5971    optional AggStats rss = 8;
5972}
5973
5974// Next Tag: 8
5975message ProcessStatsProto {
5976    // Name of process.
5977    optional string process = 1;
5978
5979    // Uid of the process.
5980    optional int32 uid = 2 [(is_uid) = true];
5981
5982    // Information about how often kills occurred
5983    message Kill {
5984        // Count of excessive CPU kills
5985        optional int32 cpu = 1;
5986
5987        // Count of kills when cached
5988        optional int32 cached = 2;
5989
5990        // PSS stats during cached kill
5991        optional AggStats cached_pss = 3;
5992    }
5993    optional Kill kill = 3 [deprecated = true];
5994
5995    // Time and memory spent in various states.
5996    repeated ProcessStatsStateProto states = 5;
5997
5998    // Total time process has been running...  screen_state, memory_state, and process_state
5999    // will not be set.
6000    optional ProcessStatsStateProto total_running_state = 6;
6001
6002    // Association data for this process in this state;
6003    // each entry here is one association.
6004    repeated ProcessStatsAssociationProto assocs = 7;
6005}
6006
6007// Next Tag: 6
6008message ProcessStatsAssociationProto {
6009    // Procss Name of the associated process (client process of service binding)
6010    optional string assoc_process_name = 1;
6011
6012    // Package Name of the associated package (client package of service binding)
6013    optional string assoc_package_name = 2 [deprecated = true];
6014
6015    // UID of the associated process/package (client package of service binding)
6016    optional int32 assoc_uid = 5 [(is_uid) = true];
6017
6018    // Total count of the times this association (service binding) appeared.
6019    optional int32 total_count = 3;
6020
6021    // Uptime total duration in seconds this association (service binding) was around.
6022    optional int32 total_duration_secs = 4;
6023}
6024
6025message PackageServiceOperationStatsProto {
6026    // Operate enum: Started, Foreground, Bound, Executing
6027    optional android.service.procstats.ServiceOperationState operation = 1;
6028
6029    // Number of times the service was in this operation.
6030    optional int32 count = 2;
6031
6032    // Information about a state the service can be in.
6033    message StateStats {
6034        // Screen state enum.
6035        optional android.service.procstats.ScreenState screen_state = 1;
6036        // Memory state enum.
6037        optional android.service.procstats.MemoryState memory_state = 2;
6038
6039        // duration in milliseconds.
6040        optional int64 duration_millis = 3;
6041        // Millisecond elapsed realtime duration spent in this state
6042        optional int64 realtime_duration_millis = 4;
6043    }
6044    repeated StateStats state_stats = 3;
6045}
6046
6047message PackageServiceStatsProto {
6048    // Name of service component.
6049    optional string service_name = 1;
6050
6051    // The operation stats.
6052    // The package_name, package_uid, package_version, service_name will not be set to save space.
6053    repeated PackageServiceOperationStatsProto operation_stats = 2;
6054}
6055
6056message PackageAssociationSourceProcessStatsProto {
6057    // Uid of the process.
6058    optional int32 process_uid = 1;
6059    // Process name.
6060    optional string process_name = 2;
6061    // Package name.
6062    optional string package_name = 7;
6063    // Total count of the times this association appeared.
6064    optional int32 total_count = 3;
6065
6066    // Millisecond uptime total duration this association was around.
6067    optional int64 total_duration_millis = 4;
6068
6069    // Total count of the times this association became actively impacting its target process.
6070    optional int32 active_count = 5;
6071
6072    // Information on one source in this association.
6073    message StateStats {
6074        // Process state enum.
6075        optional android.service.procstats.ProcessState process_state = 1;
6076        // Millisecond uptime duration spent in this state
6077        optional int64 duration_millis = 2;
6078        // Millisecond elapsed realtime duration spent in this state
6079        optional int64 realtime_duration_mmillis = 3;
6080    }
6081    repeated StateStats active_state_stats = 6;
6082}
6083
6084message PackageAssociationProcessStatsProto {
6085    // Name of the target component.
6086    optional string component_name = 1;
6087    // Information on one source in this association.
6088    repeated PackageAssociationSourceProcessStatsProto sources = 2;
6089}
6090
6091
6092message ProcessStatsPackageProto {
6093    // Name of package.
6094    optional string package = 1;
6095
6096    // Uid of the package.
6097    optional int32 uid = 2;
6098
6099    // Version of the package.
6100    optional int64 version = 3;
6101
6102    // Stats for each process running with the package loaded in to it.
6103    repeated ProcessStatsProto process_stats = 4;
6104
6105    // Stats for each of the package's services.
6106    repeated PackageServiceStatsProto service_stats = 5;
6107
6108    // Stats for each association with the package.
6109    repeated PackageAssociationProcessStatsProto association_stats = 6;
6110}
6111
6112message ProcessStatsSectionProto {
6113    // Elapsed realtime at start of report.
6114    optional int64 start_realtime_millis = 1;
6115
6116    // Elapsed realtime at end of report.
6117    optional int64 end_realtime_millis = 2;
6118
6119    // CPU uptime at start of report.
6120    optional int64 start_uptime_millis = 3;
6121
6122    // CPU uptime at end of report.
6123    optional int64 end_uptime_millis = 4;
6124
6125    // System runtime library. e.g. "libdvm.so", "libart.so".
6126    optional string runtime = 5;
6127
6128    // whether kernel reports swapped pss.
6129    optional bool has_swapped_pss = 6;
6130
6131    // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
6132    enum Status {
6133        STATUS_UNKNOWN = 0;
6134        STATUS_COMPLETE = 1;
6135        STATUS_PARTIAL = 2;
6136        STATUS_SHUTDOWN = 3;
6137        STATUS_SYSPROPS = 4;
6138    }
6139    repeated Status status = 7;
6140
6141    // Number of pages available of various types and sizes, representation fragmentation.
6142    repeated ProcessStatsAvailablePagesProto available_pages = 10;
6143
6144    // Stats for each process.
6145    repeated ProcessStatsProto process_stats = 8;
6146
6147    // Stats for each package.
6148    repeated ProcessStatsPackageProto package_stats = 9;
6149}
6150
6151message ProcessStatsAvailablePagesProto {
6152    // Node these pages are in (as per /proc/pagetypeinfo)
6153    optional int32 node = 1;
6154
6155    // Zone these pages are in (as per /proc/pagetypeinfo)
6156    optional string zone = 2;
6157
6158    // Label for the type of these pages (as per /proc/pagetypeinfo)
6159    optional string label = 3;
6160
6161    // Distribution of number of pages available by order size.  First entry in array is
6162    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
6163    repeated int32 pages_per_order = 4;
6164}
6165
6166/**
6167 * Pulled from ProcessStatsService.java
6168 */
6169message ProcStats {
6170    optional ProcessStatsSectionProto proc_stats_section = 1;
6171    // Data pulled from device into this is sometimes sharded across multiple atoms to work around
6172    // a size limit. When this happens, this shard ID will contain an increasing 1-indexed integer
6173    // with the number of this shard.
6174    optional int32 shard_id = 2;
6175}
6176
6177/**
6178 * Pulled from ProcessStatsService.java
6179 */
6180message ProcStatsPkgProc {
6181    optional ProcessStatsSectionProto proc_stats_section = 1;
6182}
6183
6184// Next Tag: 2
6185message PackageRemoteViewInfoProto {
6186    optional string package_name = 1;
6187    // add per-package additional info here (like channels)
6188}
6189
6190// Next Tag: 2
6191message NotificationRemoteViewsProto {
6192    repeated PackageRemoteViewInfoProto package_remote_view_info = 1;
6193}
6194
6195/**
6196 * Pulled from NotificationManagerService.java
6197 */
6198message NotificationRemoteViews {
6199    optional NotificationRemoteViewsProto notification_remote_views = 1;
6200}
6201
6202/**
6203 * Atom that contains a list of a package's preferences, pulled from NotificationManagerService.java
6204 */
6205message PackageNotificationPreferences {
6206    // Uid under which the package is installed.
6207    optional int32 uid = 1 [(is_uid) = true];
6208    // Notification importance, which specifies when and how a notification is displayed.
6209    // Specified under core/java/android/app/NotificationManager.java.
6210    optional int32 importance = 2;
6211    // Lockscreen visibility as set by the user.
6212    optional int32 visibility = 3;
6213    // Bitfield mask indicating what fields were locked by the user (see LockableAppfields in
6214    // PreferencesHelper.java)
6215    optional int32 user_locked_fields = 4;
6216}
6217
6218/**
6219 * Atom that contains a list of a package's channel preferences, pulled from
6220 * NotificationManagerService.java.
6221 */
6222message PackageNotificationChannelPreferences {
6223    // Uid under which the package is installed.
6224    optional int32 uid = 1 [(is_uid) = true];
6225    // Channel's ID. Should always be available.
6226    optional string channel_id = 2;
6227    // Channel's name. Should always be available.
6228    optional string channel_name = 3;
6229    // Channel's description. Optionally set by the channel creator.
6230    optional string description = 4;
6231    // Notification importance, which specifies when and how a notification is displayed. Specified
6232    // under core/java/android/app/NotificationManager.java.
6233    optional int32 importance = 5;
6234    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
6235    // at core/java/android/app/NotificationChannel.java
6236    optional int32 user_locked_fields = 6;
6237    // Indicates if the channel was deleted by the app.
6238    optional bool is_deleted = 7;
6239    // Indicates if the channel was marked as a conversation by the app.
6240    optional bool is_conversation = 8;
6241    // Indicates if the channel is a conversation that was demoted by the user.
6242    optional bool is_demoted_conversation = 9;
6243    // Indicates if the channel is a conversation that was marked as important by the user.
6244    optional bool is_important_conversation = 10;
6245}
6246
6247/**
6248 * Atom that represents an item in the list of Do Not Disturb rules, pulled from
6249 * NotificationManagerService.java.
6250 */
6251message DNDModeProto {
6252    enum Mode {
6253        ROOT_CONFIG = -1;  // Used to distinguish the config (one per user) from the rules.
6254        ZEN_MODE_OFF = 0;
6255        ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
6256        ZEN_MODE_NO_INTERRUPTIONS = 2;
6257        ZEN_MODE_ALARMS = 3;
6258    }
6259    optional int32 user = 1;  // Android user ID (0, 1, 10, ...)
6260    optional bool enabled = 2;  // true for ROOT_CONFIG if a manualRule is enabled
6261    optional bool channels_bypassing = 3; // only valid for ROOT_CONFIG
6262    optional Mode zen_mode = 4;
6263    // id is one of the system default rule IDs, or empty
6264    // May also be "MANUAL_RULE" to indicate app-activation of the manual rule.
6265    optional string id = 5;
6266    optional int32 uid = 6 [(is_uid) = true]; // currently only SYSTEM_UID or 0 for other
6267    optional DNDPolicyProto policy = 7;
6268}
6269
6270/**
6271 * Atom that represents a Do Not Disturb policy, an optional detail proto for DNDModeProto.
6272 */
6273message DNDPolicyProto {
6274    enum State {
6275        STATE_UNSET = 0;
6276        STATE_ALLOW = 1;
6277        STATE_DISALLOW = 2;
6278    }
6279    optional State calls = 1;
6280    optional State repeat_callers = 2;
6281    optional State messages = 3;
6282    optional State conversations = 4;
6283    optional State reminders = 5;
6284    optional State events = 6;
6285    optional State alarms = 7;
6286    optional State media = 8;
6287    optional State system = 9;
6288    optional State fullscreen = 10;
6289    optional State lights = 11;
6290    optional State peek = 12;
6291    optional State status_bar = 13;
6292    optional State badge = 14;
6293    optional State ambient = 15;
6294    optional State notification_list = 16;
6295
6296    enum PeopleType {
6297        PEOPLE_UNSET = 0;
6298        PEOPLE_ANYONE = 1;
6299        PEOPLE_CONTACTS = 2;
6300        PEOPLE_STARRED = 3;
6301        PEOPLE_NONE = 4;
6302    }
6303
6304    optional PeopleType allow_calls_from = 17;
6305    optional PeopleType allow_messages_from = 18;
6306
6307    enum ConversationType {
6308        CONV_UNSET = 0;
6309        CONV_ANYONE = 1;
6310        CONV_IMPORTANT = 2;
6311        CONV_NONE = 3;
6312    }
6313
6314    optional ConversationType allow_conversations_from = 19;
6315}
6316
6317/**
6318 * Atom that contains a list of a package's channel group preferences, pulled from
6319 * NotificationManagerService.java.
6320 */
6321message PackageNotificationChannelGroupPreferences {
6322    // Uid under which the package is installed.
6323    optional int32 uid = 1 [(is_uid) = true];
6324    // Channel Group's ID. Should always be available.
6325    optional string group_id = 2;
6326    // Channel Group's name. Should always be available.
6327    optional string group_name = 3;
6328    // Channel Group's description. Optionally set by group creator.
6329    optional string description = 4;
6330    // Indicates if notifications from this channel group are blocked.
6331    optional bool is_blocked = 5;
6332    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
6333    // at core/java/android/app/NotificationChannelGroup.java
6334    optional int32 user_locked_fields = 6;
6335}
6336
6337message PowerProfileProto {
6338    optional double cpu_suspend = 1;
6339
6340    optional double cpu_idle = 2;
6341
6342    optional double cpu_active = 3;
6343
6344    message CpuCluster {
6345        optional int32 id = 1;
6346        optional double cluster_power = 2;
6347        optional int32 cores = 3;
6348        repeated int64 speed = 4;
6349        repeated double core_power = 5;
6350    }
6351
6352    repeated CpuCluster cpu_cluster = 40;
6353
6354    optional double wifi_scan = 4;
6355
6356    optional double wifi_on = 5;
6357
6358    optional double wifi_active = 6;
6359
6360    optional double wifi_controller_idle = 7;
6361
6362    optional double wifi_controller_rx = 8;
6363
6364    optional double wifi_controller_tx = 9;
6365
6366    repeated double wifi_controller_tx_levels = 10;
6367
6368    optional double wifi_controller_operating_voltage = 11;
6369
6370    optional double bluetooth_controller_idle = 12;
6371
6372    optional double bluetooth_controller_rx = 13;
6373
6374    optional double bluetooth_controller_tx = 14;
6375
6376    optional double bluetooth_controller_operating_voltage = 15;
6377
6378    optional double modem_controller_sleep = 16;
6379
6380    optional double modem_controller_idle = 17;
6381
6382    optional double modem_controller_rx = 18;
6383
6384    repeated double modem_controller_tx = 19;
6385
6386    optional double modem_controller_operating_voltage = 20;
6387
6388    optional double gps_on = 21;
6389
6390    repeated double gps_signal_quality_based = 22;
6391
6392    optional double gps_operating_voltage = 23;
6393
6394    optional double bluetooth_on = 24;
6395
6396    optional double bluetooth_active = 25;
6397
6398    optional double bluetooth_at_cmd = 26;
6399
6400    optional double ambient_display = 27;
6401
6402    optional double screen_on = 28;
6403
6404    optional double radio_on = 29;
6405
6406    optional double radio_scanning = 30;
6407
6408    optional double radio_active = 31;
6409
6410    optional double screen_full = 32;
6411
6412    optional double audio = 33;
6413
6414    optional double video = 34;
6415
6416    optional double flashlight = 35;
6417
6418    optional double memory = 36;
6419
6420    optional double camera = 37;
6421
6422    optional double wifi_batched_scan = 38;
6423
6424    optional double battery_capacity = 39;
6425}
6426
6427/**
6428 * power_profile.xml and other constants for power model calculations.
6429 * Pulled from PowerProfile.java
6430 */
6431message PowerProfile {
6432    optional PowerProfileProto power_profile = 1;
6433}
6434
6435/**
6436 * Logs when a user restriction was added or removed.
6437 *
6438 * Logged from:
6439 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
6440 */
6441message UserRestrictionChanged {
6442    // The raw string of the user restriction as defined in UserManager.
6443    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
6444    optional string restriction = 1;
6445    // Whether the restriction is enabled or disabled.
6446    optional bool enabled = 2;
6447}
6448
6449/**
6450 * Pulls process user time and system time. Puller takes a snapshot of all pids
6451 * in the system and returns cpu stats for those that are working at the time.
6452 * Dead pids will be dropped. Kernel processes are excluded.
6453 * Min cool-down is 5 sec.
6454 */
6455message ProcessCpuTime {
6456    optional int32 uid = 1 [(is_uid) = true];
6457
6458    optional string process_name = 2;
6459    // Process cpu time in user space, cumulative from boot/process start
6460    optional int64 user_time_millis = 3;
6461    // Process cpu time in system space, cumulative from boot/process start
6462    optional int64 system_time_millis = 4;
6463}
6464
6465/**
6466 * Pulls the CPU usage for each thread.
6467 *
6468 * Read from /proc/$PID/task/$TID/time_in_state files.
6469 *
6470 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
6471 * time_in_state files not being present on some phones, have not been addressed. These should be
6472 * considered before a public release.
6473 */
6474message CpuTimePerThreadFreq {
6475    // UID that owns the process.
6476    optional int32 uid = 1 [(is_uid) = true];
6477    // ID of the process.
6478    optional int32 process_id = 2;
6479    // ID of the thread.
6480    optional int32 thread_id = 3;
6481    // Name of the process taken from `/proc/$PID/cmdline`.
6482    optional string process_name = 4;
6483    // Name of the thread taken from `/proc/$PID/task/$TID/comm`
6484    optional string thread_name = 5;
6485
6486    // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
6487    // are given in KHz, and time is given in milliseconds since the thread started. All eight
6488    // frequencies are given here as the alternative is sending eight separate atoms. This method
6489    // significantly reduces the amount of data created
6490    optional int32 frequency1_khz = 6;
6491    optional int32 time1_millis = 7;
6492    optional int32 frequency2_khz = 8;
6493    optional int32 time2_millis = 9;
6494    optional int32 frequency3_khz = 10;
6495    optional int32 time3_millis = 11;
6496    optional int32 frequency4_khz = 12;
6497    optional int32 time4_millis = 13;
6498    optional int32 frequency5_khz = 14;
6499    optional int32 time5_millis = 15;
6500    optional int32 frequency6_khz = 16;
6501    optional int32 time6_millis = 17;
6502    optional int32 frequency7_khz = 18;
6503    optional int32 time7_millis = 19;
6504    optional int32 frequency8_khz = 20;
6505    optional int32 time8_millis = 21;
6506}
6507
6508/**
6509 * Pulls information about the device's build.
6510 */
6511message BuildInformation {
6512    // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
6513    // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
6514    optional string fingerprint = 1;
6515
6516    // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
6517    optional string brand = 2;
6518
6519    // Build.PRODUCT. The name of the overall product.
6520    optional string product = 3;
6521
6522    // Build.DEVICE. The name of the industrial design.
6523    optional string device = 4;
6524
6525    // Build.VERSION.RELEASE. The user-visible version string.  E.g., "1.0" or "3.4b5" or "bananas".
6526    optional string version_release = 5;
6527
6528    // Build.ID. E.g. a label like "M4-rc20".
6529    optional string id = 6;
6530
6531    // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
6532    // represent this build.
6533    optional string version_incremental = 7;
6534
6535    // Build.TYPE. The type of build, like "user" or "eng".
6536    optional string type = 8;
6537
6538    // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
6539    optional string tags = 9;
6540}
6541
6542/**
6543 * Logs information about mismatched caller for content capture.
6544 *
6545 * Logged from:
6546 *   frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java
6547 */
6548message ContentCaptureCallerMismatchReported {
6549    optional string intended_package = 1;
6550    optional string calling_package = 2;
6551}
6552
6553/**
6554 * Logs information about content capture service events.
6555 *
6556 * Logged from:
6557 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
6558 */
6559message ContentCaptureServiceEvents {
6560    // The type of event.
6561    enum Event {
6562        UNKNOWN = 0;
6563        ON_CONNECTED = 1;
6564        ON_DISCONNECTED = 2;
6565        SET_WHITELIST = 3;
6566        SET_DISABLED = 4;
6567        ON_USER_DATA_REMOVED = 5;
6568        ON_DATA_SHARE_REQUEST = 6;
6569        ACCEPT_DATA_SHARE_REQUEST = 7;
6570        REJECT_DATA_SHARE_REQUEST = 8;
6571        DATA_SHARE_WRITE_FINISHED = 9;
6572        DATA_SHARE_ERROR_IOEXCEPTION = 10;
6573        DATA_SHARE_ERROR_EMPTY_DATA = 11;
6574        DATA_SHARE_ERROR_CLIENT_PIPE_FAIL = 12;
6575        DATA_SHARE_ERROR_SERVICE_PIPE_FAIL = 13;
6576        DATA_SHARE_ERROR_CONCURRENT_REQUEST = 14;
6577        DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED = 15;
6578    }
6579    optional Event event = 1;
6580    // component/package of content capture service.
6581    optional string service_info = 2;
6582    // component/package of target.
6583    // it's a concatenated list of component/package for SET_WHITELIST event
6584    // separated by " ".
6585    optional string target_info = 3;
6586}
6587
6588/**
6589 * Logs information about content capture session events.
6590 *
6591 * Logged from:
6592 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
6593 */
6594message ContentCaptureSessionEvents {
6595    // The type of event.
6596    enum Event {
6597        UNKNOWN = 0;
6598        ON_SESSION_STARTED = 1;
6599        ON_SESSION_FINISHED = 2;
6600        SESSION_NOT_CREATED = 3;
6601    }
6602    optional int32 session_id = 1;
6603    optional Event event = 2;
6604    // (n/a on session finished)
6605    optional int32 state_flags = 3;
6606    // component/package of content capture service.
6607    optional string service_info = 4;
6608    // component/package of app.
6609    // (n/a on session finished)
6610    optional string app_info = 5;
6611    optional bool is_child_session = 6;
6612}
6613
6614/**
6615 * Logs information about session being flushed.
6616 *
6617 * Logged from:
6618 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
6619 */
6620message ContentCaptureFlushed {
6621    optional int32 session_id = 1;
6622    // component/package of content capture service.
6623    optional string service_info = 2;
6624    // component/package of app.
6625    optional string app_info = 3;
6626    // session start/finish events
6627    optional int32 child_session_started = 4;
6628    optional int32 child_session_finished = 5;
6629    // count of view events.
6630    optional int32 view_appeared_count = 6;
6631    optional int32 view_disappeared_count = 7;
6632    optional int32 view_text_changed_count = 8;
6633
6634    // Flush stats.
6635    optional int32 max_events = 9;
6636    optional int32 idle_flush_freq = 10;
6637    optional int32 text_flush_freq = 11;
6638    optional int32 flush_reason = 12;
6639}
6640
6641/**
6642 * Pulls on-device BatteryStats power use calculations for the overall device.
6643 */
6644message DeviceCalculatedPowerUse {
6645    // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
6646    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
6647    // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
6648    optional int64 computed_power_nano_amp_secs = 1;
6649}
6650
6651/**
6652 * Pulls on-device BatteryStats power use calculations broken down by uid.
6653 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
6654 * that is attributed to non-uid items. They must all be included to get the total power use.
6655 */
6656message DeviceCalculatedPowerBlameUid {
6657    // Uid being blamed. Note: isolated uids have already been mapped to host uid.
6658    optional int32 uid = 1 [(is_uid) = true];
6659
6660    // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
6661    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
6662    optional int64 power_nano_amp_secs = 2;
6663}
6664
6665/**
6666 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
6667 * drain type.
6668 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
6669 * is attributed uids. They must all be included to get the total power use.
6670 */
6671message DeviceCalculatedPowerBlameOther {
6672    // The type of item whose power use is being reported.
6673    enum DrainType {
6674        AMBIENT_DISPLAY = 0;
6675        // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
6676        BLUETOOTH = 2;
6677        CAMERA = 3;
6678        // Cell-standby
6679        CELL = 4;
6680        FLASHLIGHT = 5;
6681        IDLE = 6;
6682        MEMORY = 7;
6683        // Amount that total computed drain exceeded the drain estimated using the
6684        // battery level changes and capacity.
6685        OVERCOUNTED = 8;
6686        PHONE = 9;
6687        SCREEN = 10;
6688        // Amount that total computed drain was below the drain estimated using the
6689        // battery level changes and capacity.
6690        UNACCOUNTED = 11;
6691        // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
6692        WIFI = 13;
6693    }
6694    optional DrainType drain_type = 1;
6695
6696    // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
6697    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
6698    optional int64 power_nano_amp_secs = 2;
6699}
6700
6701/**
6702 * Logs device policy features.
6703 *
6704 * Logged from:
6705 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
6706 *   packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
6707 */
6708message DevicePolicyEvent {
6709    // The event id - unique for each event.
6710    optional android.stats.devicepolicy.EventId event_id = 1;
6711    // The admin package name.
6712    optional string admin_package_name = 2;
6713    // A generic integer parameter.
6714    optional int32 integer_value = 3;
6715    // A generic boolean parameter.
6716    optional bool boolean_value = 4;
6717    // A parameter specifying a time period in milliseconds.
6718    optional uint64 time_period_millis = 5;
6719    // A parameter specifying a list of package names, bundle extras or string parameters.
6720    optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
6721}
6722
6723/**
6724 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
6725 *
6726 * Logged from:
6727 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6728 */
6729message DocsUILaunchReported {
6730    optional android.stats.docsui.LaunchAction launch_action = 1;
6731    optional bool has_initial_uri = 2;
6732    optional android.stats.docsui.MimeType mime_type = 3;
6733    optional android.stats.docsui.Root initial_root = 4;
6734}
6735
6736/**
6737 * Logs root/app visited event in file managers/picker. Call this when the user
6738 * taps on root/app in hamburger menu.
6739 *
6740 * Logged from:
6741 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6742 */
6743message DocsUIRootVisitedReported {
6744    optional android.stats.docsui.ContextScope scope = 1;
6745    optional android.stats.docsui.Root root = 2;
6746}
6747
6748/**
6749 * Logs file operation stats. Call this when a file operation has completed.
6750 *
6751 * Logged from:
6752 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6753 */
6754message DocsUIFileOperationReported {
6755    optional android.stats.docsui.Provider provider = 1;
6756    optional android.stats.docsui.FileOperation file_op = 2;
6757}
6758
6759/**
6760 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
6761 * mode.
6762 *
6763 * Logged from:
6764 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6765 */
6766message DocsUIFileOperationCopyMoveModeReported {
6767    optional android.stats.docsui.FileOperation file_op = 1;
6768    optional android.stats.docsui.CopyMoveOpMode mode = 2;
6769}
6770
6771
6772/**
6773 * Logs file sub operation stats. Call this when a file operation has failed.
6774 *
6775 * Logged from:
6776 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6777 */
6778message DocsUIFileOperationFailureReported {
6779    optional android.stats.docsui.Authority authority = 1;
6780    optional android.stats.docsui.SubFileOperation sub_op = 2;
6781}
6782
6783/**
6784* Logs the cancellation of a file operation. Call this when a job is canceled
6785*
6786* Logged from:
6787*     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6788*/
6789message DocsUIFileOperationCanceledReported {
6790    optional android.stats.docsui.FileOperation file_op = 1;
6791}
6792
6793/**
6794 * Logs startup time in milliseconds.
6795 *
6796 * Logged from:
6797 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6798 */
6799message DocsUIStartupMsReported {
6800    optional int32 startup_millis = 1;
6801}
6802
6803/**
6804 * Logs the action that was started by user.
6805 *
6806 * Logged from:
6807 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6808 */
6809message DocsUIUserActionReported {
6810    optional android.stats.docsui.UserAction action = 1;
6811}
6812
6813/**
6814 * Logs the invalid type when invalid scoped access is requested.
6815 *
6816 * Logged from:
6817 *     package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
6818 */
6819message DocsUIInvalidScopedAccessRequestReported {
6820    optional android.stats.docsui.InvalidScopedAccess type = 1;
6821}
6822
6823/**
6824 * Logs the package name that launches docsui picker mode.
6825 *
6826 * Logged from:
6827 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6828 */
6829message DocsUIPickerLaunchedFromReported {
6830    optional string package_name = 1;
6831}
6832
6833/**
6834 * Logs the search type.
6835 *
6836 * Logged from:
6837 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6838 */
6839message DocsUISearchTypeReported {
6840    optional android.stats.docsui.SearchType search_type = 1;
6841}
6842
6843/**
6844 * Logs the search mode.
6845 *
6846 * Logged from:
6847 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6848 */
6849message DocsUISearchModeReported {
6850    optional android.stats.docsui.SearchMode search_mode = 1;
6851}
6852
6853/**
6854 * Logs the pick result information.
6855 *
6856 * Logged from:
6857 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6858 */
6859message DocsUIPickResultReported {
6860    optional int32 total_action_count = 1;
6861    optional int64 duration_millis = 2;
6862    optional int32 file_count= 3;
6863    optional bool is_searching = 4;
6864    optional android.stats.docsui.Root picked_from = 5;
6865    optional android.stats.docsui.MimeType mime_type = 6;
6866    optional int32 repeatedly_pick_times = 7;
6867}
6868
6869/** Logs the drag and drop of files.
6870
6871 * Logged from:
6872 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
6873 */
6874message DocsUIDragAndDropReported {
6875    optional bool drag_initiated_from_docsui = 1;
6876}
6877
6878/**
6879 * Logs when an app's memory is compacted.
6880 *
6881 * Logged from:
6882 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6883 */
6884message AppCompacted {
6885  // The pid of the process being compacted.
6886  optional int32 pid = 1;
6887
6888  // The name of the process being compacted.
6889  optional string process_name = 2;
6890
6891  // The type of compaction.
6892  enum Action {
6893    UNKNOWN = 0;
6894    SOME = 1;
6895    FULL = 2;
6896    PERSISTENT = 3;
6897    BFGS = 4;
6898  }
6899  optional Action action = 3;
6900
6901  // Total RSS in kilobytes consumed by the process prior to compaction.
6902  optional int64 before_rss_total_kilobytes = 4;
6903
6904  // File RSS in kilobytes consumed by the process prior to compaction.
6905  optional int64 before_rss_file_kilobytes = 5;
6906
6907  // Anonymous RSS in kilobytes consumed by the process prior to compaction.
6908  optional int64 before_rss_anon_kilobytes = 6;
6909
6910  // Swap in kilobytes consumed by the process prior to compaction.
6911  optional int64 before_swap_kilobytes = 7;
6912
6913  // Total RSS in kilobytes consumed by the process after compaction.
6914  optional int64 after_rss_total_kilobytes = 8;
6915
6916  // File RSS in kilobytes consumed by the process after compaction.
6917  optional int64 after_rss_file_kilobytes = 9;
6918
6919  // Anonymous RSS in kilobytes consumed by the process after compaction.
6920  optional int64 after_rss_anon_kilobytes = 10;
6921
6922  // Swap in kilobytes consumed by the process after compaction.
6923  optional int64 after_swap_kilobytes = 11;
6924
6925  // The time taken to perform compaction in milliseconds.
6926  optional int64 time_to_compact_millis = 12;
6927
6928  // The last compaction action performed for this app.
6929  optional Action last_action = 13;
6930
6931  // The last time that compaction was attempted on this process in milliseconds
6932  // since boot, not including sleep (see SystemClock.uptimeMillis()).
6933  optional int64 last_compact_timestamp_ms_since_boot = 14;
6934
6935  // The "setAdj" (i.e. previous) oom_score_adj at the time of compaction.
6936  optional int32 oom_score_adj = 15;
6937
6938  // The process state at the time of compaction.
6939  optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
6940
6941  // Free ZRAM in kilobytes before compaction.
6942  optional int64 before_zram_free_kilobytes = 17;
6943
6944  // Free ZRAM in kilobytes after compaction.
6945  optional int64 after_zram_free_kilobytes = 18;
6946}
6947
6948/**
6949 * Logs when a Tethering event occurs.
6950 *
6951 */
6952message NetworkTetheringReported {
6953  // tethering error code
6954  optional android.stats.connectivity.ErrorCode error_code = 1;
6955
6956  // tethering downstream type
6957  optional android.stats.connectivity.DownstreamType downstream_type = 2;
6958
6959  // transport type of upstream network
6960  optional android.stats.connectivity.UpstreamType upstream_type = 3;
6961
6962  // The user type of Tethering
6963  optional android.stats.connectivity.UserType user_type= 4;
6964}
6965
6966/**
6967 * Logs a DNS lookup operation initiated by the system resolver on behalf of an application
6968 * invoking native APIs such as getaddrinfo() or Java APIs such as Network#getAllByName().
6969 *
6970 * The NetworkDnsEventReported message represents the entire lookup operation, which may
6971 * result one or more queries to the recursive DNS resolvers. Those are individually logged
6972 * in DnsQueryEvents to enable computing error rates and network latency and timeouts
6973 * broken up by query type, transport, network interface, etc.
6974 */
6975message NetworkDnsEventReported {
6976    optional android.stats.dnsresolver.EventType event_type = 1;
6977
6978    optional android.stats.dnsresolver.ReturnCode return_code = 2;
6979
6980    // The latency in microseconds of the entire DNS lookup operation.
6981    optional int32 latency_micros = 3;
6982
6983    // Only valid for event_type = EVENT_GETADDRINFO.
6984    optional int32 hints_ai_flags = 4;
6985
6986    // Flags passed to android_res_nsend() defined in multinetwork.h
6987    // Only valid for event_type = EVENT_RESNSEND.
6988    optional int32 res_nsend_flags = 5;
6989
6990    optional android.stats.dnsresolver.NetworkType network_type = 6;
6991
6992    // The DNS over TLS mode on a specific netId.
6993    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7;
6994
6995    // Additional pass-through fields opaque to statsd.
6996    // The DNS resolver Mainline module can add new fields here without requiring an OS update.
6997    optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES];
6998
6999    // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom.
7000    optional int32 sampling_rate_denom = 9;
7001}
7002
7003/**
7004 * logs the CapportApiData info
7005 * Logged from:
7006 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
7007 */
7008message CapportApiData {
7009    // The TTL of the network connection provided by captive portal
7010    optional int32 remaining_ttl_secs = 1;
7011
7012    // The limit traffic data of the network connection provided by captive portal
7013    optional int32 remaining_bytes = 2;
7014
7015    // Is portal url option included in the DHCP packet (Yes, No)
7016    optional bool has_portal_url = 3;
7017
7018    // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
7019    optional bool has_venue_info = 4;
7020}
7021
7022/**
7023 * logs a network Probe Event
7024 * Logged from:
7025 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
7026 */
7027message ProbeEvent {
7028    // The probe type (http or https, or captive portal API...)
7029    optional android.stats.connectivity.ProbeType probe_type = 1;
7030
7031    // The latency in microseconds of the probe event
7032    optional int32 latency_micros = 2;
7033
7034    // The result of the probe event
7035    optional android.stats.connectivity.ProbeResult probe_result = 3;
7036
7037    // The CaptivePortal API info
7038    optional CapportApiData capport_api_data = 4;
7039}
7040
7041/**
7042 * log each ProbeEvent in ProbeEvents
7043 * Logged from:
7044 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
7045 */
7046message ProbeEvents {
7047    // Record probe event during the validation
7048    repeated ProbeEvent probe_event = 1;
7049}
7050
7051/**
7052 * The DHCP (Dynamic Host Configuration Protocol) session info
7053 * Logged from:
7054 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
7055 */
7056message DhcpSession {
7057    // The DHCP Feature(s) enabled in this session
7058    repeated android.stats.connectivity.DhcpFeature used_features = 1;
7059
7060    // The discover packet (re)transmit count
7061    optional int32 discover_count = 2;
7062
7063    // The request packet (re)transmit count
7064    optional int32 request_count = 3;
7065
7066    // The IPv4 address conflict count
7067    // (only be meaningful when duplicate address detection is enabled)
7068    optional int32 conflict_count = 4;
7069
7070    // The DHCP packet parsing error code in this session
7071    // (defined in android.net.metrics.DhcpErrorEvent)
7072    repeated android.stats.connectivity.DhcpErrorCode error_code = 5;
7073
7074    // The result of DHCP hostname transliteration
7075    optional android.stats.connectivity.HostnameTransResult ht_result = 6;
7076}
7077
7078/**
7079 * Logs Network IP provisioning event
7080 * Logged from:
7081 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
7082 */
7083message NetworkIpProvisioningReported {
7084    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
7085    optional android.stats.connectivity.TransportType transport_type = 1;
7086
7087    // The latency in microseconds of IP Provisioning over IPV4
7088    optional int32 ipv4_latency_micros = 2;
7089
7090    // The latency in microseconds of IP Provisioning over IPV6
7091    optional int32 ipv6_latency_micros = 3;
7092
7093    // The time duration between provisioning start and end (success or failure)
7094    optional int64 provisioning_duration_micros = 4;
7095
7096    // The specific disconnect reason for this IP provisioning
7097    optional android.stats.connectivity.DisconnectCode disconnect_code = 5;
7098
7099    // Log DHCP session info (Only valid for IPv4)
7100    optional DhcpSession dhcp_session = 6 [(log_mode) = MODE_BYTES];
7101
7102    // The random number between 0 ~ 999 for sampling
7103    optional int32 random_number = 7;
7104}
7105
7106/**
7107 * Logs Network DHCP Renew event
7108 * Logged from:
7109 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
7110 */
7111message NetworkDhcpRenewReported {
7112    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
7113    optional android.stats.connectivity.TransportType transport_type = 1;
7114
7115    // The request packet (re)transmit count
7116    optional int32 request_count = 2;
7117
7118    // The latency in microseconds of DHCP Renew
7119    optional int32 latency_micros = 3;
7120
7121    // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
7122    optional android.stats.connectivity.DhcpErrorCode error_code = 4;
7123
7124    // The result of DHCP renew
7125    optional android.stats.connectivity.DhcpRenewResult renew_result = 5;
7126
7127    // The random number between 0 ~ 999 for sampling
7128    optional int32 random_number = 6;
7129}
7130
7131/**
7132 * Logs Network Validation event
7133 * Logged from:
7134 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
7135 */
7136message NetworkValidationReported {
7137    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
7138    optional android.stats.connectivity.TransportType transport_type = 1;
7139
7140    // Record each probe event
7141    optional ProbeEvents probe_events = 2 [(log_mode) = MODE_BYTES];
7142
7143    // The result of the network validation
7144    optional android.stats.connectivity.ValidationResult validation_result = 3;
7145
7146    // The latency in microseconds of network validation
7147    optional int32 latency_micros = 4;
7148
7149    // The validation index (the first validation attempt or second, third...)
7150    optional int32 validation_index = 5;
7151
7152    // The random number between 0 ~ 999 for sampling
7153    optional int32 random_number = 6;
7154}
7155
7156/**
7157 * Logs NetworkStack Quirk event
7158 * Logged from:
7159 * packages/modules/NetworkStack/src/com/android/networkstack/
7160 */
7161message NetworkStackQuirkReported {
7162    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
7163    optional android.stats.connectivity.TransportType transport_type = 1;
7164
7165    // Record each Quirk event
7166    optional android.stats.connectivity.NetworkQuirkEvent event = 2;
7167}
7168
7169/**
7170 * Logs when a data stall event occurs.
7171 *
7172 * Log from:
7173 *     packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
7174 */
7175message DataStallEvent {
7176    // Data stall evaluation type.
7177    // See packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
7178    // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
7179    optional int32 evaluation_type = 1;
7180    // See definition in data_stall_event.proto.
7181    optional com.android.server.connectivity.ProbeResult validation_result = 2;
7182    // See definition in data_stall_event.proto.
7183    optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
7184    // See definition in data_stall_event.proto.
7185    optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
7186    // See definition in data_stall_event.proto.
7187    optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
7188    // See definition in data_stall_event.proto.
7189    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
7190    // The tcp packets fail rate from the latest tcp polling.
7191    optional int32 tcp_fail_rate = 7;
7192    // Number of packets sent since the last received packet.
7193    optional int32 tcp_sent_since_last_recv = 8;
7194}
7195
7196/*
7197 * Logs when RescueParty resets some set of experiment flags.
7198 *
7199 * Logged from:
7200 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
7201 */
7202message RescuePartyResetReported {
7203    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
7204    optional int32 rescue_level = 1;
7205}
7206
7207/**
7208 * Logs when signed config is received from an APK, and if that config was applied successfully.
7209 * Logged from:
7210 *   frameworks/base/services/core/java/com/android/server/signedconfig/SignedConfigService.java
7211 */
7212message SignedConfigReported {
7213    enum Type {
7214        UNKNOWN_TYPE = 0;
7215        GLOBAL_SETTINGS = 1;
7216    }
7217    optional Type type = 1;
7218
7219    // The final status of the signed config received.
7220    enum Status {
7221        UNKNOWN_STATUS = 0;
7222        APPLIED = 1;
7223        BASE64_FAILURE_CONFIG = 2;
7224        BASE64_FAILURE_SIGNATURE = 3;
7225        SECURITY_EXCEPTION = 4;
7226        INVALID_CONFIG = 5;
7227        OLD_CONFIG = 6;
7228        SIGNATURE_CHECK_FAILED = 7;
7229        NOT_APPLICABLE = 8;
7230        SIGNATURE_CHECK_FAILED_PROD_KEY_ABSENT = 9;
7231    }
7232    optional Status status = 2;
7233
7234    // The version of the signed config processed.
7235    optional int32 version = 3;
7236
7237    // The package name that the config was extracted from.
7238    optional string from_package = 4;
7239
7240    enum Key {
7241        NO_KEY = 0;
7242        DEBUG = 1;
7243        PRODUCTION = 2;
7244    }
7245    // Which key was used to verify the config.
7246    optional Key verified_with = 5;
7247}
7248
7249/*
7250 * Logs GNSS Network-Initiated (NI) location events.
7251 *
7252 * Logged from:
7253 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
7254 */
7255message GnssNiEventReported {
7256    // The type of GnssNiEvent.
7257    enum EventType {
7258        UNKNOWN = 0;
7259        NI_REQUEST = 1;
7260        NI_RESPONSE = 2;
7261    }
7262    optional EventType event_type = 1;
7263
7264    // An ID generated by HAL to associate NI notifications and UI responses.
7265    optional int32 notification_id = 2;
7266
7267    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
7268    optional android.server.location.GnssNiType ni_type = 3;
7269
7270    // NI requires notification.
7271    optional bool need_notify = 4;
7272
7273    // NI requires verification.
7274    optional bool need_verify = 5;
7275
7276    // NI requires privacy override, no notification/minimal trace.
7277    optional bool privacy_override = 6;
7278
7279    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
7280    // seconds.
7281    optional int32 timeout = 7;
7282
7283    // Default response when timeout.
7284    optional android.server.location.GnssUserResponseType default_response = 8;
7285
7286    // String representing the requester of the network inititated location request.
7287    optional string requestor_id = 9;
7288
7289    // Notification message text string representing the service(for eg. SUPL-service) who sent the
7290    // network initiated location request.
7291    optional string text = 10;
7292
7293    // requestorId decoding scheme.
7294    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;
7295
7296    // Notification message text decoding scheme.
7297    optional android.server.location.GnssNiEncodingType text_encoding = 12;
7298
7299    // True if SUPL ES is enabled.
7300    optional bool is_supl_es_enabled = 13;
7301
7302    // True if GNSS location is enabled.
7303    optional bool is_location_enabled = 14;
7304
7305    // GNSS NI responses which define the response in NI structures.
7306    optional android.server.location.GnssUserResponseType user_response = 15;
7307}
7308
7309/**
7310 * Logs GNSS non-framework (NFW) location notification.
7311 *
7312 * Logged from:
7313 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
7314 */
7315message GnssNfwNotificationReported {
7316    // Package name of the Android proxy application representing the non-framework entity that
7317    // requested location. Set to empty string if unknown.
7318    optional string proxy_app_package_name = 1;
7319
7320    // Protocol stack that initiated the non-framework location request.
7321    optional android.server.location.NfwProtocolStack protocol_stack = 2;
7322
7323    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
7324    // set to empty string. This field is opaque to the framework and used for logging purposes.
7325    optional string other_protocol_stack_name = 3;
7326
7327    // Source initiating/receiving the location information.
7328    optional android.server.location.NfwRequestor requestor = 4;
7329
7330    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
7331    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
7332    // and used for logging purposes.
7333    optional string requestor_id = 5;
7334
7335    // Indicates whether location information was provided for this request.
7336    optional android.server.location.NfwResponseType response_type = 6;
7337
7338    // True if the device is in user initiated emergency session.
7339    optional bool in_emergency_mode = 7;
7340
7341    // True if cached location is provided.
7342    optional bool is_cached_location = 8;
7343
7344    // True if proxy app permission mismatch between framework and GNSS HAL.
7345    optional bool is_permission_mismatched = 9;
7346}
7347
7348/**
7349 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
7350 *
7351 * Logged from:
7352 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
7353 */
7354message GnssConfigurationReported {
7355    // SUPL host name.
7356    optional string supl_host = 1;
7357
7358    // SUPL port number.
7359    optional int32 supl_port = 2;
7360
7361    // C2K host name.
7362    optional string c2k_host = 3;
7363
7364    // C2K port number.
7365    optional int32 c2k_port = 4;
7366
7367    // The SUPL version requested by Carrier.
7368    optional int32 supl_ver = 5;
7369
7370    // The SUPL mode.
7371    optional android.server.location.SuplMode supl_mode = 6;
7372
7373    // True if NI emergency SUPL restrictions is enabled.
7374    optional bool supl_es = 7;
7375
7376    // LTE Positioning Profile settings
7377    optional android.server.location.LppProfile lpp_profile = 8;
7378
7379    // Positioning protocol on A-Glonass system.
7380    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;
7381
7382    // True if emergency PDN is used. Otherwise, regular PDN is used.
7383    optional bool use_emergency_pdn_for_emergency_supl= 10;
7384
7385    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
7386    optional android.server.location.GpsLock gps_lock = 11;
7387
7388    // Number of seconds to extend the emergency session duration post emergency call.
7389    optional int32 es_extension_sec = 12;
7390
7391    // The full list of package names of proxy Android applications representing the non-framework
7392    // location access entities (on/off the device) for which the framework user has granted
7393    // non-framework location access permission. The package names are concatenated in one string
7394    // with spaces as separators.
7395    optional string enabled_proxy_app_package_name_list = 13;
7396}
7397
7398/**
7399 * Logs when a NFC device's error occurred.
7400 * Logged from:
7401 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
7402 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
7403 */
7404message NfcErrorOccurred {
7405    enum Type {
7406        UNKNOWN = 0;
7407        CMD_TIMEOUT = 1;
7408        ERROR_NOTIFICATION = 2;
7409        AID_OVERFLOW = 3;
7410    }
7411    optional Type type = 1;
7412    // If it's nci cmd timeout, log the timeout command.
7413    optional uint32 nci_cmd = 2;
7414
7415    optional uint32 error_ntf_status_code = 3;
7416}
7417
7418/**
7419 * Logs when a NFC device's state changed event
7420 * Logged from:
7421 *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
7422 */
7423message NfcStateChanged {
7424    enum State {
7425        UNKNOWN = 0;
7426        OFF = 1;
7427        ON = 2;
7428        ON_LOCKED = 3; // Secure Nfc enabled.
7429        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
7430    }
7431    optional State state = 1;
7432}
7433
7434/**
7435 * Logs when a NFC Beam Transaction occurred.
7436 * Logged from:
7437 *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
7438 */
7439message NfcBeamOccurred {
7440    enum Operation {
7441        UNKNOWN = 0;
7442        SEND = 1;
7443        RECEIVE = 2;
7444    }
7445    optional Operation operation = 1;
7446}
7447
7448/**
7449 * Logs when a NFC Card Emulation Transaction occurred.
7450 * Logged from:
7451 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
7452 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
7453 */
7454message NfcCardemulationOccurred {
7455    enum Category {
7456        UNKNOWN = 0;
7457        HCE_PAYMENT = 1;
7458        HCE_OTHER = 2;
7459        OFFHOST = 3;
7460    }
7461    // Transaction belongs to HCE payment or HCE other category, or offhost.
7462    optional Category category = 1;
7463    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
7464    optional string se_name = 2;
7465}
7466
7467/**
7468 * Logs when a NFC Tag event occurred.
7469 * Logged from:
7470 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
7471 */
7472message NfcTagOccurred {
7473    enum Type {
7474        UNKNOWN = 0;
7475        URL = 1;
7476        BT_PAIRING = 2;
7477        PROVISION = 3;
7478        WIFI_CONNECT = 4;
7479        APP_LAUNCH = 5;
7480        OTHERS = 6;
7481    }
7482    optional Type type = 1;
7483}
7484
7485/**
7486 * Logs when Hce transaction triggered
7487 * Logged from:
7488 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
7489 */
7490message NfcHceTransactionOccurred {
7491    // The latency period(in microseconds) it took for the first HCE data
7492    // exchange.
7493    optional uint32 latency_micros = 1;
7494}
7495
7496/**
7497 * Logs when SecureElement state event changed
7498 * Logged from:
7499 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
7500 */
7501message SeStateChanged {
7502    enum State {
7503        UNKNOWN = 0;
7504        INITIALIZED = 1;
7505        DISCONNECTED = 2;
7506        CONNECTED = 3;
7507        HALCRASH = 4;
7508    }
7509    optional State state = 1;
7510
7511    optional string state_change_reason = 2;
7512    // SIMx or eSEx.
7513    optional string terminal = 3;
7514}
7515
7516/**
7517 * Information about a permission grant request
7518 */
7519message PermissionGrantRequestResultReported {
7520    // unique value identifying an API call. A API call might result in multiple of these atoms
7521    optional int64 request_id = 1;
7522
7523    // UID of package requesting the permission grant
7524    optional int32 uid = 2 [(is_uid) = true];
7525
7526    // Name of package requesting the permission grant
7527    optional string package_name = 3;
7528
7529    // The permission to be granted
7530    optional string permission_name = 4;
7531
7532    // If the permission was explicitly requested via the API or added by the system
7533    optional bool is_implicit = 5;
7534
7535    enum Result {
7536        UNDEFINED = 0;
7537        // permission request was ignored
7538        IGNORED = 1;
7539        // permission request was ignored because it was user fixed
7540        IGNORED_USER_FIXED = 2;
7541        // permission request was ignored because it was policy fixed
7542        IGNORED_POLICY_FIXED = 3;
7543        // permission was granted by user action
7544        USER_GRANTED = 4;
7545        // permission was automatically granted
7546        AUTO_GRANTED = 5;
7547        // permission was denied by user action
7548        USER_DENIED = 6;
7549        // permission was denied with prejudice by the user
7550        USER_DENIED_WITH_PREJUDICE = 7;
7551        // permission was automatically denied
7552        AUTO_DENIED = 8;
7553        // permission request was ignored because permission is restricted
7554        IGNORED_RESTRICTED_PERMISSION = 9;
7555        // one time permission was granted by user action
7556        USER_GRANTED_ONE_TIME = 10;
7557        // user ignored request by leaving the request screen without choosing any option
7558        USER_IGNORED = 11;
7559        // user granted the permission after being linked to settings
7560        USER_GRANTED_IN_SETTINGS = 12;
7561        // user denied the permission after being linked to settings
7562        USER_DENIED_IN_SETTINGS = 13;
7563        // user denied the permission with prejudice after being linked to settings
7564        USER_DENIED_WITH_PREJUDICE_IN_SETTINGS = 14;
7565        // permission was automatically revoked after one-time permission expired
7566        AUTO_ONE_TIME_PERMISSION_REVOKED = 15;
7567        // permission was automatically revoked for unused app
7568        AUTO_UNUSED_APP_PERMISSION_REVOKED = 16;
7569    }
7570    // The result of the permission grant
7571    optional Result result = 6;
7572}
7573
7574/**
7575 * Logs when Omapi API used
7576 * Logged from:
7577 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
7578 */
7579message SeOmapiReported {
7580    enum Operation {
7581        UNKNOWN = 0;
7582        OPEN_CHANNEL = 1;
7583    }
7584    optional Operation operation = 1;
7585    // SIMx or eSEx.
7586    optional string terminal = 2;
7587
7588    optional string package_name = 3;
7589}
7590
7591/**
7592  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
7593  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
7594  * Logged from:
7595  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
7596  */
7597message BroadcastDispatchLatencyReported {
7598    optional int64 dispatch_latency_millis = 1;
7599}
7600
7601/**
7602   * Logs AttentionManagerService attention check result.
7603   *
7604   * Logged from:
7605   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
7606   */
7607message AttentionManagerServiceResultReported {
7608    // See core/java/android/service/attention/AttentionService.java
7609    enum AttentionCheckResult {
7610        UNKNOWN = 20;
7611        ATTENTION_SUCCESS_ABSENT = 0;
7612        ATTENTION_SUCCESS_PRESENT = 1;
7613        ATTENTION_FAILURE_UNKNOWN = 2;
7614        ATTENTION_FAILURE_CANCELLED = 3;
7615        ATTENTION_FAILURE_PREEMPTED = 4;
7616        ATTENTION_FAILURE_TIMED_OUT = 5;
7617        ATTENTION_FAILURE_CAMERA_PERMISSION_ABSENT = 6;
7618    }
7619    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
7620}
7621
7622/**
7623 * Logs when an adb connection changes state.
7624 *
7625 * Logged from:
7626 *     frameworks/base/services/core/java/com/android/server/adb/AdbDebuggingManager.java
7627 */
7628message AdbConnectionChanged {
7629    // The last time this system connected via adb, or 0 if the 'always allow' option was not
7630    // previously selected for this system.
7631    optional int64 last_connection_time_millis = 1;
7632
7633    // The time in ms within which a subsequent connection from an 'always allow' system is allowed
7634    // to reconnect via adb without user interaction.
7635    optional int64 auth_window_millis = 2;
7636
7637    // The state of the adb connection from frameworks/base/core/proto/android/debug/enums.proto.
7638    optional android.debug.AdbConnectionStateEnum state = 3;
7639
7640    // True if the 'always allow' option was selected for this system.
7641    optional bool always_allow = 4;
7642}
7643
7644/*
7645 * Logs the reported speech DSP status.
7646 *
7647 * Logged from:
7648 *  Vendor audio implementation.
7649 */
7650message SpeechDspStatReported {
7651    // The total Speech DSP uptime in milliseconds.
7652    optional int32 total_uptime_millis = 1;
7653    // The total Speech DSP downtime in milliseconds.
7654    optional int32 total_downtime_millis = 2;
7655    optional int32 total_crash_count = 3;
7656    optional int32 total_recover_count = 4;
7657}
7658
7659/**
7660 * Logs USB connector contaminant status.
7661 *
7662 * Logged from: USB Service.
7663 */
7664message UsbContaminantReported {
7665    optional string id = 1;
7666    optional android.service.usb.ContaminantPresenceStatus status = 2;
7667}
7668
7669/**
7670 * This atom is for debugging purpose.
7671 */
7672message DebugElapsedClock {
7673    // Monotically increasing value for each pull.
7674    optional int64 pull_count = 1;
7675    // Time from System.elapsedRealtime.
7676    optional int64 elapsed_clock_millis = 2;
7677    // Time from System.elapsedRealtime.
7678    optional int64 same_elapsed_clock_millis = 3;
7679    // Diff between current elapsed time and elapsed time from previous pull.
7680    optional int64 elapsed_clock_diff_millis = 4;
7681
7682    enum Type {
7683      TYPE_UNKNOWN = 0;
7684      ALWAYS_PRESENT = 1;
7685      PRESENT_ON_ODD_PULLS = 2;
7686    }
7687    // Type of behavior for the pulled data.
7688    optional Type type = 5;
7689}
7690
7691/**
7692 * This atom is for debugging purpose.
7693 */
7694message DebugFailingElapsedClock {
7695    // Monotically increasing value for each pull.
7696    optional int64 pull_count = 1;
7697    // Time from System.elapsedRealtime.
7698    optional int64 elapsed_clock_millis = 2;
7699    // Time from System.elapsedRealtime.
7700    optional int64 same_elapsed_clock_millis = 3;
7701    // Diff between current elapsed time and elapsed time from previous pull.
7702    optional int64 elapsed_clock_diff_millis = 4;
7703}
7704
7705/** Logs System UI bubbles event changed.
7706 *
7707 * Logged from:
7708 *     frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles
7709 */
7710message BubbleUIChanged {
7711
7712    // The app package that is posting the bubble.
7713    optional string package_name = 1;
7714
7715    // The notification channel that is posting the bubble.
7716    optional string notification_channel = 2;
7717
7718    // The notification id associated with the posted bubble.
7719    optional int32 notification_id = 3;
7720
7721    // The position of the bubble within the bubble stack.
7722    optional int32 position = 4;
7723
7724    // The total number of bubbles within the bubble stack.
7725    optional int32 total_number = 5;
7726
7727    // User interactions with the bubble.
7728    enum Action {
7729        UNKNOWN = 0;
7730        POSTED = 1;
7731        UPDATED = 2;
7732        EXPANDED = 3;
7733        COLLAPSED = 4;
7734        DISMISSED = 5;
7735        STACK_DISMISSED = 6;
7736        STACK_MOVED = 7;
7737        HEADER_GO_TO_APP = 8;
7738        HEADER_GO_TO_SETTINGS = 9;
7739        PERMISSION_OPT_IN = 10;
7740        PERMISSION_OPT_OUT = 11;
7741        PERMISSION_DIALOG_SHOWN = 12;
7742        SWIPE_LEFT = 13;
7743        SWIPE_RIGHT = 14;
7744        STACK_EXPANDED = 15;
7745        FLYOUT = 16;
7746    }
7747    optional Action action = 6;
7748
7749    // Normalized screen position of the bubble stack. The range is between 0 and 1.
7750    optional float normalized_x_position = 7;
7751    optional float normalized_y_position = 8;
7752
7753    // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
7754    optional bool is_unread = 9;
7755
7756    // Whether the bubble is an on-going one.
7757    optional bool is_ongoing = 10;
7758
7759    // Whether the bubble is produced by an app running in foreground.
7760    // This is deprecated and the value should be ignored.
7761    optional bool is_foreground = 11 [deprecated = true];
7762}
7763
7764/**
7765  * Logs System UI bubbles developer errors.
7766  *
7767  * Logged from:
7768  *   frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
7769  */
7770message BubbleDeveloperErrorReported {
7771
7772    // The app package that is posting the bubble.
7773    optional string package_name = 1;
7774
7775    // Bubble developer error type enums.
7776    enum Error {
7777        UNKNOWN = 0;
7778        ACTIVITY_INFO_MISSING = 1;
7779        ACTIVITY_INFO_NOT_RESIZABLE = 2;
7780        DOCUMENT_LAUNCH_NOT_ALWAYS = 3;
7781    }
7782    optional Error error = 2 [default = UNKNOWN];
7783}
7784
7785/**
7786 * Logs that a constraint for a scheduled job has changed.
7787 *
7788 * Logged from:
7789 *     frameworks/base/services/core/java/com/android/server/job/controllers/JobStatus.java
7790 */
7791message ScheduledJobConstraintChanged {
7792    repeated AttributionNode attribution_node = 1;
7793
7794    // Name of the job.
7795    optional string job_name = 2;
7796
7797    optional com.android.server.job.ConstraintEnum constraint = 3;
7798
7799    enum State {
7800        UNKNOWN = 0;
7801        UNSATISFIED = 1;
7802        SATISFIED = 2;
7803    }
7804    optional State state = 4;
7805}
7806
7807/**
7808 * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
7809 * returns true.
7810 *
7811 * Logged from:
7812 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
7813 */
7814message ScreenTimeoutExtensionReported {
7815    // Describes how many times in a row did the power manager reset the screen off timeout.
7816    optional uint32 consecutive_timeout_extended_count = 1;
7817}
7818
7819/*
7820* Logs number of milliseconds it takes to start a process.
7821* The definition of app process start time is from the app launch time to
7822* the time that Zygote finished forking the app process and loaded the
7823* application package's java classes.
7824
7825* This metric is different from AppStartOccurred which is for foreground
7826* activity only.
7827
7828* ProcessStartTime can report all processes (both foreground and background)
7829* start time.
7830*
7831* Logged from:
7832*   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7833*/
7834message ProcessStartTime {
7835    // The uid of the ProcessRecord.
7836    optional int32 uid = 1 [(is_uid) = true];
7837
7838    // The process pid.
7839    optional int32 pid = 2;
7840
7841    // The process name.
7842    // Usually package name, "system" for system server.
7843    // Provided by ActivityManagerService.
7844    optional string process_name = 3;
7845
7846    enum StartType {
7847        UNKNOWN = 0;
7848        WARM = 1;
7849        HOT = 2;
7850        COLD = 3;
7851    }
7852
7853    // The start type.
7854    optional StartType type = 4;
7855
7856    // The elapsed realtime at the start of the process.
7857    optional int64 process_start_time_millis = 5;
7858
7859    // Number of milliseconds it takes to reach bind application.
7860    optional int32 bind_application_delay_millis = 6;
7861
7862    // Number of milliseconds it takes to finish start of the process.
7863    optional int32 process_start_delay_millis = 7;
7864
7865    // hostingType field in ProcessRecord, the component type such as "activity",
7866    // "service", "content provider", "broadcast" or other strings.
7867    optional string hosting_type = 8;
7868
7869    // hostingNameStr field in ProcessRecord. The component class name that runs
7870    // in this process.
7871    optional string hosting_name = 9;
7872}
7873
7874/**
7875 * Track Media Codec usage
7876 * Logged from:
7877 *   frameworks/av/media/libstagefright/MediaCodec.cpp
7878 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
7879 */
7880message MediametricsCodecReported {
7881    optional int64 timestamp_nanos = 1;
7882    optional string package_name = 2;
7883    optional int64 package_version_code = 3;
7884    optional int64 media_apex_version = 4;
7885
7886    optional android.stats.mediametrics.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
7887}
7888
7889/**
7890 * Track Media Extractor (pulling video/audio streams out of containers) usage
7891 * Logged from:
7892 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
7893 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
7894 */
7895message MediametricsExtractorReported {
7896    optional int64 timestamp_nanos = 1;
7897    optional string package_name = 2;
7898    optional int64 package_version_code = 3;
7899    optional int64 media_apex_version = 4;
7900
7901    optional android.stats.mediametrics.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
7902}
7903
7904/**
7905 * Track how we arbitrate between microphone/input requests.
7906 * Logged from
7907 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
7908 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
7909 */
7910message MediametricsAudiopolicyReported {
7911    optional int64 timestamp_nanos = 1;
7912    optional string package_name = 2;
7913    optional int64 package_version_code = 3;
7914    optional int64 media_apex_version = 4;
7915
7916    optional android.stats.mediametrics.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
7917}
7918
7919/**
7920 * Track how we arbitrate between microphone requests.
7921 * Logged from
7922 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
7923 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
7924 */
7925message MediametricsAudiorecordReported {
7926    optional int64 timestamp_nanos = 1;
7927    optional string package_name = 2;
7928    optional int64 package_version_code = 3;
7929    optional int64 media_apex_version = 4;
7930
7931    optional android.stats.mediametrics.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
7932}
7933
7934/**
7935 * Track how we arbitrate between microphone/input requests.
7936 * Logged from
7937 *   frameworks/av/media/libnblog/ReportPerformance.cpp
7938 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
7939 */
7940message MediametricsAudiothreadReported {
7941    optional int64 timestamp_nanos = 1;
7942    optional string package_name = 2;
7943    optional int64 package_version_code = 3;
7944    optional int64 media_apex_version = 4;
7945
7946    optional android.stats.mediametrics.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
7947}
7948
7949/**
7950 * Track how we arbitrate between microphone/input requests.
7951 * Logged from
7952 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
7953 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
7954 */
7955message MediametricsAudiotrackReported {
7956    optional int64 timestamp_nanos = 1;
7957    optional string package_name = 2;
7958    optional int64 package_version_code = 3;
7959    optional int64 media_apex_version = 4;
7960
7961    optional android.stats.mediametrics.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
7962}
7963
7964/**
7965 * Track information about DRM framework performance
7966 * Logged from
7967 *   frameworks/av/drm/libmediadrm/DrmHal.cpp
7968 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
7969 */
7970message MediametricsMediadrmReported {
7971    optional int64 timestamp_nanos = 1;
7972    optional string package_name = 2;
7973    optional int64 package_version_code = 3;
7974    optional int64 media_apex_version = 4;
7975
7976    // vendor+description tell about which DRM plugin is in use on this device
7977    optional string vendor = 5;
7978    optional string description = 6;
7979    // from frameworks/av/drm/libmediadrm/protos/metrics.proto
7980    optional bytes framework_stats = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
7981}
7982
7983/**
7984 * Track information about the widevine DRM plugin performance
7985 * Logged from
7986 *   vendor/widevine/libwvdrmengine/cdm/metrics
7987 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
7988 */
7989message MediametricsDrmWidevineReported {
7990    optional int64 timestamp_nanos = 1;
7991    optional string package_name = 2;
7992    optional int64 package_version_code = 3;
7993    optional int64 media_apex_version = 4;
7994
7995    optional bytes vendor_specific_stats = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
7996}
7997
7998/**
7999 * Track information about recordings (e.g. camcorder)
8000 * Logged from
8001 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
8002 *   frameworks/av/services/mediaanalytics/statsd_recorder.cpp
8003 */
8004message MediametricsRecorderReported {
8005    optional int64 timestamp_nanos = 1;
8006    optional string package_name = 2;
8007    optional int64 package_version_code = 3;
8008    optional int64 media_apex_version = 4;
8009
8010    optional android.stats.mediametrics.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
8011}
8012
8013/**
8014 * Track Media Player usage
8015 * Logged from:
8016 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
8017 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
8018 */
8019message MediametricsNuPlayerReported {
8020    optional int64 timestamp_nanos = 1;
8021    optional string package_name = 2;
8022    optional int64 package_version_code = 3;
8023    optional int64 media_apex_version = 4;
8024
8025    optional android.stats.mediametrics.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
8026}
8027
8028/**
8029 * Track Legacy DRM usage
8030 * Logged from
8031 *   frameworks/av/drm/drmserver/DrmManager.cpp
8032 */
8033message MediametricsDrmManagerReported {
8034    optional int64 timestamp_nanos = 1;
8035    optional string package_name = 2;
8036    optional int64 package_version_code = 3;
8037    optional int64 media_apex_version = 4;
8038
8039    enum Method {
8040        METHOD_NOT_FOUND       = -1;
8041        GET_CONSTRAINTS        =  0;
8042        GET_METADATA           =  1;
8043        CAN_HANDLE             =  2;
8044        PROCESS_DRM_INFO       =  3;
8045        ACQUIRE_DRM_INFO       =  4;
8046        SAVE_RIGHTS            =  5;
8047        GET_ORIGINAL_MIME_TYPE =  6;
8048        GET_DRM_OBJECT_TYPE    =  7;
8049        CHECK_RIGHTS_STATUS    =  8;
8050        REMOVE_RIGHTS          =  9;
8051        REMOVE_ALL_RIGHTS      = 10;
8052        OPEN_CONVERT_SESSION   = 11;
8053        OPEN_DECRYPT_SESSION   = 12;
8054    }
8055
8056    // plugin_id+description inform which Legacy DRM plugins are still in use on device
8057    optional string plugin_id = 5;
8058    optional string description = 6;
8059    optional Method method = 7;
8060    optional string mime_types = 8;
8061
8062    optional int64 get_constraints_count =  9;
8063    optional int64 get_metadata_count = 10;
8064    optional int64 can_handle_count = 11;
8065    optional int64 process_drm_info_count = 12;
8066    optional int64 acquire_drm_info_count = 13;
8067    optional int64 save_rights_count = 14;
8068    optional int64 get_original_mime_type_count = 15;
8069    optional int64 get_drm_object_type_count = 16;
8070    optional int64 check_rights_status_count = 17;
8071    optional int64 remove_rights_count = 18;
8072    optional int64 remove_all_rights_count = 19;
8073    optional int64 open_convert_session_count = 20;
8074    optional int64 open_decrypt_session_count = 21;
8075}
8076
8077/**
8078 * State of a dangerous permission requested by a package
8079 * Pulled from: StatsCompanionService
8080*/
8081message DangerousPermissionState {
8082    // Name of the permission
8083    optional string permission_name = 1;
8084
8085    // Uid of the package
8086    optional int32 uid = 2 [(is_uid) = true];
8087
8088    // Package requesting the permission
8089    optional string package_name = 3;
8090
8091    // If the permission is granted to the uid
8092    optional bool is_granted = 4;
8093
8094    // Permission flags as per android.content.pm.PermissionFlags
8095    optional int32 permission_flags = 5;
8096}
8097
8098/**
8099 * Logs when a package is denied access to a device identifier based on the new access requirements.
8100 *
8101 * Logged from:
8102 *     frameworks/base/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
8103 */
8104message DeviceIdentifierAccessDenied {
8105    // The name of the package denied access to the requested device identifier.
8106    optional string package_name = 1;
8107
8108    // The name of the device identifier method the package attempted to invoke.
8109    optional string method_name = 2;
8110
8111    // True if the package is preinstalled.
8112    // Starting from Android 11, this boolean is not set and will always be false.
8113    optional bool is_preinstalled = 3 [deprecated = true];
8114
8115    // True if the package is privileged.
8116    // Starting from Android 11, this boolean is not set and will always be false.
8117    optional bool is_priv_app = 4 [deprecated = true];
8118}
8119
8120/**
8121 * Pulls the ongoing mainline install train version code.
8122 * Pulled from StatsCompanionService
8123 */
8124message TrainInfo {
8125    optional int64 train_version_code = 1;
8126
8127    optional TrainExperimentIds train_experiment_id = 2;
8128
8129    optional string train_name = 3;
8130
8131    enum Status {
8132        UNKNOWN = 0;
8133        INSTALL_REQUESTED = 1;
8134        INSTALL_STARTED = 2;
8135        INSTALL_STAGED_NOT_READY = 3;
8136        INSTALL_STAGED_READY = 4;
8137        INSTALL_SUCCESS = 5;
8138        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
8139        // and INSTALL_FAILURE_COMMIT.
8140        INSTALL_FAILURE = 6  [deprecated = true];
8141        // This enum is for installs that are manually cancelled via the Manual Update UI.
8142        INSTALL_CANCELLED = 7;
8143        INSTALLER_ROLLBACK_REQUESTED = 8;
8144        INSTALLER_ROLLBACK_INITIATED = 9;
8145        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
8146        INSTALLER_ROLLBACK_STAGED = 11;
8147        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
8148        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
8149        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
8150        INSTALLER_ROLLBACK_SUCCESS = 15;
8151        INSTALLER_ROLLBACK_FAILURE = 16;
8152        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
8153        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
8154        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
8155        INSTALL_STAGED_CANCEL_REQUESTED = 20;
8156        INSTALL_STAGED_CANCEL_SUCCESS = 21;
8157        INSTALL_STAGED_CANCEL_FAILURE = 22;
8158        INSTALL_FAILURE_DOWNLOAD = 23;
8159        INSTALL_FAILURE_STATE_MISMATCH = 24;
8160        INSTALL_FAILURE_COMMIT = 25;
8161        REBOOT_TRIGGERED = 26;
8162    }
8163    optional Status status = 4;
8164}
8165
8166/**
8167 * Logs the gesture stage changed event.
8168 *
8169 * Logged from:
8170 *   frameworks/base/packages/SystemUI/
8171 */
8172message AssistGestureStageReported {
8173    optional android.hardware.sensor.assist.AssistGestureStageEnum gesture_stage = 1;
8174}
8175
8176/**
8177 * Logs the feedback type.
8178 *
8179 * Logged from:
8180 *   frameworks/base/packages/SystemUI/
8181 */
8182message AssistGestureFeedbackReported {
8183    // Whether or not the gesture was used.
8184    optional android.hardware.sensor.assist.AssistGestureFeedbackEnum feedback_type = 1;
8185}
8186
8187/**
8188 * Logs the progress.
8189 *
8190 * Logged from:
8191 *   frameworks/base/packages/SystemUI/
8192 */
8193message AssistGestureProgressReported {
8194    // [0,100] progress for the assist gesture.
8195    optional int32 progress = 1;
8196}
8197
8198/*
8199 * Information about the time zone data on a device.
8200 */
8201message TimeZoneDataInfo {
8202    // A version identifier for the data set on device. e.g. "2018i"
8203    optional string tzdb_version = 1;
8204}
8205
8206/**
8207 * Logs the GPU stats global health information.
8208 *
8209 * Logged from:
8210 *   frameworks/native/services/gpuservice/gpustats/
8211 */
8212message GpuStatsGlobalInfo {
8213    // Package name of the gpu driver.
8214    optional string driver_package_name = 1;
8215
8216    // Version name of the gpu driver.
8217    optional string driver_version_name = 2;
8218
8219    // Version code of the gpu driver.
8220    optional int64 driver_version_code = 3;
8221
8222    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
8223    optional int64 driver_build_time = 4;
8224
8225    // Total count of the gl driver gets loaded.
8226    optional int64 gl_loading_count = 5;
8227
8228    // Total count of the gl driver fails to be loaded.
8229    optional int64 gl_loading_failure_count = 6;
8230
8231    // Total count of the Vulkan driver gets loaded.
8232    optional int64 vk_loading_count = 7;
8233
8234    // Total count of the Vulkan driver fails to be loaded.
8235    optional int64 vk_loading_failure_count = 8;
8236
8237    // Api version of the system Vulkan driver.
8238    optional int32 vulkan_version = 9;
8239
8240    // Api version of the system CPU Vulkan driver.
8241    optional int32 cpu_vulkan_version = 10;
8242
8243    // Api version of the system GLES driver.
8244    optional int32 gles_version = 11;
8245
8246    // Total count of the angle driver gets loaded.
8247    optional int64 angle_loading_count = 12;
8248
8249    // Total count of the angle driver fails to be loaded.
8250    optional int64 angle_loading_failure_count = 13;
8251}
8252
8253/**
8254 * GPU driver loading time info.
8255 */
8256message GpuDriverLoadingTime {
8257    // List of all the driver loading times for this app. The list size is
8258    // capped at 50.
8259    repeated int64 driver_loading_time = 1;
8260}
8261
8262/**
8263 * Logs the GPU stats per app health information.
8264 *
8265 * Logged from:
8266 *   frameworks/native/services/gpuservice/gpustats/
8267 */
8268message GpuStatsAppInfo {
8269    // Package name of the application that loads the gpu driver. Total number
8270    // of different packages is capped at 100.
8271    optional string app_package_name = 1;
8272
8273    // Version code of the gpu driver this app loads.
8274    optional int64 driver_version_code = 2;
8275
8276    // gl driver loading time info.
8277    optional GpuDriverLoadingTime gl_driver_loading_time = 3
8278            [(android.os.statsd.log_mode) = MODE_BYTES];
8279
8280    // Vulkan driver loading time info.
8281    optional GpuDriverLoadingTime vk_driver_loading_time = 4
8282            [(android.os.statsd.log_mode) = MODE_BYTES];
8283
8284    // Angle driver loading time info.
8285    optional GpuDriverLoadingTime angle_driver_loading_time = 5
8286            [(android.os.statsd.log_mode) = MODE_BYTES];
8287
8288    // CPU Vulkan implementation is in use.
8289    optional bool cpu_vulkan_in_use = 6;
8290
8291    // App is not doing pre-rotation correctly.
8292    optional bool false_prerotation = 7;
8293
8294    // App creates GLESv1 context.
8295    optional bool gles_1_in_use = 8;
8296}
8297
8298/*
8299 * Logs the size of the system ion heap.
8300 *
8301 * Pulled from StatsCompanionService.
8302 */
8303message SystemIonHeapSize {
8304    // Deprecated due to limited support of ion stats in debugfs.
8305    // Use `IonHeapSize` instead.
8306    option deprecated = true;
8307
8308    // Size of the system ion heap in bytes.
8309    // Read from debugfs.
8310    optional int64 size_in_bytes = 1;
8311}
8312
8313/*
8314 * Logs the total size of the ion heap.
8315 *
8316 * Pulled from StatsCompanionService.
8317 */
8318message IonHeapSize {
8319    // Total size of all ion heaps in kilobytes.
8320    // Read from: /sys/kernel/ion/total_heaps_kb.
8321    optional int32 total_size_kb = 1;
8322}
8323
8324/*
8325 * Logs the per-process size of the system ion heap.
8326 *
8327 * Pulled from StatsCompanionService.
8328 */
8329message ProcessSystemIonHeapSize {
8330    // The uid if available. -1 means not available.
8331    optional int32 uid = 1 [(is_uid) = true];
8332
8333    // The process name (from /proc/PID/cmdline).
8334    optional string process_name = 2;
8335
8336    // Sum of sizes of all allocations.
8337    optional int32 total_size_in_kilobytes = 3;
8338
8339    // Number of allocations.
8340    optional int32 allocation_count = 4;
8341
8342    // Size of the largest allocation.
8343    optional int32 max_size_in_kilobytes = 5;
8344}
8345
8346/**
8347 * Push network stack events.
8348 *
8349 * Log from:
8350 *     frameworks/base/packages/NetworkStack/
8351 */
8352message NetworkStackReported {
8353    // The id that indicates the event reported from NetworkStack.
8354    optional int32 event_id = 1;
8355    // The data for the reported events.
8356    optional android.stats.connectivity.NetworkStackEventData network_stack_event = 2 [(log_mode) = MODE_BYTES];
8357}
8358
8359/**
8360 * Logs the apps that are installed on the external storage.
8361 * Pulled from:
8362 *   StatsCompanionService
8363 */
8364message AppsOnExternalStorageInfo {
8365    // The type of the external storage.
8366    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
8367    // The name of the package that is installed on the external storage.
8368    optional string package_name = 2;
8369}
8370
8371/**
8372 * Logs the settings related to Face.
8373 * Logged from:
8374 *   frameworks/base/services/core/java/com/android/server/stats
8375 */
8376message FaceSettings {
8377    // Whether or not face unlock is allowed on Keyguard.
8378    optional bool unlock_keyguard_enabled = 1;
8379    // Whether or not face unlock dismisses the Keyguard.
8380    optional bool unlock_dismisses_keyguard = 2;
8381    // Whether or not face unlock requires attention.
8382    optional bool unlock_attention_required = 3;
8383    // Whether or not face unlock is allowed for apps (through BiometricPrompt).
8384    optional bool unlock_app_enabled = 4;
8385    // Whether or not face unlock always requires user confirmation.
8386    optional bool unlock_always_require_confirmation = 5;
8387    // Whether or not a diverse set of poses are required during enrollment.
8388    optional bool unlock_diversity_required = 6;
8389}
8390
8391/**
8392 * Logs cooling devices maintained by the kernel.
8393 *
8394 * Pulled from StatsCompanionService.java
8395 */
8396message CoolingDevice {
8397    // The type of cooling device being reported. Eg. CPU, GPU...
8398    optional android.os.CoolingTypeEnum device_location = 1;
8399    // The name of the cooling device source. Eg. CPU0
8400    optional string device_name = 2;
8401    // Current throttle state of the cooling device. The value can any unsigned
8402    // integer between 0 and max_state defined in its driver. 0 means device is
8403    // not in throttling, higher value means deeper throttling.
8404    optional int32 state = 3;
8405}
8406
8407/**
8408 * Intelligence has several counter-type events that don't warrant a
8409 * full separate atom. These are primarily API call counters but also include
8410 * counters for feature usage and specific failure modes.
8411 *
8412 * Logged from the Intelligence mainline module.
8413 */
8414message IntelligenceEventReported {
8415  // The event type.
8416  optional android.stats.intelligence.EventType event_id = 1;
8417  // Success, failure.
8418  optional android.stats.intelligence.Status status = 2;
8419  // How many times the event occured (to report a batch of high frequency events).
8420  optional int32 count = 3;
8421  // How long the event took (sum of durations if count > 1)
8422  optional int64 duration_millis = 4;
8423}
8424
8425/**
8426 * Logs when Car Power state changed.
8427 *
8428 * Logged from:
8429 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
8430 */
8431message CarPowerStateChanged {
8432    // States come from CpmsState in CarPowerManagementService.java.
8433    enum State {
8434       WAIT_FOR_VHAL = 0;
8435       ON = 1;
8436       SHUTDOWN_PREPARE = 2;
8437       WAIT_FOR_FINISH = 3;
8438       SUSPEND = 4;
8439       SIMULATE_SLEEP = 5;
8440    }
8441    optional State state = 1;
8442}
8443
8444/**
8445 * Logs when Car User Hal is requested to switch/create/remove user.
8446 *
8447 * Logged from:
8448 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
8449 */
8450message CarUserHalModifyUserRequestReported {
8451    // Request id for the request.
8452    optional int32 request_id = 1;
8453    // Request type.
8454    enum RequestType {
8455        UNKNOWN = 0;
8456        // Car user manager requested user switch.
8457        SWITCH_REQUEST_ANDROID = 1;
8458        // OEM requested User switch.
8459        SWITCH_REQUEST_OEM = 2;
8460        // Hal switch requested after android switch using activity manager.
8461        SWITCH_REQUEST_LEGACY = 3;
8462        // Create User
8463        CREATE_REQUEST = 4;
8464        // Remove User
8465        REMOVE_REQUEST = 5;
8466    }
8467    optional RequestType request_type = 2;
8468    // Android User id of the current user which can only be 0, 10, 11 and so on.
8469    // -1 if not available.
8470    optional int32 user_id = 3;
8471    // VHAL flags of the current user. (-1 if not available)
8472    optional int32 user_flags = 4;
8473    // Android User id of the target user for switch/create/remove. It can only
8474    // be 0, 10, 11 and so on. -1 if not available.
8475    optional int32 target_user_id = 5;
8476    // VHAL flags of the target user for switch/create/remove. (-1 if not available)
8477    optional int32 target_user_flags = 6;
8478    // Request timeout Milliseconds (-1 if not available)
8479    optional int32 timeout_millis = 7;
8480}
8481
8482/**
8483 * Logs when Car User Hal responds to switch/create user request.
8484 *
8485 * Logged from:
8486 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
8487 */
8488message CarUserHalModifyUserResponseReported {
8489    // Request id of the request associated with the response.
8490    optional int32 request_id = 1;
8491    // Car user hal callback status.
8492    enum CallbackStatus {
8493        UNKNOWN = 0;
8494        // Hal response was invalid.
8495        INVALID = 1;
8496        // Hal response was ok.
8497        OK = 2;
8498        // Hal timeout during set call.
8499        HAL_SET_TIMEOUT = 3;
8500        // Hal response timeout.
8501        HAL_RESPONSE_TIMEOUT = 4;
8502        // Hal responded with wrong info.
8503        WRONG_HAL_RESPONSE = 5;
8504        // Hal is processing multiple requests simultaneously.
8505        CONCURRENT_OPERATION = 6;
8506    }
8507    optional CallbackStatus callback_status = 2;
8508
8509    // Hal request status for user switch/create/remove.
8510    enum HalRequestStatus {
8511        UNSPECIFIED = 0;
8512        // Hal request for user switch/create is successful.
8513        SUCCESS = 1;
8514        // Hal request for user switch/create failed.
8515        FAILURE = 2;
8516    }
8517    optional HalRequestStatus request_status = 3;
8518}
8519
8520/**
8521 * Logs when post switch response is posted to Car User Hal.
8522 *
8523 * Logged from:
8524 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
8525 */
8526message CarUserHalPostSwitchResponseReported {
8527    // Request id.
8528    optional int32 request_id = 1;
8529
8530    // Android user switch status.
8531    enum UserSwitchStatus {
8532        UNKNOWN = 0;
8533        // Android user switch is successful.
8534        SUCCESS = 1;
8535        // Android user switch failed.
8536        FAILURE = 2;
8537    }
8538    optional UserSwitchStatus switch_status = 2;
8539}
8540
8541/**
8542 * Logs when initial user information is requested from Car User Hal.
8543 *
8544 * Logged from:
8545 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
8546 */
8547message CarUserHalInitialUserInfoRequestReported {
8548    // Request id for the request.
8549    optional int32 request_id = 1;
8550
8551    // Request type for initial user information.
8552    enum InitialUserInfoRequestType {
8553        UNKNOWN = 0;
8554        // At the first time Android was booted (or after a factory reset).
8555        FIRST_BOOT = 1;
8556        // At the first time Android was booted after the system was updated.
8557        FIRST_BOOT_AFTER_OTA = 2;
8558        // When Android was booted "from scratch".
8559        COLD_BOOT = 3;
8560        // When Android was resumed after the system was suspended to memory.
8561        RESUME = 4;
8562    }
8563    optional InitialUserInfoRequestType request_type = 2;
8564    // Request timeout Milliseconds (-1 if not available)
8565    optional int32 timeout_millis = 3;
8566}
8567
8568/**
8569 * Logs when Car User Hal responds to initial user information requests.
8570 *
8571 * Logged from:
8572 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
8573 */
8574message CarUserHalInitialUserInfoResponseReported {
8575    // Request id of the request associated with the response.
8576    optional int32 request_id = 1;
8577    // Car user hal callback status.
8578    enum CallbackStatus {
8579        UNKNOWN = 0;
8580        // Hal response was invalid.
8581        INVALID = 1;
8582        // Hal response was ok.
8583        OK = 2;
8584        // Hal timeout during set call.
8585        HAL_SET_TIMEOUT = 3;
8586        // Hal response timeout.
8587        HAL_RESPONSE_TIMEOUT = 4;
8588        // Hal responded with wrong info.
8589        WRONG_HAL_RESPONSE = 5;
8590        // Hal is processing multiple requests simultaneously.
8591        CONCURRENT_OPERATION = 6;
8592    }
8593    optional CallbackStatus callback_status = 2;
8594    // Response for initial user information request.
8595    enum InitialUserInfoResponseAction {
8596        UNSPECIFIED = 0;
8597        // Let the Android System decide what to do.
8598        DEFAULT = 1;
8599        // Switch to an existing Android user.
8600        SWITCH = 2;
8601        // Create a new Android user (and switch to it).
8602        CREATE = 3;
8603    }
8604    optional InitialUserInfoResponseAction response_action = 3;
8605    // Android User id of the target user which can only be 0, 10, 11 and so on.
8606    // -1 if not available.
8607    optional int32 target_user = 4;
8608    // VHAL flags of the current user. (-1 if not available)
8609    optional int32 target_user_flags = 5;
8610    // User locales
8611    optional string user_locales = 6;
8612}
8613
8614/**
8615 * Logs when set user association is requested from Car User Hal.
8616 *
8617 * Logged from:
8618 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
8619 */
8620message CarUserHalUserAssociationRequestReported {
8621    // Request id for the request.
8622    optional int32 request_id = 1;
8623    // Request type.
8624    enum RequestType {
8625        UNKNOWN = 0;
8626        // For setting user association information.
8627        SET = 1;
8628        // For getting user association information.
8629        GET = 2;
8630    }
8631    optional RequestType request_type = 2;
8632    // Android User id of the current user which can only be 0, 10, 11 and so on.
8633    // -1 if not available.
8634    optional int32 current_user_id = 3;
8635    // VHAL flags of the current user. (-1 if not available)
8636    optional int32 current_user_flags = 4;
8637    // Number of the set associations requested.
8638    optional int32 number_associations = 5;
8639    // Concatenated string for the types from set associations request.
8640    // This is a string converted from an array of integers.
8641    optional string user_identification_association_types = 6;
8642    // Concatenated string for the values from set associations request.
8643    // This is a string converted from an array of integers.
8644    optional string user_identification_association_values = 7;
8645}
8646
8647/**
8648 * Logs when Car User Hal responds to set user association requests.
8649 *
8650 * Logged from:
8651 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
8652 */
8653message CarUserHalSetUserAssociationResponseReported {
8654    // Request id of the request associated with the response.
8655    optional int32 request_id = 1;
8656    // Car user hal callback status.
8657    enum CallbackStatus {
8658        UNKNOWN = 0;
8659        // Hal response was invalid.
8660        INVALID = 1;
8661        // Hal response was ok.
8662        OK = 2;
8663        // Hal timeout during set call.
8664        HAL_SET_TIMEOUT = 3;
8665        // Hal response timeout.
8666        HAL_RESPONSE_TIMEOUT = 4;
8667        // Hal responded with wrong info.
8668        WRONG_HAL_RESPONSE = 5;
8669        // Hal is processing multiple requests simultaneously.
8670        CONCURRENT_OPERATION = 6;
8671    }
8672    optional CallbackStatus callback_status = 2;
8673    // Number of the set associations in the response.
8674    optional int32 number_associations = 3;
8675    // Concatenated string for the types from set associations request.
8676    // This is a string converted from an array of integers.
8677    optional string user_identification_association_types = 4;
8678    // Concatenated string for the values from set associations request.
8679    // This is a string converted from an array of integers.
8680    optional string user_identification_association_values = 5;
8681}
8682
8683/**
8684 * Logs whether GarageMode is entered.
8685 *
8686 * Logged from:
8687 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
8688 */
8689message GarageModeInfo {
8690    // Whether GarageMode is entered.
8691    optional bool is_garage_mode = 1;
8692}
8693
8694/**
8695 * Historical app ops data per package.
8696 */
8697message AppOps {
8698    // Uid of the package requesting the op
8699    optional int32 uid = 1 [(is_uid) = true];
8700
8701    // Name of the package performing the op
8702    optional string package_name = 2;
8703
8704    // operation id
8705    optional android.app.AppOpEnum op_id = 3 [default = APP_OP_NONE];
8706
8707    // The number of times the op was granted while the app was in the
8708    // foreground (only for trusted requests)
8709    optional int64 trusted_foreground_granted_count = 4;
8710
8711    // The number of times the op was granted while the app was in the
8712    // background (only for trusted requests)
8713    optional int64 trusted_background_granted_count = 5;
8714
8715    // The number of times the op was rejected while the app was in the
8716    // foreground (only for trusted requests)
8717    optional int64 trusted_foreground_rejected_count = 6;
8718
8719    // The number of times the op was rejected while the app was in the
8720    // background (only for trusted requests)
8721    optional int64 trusted_background_rejected_count = 7;
8722
8723    // For long-running operations, total duration of the operation
8724    // while the app was in the foreground (only for trusted requests)
8725    optional int64 trusted_foreground_duration_millis = 8;
8726
8727    // For long-running operations, total duration of the operation
8728    // while the app was in the background (only for trusted requests)
8729    optional int64 trusted_background_duration_millis = 9;
8730
8731    // Whether AppOps is guarded by Runtime permission
8732    optional bool is_runtime_permission = 10;
8733}
8734
8735/**
8736 * Historical app ops data per package and attribution tag.
8737 */
8738message AttributedAppOps {
8739    // Uid of the package requesting the op
8740    optional int32 uid = 1 [(is_uid) = true];
8741
8742    // Name of the package performing the op
8743    optional string package_name = 2;
8744
8745    // tag; provided by developer when accessing related API, limited at 50 chars by API.
8746    // Attributions must be provided through manifest using <attribution> tag available in R and
8747    // above.
8748    optional string tag = 3;
8749
8750    // operation id
8751    optional android.app.AppOpEnum op = 4 [default = APP_OP_NONE];
8752
8753    // The number of times the op was granted while the app was in the
8754    // foreground (only for trusted requests)
8755    optional int64 trusted_foreground_granted_count = 5;
8756
8757    // The number of times the op was granted while the app was in the
8758    // background (only for trusted requests)
8759    optional int64 trusted_background_granted_count = 6;
8760
8761    // The number of times the op was rejected while the app was in the
8762    // foreground (only for trusted requests)
8763    optional int64 trusted_foreground_rejected_count = 7;
8764
8765    // The number of times the op was rejected while the app was in the
8766    // background (only for trusted requests)
8767    optional int64 trusted_background_rejected_count = 8;
8768
8769    // For long-running operations, total duration of the operation
8770    // while the app was in the foreground (only for trusted requests)
8771    optional int64 trusted_foreground_duration_millis = 9;
8772
8773    // For long-running operations, total duration of the operation
8774    // while the app was in the background (only for trusted requests)
8775    optional int64 trusted_background_duration_millis = 10;
8776
8777    // Whether AppOps is guarded by Runtime permission
8778    optional bool is_runtime_permission = 11;
8779
8780    // Sampling rate used on device, from 0 to 100
8781    optional int32 sampling_rate = 12;
8782}
8783
8784/**
8785 * Location Manager API Usage information(e.g. API under usage,
8786 * API call's parameters).
8787 * Logged from:
8788 *  frameworks/base/services/core/java/com/android/server/LocationManagerService.java
8789 */
8790message LocationManagerApiUsageReported {
8791
8792    // Indicating if usage starts or usage ends.
8793    optional android.stats.location.UsageState state = 1;
8794
8795    // LocationManagerService's API in use.
8796    // We can identify which API from LocationManager is
8797    // invoking current LMS API by the combination of
8798    // API parameter(e.g. is_listener_null, is_intent_null,
8799    // is_location_request_null)
8800    optional android.stats.location.LocationManagerServiceApi api_in_use = 2;
8801
8802    // Name of the package calling the API.
8803    optional string calling_package_name = 3;
8804
8805    // Type of the location provider.
8806    optional android.stats.location.ProviderType provider = 4;
8807
8808    // Quality of the location request
8809    optional android.stats.location.LocationRequestQuality quality = 5;
8810
8811    // The desired interval for active location updates, in milliseconds.
8812    // Bucketized to reduce cardinality.
8813    optional android.stats.location.LocationRequestIntervalBucket bucketized_interval = 6;
8814
8815    // Minimum distance between location updates, in meters.
8816    // Bucketized to reduce cardinality.
8817    optional android.stats.location.SmallestDisplacementBucket
8818            bucketized_smallest_displacement = 7;
8819
8820    // The number of location updates.
8821    optional int64 num_updates = 8;
8822
8823    // The request expiration time, in millisecond since boot.
8824    // Bucketized to reduce cardinality.
8825    optional android.stats.location.ExpirationBucket
8826            bucketized_expire_in = 9;
8827
8828    // Type of Callback passed in for this API.
8829    optional android.stats.location.CallbackType callback_type = 10;
8830
8831    // The radius of the central point of the alert
8832    // region, in meters. Only for API REQUEST_GEOFENCE.
8833    // Bucketized to reduce cardinality.
8834    optional android.stats.location.GeofenceRadiusBucket bucketized_radius = 11;
8835
8836    // Activity Importance of API caller.
8837    // Categorized to 3 types that are interesting from location's perspective.
8838    optional android.stats.location.ActivityImportance activiy_importance = 12;
8839}
8840
8841/**
8842 * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
8843 */
8844message ReviewPermissionsFragmentResultReported {
8845    // unique value identifying a permission group change. A permission group change might result
8846    // in multiple of these atoms
8847    optional int64 change_id = 1;
8848
8849    // UID of package the permission belongs to
8850    optional int32 uid = 2 [(is_uid) = true];
8851
8852    // Name of package the permission belongs to
8853    optional string package_name = 3;
8854
8855    // The permission to be granted
8856    optional string permission_name = 4;
8857
8858    // The result of the permission grant
8859    optional bool permission_granted = 5;
8860}
8861
8862/**
8863* Information about results of permission upgrade by RuntimePermissionsUpgradeController
8864* Logged from: RuntimePermissionUpdgradeController
8865*/
8866message RuntimePermissionsUpgradeResult {
8867    // Permission granted as result of upgrade
8868    optional string permission_name = 1;
8869
8870    // UID of package granted permission
8871    optional int32 uid = 2 [(is_uid) = true];
8872
8873    // Name of package granted permission
8874    optional string package_name = 3;
8875}
8876
8877/**
8878* Information about a buttons presented in GrantPermissionsActivty and choice made by user
8879*/
8880message GrantPermissionsActivityButtonActions {
8881    // Permission granted as result of upgrade
8882    optional string permission_group_name = 1;
8883
8884    // UID of package granted permission
8885    optional int32 uid = 2 [(is_uid) = true];
8886
8887    // Name of package requesting permission
8888    optional string package_name = 3;
8889
8890    // Buttons presented in the dialog - bit flags, bit numbers are in accordance with
8891    // LABEL_ constants in GrantPermissionActivity.java
8892    optional int32 buttons_presented = 4;
8893
8894    // Button clicked by user - same as bit flags in buttons_presented with only single bit set
8895    optional int32 button_clicked = 5;
8896
8897    // id which identifies single session of user interacting with permission controller
8898    optional int64 session_id = 6;
8899}
8900
8901/**
8902 * Information about LocationAccessCheck notification presented to user
8903 */
8904message LocationAccessCheckNotificationAction {
8905
8906    // id which identifies single session of user interacting with permission controller
8907    optional int64 session_id = 1;
8908
8909    // Uid of package for which location access check is presented
8910    optional int32 package_uid = 2;
8911
8912    // Name of package for which location access check is presented
8913    optional string package_name = 3;
8914
8915    enum Result {
8916        UNDEFINED = 0;
8917        // notification was presented to the user
8918        NOTIFICATION_PRESENTED = 1;
8919        // notification was declined by the user
8920        NOTIFICATION_DECLINED = 2;
8921        // notification was clicked by the user
8922        NOTIFICATION_CLICKED = 3;
8923    }
8924
8925    // View / interaction recorded
8926    optional Result result = 4;
8927}
8928
8929/**
8930 * Information about a permission grant or revoke made by user inside AppPermissionFragment
8931 */
8932message AppPermissionFragmentActionReported {
8933    // id which identifies single session of user interacting with permission controller
8934    optional int64 session_id = 1;
8935
8936    // unique value identifying a permission group change. A permission group change might result
8937    // in multiple of these atoms
8938    optional int64 change_id = 2;
8939
8940    // UID of package the permission belongs to
8941    optional int32 uid = 3 [(is_uid) = true];
8942
8943    // Name of package the permission belongs to
8944    optional string package_name = 4;
8945
8946    // The permission to be granted
8947    optional string permission_name = 5;
8948
8949    // The result of the permission grant
8950    optional bool permission_granted = 6;
8951
8952    // State of Permission Flags after grant as per android.content.pm.PermissionFlags
8953    optional int32 permission_flags = 7;
8954
8955    enum Button {
8956        UNDEFINED = 0;
8957        // Allow button
8958        ALLOW = 1;
8959        // Deny button
8960        DENY = 2;
8961        // Ask every time button
8962        ASK_EVERY_TIME = 3;
8963        // Allow all the time button
8964        ALLOW_ALWAYS = 4;
8965        // Allow only while using the app button
8966        ALLOW_FOREGROUND = 5;
8967        // Same is Deny button but shown in while in use dialog
8968        DENY_FOREGROUND = 6;
8969    }
8970
8971    // Button pressed in the dialog
8972    optional Button button_pressed = 8;
8973}
8974
8975/**
8976* Information about a AppPermissionFragment viewed by user
8977*/
8978message AppPermissionFragmentViewed {
8979    // id which identifies single session of user interacting with permission controller
8980    optional int64 session_id = 1;
8981
8982    // UID of package for which permissions are viewed
8983    optional int32 uid = 2 [(is_uid) = true];
8984
8985    // Name of package for which permissions are viewed
8986    optional string package_name = 3;
8987
8988    // Permission group viewed
8989    optional string permission_group_name = 4;
8990}
8991
8992/**
8993* Information about a AppPermissionGroupsFragment viewed by user. Fragment has been renamed, but
8994* the log retains the old fragment name.
8995*/
8996message AppPermissionsFragmentViewed {
8997    // id which identifies single session of user interacting with permission controller
8998    optional int64 session_id = 1;
8999
9000    // id which identifies single view as every view might have several logging records
9001    // with different package information attached
9002    optional int64 view_id = 2;
9003
9004    // Permission group viewed
9005    optional string permission_group_name = 3;
9006
9007    // UID of package for which permissions are viewed
9008    optional int32 uid = 4 [(is_uid) = true];
9009
9010    // Name of package for which permissions are viewed
9011    optional string package_name = 5;
9012
9013    // Category in which permission is included
9014    enum Category {
9015      UNDEFINED = 0;
9016      ALLOWED = 1;
9017      ALLOWED_FOREGROUND = 2;
9018      DENIED = 3;
9019    }
9020    optional Category category = 6;
9021}
9022/**
9023* Information about a PermissionAppsFragment viewed by user.
9024* Logged from ui/handheld/PermissionAppsFragment.java
9025*/
9026message PermissionAppsFragmentViewed {
9027    // id which identifies single session of user interacting with permission controller
9028    optional int64 session_id = 1;
9029
9030    // id which identifies single view as every view might have several logging records
9031    // with different package information attached
9032    optional int64 view_id = 2;
9033
9034    // Permission group viewed
9035    optional string permission_group_name = 3;
9036
9037    // UID of package for which permissions are viewed
9038    optional int32 uid = 4 [(is_uid) = true];
9039
9040    // Name of package for which permissions are viewed
9041    optional string package_name = 5;
9042
9043    // Category in which app is included
9044    enum Category {
9045        UNDEFINED = 0;
9046        ALLOWED = 1;
9047        ALLOWED_FOREGROUND = 2;
9048        DENIED = 3;
9049    }
9050    optional Category category = 6;
9051}
9052
9053/**
9054* Log that the Auto Revoke notification has been clicked
9055* Logged from ui/ManagePermissionsActivity
9056*/
9057message AutoRevokeNotificationClicked {
9058    // id which identifies single session of user interacting with permission controller
9059    optional int64 session_id = 1;
9060}
9061
9062/**
9063* Log that an app has been displayed on the auto revoke page, and lists one permission that was
9064* auto revoked for it.
9065* Logged from ui/handheld/AutoRevokeFragment
9066*/
9067message AutoRevokeFragmentAppViewed {
9068    // id which identifies single session of user interacting with permission controller
9069    optional int64 session_id = 1;
9070
9071    // UID of package for which permissions are viewed
9072    optional int32 uid = 2 [(is_uid) = true];
9073
9074    // Name of package for which permissions are viewed
9075    optional string package_name = 3;
9076
9077    // The name of a permission group that has been revoked
9078    optional string permission_group_name = 4;
9079
9080    // The age of the app- more than three months old, or more than six months
9081    enum Age {
9082        UNDEFINED = 0;
9083        NEWER_BUCKET = 1;
9084        OLDER_BUCKET = 2;
9085    }
9086
9087    // How long the app has been unused. Currently, newer bucket is 3 months, older is 6 months
9088    optional Age age = 5;
9089}
9090
9091/**
9092* Log that the user has interacted with an app on the auto revoke fragment
9093* Logged from ui/handheld/AutoRevokeFragment
9094*/
9095message AutoRevokedAppInteraction {
9096    // id which identifies single session of user interacting with permission controller
9097    optional int64 session_id = 1;
9098
9099    // UID of package for which permissions are viewed
9100    optional int32 uid = 2 [(is_uid) = true];
9101
9102    // Name of package for which permissions are viewed
9103    optional string package_name = 3;
9104
9105    enum Action {
9106        UNDEFINED = 0;
9107        REMOVE = 1;
9108        OPEN = 2;
9109        APP_INFO = 3;
9110        PERMISSIONS = 4;
9111        REMOVE_IN_SETTINGS = 5;
9112        OPEN_IN_SETTINGS = 6;
9113    }
9114
9115    // The action the user took to interact with the app
9116    optional Action action = 4;
9117}
9118
9119/**
9120* Log that the AppPermissionGroupsFragment has been interacted with for the possible purposes of
9121* auto revoke, or that the auto revoke switch has been changed
9122* Logged from ui/handheld/AppPermissionGroupsFragment
9123 */
9124message AppPermissionGroupsFragmentAutoRevokeAction {
9125    // id which identifies single session of user interacting with permission controller
9126    optional int64 session_id = 1;
9127
9128    // UID of package for which permissions are viewed
9129    optional int32 uid = 2 [(is_uid) = true];
9130
9131    // Name of package for which permissions are viewed
9132    optional string package_name = 3;
9133
9134    enum Action {
9135        UNDEFINED = 0;
9136        OPENED_FOR_AUTO_REVOKE = 1;
9137        OPENED_FROM_INTENT = 2;
9138        SWITCH_ENABLED = 3;
9139        SWITCH_DISABLED = 4;
9140    }
9141
9142    // The action the user took to interact with the fragment
9143    optional Action action = 4;
9144}
9145
9146/**
9147 * Logs when there is a smart selection related event.
9148 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
9149 * Logged from: TextClassifierEventLogger.java
9150 */
9151message TextSelectionEvent {
9152    // A session ID.
9153    optional string session_id = 1;
9154
9155    // Event type of this event.
9156    optional android.stats.textclassifier.EventType event_type = 2;
9157
9158    // Name of the annotator model that is involved in this event.
9159    optional string model_name = 3;
9160
9161    // Type of widget that was involved in triggering this event.
9162    optional android.stats.textclassifier.WidgetType widget_type = 4;
9163
9164    // Index of this event in a session.
9165    optional int32 event_index = 5;
9166
9167    // Entity type that is involved.
9168    optional string entity_type = 6;
9169
9170    // Relative word index of the start of the selection.
9171    optional int32 relative_word_start_index = 7;
9172
9173    // Relative word (exclusive) index of the end of the selection.
9174    optional int32 relative_word_end_index = 8;
9175
9176    // Relative word index of the start of the smart selection.
9177    optional int32 relative_suggested_word_start_index = 9;
9178
9179    // Relative word (exclusive) index of the end of the smart selection.
9180    optional int32 relative_suggested_word_end_index = 10;
9181
9182    // Name of source package.
9183    optional string package_name = 11;
9184
9185    // Name of the LangID model that is involved in this event.
9186    optional string langid_model_name = 12;
9187}
9188
9189/**
9190 * Logs when there is a smart linkify related event.
9191 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
9192 * Logged from: TextClassifierEventLogger.java
9193 */
9194message TextLinkifyEvent {
9195    // A session ID.
9196    optional string session_id = 1;
9197
9198    // Event type of this event.
9199    optional android.stats.textclassifier.EventType event_type = 2;
9200
9201    // Name of the annotator model that is involved in this event.
9202    optional string model_name = 3;
9203
9204    // Type of widget that was involved in triggering this event.
9205    optional android.stats.textclassifier.WidgetType widget_type = 4;
9206
9207    // Index of this event in a session.
9208    optional int32 event_index = 5;
9209
9210    // Entity type that is involved.
9211    optional string entity_type = 6;
9212
9213    // Number of links detected.
9214    optional int32 num_links = 7;
9215
9216    // The total length of all links.
9217    optional int32 linked_text_length = 8;
9218
9219    // Length of input text.
9220    optional int32 text_length = 9;
9221
9222    // Time spent on generating links in ms.
9223    optional int64 latency_millis = 10;
9224
9225    // Name of source package.
9226    optional string package_name = 11;
9227
9228    // Name of the LangID model that is involved in this event.
9229    optional string langid_model_name = 12;
9230}
9231
9232/**
9233 * Logs when there is a conversation actions related event.
9234 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
9235 * Logged from: TextClassifierEventLogger.java
9236 */
9237message ConversationActionsEvent {
9238    // A session ID.
9239    optional string session_id = 1;
9240
9241    // Event type of this event.
9242    optional android.stats.textclassifier.EventType event_type = 2;
9243
9244    // Name of the actions model that is involved in this event.
9245    optional string model_name = 3;
9246
9247    // Type of widget that was involved in triggering this event.
9248    optional android.stats.textclassifier.WidgetType widget_type = 4;
9249
9250    // The first entity type that is involved.
9251    optional string first_entity_type = 5;
9252
9253    // The second entity type that is involved.
9254    optional string second_entity_type = 6;
9255
9256    // The third entity type that is involved.
9257    optional string third_entity_type = 7;
9258
9259    // The score of the first entity type.
9260    optional float score = 8;
9261
9262    // Name of source package.
9263    optional string package_name = 9;
9264
9265    // Name of the annotator model that is involved in this event.
9266    optional string annotator_model_name = 10;
9267
9268    // Name of the LangID model that is involved in this event.
9269    optional string langid_model_name = 11;
9270}
9271
9272/**
9273 * Logs when there is a language detection related event.
9274 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
9275 * Logged from: TextClassifierEventLogger.java
9276 */
9277message LanguageDetectionEvent {
9278    // A session ID.
9279    optional string session_id = 1;
9280
9281    // Event type of this event.
9282    optional android.stats.textclassifier.EventType event_type = 2;
9283
9284    // Name of the language detection model that is involved in this event.
9285    optional string model_name = 3;
9286
9287    // Type of widget that was involved in triggering this event.
9288    optional android.stats.textclassifier.WidgetType widget_type = 4;
9289
9290    // Detected language.
9291    optional string language_tag = 5;
9292
9293    // Score of the detected language.
9294    optional float score = 6;
9295
9296    // Position of this action.
9297    optional int32 action_index = 7;
9298
9299    // Name of source package.
9300    optional string package_name = 8;
9301}
9302
9303/**
9304 * Information about an OTA update attempt by update_engine.
9305 * Logged from platform/system/update_engine/metrics_reporter_android.cc
9306 */
9307message UpdateEngineUpdateAttemptReported {
9308    // The number of attempts for the update engine to apply a given payload.
9309    optional int32 attempt_number = 1;
9310
9311    optional android.stats.otaupdate.PayloadType payload_type = 2;
9312
9313    // The total time in minutes for the update engine to apply a given payload.
9314    // The time is calculated by calling clock_gettime() / CLOCK_BOOTTIME; and
9315    // it's increased when the system is sleeping.
9316    optional int32 duration_boottime_in_minutes = 3;
9317
9318    // The total time in minutes for the update engine to apply a given payload.
9319    // The time is calculated by calling clock_gettime() / CLOCK_MONOTONIC_RAW;
9320    // and it's not increased when the system is sleeping.
9321    optional int32 duration_monotonic_in_minutes = 4;
9322
9323    // The size of the payload in MiBs.
9324    optional int32 payload_size_mib = 5;
9325
9326    // The attempt result reported by the update engine for an OTA update.
9327    optional android.stats.otaupdate.AttemptResult attempt_result = 6;
9328
9329    // The error code reported by the update engine after an OTA update attempt
9330    // on A/B devices.
9331    optional android.stats.otaupdate.ErrorCode error_code = 7;
9332
9333    // The build fingerprint of the source system. The value is read from a
9334    // system property when the device takes the update. e.g.
9335    // Android/aosp_sailfish/sailfish:10/QP1A.190425.004/5507117:userdebug/test-keys
9336    optional string source_fingerprint = 8;
9337
9338    // Size of super partition.
9339    optional int64 super_partition_size_bytes = 9;
9340
9341    // Size of current slot within the super partition.
9342    optional int64 slot_size_bytes = 10;
9343
9344    // Free space available in the super partition.
9345    optional int64 super_free_space_bytes = 11;
9346}
9347
9348/**
9349 * Information about all the attempts the device make before finishing the
9350 * successful update.
9351 * Logged from platform/system/update_engine/metrics_reporter_android.cc
9352 */
9353message UpdateEngineSuccessfulUpdateReported {
9354    // The number of attempts for the update engine to apply the payload for a
9355    // successful update.
9356    optional int32 attempt_count = 1;
9357
9358    optional android.stats.otaupdate.PayloadType payload_type = 2;
9359
9360    optional int32 payload_size_mib = 3;
9361
9362    // The total number of bytes downloaded by update_engine since the last
9363    // successful update.
9364    optional int32 total_bytes_downloaded_mib = 4;
9365
9366    // The ratio in percentage of the over-downloaded bytes compared to the
9367    // total bytes needed to successfully install the update. e.g. 200 if we
9368    // download 200MiB in total for a 100MiB package.
9369    optional int32 download_overhead_percentage = 5;
9370
9371    // The total time in minutes for the update engine to apply the payload for a
9372    // successful update.
9373    optional int32 total_duration_minutes = 6;
9374
9375    // The number of reboot of the device during a successful update.
9376    optional int32 reboot_count = 7;
9377}
9378
9379/**
9380 * Reported when the RebootEscrow HAL has attempted to recover the escrowed
9381 * key to indicate whether it was successful or not.
9382 *
9383 * Logged from:
9384 *   frameworks/base/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
9385 */
9386message RebootEscrowRecoveryReported {
9387    optional bool successful = 1;
9388}
9389
9390/**
9391 * Global display pipeline metrics reported by SurfaceFlinger.
9392 * Pulled from:
9393 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
9394 */
9395message SurfaceflingerStatsGlobalInfo {
9396    // Total number of frames presented during the tracing period
9397    optional int64 total_frames = 1;
9398    // Total number of frames missed
9399    optional int64 missed_frames = 2;
9400    // Total number of frames that fell back to client composition
9401    optional int64 client_composition_frames = 3;
9402    // Total time the display was turned on
9403    optional int64 display_on_millis = 4;
9404    // Total time that was spent performing animations.
9405    // This is derived from the present-to-present layer histogram
9406    optional int64 animation_millis = 5;
9407    // Total number of event connections tracked by SurfaceFlinger at the time
9408    // of this pull. If this number grows prohibitively large, then this can
9409    // cause jank due to resource contention.
9410    optional int32 event_connection_count = 6;
9411    // Set of timings measured from when SurfaceFlinger began compositing a
9412    // frame, until the frame was requested to be presented to the display. This
9413    // measures SurfaceFlinger's total CPU walltime on the critical path per
9414    // frame.
9415    optional FrameTimingHistogram frame_duration = 7
9416        [(android.os.statsd.log_mode) = MODE_BYTES];
9417    // Set of timings measured from when SurfaceFlinger first began using the
9418    // GPU to composite a frame, until the GPU has finished compositing that
9419    // frame. This measures the total additional time SurfaceFlinger needed to
9420    // perform due to falling back into GPU composition.
9421    optional FrameTimingHistogram render_engine_timing = 8
9422        [(android.os.statsd.log_mode) = MODE_BYTES];
9423}
9424
9425/**
9426 * Per-layer display pipeline metrics reported by SurfaceFlinger.
9427 * The number of layers uploaded will be restricted due to size limitations.
9428 * Pulled from:
9429 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
9430 */
9431message SurfaceflingerStatsLayerInfo {
9432    // The layer for this set of metrics
9433    // For now we can infer that the package name is included in the layer
9434    // name.
9435    optional string layer_name = 1;
9436    // Total number of frames presented
9437    optional int64 total_frames = 2;
9438    // Total number of dropped frames while latching a buffer for this layer.
9439    optional int64 dropped_frames = 3;
9440    // Set of timings measured between successive presentation timestamps.
9441    optional FrameTimingHistogram present_to_present = 4
9442        [(android.os.statsd.log_mode) = MODE_BYTES];
9443    // Set of timings measured from when an app queued a buffer for
9444    // presentation, until the buffer was actually presented to the
9445    // display.
9446    optional FrameTimingHistogram post_to_present = 5
9447        [(android.os.statsd.log_mode) = MODE_BYTES];
9448    // Set of timings measured from when a buffer is ready to be presented,
9449    // until the buffer was actually presented to the display.
9450    optional FrameTimingHistogram acquire_to_present = 6
9451        [(android.os.statsd.log_mode) = MODE_BYTES];
9452    // Set of timings measured from when a buffer was latched by
9453    // SurfaceFlinger, until the buffer was presented to the display
9454    optional FrameTimingHistogram latch_to_present = 7
9455        [(android.os.statsd.log_mode) = MODE_BYTES];
9456    // Set of timings measured from the desired presentation to the actual
9457    // presentation time
9458    optional FrameTimingHistogram desired_to_present = 8
9459        [(android.os.statsd.log_mode) = MODE_BYTES];
9460    // Set of timings measured from when an app queued a buffer for
9461    // presentation, until the buffer was ready to be presented.
9462    optional FrameTimingHistogram post_to_acquire = 9
9463        [(android.os.statsd.log_mode) = MODE_BYTES];
9464    // Frames missed latch because the acquire fence didn't fire
9465    optional int64 late_acquire_frames = 10;
9466    // Frames latched early because the desired present time was bad
9467    optional int64 bad_desired_present_frames = 11;
9468}
9469
9470/**
9471 * Histogram of frame counts bucketed by time in milliseconds.
9472 * Because of size limitations, we hard-cap the number of buckets, with
9473 * buckets for corresponding to larger milliseconds being less precise.
9474 */
9475message FrameTimingHistogram {
9476    // Timings in milliseconds that describes a set of histogram buckets
9477    repeated int32 time_millis_buckets = 1;
9478    // Number of frames that match to each time_millis, i.e. the bucket
9479    // contents
9480    // It's required that len(time_millis) == len(frame_count)
9481    repeated int64 frame_counts = 2;
9482}
9483
9484/**
9485 * Janky event as reported by SurfaceFlinger.
9486 * This event is intended to be consumed by a Perfetto subscriber for
9487 * automated trace collection.
9488 *
9489 * Logged from:
9490 *    frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9491 */
9492message DisplayJankReported {
9493    // Informational field for how long the janky event lasted in milliseconds
9494    optional int64 event_duration_millis = 1;
9495    // Number of frame deadlines missed, where SurfaceFlinger failed to update
9496    // the display on time.
9497    optional int32 present_deadlines_missed = 2;
9498}
9499
9500/**
9501 * Information about camera facing and API level usage.
9502 * Logged from:
9503 *   frameworks/base/services/core/java/com/android/server/camera/CameraServiceProxy.java
9504 */
9505message CameraActionEvent {
9506    // Camera session duration
9507    optional int64 duration_millis = 1;
9508
9509    // Camera API level used
9510    optional int32 api_level = 2;
9511
9512    // Name of client package
9513    optional string package_name = 3;
9514
9515    // Camera facing
9516    enum Facing {
9517        UNKNOWN = 0;
9518        BACK = 1;
9519        FRONT = 2;
9520        EXTERNAL = 3;
9521    }
9522    optional Facing facing = 4;
9523}
9524
9525/**
9526 * Logs when a compatibility change is affecting an app.
9527 *
9528 * Logged from:
9529 *   frameworks/base/core/java/android/app/AppCompatCallbacks.java and
9530 *   frameworks/base/services/core/java/com/android/server/compat/PlatformCompat.java
9531 */
9532message AppCompatibilityChangeReported {
9533    // The UID of the app being affected by the compatibilty change.
9534    optional int32 uid = 1 [(is_uid) = true];
9535
9536    // The ID of the change affecting the app.
9537    optional int64 change_id = 2;
9538
9539    enum State {
9540        UNKNOWN_STATE = 0;
9541        ENABLED = 1;
9542        DISABLED = 2;
9543        LOGGED = 3;
9544    }
9545
9546    // The state of the change - if logged from gating whether it was enabled or disabled, or just
9547    // logged otherwise.
9548    optional State state = 3;
9549
9550    enum Source {
9551        UNKNOWN_SOURCE = 0;
9552        APP_PROCESS = 1;
9553        SYSTEM_SERVER = 2;
9554    }
9555
9556    // Where it was logged from.
9557    optional Source source = 4;
9558
9559}
9560
9561/**
9562 * Logged from
9563 *     external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
9564 */
9565message PerfettoUploaded {
9566    enum Event {
9567        PERFETTO_UNDEFINED = 0;
9568        PERFETTO_TRACE_BEGIN = 1;
9569        PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
9570        PERFETTO_ON_CONNECT = 3;
9571        PERFETTO_ON_TRACING_DISABLED = 4;
9572        PERFETTO_UPLOAD_DROPBOX_BEGIN = 5;
9573        PERFETTO_UPLOAD_DROPBOX_SUCCESS = 6;
9574        PERFETTO_UPLOAD_DROPBOX_FAILURE = 7;
9575        PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
9576        PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9;
9577        PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
9578        PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
9579        PERFETTO_TRIGGER_BEGIN = 12;
9580        PERFETTO_TRIGGER_SUCCESS = 13;
9581        PERFETTO_TRIGGER_FAILURE = 14;
9582        PERFETTO_HIT_GUARDRAILS = 15;
9583        PERFETTO_ON_TIMEOUT = 16;
9584        PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
9585    }
9586
9587    // Which stage of the pipeline we are reporting from.
9588    optional Event event = 1;
9589
9590    // UUID matching the one set inside the SystemInfo trace packet.
9591    optional int64 trace_uuid_lsb = 2;
9592    optional int64 trace_uuid_msb = 3;
9593}
9594
9595/**
9596 * Pulls client metrics on data transferred via Vehicle Maps Service.
9597 * Metrics are keyed by uid + layer.
9598 *
9599 * Pulled from:
9600 *   packages/services/Car/service/src/com/android/car/stats/CarStatsService.java
9601 */
9602message VmsClientStats {
9603    // UID of the VMS client app
9604    optional int32 uid = 1 [(is_uid) = true];
9605
9606    // VMS layer definition
9607    optional int32 layer_type = 2;
9608    optional int32 layer_channel = 3;
9609    optional int32 layer_version = 4;
9610
9611    // Bytes and packets sent by the client for the layer
9612    optional int64 tx_bytes = 5;
9613    optional int64 tx_packets = 6;
9614
9615    // Bytes and packets received by the client for the layer
9616    optional int64 rx_bytes = 7;
9617    optional int64 rx_packets = 8;
9618
9619    // Bytes and packets dropped due to client error
9620    optional int64 dropped_bytes = 9;
9621    optional int64 dropped_packets = 10;
9622}
9623
9624/**
9625 * State of a dangerous permission requested by a package - sampled
9626 * Pulled from: StatsCompanionService.java with data obtained from PackageManager API
9627*/
9628message DangerousPermissionStateSampled {
9629    // Name of the permission
9630    optional string permission_name = 1;
9631
9632    // Uid of the package
9633    optional int32 uid = 2 [(is_uid) = true];
9634
9635    // If the permission is granted to the uid
9636    optional bool is_granted = 3;
9637
9638    // Permission flags as per android.content.pm.PermissionFlags
9639    optional int32 permission_flags = 4;
9640}
9641
9642/**
9643 * HWUI stats for a given app.
9644 */
9645message GraphicsStats {
9646    // The package name of the app
9647    optional string package_name = 1;
9648
9649    // The version code of the app
9650    optional int64 version_code = 2;
9651
9652    // The start & end timestamps in UTC as
9653    // milliseconds since January 1, 1970
9654    // Compatible with java.util.Date#setTime()
9655    optional int64 start_millis = 3;
9656
9657    optional int64 end_millis = 4;
9658
9659    // HWUI renders pipeline type: GL (1) or Vulkan (2).
9660    enum PipelineType {
9661        UNKNOWN = 0;
9662        GL = 1;
9663        VULKAN = 2;
9664    }
9665
9666    // HWUI renders pipeline type: GL or Vulkan.
9667    optional PipelineType pipeline = 5;
9668
9669    // Distinct frame count.
9670    optional int32 total_frames = 6;
9671
9672    // Number of "missed vsync" events.
9673    optional int32 missed_vsync_count = 7;
9674
9675    // Number of frames in triple-buffering scenario (high input latency)
9676    optional int32 high_input_latency_count = 8;
9677
9678    // Number of "slow UI thread" events.
9679    optional int32 slow_ui_thread_count = 9;
9680
9681    // Number of "slow bitmap upload" events.
9682    optional int32 slow_bitmap_upload_count = 10;
9683
9684    // Number of "slow draw" events.
9685    optional int32 slow_draw_count = 11;
9686
9687    // Number of frames that missed their deadline (aka, visibly janked)
9688    optional int32 missed_deadline_count = 12;
9689
9690    // The frame time histogram for the package
9691    optional FrameTimingHistogram cpu_histogram = 13
9692    [(android.os.statsd.log_mode) = MODE_BYTES];
9693
9694    // The gpu frame time histogram for the package
9695    optional FrameTimingHistogram gpu_histogram = 14
9696    [(android.os.statsd.log_mode) = MODE_BYTES];
9697
9698    // UI mainline module version.
9699    optional int64 version_ui_module = 15;
9700
9701    // If true, these are HWUI stats for up to a 24h period for a given app from today.
9702    // If false, these are HWUI stats for a 24h period for a given app from the last complete
9703    // day (yesterday). Stats from yesterday stay constant, while stats from today may change as
9704    // more apps are running / rendering.
9705    optional bool is_today = 16;
9706}
9707
9708/**
9709 * Message related to dangerous (runtime) app ops access
9710 */
9711message RuntimeAppOpAccess {
9712    // Uid of the package accessing app op
9713    optional int32 uid = 1 [(is_uid) = true];
9714
9715    // Name of the package accessing app op
9716    optional string package_name = 2;
9717
9718    // deprecated - set to empty string
9719    optional string op_deprecated = 3 [deprecated = true];
9720
9721    // attribution_tag; provided by developer when accessing related API, limited at 50 chars by
9722    // API. Attributions must be provided through manifest using <attribution> tag available in R
9723    // and above.
9724    optional string attribution_tag = 4;
9725
9726    // message related to app op access, limited to 600 chars by API
9727    optional string message = 5;
9728
9729    enum SamplingStrategy {
9730        DEFAULT = 0;
9731        UNIFORM = 1;
9732        RARELY_USED = 2;
9733        BOOT_TIME_SAMPLING = 3;
9734        UNIFORM_OPS = 4;
9735    }
9736
9737    // sampling strategy used to collect this message
9738    optional SamplingStrategy sampling_strategy = 6;
9739
9740    // operation id
9741    optional android.app.AppOpEnum op = 7 [default = APP_OP_NONE];
9742}
9743
9744/*
9745 * Logs userspace reboot outcome and duration.
9746 *
9747 * Logged from:
9748 *   frameworks/base/core/java/com/android/server/BootReceiver.java
9749 */
9750message UserspaceRebootReported {
9751    // Possible outcomes of userspace reboot.
9752    enum Outcome {
9753        // Default value in case platform failed to determine the outcome.
9754        OUTCOME_UNKNOWN = 0;
9755        // Userspace reboot succeeded (i.e. boot completed without a fall back to hard reboot).
9756        SUCCESS = 1;
9757        // Userspace reboot shutdown sequence was aborted.
9758        FAILED_SHUTDOWN_SEQUENCE_ABORTED = 2;
9759        // Remounting userdata into checkpointing mode failed.
9760        FAILED_USERDATA_REMOUNT = 3;
9761        // Device didn't finish booting before timeout and userspace reboot watchdog issued a hard
9762        // reboot.
9763        FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED = 4;
9764    }
9765    // Outcome of userspace reboot. Always set.
9766    optional Outcome outcome = 1;
9767    // Duration of userspace reboot in case it has a successful outcome.
9768    // Duration is measured as time between userspace reboot was initiated and until boot completed
9769    // (e.g. sys.boot_completed=1).
9770    optional int64 duration_millis = 2;
9771    // State of primary user's (user0) credential encryption storage.
9772    enum UserEncryptionState {
9773        // Default value.
9774        USER_ENCRYPTION_STATE_UNKNOWN = 0;
9775        // Credential encrypted storage is unlocked.
9776        UNLOCKED = 1;
9777        // Credential encrypted storage is locked.
9778        LOCKED = 2;
9779    }
9780    // State of primary user's encryption storage at the moment boot completed. Always set.
9781    optional UserEncryptionState user_encryption_state = 3;
9782}
9783
9784/*
9785 * Logs integrity check information during each install.
9786 *
9787 * Logged from:
9788 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
9789 */
9790message IntegrityCheckResultReported {
9791    optional string package_name = 1;
9792    optional string app_certificate_hash = 2;
9793    optional int64 version_code = 3;
9794    optional string installer_package_name = 4;
9795    enum Response {
9796        UNKNOWN = 0;
9797        ALLOWED = 1;
9798        REJECTED = 2;
9799        FORCE_ALLOWED = 3;
9800    }
9801    optional Response response = 5;
9802    // An estimate on the cause of the response. This will only be populated for
9803    // REJECTED and FORCE_ALLOWED
9804    optional bool caused_by_app_cert_rule = 6;
9805    optional bool caused_by_installer_rule = 7;
9806}
9807
9808/**
9809 * Logs the information about the rules and the provider whenever rules are
9810 * pushed into AppIntegrityManager.
9811 *
9812 * Logged from:
9813 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
9814 */
9815message IntegrityRulesPushed {
9816    optional bool success = 1;
9817    // Package name of the app that pushed the rules.
9818    optional string rule_provider = 2;
9819    // Version string of arbitrary format provided by the rule provider to
9820    // identify the rules.
9821    optional string rule_version = 3;
9822}
9823
9824/**
9825 * Logs when a cell broadcast message is received on the device.
9826 *
9827 * Logged from Cell Broadcast module and platform:
9828 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
9829 *   packages/apps/CellBroadcastReceiver/
9830 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/CellBroadcastServiceManager.java
9831 */
9832message CellBroadcastMessageReported {
9833    // The type of Cell Broadcast message
9834    enum CbType {
9835        UNKNOWN_TYPE = 0;
9836        GSM = 1;
9837        CDMA = 2;
9838        CDMA_SPC = 3;
9839    }
9840
9841    // The parts of the cell broadcast message pipeline
9842    enum ReportSource {
9843        UNKNOWN_SOURCE = 0;
9844        FRAMEWORK = 1;
9845        CB_SERVICE = 2;
9846        CB_RECEIVER_APP = 3;
9847    }
9848
9849    // GSM, CDMA, CDMA-SCP
9850    optional CbType type = 1;
9851
9852    // The source of the report
9853    optional ReportSource source = 2;
9854}
9855
9856/**
9857 * Logs when a cell broadcast message is filtered out, or otherwise intentionally not sent to CBR.
9858 *
9859 * Logged from CellBroadcastService module:
9860 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
9861 */
9862message CellBroadcastMessageFiltered {
9863    enum FilterReason {
9864        NOT_FILTERED = 0;
9865        DUPLICATE_MESSAGE = 1;
9866        GEOFENCED_MESSAGE = 2;
9867        AREA_INFO_MESSAGE = 3;
9868    }
9869
9870    // GSM, CDMA, CDMA-SCP
9871    optional CellBroadcastMessageReported.CbType type = 1;
9872
9873    // The source of the report
9874    optional FilterReason filter = 2;
9875}
9876
9877/**
9878 * Logs when an error occurs while handling a cell broadcast message;
9879 *
9880 * Logged from CellBroadcastService module:
9881 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
9882 */
9883message CellBroadcastMessageError {
9884    // The type of error raised when trying to handle a cell broadcast message
9885    enum ErrorType {
9886        UNKNOWN_TYPE = 0;
9887        CDMA_DECODING_ERROR = 1;
9888        CDMA_SCP_EMPTY = 2;
9889        CDMA_SCP_HANDLING_ERROR = 3;
9890        GSM_INVALID_HEADER_LENGTH = 4;
9891        GSM_UNSUPPORTED_HEADER_MESSAGE_TYPE = 5;
9892        GSM_UNSUPPORTED_HEADER_DATA_CODING_SCHEME = 6;
9893        GSM_INVALID_PDU = 7;
9894        GSM_INVALID_GEO_FENCING_DATA = 8;
9895        GSM_UMTS_INVALID_WAC = 9;
9896        FAILED_TO_INSERT_TO_DB = 10;
9897        UNEXPECTED_GEOMETRY_FROM_FWK = 11;
9898        UNEXPECTED_GSM_MESSAGE_TYPE_FROM_FWK = 12;
9899        UNEXPECTED_CDMA_MESSAGE_TYPE_FROM_FWK = 13;
9900        UNEXPECTED_CDMA_SCP_MESSAGE_TYPE_FROM_FWK = 14;
9901        NO_CONNECTION_TO_CB_SERVICE = 15;
9902    }
9903
9904    // What kind of error occurred
9905    optional ErrorType type = 1;
9906
9907    // Exception message (or log message) associated with the error (max 1000 chars)
9908    optional string exception_message = 2;
9909}
9910
9911/**
9912 * Logs when a tune occurs through device's Frontend.
9913 * This is atom ID 276.
9914 *
9915 * Logged from:
9916 *   frameworks/base/media/java/android/media/tv/tuner/Tuner.java
9917 */
9918message TvTunerStateChanged {
9919    enum State {
9920        UNKNOWN = 0;
9921        TUNING = 1; // Signal is tuned
9922        LOCKED = 2;    // the signal is locked
9923        NOT_LOCKED = 3; // the signal isn’t locked.
9924        SIGNAL_LOST = 4; // the signal was locked, but is lost now.
9925        SCANNING = 5; // the signal is scanned
9926        SCAN_STOPPED = 6; // the scan is stopped.
9927    }
9928    // The uid of the application that sent this custom atom.
9929    optional int32 uid = 1 [(is_uid) = true];
9930    //  new state
9931    optional State state = 2;
9932}
9933
9934/**
9935 * Logs the status of a dvr playback or record.
9936 * This is atom ID 279.
9937 *
9938 * Logged from:
9939 *   frameworks/base/media/java/android/media/tv/tuner/dvr
9940 */
9941message TvTunerDvrStatus {
9942    enum Type {
9943        UNKNOWN_TYPE = 0;
9944        PLAYBACK = 1; // is a playback
9945        RECORD = 2; // is a record
9946    }
9947    enum State {
9948        UNKNOWN_STATE = 0;
9949        STARTED = 1; // DVR is started
9950        STOPPED = 2; // DVR is stopped
9951    }
9952    // The uid of the application that sent this custom atom.
9953    optional int32 uid = 1 [(is_uid) = true];
9954    // DVR type
9955    optional Type type = 2;
9956    //  DVR state
9957    optional State state = 3;
9958    //  Identify the segment of a record or playback
9959    optional int32 segment_id = 4;
9960    // indicate how many overflow or underflow happened between started to stopped
9961    optional int32 overflow_underflow_count = 5;
9962}
9963
9964/**
9965 * Logs when a cas session opened through MediaCas.
9966 * This is atom ID 280.
9967 *
9968 * Logged from:
9969 *   frameworks/base/media/java/android/media/MediaCas.java
9970 */
9971message TvCasSessionOpenStatus {
9972    enum State {
9973        UNKNOWN = 0;
9974        SUCCEEDED = 1; // indicate that the session is opened successfully.
9975        FAILED = 2; // indicate that the session isn’t opened successfully.
9976    }
9977    // The uid of the application that sent this custom atom.
9978    optional int32 uid = 1 [(is_uid) = true];
9979    //  Cas system Id
9980    optional int32 cas_system_id = 2;
9981    // State of the session
9982    optional State state = 3;
9983}
9984
9985/**
9986 * Logs for ContactsProvider general usage.
9987 * This is atom ID 301.
9988 *
9989 * Logged from:
9990 *   packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
9991 */
9992message ContactsProviderStatusReported {
9993    enum ApiType {
9994        UNKNOWN_API = 0;
9995        QUERY = 1;
9996        // INSERT includes insert and bulkInsert, and inserts triggered by applyBatch.
9997        INSERT = 2;
9998        // UPDATE and DELETE includes update/delete and the ones triggered by applyBatch.
9999        UPDATE = 3;
10000        DELETE = 4;
10001    }
10002
10003    enum ResultType {
10004        UNKNOWN_RESULT = 0;
10005        SUCCESS = 1;
10006        FAIL = 2;
10007        ILLEGAL_ARGUMENT = 3;
10008        UNSUPPORTED_OPERATION = 4;
10009    }
10010
10011    enum CallerType {
10012        UNSPECIFIED_CALLER_TYPE = 0;
10013        CALLER_IS_SYNC_ADAPTER = 1;
10014        CALLER_IS_NOT_SYNC_ADAPTER = 2;
10015    }
10016
10017    optional ApiType api_type = 1;
10018    // Defined in
10019    // packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
10020    optional int32 uri_type = 2;
10021    optional CallerType caller_type = 3;
10022    optional ResultType result_type = 4;
10023    optional int32 result_count = 5;
10024    optional int64 latency_micros = 6;
10025}
10026
10027/**
10028 * Logs when an app is frozen or unfrozen.
10029 *
10030 * Logged from:
10031 *   frameworks/base/services/core/java/com/android/server/am/CachedAppOptimizer.java
10032 */
10033message AppFreezeChanged {
10034    // The type of event.
10035    enum Action {
10036        UNKNOWN = 0;
10037        FREEZE_APP = 1;
10038        UNFREEZE_APP = 2;
10039    }
10040    optional Action action = 1;
10041
10042    // Pid of the process being frozen.
10043    optional int32 pid = 2;
10044
10045    // Name of the process being frozen.
10046    optional string process_name = 3;
10047
10048    // Time since last unfrozen.
10049    optional int64 time_unfrozen_millis = 4;
10050}
10051
10052/**
10053 * Pulls information for a single voice call.
10054 *
10055 * Each pull creates multiple atoms, one for each call. The sequence is randomized when pulled.
10056 *
10057 * Pulled from:
10058 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
10059 */
10060message VoiceCallSession {
10061    // Bearer (IMS or CS) when the call started.
10062    optional android.telephony.CallBearerEnum bearer_at_start = 1;
10063
10064    // Bearer (IMS or CS) when the call ended.
10065    // The bearer may change during the call, e.g. due to SRVCC.
10066    optional android.telephony.CallBearerEnum bearer_at_end = 2;
10067
10068    // Direction of the call (incoming or outgoing).
10069    optional android.telephony.CallDirectionEnum direction = 3;
10070
10071    // Time spent setting up the call.
10072    optional android.telephony.CallSetupDurationEnum setup_duration = 4;
10073
10074    // Whether the call ended before the setup was completed.
10075    optional bool setup_failed = 5;
10076
10077    // IMS reason code or CS disconnect cause.
10078    // For IMS, see: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
10079    // For CS, see: frameworks/base/telephony/java/android/telephony/DisconnectCause.java
10080    optional int32 disconnect_reason_code = 6;
10081
10082    // IMS extra code or CS precise disconnect cause.
10083    // For IMS, this code is vendor-specific
10084    // For CS, see: frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java
10085    optional int32 disconnect_extra_code = 7;
10086
10087    // IMS extra message or CS vendor cause.
10088    optional string disconnect_extra_message = 8;
10089
10090    // Radio access technology (RAT) used when call started.
10091    optional android.telephony.NetworkTypeEnum rat_at_start = 9;
10092
10093    // Radio access technology (RAT) used when call terminated.
10094    optional android.telephony.NetworkTypeEnum rat_at_end = 10;
10095
10096    // Number of times RAT changed during the call.
10097    optional int64 rat_switch_count = 11;
10098
10099    // A bitmask of all codecs used during the call.
10100    // See: frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java
10101    optional int64 codec_bitmask = 12;
10102
10103    // Number of other calls going on during call setup, for the same SIM slot.
10104    optional int32 concurrent_call_count_at_start = 13;
10105
10106    // Number of other calls going on during call termination, for the same SIM slot.
10107    optional int32 concurrent_call_count_at_end = 14;
10108
10109    // Index of the SIM is used, 0 for single-SIM devices.
10110    optional int32 sim_slot_index = 15;
10111
10112    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
10113    optional bool is_multi_sim = 16;
10114
10115    // Whether the call was made with an eSIM profile.
10116    optional bool is_esim = 17;
10117
10118    // Carrier ID of the SIM card.
10119    // See https://source.android.com/devices/tech/config/carrierid.
10120    optional int32 carrier_id = 18;
10121
10122    // Whether an SRVCC has been completed successfully for this call.
10123    optional bool srvcc_completed = 19;
10124
10125    // Number of SRVCC failures.
10126    optional int64 srvcc_failure_count = 20;
10127
10128    // Number of SRVCC cancellations.
10129    optional int64 srvcc_cancellation_count = 21;
10130
10131    // Whether the Real-Time Text (RTT) was ever used in the call (rather than whether RTT was
10132    // enabled in the dialer's settings).
10133    optional bool rtt_enabled = 22;
10134
10135    // Whether this was an emergency call.
10136    optional bool is_emergency = 23;
10137
10138    // Whether the call was performed while roaming.
10139    optional bool is_roaming = 24;
10140
10141    // A random number used as the dimension field to pull multiple atoms.
10142    optional int32 dimension = 25;
10143}
10144
10145/**
10146 * Pulls voice call radio access technology (RAT) usage.
10147 *
10148 * Each pull creates multiple atoms, one for each carrier/RAT, the order of which is irrelevant to
10149 * time. The atom will be skipped if not enough data is available.
10150 *
10151 * Pulled from:
10152 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
10153 */
10154message VoiceCallRatUsage {
10155    // Carrier ID (https://source.android.com/devices/tech/config/carrierid).
10156    optional int32 carrier_id = 1;
10157
10158    // Radio access technology.
10159    optional android.telephony.NetworkTypeEnum rat = 2;
10160
10161    // Total duration that voice calls spent on this carrier and RAT.
10162    optional int64 total_duration_seconds = 3;
10163
10164    // Total number of calls using this carrier and RAT.
10165    // A call is counted once even if it used the RAT multiple times.
10166    optional int64 call_count = 4;
10167}
10168
10169/**
10170 * Pulls the number of active SIM slots and SIMs/eSIM profiles.
10171 *
10172 * Pulled from:
10173 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
10174 */
10175message SimSlotState {
10176    // Number of active SIM slots (both physical and eSIM profiles) in the device.
10177    optional int32 active_slot_count = 1;
10178
10179    // Number of SIM cards (both physical and active eSIM profiles).
10180    // This number is always equal to or less than the number of active SIM slots.
10181    optional int32 sim_count = 2;
10182
10183    // Number of active eSIM profiles.
10184    // This number is always equal to or less than the number of SIMs.
10185    optional int32 esim_count = 3;
10186}
10187
10188/**
10189 * Pulls supported cellular radio access technologies.
10190 *
10191 * This atom reports the capabilities of the device, rather than the network it has access to.
10192 *
10193 * Pulled from:
10194 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
10195 */
10196message SupportedRadioAccessFamily {
10197    // A bitmask of supported radio technologies.
10198    // See android.telephony.TelephonyManager.NetworkTypeBitMask.
10199    optional int64 network_type_bitmask = 1;
10200}
10201
10202/**
10203 * Logs gnss stats from location service provider
10204 *
10205 * Pulled from:
10206 *  frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
10207 */
10208
10209message GnssStats {
10210    // Number of location reports since boot
10211    optional int64 location_reports = 1;
10212
10213    // Total pulled reports of Location failures since boot
10214    optional int64 location_failure_reports = 2;
10215
10216    // Number of time to first fix reports since boot
10217    optional int64 time_to_first_fix_reports = 3;
10218
10219    // Total pulled reported time to first fix (in milli-seconds) since boot
10220    optional int64 time_to_first_fix_millis = 4;
10221
10222    // Number of position accuracy reports since boot
10223    optional int64 position_accuracy_reports = 5;
10224
10225    // Total pulled reported position accuracy (in meters) since boot
10226    optional int64 position_accuracy_meters = 6;
10227
10228    // Number of top 4 average CN0 reports since boot
10229    optional int64 top_four_average_cn0_reports = 7;
10230
10231    // Total pulled reported of top 4 average CN0 (dB-mHz) since boot
10232    optional int64 top_four_average_cn0_db_mhz = 8;
10233
10234    // Number of l5 top 4 average CN0 reports since boot
10235    optional int64 l5_top_four_average_cn0_reports = 9;
10236
10237    // Total pulled reported of l5 top 4 average CN0 (dB-mHz) since boot
10238    optional int64 l5_top_four_average_cn0_db_mhz = 10;
10239
10240    // Total number of sv status messages reports since boot
10241    optional int64 sv_status_reports = 11;
10242
10243    // Total number of sv status messages reports, where sv is used in fix since boot
10244    optional int64 sv_status_reports_used_in_fix = 12;
10245
10246    // Total number of L5 sv status messages reports since boot
10247    optional int64 l5_sv_status_reports = 13;
10248
10249    // Total number of L5 sv status messages reports, where sv is used in fix since boot
10250    optional int64 l5_sv_status_reports_used_in_fix = 14;
10251}
10252
10253/**
10254 * Logs when an app is moved to a different standby bucket.
10255 *
10256 * Logged from:
10257 *   frameworks/base/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
10258 */
10259message AppStandbyBucketChanged {
10260    optional string package_name = 1;
10261
10262    // Should be 0, 10, 11, 12, etc. where 0 is the owner. See UserHandle for more documentation.
10263    optional int32 user_id = 2;
10264
10265    // These enum values match the constants defined in UsageStatsManager.java.
10266    enum Bucket {
10267        BUCKET_UNKNOWN = 0;
10268        BUCKET_EXEMPTED = 5;
10269        BUCKET_ACTIVE = 10;
10270        BUCKET_WORKING_SET = 20;
10271        BUCKET_FREQUENT = 30;
10272        BUCKET_RARE = 40;
10273        BUCKET_RESTRICTED = 45;
10274        BUCKET_NEVER = 50;
10275    }
10276    optional Bucket bucket = 3;
10277
10278    enum MainReason {
10279        MAIN_UNKNOWN = 0;
10280        MAIN_DEFAULT = 0x0100;
10281        MAIN_TIMEOUT = 0x0200;
10282        MAIN_USAGE = 0x0300;
10283        MAIN_FORCED_BY_USER = 0x0400;
10284        MAIN_PREDICTED = 0x0500;
10285        MAIN_FORCED_BY_SYSTEM = 0x0600;
10286    }
10287    optional MainReason main_reason = 4;
10288
10289    // A more detailed reason for the standby bucket change. The sub reason name is dependent on
10290    // the main reason. Values are one of the REASON_SUB_XXX constants defined in
10291    // UsageStatsManager.java.
10292    optional int32 sub_reason = 5;
10293}
10294
10295/**
10296* Reports a started sharesheet transaction.
10297*
10298* Logged from:
10299*   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java
10300*/
10301message SharesheetStarted {
10302    // The event_id (as for UiEventReported).
10303    optional int32 event_id = 1;
10304    // The calling app's package name.
10305    optional string package_name = 2;
10306    // An identifier to tie together multiple logs relating to the same share event
10307    optional int32 instance_id = 3;
10308    // The mime type of the share
10309    optional string mime_type = 4;
10310    // The number of direct targets the calling app is providing that will be shown.
10311    optional int32 num_app_provided_direct_targets = 5;
10312    // The number of app targets the calling app is providing that will be shown.
10313    optional int32 num_app_provided_app_targets = 6;
10314    // True if the share originates from the workprofile
10315    optional bool is_workprofile = 7;
10316
10317    enum SharesheetPreviewType {  // Constants from ChooserActivity.java
10318        CONTENT_PREVIEW_TYPE_UNKNOWN = 0;  // Default for proto 2 / 3 compatibility.
10319        CONTENT_PREVIEW_IMAGE = 1;  // The preview shown in the sharesheet is an image.
10320        CONTENT_PREVIEW_FILE = 2;  // The preview shown in the sharesheet is a file.
10321        CONTENT_PREVIEW_TEXT = 3;  // The preview shown in the sharesheet is text.
10322    }
10323    // How the sharesheet preview is presented.
10324    optional SharesheetPreviewType preview_type = 8;
10325
10326    enum ResolverActivityIntent { // Intents handled by ResolverActivity.java
10327        INTENT_DEFAULT = 0;
10328        INTENT_ACTION_VIEW = 1;
10329        INTENT_ACTION_EDIT = 2;
10330        INTENT_ACTION_SEND = 3;
10331        INTENT_ACTION_SENDTO = 4;
10332        INTENT_ACTION_SEND_MULTIPLE = 5;
10333        INTENT_ACTION_IMAGE_CAPTURE = 6;
10334        INTENT_ACTION_MAIN = 7;
10335    }
10336    // The intent being processed (only SEND and SEND_MULTIPLE are system sharesheet)
10337    optional ResolverActivityIntent intent_type = 9;
10338}
10339
10340/**
10341 * Reports a ranking selection event.
10342 *
10343 * Logged from:
10344 *   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java (sharesheet)
10345 */
10346message RankingSelected {
10347    // The event_id (as for UiEventReported).
10348    optional int32 event_id = 1;
10349    // The relevant app's package name (can be source or picked package).
10350    optional string package_name = 2;
10351    // An identifier to tie together multiple logs relating to the same share event.
10352    optional int32 instance_id = 3;
10353    // Which of the ranked targets got picked, default starting position 0.
10354    optional int32 position_picked = 4;
10355}
10356
10357/**
10358 * Logs when TvSettings UI is interacted at.
10359 *
10360 * Logged from: packages/apps/TvSettings
10361 */
10362message TvSettingsUIInteracted {
10363
10364    /** The UI action category */
10365    optional android.app.tvsettings.Action action = 1;
10366
10367    /** The ID of the entry that the users actioned on */
10368    optional android.app.tvsettings.ItemId item_id = 2;
10369}
10370
10371/**
10372 * Logs information about a package installation using package installer V2 APIs.
10373 *
10374 * Logged from:
10375 *      frameworks/base/services/core/java/com/android/server/pm/PackageInstallerSession.java
10376 */
10377message PackageInstallerV2Reported {
10378    // Whether this installation uses Incremental File System
10379    optional bool is_incremental = 1;
10380    // Name of the package that is intended to be installed
10381    optional string package_name = 2;
10382    // The duration between when the install was requested to when the install has completed
10383    optional int64 duration_millis = 3;
10384    // Installation result in final integer, which are SystemApi's.
10385    // Return_code 1 indicates success.
10386    // For full list, see frameworks/base/core/java/android/content/pm/PackageManager.java
10387    optional int32 return_code  = 4;
10388    // Total size of the APKs installed for this package
10389    optional int64 apks_size_bytes = 5;
10390}
10391
10392/**
10393 * Logs settings provider values.
10394 *
10395 * Use DeviceConfig.getProperties to get a list Setting key, query the data from content provider,
10396 * then write the value to proto.
10397 *
10398 */
10399message SettingSnapshot {
10400
10401    // Setting key
10402    optional string name = 1;
10403
10404    enum SettingsValueType {
10405        NOTASSIGNED = 0;
10406        ASSIGNED_BOOL_TYPE = 1;
10407        ASSIGNED_INT_TYPE = 2;
10408        ASSIGNED_FLOAT_TYPE = 3;
10409        ASSIGNED_STRING_TYPE = 4;
10410    };
10411    // Setting value type
10412    optional SettingsValueType type = 2;
10413
10414    optional bool bool_value = 3;
10415
10416    optional int32 int_value = 4;
10417
10418    optional float float_value = 5;
10419
10420    optional string str_value = 6;
10421
10422    // Android user index. 0 for primary user, 10, 11 for secondary or profile user
10423    optional int32 user_id = 7;
10424}
10425
10426/**
10427 * An event logged to indicate that a user journey is about to be performed. This atom includes
10428 * relevant information about the users involved in the journey. A UserLifecycleEventOccurred event
10429 * will immediately follow this atom which will describe the event(s) and its state.
10430 *
10431 * Logged from:
10432 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
10433 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
10434 */
10435message UserLifecycleJourneyReported {
10436    // An identifier to track a chain of user lifecycle events occurring (referenced in the
10437    // UserLifecycleEventOccurred atom)
10438    optional int64 session_id = 1;
10439
10440    // Indicates what type of user journey this session is related to
10441    enum Journey {
10442        UNKNOWN = 0; // Undefined user lifecycle journey
10443        USER_SWITCH_UI = 1; // A user switch journey where a UI is shown
10444        USER_SWITCH_FG = 2; // A user switch journey without a UI shown
10445        USER_START = 3; // A user start journey
10446        USER_CREATE = 4; // A user creation journey
10447    }
10448    optional Journey journey = 2;
10449    // Which user the journey is originating from - could be -1 for certain phases (eg USER_CREATE)
10450    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
10451    optional int32 origin_user = 3;
10452    // Which user the journey is targeting
10453    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
10454    optional int32 target_user = 4;
10455
10456    // What is the user type of the target user
10457    // These should be in sync with USER_TYPE_* flags defined in UserManager.java
10458    enum UserType {
10459        TYPE_UNKNOWN = 0;
10460        FULL_SYSTEM = 1;
10461        FULL_SECONDARY = 2;
10462        FULL_GUEST = 3;
10463        FULL_DEMO = 4;
10464        FULL_RESTRICTED = 5;
10465        PROFILE_MANAGED = 6;
10466        SYSTEM_HEADLESS = 7;
10467    }
10468    optional UserType user_type = 5;
10469    // What are the flags attached to the target user
10470    optional int32 user_flags = 6;
10471}
10472
10473/**
10474 * An event logged when a specific user lifecycle event is performed. These events should be
10475 * correlated with a UserLifecycleJourneyReported atom via the session_id.
10476 * Note: journeys can span over multiple events, hence some events may share a single session id.
10477 *
10478 * Logged from:
10479 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
10480 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
10481 */
10482message UserLifecycleEventOccurred {
10483    // An id which links back to user details (reported in the UserLifecycleJourneyReported atom)
10484    optional int64 session_id = 1;
10485    // The target user for this event (same as target_user in the UserLifecycleJourneyReported atom)
10486    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
10487    optional int32 user_id = 2;
10488
10489    enum Event {
10490        UNKNOWN = 0; // Indicates that the associated user journey timed-out or resulted in an error
10491        SWITCH_USER = 1; // Indicates that this is a user switch event
10492        START_USER = 2; // Indicates that this is a user start event
10493        CREATE_USER = 3; // Indicates that this is a user create event
10494        USER_RUNNING_LOCKED = 4; // Indicates that user is running in locked state
10495        UNLOCKING_USER = 5; // Indicates that this is a user unlocking event
10496        UNLOCKED_USER = 6; // Indicates that this is a user unlocked event
10497    }
10498    optional Event event = 3;
10499
10500    enum State {
10501        NONE = 0; // Indicates the associated event has no start/end defined
10502        BEGIN = 1;
10503        FINISH = 2;
10504    }
10505    optional State state = 4; // Represents the state of an event (beginning/ending)
10506}
10507
10508/**
10509 * Logs when accessibility shortcut clicked.
10510 *
10511 * Logged from:
10512 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
10513 */
10514message AccessibilityShortcutReported {
10515    // The accessibility feature(including installed a11y service, framework a11y feature,
10516    // and installed a11y activity) package name that is assigned to the accessibility shortcut.
10517    optional string package_name = 1;
10518
10519    // The definition of the accessibility shortcut.
10520    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
10521    optional android.stats.accessibility.ShortcutType shortcut_type = 2;
10522
10523    // The definition of the service status.
10524    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
10525    optional android.stats.accessibility.ServiceStatus service_status = 3;
10526}
10527
10528/**
10529 * Logs when accessibility service status changed.
10530 *
10531 * Logged from:
10532 *   packages/apps/Settings/src/com/android/settings/accessibility
10533 */
10534message AccessibilityServiceReported {
10535    // The accessibility service package name.
10536    optional string package_name = 1;
10537
10538    // The definition of the service status.
10539    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
10540    optional android.stats.accessibility.ServiceStatus service_status = 2;
10541}
10542
10543/**
10544 * Logs when display wake up.
10545 *
10546 * Logged from:
10547 *   services/core/java/com/android/server/power/Notifier.java
10548 */
10549
10550message DisplayWakeReported {
10551    // Wake_up_reason code
10552    // If LOWORD(wake_up_reason) = 0
10553    //     reference to HIWORD(wake_up_reason) PowerManager.WAKE_REASON_XXX
10554    //     else reference wake_up_reason to
10555    //     services/core/java/com/android/server/power/Notifier.java#onWakeUp
10556    optional int32 wake_up_reason = 1;
10557}
10558
10559/**
10560 * Logs app usage events.
10561 */
10562message AppUsageEventOccurred {
10563    optional int32 uid = 1 [(is_uid) = true];
10564    optional string package_name = 2;
10565    optional string class_name = 3;
10566
10567    enum EventType {
10568        NONE = 0;
10569        MOVE_TO_FOREGROUND = 1;
10570        MOVE_TO_BACKGROUND = 2;
10571    }
10572    optional EventType event_type = 4;
10573}
10574
10575/*
10576 * Quality metrics logged when EVS cameras are active.
10577 *
10578 * Logged from:
10579 *  packages/services/Car/evs/manager/1.1/Enumerator.cpp
10580 */
10581message EvsUsageStatsReported {
10582
10583    // Camera identifier to distinguish the source camera device.  This is not
10584    // globally unique and therefore cannot be used to identify the user and/or
10585    // the device.
10586    optional int32 device_id = 1;
10587
10588    // Peak number of clients during the service
10589    optional int32 peak_num_clients = 2;
10590
10591    // Number of erroneous events during the service
10592    optional int32 num_errors = 3;
10593
10594    // Round trip latency of the very first frame
10595    optional int64 first_latency_millis = 4;
10596
10597    // Average frame round trip latency
10598    optional float avg_latency_millis = 5;
10599
10600    // Peak frame round trip latency
10601    optional int64 peak_latency_millis = 6;
10602
10603    // Total number of frames received
10604    optional int64 total_frames = 7;
10605
10606    // Number of frames ignored
10607    optional int64 ignored_frames = 8;
10608
10609    // Number of dropped frames to synchronize camera devices
10610    optional int64 dropped_frames_to_sync = 9;
10611
10612    // The duration of the service
10613    optional int64 duration_millis = 10;
10614}
10615
10616/**
10617 * Logs audio power usage stats.
10618 *
10619 * Pushed from:
10620 *  frameworks/av/services/mediametrics/AudioPowerUsage.cpp
10621 */
10622message AudioPowerUsageDataReported {
10623    /**
10624     * Device used for input/output
10625     *
10626     * All audio devices please refer to below file:
10627     * system/media/audio/include/system/audio-base.h
10628     *
10629     * Define our own enum values because we don't report all audio devices.
10630     * Currently, we only report built-in audio devices such as handset, speaker,
10631     * built-in mics, common audio devices such as wired headset, usb headset
10632     * and bluetooth devices.
10633     */
10634    enum AudioDevice {
10635        OUTPUT_EARPIECE         = 0x1; // handset
10636        OUTPUT_SPEAKER          = 0x2; // dual speaker
10637        OUTPUT_WIRED_HEADSET    = 0x4; // 3.5mm headset
10638        OUTPUT_USB_HEADSET      = 0x8; // usb headset
10639        OUTPUT_BLUETOOTH_SCO    = 0x10; // bluetooth sco
10640        OUTPUT_BLUETOOTH_A2DP   = 0x20; // a2dp
10641        OUTPUT_SPEAKER_SAFE     = 0x40; // bottom speaker
10642
10643        INPUT_DEVICE_BIT        = 0x40000000; // non-negative positive int32.
10644        INPUT_BUILTIN_MIC       = 0x40000001; // buildin mic
10645        INPUT_BUILTIN_BACK_MIC  = 0x40000002; // buildin back mic
10646        INPUT_WIRED_HEADSET_MIC = 0x40000004; // 3.5mm headset mic
10647        INPUT_USB_HEADSET_MIC   = 0x40000008; // usb headset mic
10648        INPUT_BLUETOOTH_SCO     = 0x40000010; // bluetooth sco mic
10649    }
10650    optional AudioDevice audio_device = 1;
10651
10652    // Duration of the audio in seconds
10653    optional int32 duration_secs = 2;
10654
10655    // Average volume (0 ... 1.0)
10656    optional float average_volume = 3;
10657
10658    enum AudioType {
10659        UNKNOWN_TYPE = 0;
10660        VOICE_CALL_TYPE = 1; // voice call
10661        VOIP_CALL_TYPE = 2; // voip call, including uplink and downlink
10662        MEDIA_TYPE = 3; // music and system sound
10663        RINGTONE_NOTIFICATION_TYPE = 4; // ringtone and notification
10664        ALARM_TYPE = 5; // alarm type
10665        // record type
10666        CAMCORDER_TYPE = 6; // camcorder
10667        RECORD_TYPE = 7;  // other recording
10668    }
10669    optional AudioType type = 4;
10670}
10671
10672/**
10673  * Pulls bytes transferred over WiFi and mobile networks sliced by uid, is_metered, and tag.
10674  *
10675  * Pulled from:
10676  *   StatsPullAtomService, which uses NetworkStatsService to query NetworkStats.
10677  */
10678message BytesTransferByTagAndMetered {
10679    optional int32 uid = 1 [(is_uid) = true];
10680
10681    optional bool is_metered = 2;
10682
10683    optional int32 tag = 3;
10684
10685    optional int64 rx_bytes = 4;
10686
10687    optional int64 rx_packets = 5;
10688
10689    optional int64 tx_bytes = 6;
10690
10691    optional int64 tx_packets = 7;
10692}
10693
10694/*
10695 * Logs when the Media Output Switcher finishes a media switch operation.
10696 *
10697 * Logged from:
10698 *  packages/apps/Settings/src/com/android/settings/media/MediaOutputSliceWorker.java
10699 */
10700message MediaOutputOpSwitchReported {
10701    // Source medium type before switching.
10702    optional android.app.settings.mediaoutput.MediumType source = 1;
10703
10704    // Target medium type after switching.
10705    optional android.app.settings.mediaoutput.MediumType target = 2;
10706
10707    // The result of switching.
10708    optional android.app.settings.mediaoutput.SwitchResult result = 3;
10709
10710    // The detail code of a switching result.
10711    optional android.app.settings.mediaoutput.SubResult subresult = 4;
10712
10713    /*
10714     * The package name of a pre-installed app, whose media session is being switched.
10715     */
10716    optional string media_session_package_name = 5;
10717
10718    // The amount of available wired devices when a switching is being performed.
10719    optional int32 available_wired_device_count = 6;
10720
10721    // The amount of available Bluetooth devices a switching is being performed.
10722    optional int32 available_bt_device_count = 7;
10723
10724    // The amount of available remote devices when a switching is being performed.
10725    optional int32 available_remote_device_count = 8;
10726
10727    // The amount of applied devices within a remote dynamic group after a switching is done.
10728    optional int32 applied_device_count_within_remote_group = 9;
10729}
10730
10731/**
10732 * Logs when the Assistant is invoked.
10733 *
10734 * Logged from:
10735 *   frameworks/base/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
10736 */
10737message AssistantInvocationReported {
10738
10739    // The event_id (as for UiEventReported).
10740    optional int32 event_id = 1;
10741
10742    // The registered Assistant's uid and package (as for UiEventReported).
10743    optional int32 uid = 2 [(is_uid) = true];
10744    optional string package_name = 3;
10745
10746    // An identifier used to disambiguate which logs refer to a particular invocation of the
10747    // Assistant  (as for UiEventReported).
10748    optional int32 instance_id = 4;
10749
10750    // The state of the device at the time of invocation.
10751    enum DeviceState {
10752        UNKNOWN_DEVICE_STATE = 0;
10753        AOD1 = 1;
10754        AOD2 = 2;
10755        BOUNCER = 3;
10756        UNLOCKED_LOCKSCREEN = 4;
10757        LAUNCHER_HOME = 5;
10758        LAUNCHER_OVERVIEW = 6;
10759        LAUNCHER_ALL_APPS = 7;
10760        APP_DEFAULT = 8;
10761        APP_IMMERSIVE = 9;
10762        APP_FULLSCREEN = 10;
10763    }
10764    optional DeviceState device_state = 5;
10765
10766    // Whether the Assistant handles were showing at the time of invocation.
10767    optional bool assistant_handles_showing = 6;
10768}
10769
10770/**
10771 * Logs when an AudioRecord finishes running on an audio device
10772 *
10773 * Logged from:
10774 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
10775 */
10776message MediametricsAudioRecordDeviceUsageReported {
10777    // The devices connected to this AudioRecord.
10778    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
10779    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10780    // See audio_device_t in system/media/audio/include/system/audio-base.h
10781    optional string devices = 1;
10782
10783    // The name of the remote device attached to the device, typically available for USB or BT.
10784    // This may be empty for a fixed device, or separated by "|" if more than one.
10785    optional string device_names = 2;
10786
10787    // The amount of time spent in the device as measured by the active track in AudioFlinger.
10788    optional int64 device_time_nanos = 3;
10789
10790    // The audio data format used for encoding.
10791    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
10792    optional string encoding = 4;
10793
10794    // The client-server buffer framecount.
10795    // The framecount is generally between 960 - 48000 for PCM encoding.
10796    // The framecount represents raw buffer size in bytes for non-PCM encoding.
10797    optional int32 frame_count = 5;
10798
10799    // The number of audio intervals (contiguous, continuous playbacks).
10800    optional int32 interval_count = 6;
10801
10802    // The sample rate of the AudioRecord.
10803    // A number generally between 8000-96000 (frames per second).
10804    optional int32 sample_rate = 7;
10805
10806    // The audio input flags used to construct the AudioRecord.
10807    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
10808    optional string flags = 8;
10809
10810    // The santized package name of the audio client associated with the AudioRecord.
10811    // See getSanitizedPackageNameAndVersionCode() in
10812    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
10813    optional string package_name = 9;
10814
10815    // The selected device id (nonzero if a non-default device is selected)
10816    optional int32 selected_device_id = 10;
10817
10818    // The caller of the AudioRecord.
10819    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10820    optional string caller = 11;
10821
10822    // The audio source for AudioRecord.
10823    // An enumeration from system/media/audio/include/system/audio-base.h audio_source_t
10824    optional string source = 12;
10825}
10826
10827/**
10828 * Logs when an AudioThread finishes running on an audio device
10829 *
10830 * Logged from:
10831 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
10832 */
10833message MediametricsAudioThreadDeviceUsageReported {
10834    // The devices connected to this audio thread.
10835    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
10836    // (for record threads):
10837    // See lookup<INPUT_DEVICE> in frameworks/av/services/mediametrics/AudioTypes.cpp
10838    // (for playback threads):
10839    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10840    // See audio_device_t in system/media/audio/include/system/audio-base.h
10841    optional string devices = 1;
10842
10843    // The name of the remote device attached to the device, typically available for USB or BT.
10844    // This may be empty for a fixed device, or separated by "|" if more than one.
10845    optional string device_names = 2;
10846
10847    // The amount of time spent in the device as measured by the active track in AudioFlinger.
10848    optional int64 device_time_nanos = 3;
10849
10850    // The audio data format used for encoding.
10851    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
10852    optional string encoding = 4;
10853
10854    // The framecount of the buffer delivered to (or from) the HAL.
10855    // The framecount is generally ~960 for PCM encoding.
10856    // The framecount represents raw buffer size in bytes for non-PCM encoding.
10857    optional int32 frame_count = 5;
10858
10859    // The number of audio intervals (contiguous, continuous playbacks).
10860    optional int32 interval_count = 6;
10861
10862    // The sample rate of the audio thread.
10863    // A number generally between 8000-96000 (frames per second).
10864    optional int32 sample_rate = 7;
10865
10866    // The audio flags used to construct the thread
10867    // (for record threads):
10868    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
10869    // (for playback threads):
10870    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
10871    optional string flags = 8;
10872
10873    // The number of underruns encountered for a playback thread or the
10874    // number of overruns encountered for a capture thread.
10875    optional int32 xruns = 9;
10876
10877    // The type of thread
10878    // A thread type enumeration from
10879    // frameworks/av/mediametrics/services/Translate.h
10880    optional string type = 10;
10881}
10882
10883/**
10884 * Logs when an AudioTrack finishes running on an audio device
10885 *
10886 * Logged from:
10887 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
10888 */
10889message MediametricsAudioTrackDeviceUsageReported {
10890    // The output devices connected to this AudioTrack.
10891    // A string OR of various output device categories, e.g. "DEVICE1|DEVICE2".
10892    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10893    // See audio_device_t in system/media/audio/include/system/audio-base.h
10894    optional string devices = 1;
10895
10896    // The name of the remote device attached to the device, typically available for USB or BT.
10897    // This may be empty for a fixed device, or separated by "|" if more than one.
10898    optional string device_names = 2;
10899
10900    // The amount of time spent in the device as measured by the active track in AudioFlinger.
10901    optional int64 device_time_nanos = 3;
10902
10903    // The audio data format used for encoding.
10904    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
10905    optional string encoding = 4;
10906
10907    // The client-server buffer framecount.
10908    // The framecount is generally between 960 - 48000 for PCM encoding.
10909    // The framecount represents raw buffer size in bytes for non-PCM encoding.
10910    // A static track (see traits) may have a very large framecount.
10911    optional int32 frame_count = 5;
10912
10913    // The number of audio intervals (contiguous, continuous playbacks).
10914    optional int32 interval_count = 6;
10915
10916    // The sample rate of the AudioTrack.
10917    // A number generally between 8000-96000 (frames per second).
10918    optional int32 sample_rate = 7;
10919
10920    // The audio flags used to construct the AudioTrack.
10921    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
10922    optional string flags = 8;
10923
10924    // The number of underruns encountered.
10925    optional int32 xruns = 9;
10926
10927    // The santized package name of the audio client associated with the AudioTrack.
10928    // See getSanitizedPackageNameAndVersionCode() in
10929    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
10930    optional string package_name = 10;
10931
10932    // The latency of the last sample in the buffer in milliseconds.
10933    optional float device_latency_millis = 11;
10934
10935    // The startup time in milliseconds from start() to sample played.
10936    optional float device_startup_millis = 12;
10937
10938    // The average volume of the track on the device [ 0.f - 1.f ]
10939    optional float device_volume = 13;
10940
10941    // The selected device id (nonzero if a non-default device is selected)
10942    optional int32 selected_device_id = 14;
10943
10944    // The stream_type category for the AudioTrack.
10945    // An enumeration from system/media/audio/include/system/audio-base.h audio_stream_type_t
10946    optional string stream_type = 15;
10947
10948    // The usage for the AudioTrack.
10949    // An enumeration from system/media/audio/include/system/audio-base.h audio_usage_t
10950    optional string usage = 16;
10951
10952    // The content type of the AudioTrack.
10953    // An enumeration from system/media/audio/include/system/audio-base.h audio_content_type_t
10954    optional string content_type = 17;
10955
10956    // The caller of the AudioTrack.
10957    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10958    optional string caller = 18;
10959
10960    // The traits of the AudioTrack.
10961    // A string OR of different traits, may be empty string.
10962    // Only "static" is supported for R.
10963    // See lookup<TRACK_TRAITS>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10964    optional string traits = 19;
10965}
10966
10967/**
10968 * Logs the status of an audio device connection attempt.
10969 *
10970 * Logged from:
10971 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
10972 */
10973message MediametricsAudioDeviceConnectionReported {
10974    // The input devices represented by this report.
10975    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
10976    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10977    // See audio_device_t in system/media/audio/include/system/audio-base.h
10978    optional string input_devices = 1;
10979
10980    // The output devices represented by this report.
10981    // A string OR of various output device categories.
10982    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
10983    // See audio_device_t in system/media/audio/include/system/audio-base.h
10984    optional string output_devices = 2;
10985
10986    // The name of the remote device attached to the device, typically available for USB or BT.
10987    // This may be empty for a fixed device, or separated by "|" if more than one.
10988    optional string device_names = 3;
10989
10990    // The result of the audio device connection.
10991    // 0 indicates success: connection verified.
10992    // 1 indicates unknown: connection not verified or not known if diverted properly.
10993    // Other values indicate specific status.
10994    // See DeviceConnectionResult in frameworks/av/services/mediametrics/AudioTypes.h
10995    optional int32 result = 4;
10996
10997    // Average milliseconds of time to connect
10998    optional float time_to_connect_millis = 5;
10999
11000    // Number of connections if aggregated statistics, otherwise 1.
11001    optional int32 connection_count = 6;
11002}
11003
11004/**
11005 * Logs: i) creation of different types of cryptographic keys in the keystore,
11006 * ii) operations performed using the keys,
11007 * iii) attestation of the keys
11008 * Logged from: system/security/keystore/key_event_log_handler.cpp
11009 */
11010message KeystoreKeyEventReported {
11011
11012    enum Algorithm {
11013        /** Asymmetric algorithms. */
11014        RSA = 1;
11015        // 2 removed, do not reuse.
11016        EC = 3;
11017        /** Block cipher algorithms */
11018        AES = 32;
11019        TRIPLE_DES = 33;
11020        /** MAC algorithms */
11021        HMAC = 128;
11022    };
11023    /** Algorithm associated with the key */
11024    optional Algorithm algorithm = 1;
11025
11026    /** Size of the key */
11027    optional int32 key_size = 2;
11028
11029    enum KeyOrigin {
11030        /** Generated in keymaster.  Should not exist outside the TEE. */
11031        GENERATED = 0;
11032        /** Derived inside keymaster.  Likely exists off-device. */
11033        DERIVED = 1;
11034        /** Imported into keymaster.  Existed as cleartext in Android. */
11035        IMPORTED = 2;
11036        /** Keymaster did not record origin. */
11037        UNKNOWN = 3;
11038        /** Securely imported into Keymaster. */
11039        SECURELY_IMPORTED = 4;
11040    };
11041    /* Logs whether the key was generated, imported, securely imported, or derived.*/
11042    optional KeyOrigin key_origin = 3;
11043
11044    enum HardwareAuthenticatorType {
11045        NONE = 0;
11046        PASSWORD = 1;
11047        FINGERPRINT = 2;
11048        // Additional entries must be powers of 2.
11049    };
11050    /**
11051     * What auth types does this key require? If none,
11052     * then no auth required.
11053     */
11054    optional HardwareAuthenticatorType user_auth_type = 4;
11055
11056    /**
11057     * If user authentication is required, is the requirement time based? If it
11058     * is not time based then this field will not be used and the key is per
11059     * operation. Per operation keys must be user authenticated on each usage.
11060     */
11061    optional int32 user_auth_key_timeout_secs = 5;
11062
11063    /**
11064     * padding mode, digest, block_mode and purpose should ideally be repeated
11065     * fields. However, since statsd does not support repeated fields in
11066     * pushed atoms, they are represented using bitmaps.
11067     */
11068
11069    /** Track which padding mode is being used.*/
11070    optional int32 padding_mode_bitmap = 6;
11071
11072    /** Track which digest is being used. */
11073    optional int32 digest_bitmap = 7;
11074
11075    /** Track what block mode is being used (for encryption). */
11076    optional int32 block_mode_bitmap = 8;
11077
11078    /** Track what purpose is this key serving. */
11079    optional int32 purpose_bitmap = 9;
11080
11081    enum EcCurve {
11082        P_224 = 0;
11083        P_256 = 1;
11084        P_384 = 2;
11085        P_521 = 3;
11086    };
11087    /** Which ec curve was selected if elliptic curve cryptography is in use **/
11088    optional EcCurve ec_curve = 10;
11089
11090    enum KeyBlobUsageRequirements {
11091        STANDALONE = 0;
11092        REQUIRES_FILE_SYSTEM = 1;
11093    };
11094    /** Standalone or is a file system required */
11095    optional KeyBlobUsageRequirements key_blob_usage_reqs = 11;
11096
11097    enum Type {
11098        key_operation = 0;
11099        key_creation = 1;
11100        key_attestation = 2;
11101    }
11102    /** Key creation event, operation event or attestation event? */
11103    optional Type type = 12;
11104
11105    /** Was the key creation, operation, or attestation successful? */
11106    optional bool was_successful = 13;
11107
11108    /** Response code or error code */
11109    optional int32 error_code = 14;
11110}
11111
11112// Blob Committer stats
11113// Keep in sync between:
11114//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
11115//     frameworks/base/cmds/statsd/src/atoms.proto
11116message BlobCommitterProto {
11117    // Committer app's uid
11118    optional int32 uid = 1 [(is_uid) = true];
11119
11120    // Unix epoch timestamp of the commit in milliseconds
11121    optional int64 commit_timestamp_millis = 2;
11122
11123    // Flags of what access types the committer has set for the Blob
11124    optional int32 access_mode = 3;
11125
11126    // Number of packages that have been whitelisted for ACCESS_TYPE_WHITELIST
11127    optional int32 num_whitelisted_package = 4;
11128}
11129
11130// Blob Leasee stats
11131// Keep in sync between:
11132//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
11133//     frameworks/base/cmds/statsd/src/atoms.proto
11134message BlobLeaseeProto {
11135    // Leasee app's uid
11136    optional int32 uid = 1 [(is_uid) = true];
11137
11138    // Unix epoch timestamp for lease expiration in milliseconds
11139    optional int64 lease_expiry_timestamp_millis = 2;
11140}
11141
11142// List of Blob Committers
11143// Keep in sync between:
11144//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
11145//     frameworks/base/cmds/statsd/src/atoms.proto
11146message BlobCommitterListProto {
11147    repeated BlobCommitterProto committer = 1;
11148}
11149
11150// List of Blob Leasees
11151// Keep in sync between:
11152//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
11153//     frameworks/base/cmds/statsd/src/atoms.proto
11154message BlobLeaseeListProto {
11155    repeated BlobLeaseeProto leasee = 1;
11156}
11157
11158/**
11159 * Logs the current state of a Blob committed with BlobStoreManager
11160 *
11161 * Pulled from:
11162 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
11163 */
11164message BlobInfo {
11165    // Id of the Blob
11166    optional int64 blob_id = 1;
11167
11168    // Size of the Blob data
11169    optional int64 size = 2;
11170
11171    // Unix epoch timestamp of the Blob's expiration in milliseconds
11172    optional int64 expiry_timestamp_millis = 3;
11173
11174    // List of committers of this Blob
11175    optional BlobCommitterListProto committers = 4;
11176
11177    // List of leasees of this Blob
11178    optional BlobLeaseeListProto leasees = 5;
11179}
11180