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