• 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/bluetooth/a2dp/enums.proto";
28import "frameworks/base/core/proto/android/bluetooth/enums.proto";
29import "frameworks/base/core/proto/android/bluetooth/hci/enums.proto";
30import "frameworks/base/core/proto/android/bluetooth/hfp/enums.proto";
31import "frameworks/base/core/proto/android/bluetooth/smp/enums.proto";
32import "frameworks/base/core/proto/android/debug/enums.proto";
33import "frameworks/base/core/proto/android/hardware/biometrics/enums.proto";
34import "frameworks/base/core/proto/android/hardware/sensor/assist/enums.proto";
35import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
36import "frameworks/base/core/proto/android/os/enums.proto";
37import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
38import "frameworks/base/core/proto/android/server/enums.proto";
39import "frameworks/base/core/proto/android/server/job/enums.proto";
40import "frameworks/base/core/proto/android/server/location/enums.proto";
41import "frameworks/base/core/proto/android/service/procstats_enum.proto";
42import "frameworks/base/core/proto/android/service/usb.proto";
43import "frameworks/base/core/proto/android/stats/connectivity/network_stack.proto";
44import "frameworks/base/core/proto/android/stats/dnsresolver/dns_resolver.proto";
45import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
46import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
47import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
48import "frameworks/base/core/proto/android/stats/enums.proto";
49import "frameworks/base/core/proto/android/stats/intelligence/enums.proto";
50import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
51import "frameworks/base/core/proto/android/stats/location/location_enums.proto";
52import "frameworks/base/core/proto/android/stats/mediametrics/mediametrics.proto";
53import "frameworks/base/core/proto/android/stats/storage/storage_enums.proto";
54import "frameworks/base/core/proto/android/stats/style/style_enums.proto";
55import "frameworks/base/core/proto/android/telecomm/enums.proto";
56import "frameworks/base/core/proto/android/telephony/enums.proto";
57import "frameworks/base/core/proto/android/view/enums.proto";
58import "frameworks/base/core/proto/android/wifi/enums.proto";
59
60/**
61 * The master atom class. This message defines all of the available
62 * raw stats log events from the Android system, also known as "atoms."
63 *
64 * This field contains a single oneof with all of the available messages.
65 * The stats-log-api-gen tool runs as part of the Android build and
66 * generates the android.util.StatsLog class, which contains the constants
67 * and methods that Android uses to log.
68 *
69 * This Atom class is not actually built into the Android system.
70 * Instead, statsd on Android constructs these messages synthetically,
71 * in the format defined here and in stats_log.proto.
72 */
73message Atom {
74    // Pushed atoms start at 2.
75    oneof pushed {
76        // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
77        BleScanStateChanged ble_scan_state_changed = 2;
78        ProcessStateChanged process_state_changed = 3;
79        BleScanResultReceived ble_scan_result_received = 4;
80        SensorStateChanged sensor_state_changed = 5;
81        GpsScanStateChanged gps_scan_state_changed = 6;
82        SyncStateChanged sync_state_changed = 7;
83        ScheduledJobStateChanged scheduled_job_state_changed = 8;
84        ScreenBrightnessChanged screen_brightness_changed = 9;
85        WakelockStateChanged wakelock_state_changed = 10;
86        LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
87        MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
88        WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
89        ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
90        MemoryFactorStateChanged memory_factor_state_changed = 15;
91        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
92        CachedKillReported cached_kill_reported = 17;
93        ProcessMemoryStatReported process_memory_stat_reported = 18;
94        LauncherUIChanged launcher_event = 19;
95        BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
96        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
97        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
98        AudioStateChanged audio_state_changed = 23;
99        MediaCodecStateChanged media_codec_state_changed = 24;
100        CameraStateChanged camera_state_changed = 25;
101        FlashlightStateChanged flashlight_state_changed = 26;
102        UidProcessStateChanged uid_process_state_changed = 27;
103        ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
104        ScreenStateChanged screen_state_changed = 29;
105        BatteryLevelChanged battery_level_changed = 30;
106        ChargingStateChanged charging_state_changed = 31;
107        PluggedStateChanged plugged_state_changed = 32;
108        InteractiveStateChanged interactive_state_changed = 33;
109        TouchEventReported touch_event_reported = 34;
110        WakeupAlarmOccurred wakeup_alarm_occurred = 35;
111        KernelWakeupReported kernel_wakeup_reported = 36;
112        WifiLockStateChanged wifi_lock_state_changed = 37;
113        WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
114        WifiScanStateChanged wifi_scan_state_changed = 39;
115        PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
116        SettingChanged setting_changed = 41;
117        ActivityForegroundStateChanged activity_foreground_state_changed = 42;
118        IsolatedUidChanged isolated_uid_changed = 43;
119        PacketWakeupOccurred packet_wakeup_occurred = 44;
120        WallClockTimeShifted wall_clock_time_shifted = 45;
121        AnomalyDetected anomaly_detected = 46;
122        AppBreadcrumbReported app_breadcrumb_reported = 47 [(allow_from_any_uid) = true];
123        AppStartOccurred app_start_occurred = 48;
124        AppStartCanceled app_start_canceled = 49;
125        AppStartFullyDrawn app_start_fully_drawn = 50;
126        LmkKillOccurred lmk_kill_occurred = 51;
127        PictureInPictureStateChanged picture_in_picture_state_changed = 52;
128        WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
129        LmkStateChanged lmk_state_changed = 54;
130        AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
131        ShutdownSequenceReported shutdown_sequence_reported = 56;
132        BootSequenceReported boot_sequence_reported = 57;
133        DaveyOccurred davey_occurred = 58 [(allow_from_any_uid) = true];
134        OverlayStateChanged overlay_state_changed = 59;
135        ForegroundServiceStateChanged foreground_service_state_changed = 60;
136        CallStateChanged call_state_changed = 61;
137        KeyguardStateChanged keyguard_state_changed = 62;
138        KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
139        KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
140        AppDied app_died = 65;
141        ResourceConfigurationChanged resource_configuration_changed = 66;
142        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
143        BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
144        GpsSignalQualityChanged gps_signal_quality_changed = 69;
145        UsbConnectorStateChanged usb_connector_state_changed = 70;
146        SpeakerImpedanceReported speaker_impedance_reported = 71;
147        HardwareFailed hardware_failed = 72;
148        PhysicalDropDetected physical_drop_detected = 73;
149        ChargeCyclesReported charge_cycles_reported = 74;
150        MobileConnectionStateChanged mobile_connection_state_changed = 75;
151        MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
152        UsbDeviceAttached usb_device_attached = 77;
153        AppCrashOccurred app_crash_occurred = 78;
154        ANROccurred anr_occurred = 79;
155        WTFOccurred wtf_occurred = 80;
156        LowMemReported low_mem_reported = 81;
157        GenericAtom generic_atom = 82;
158        KeyValuePairsAtom key_value_pairs_atom = 83 [(allow_from_any_uid) = true];
159        VibratorStateChanged vibrator_state_changed = 84;
160        DeferredJobStatsReported deferred_job_stats_reported = 85;
161        ThermalThrottlingStateChanged thermal_throttling = 86 [deprecated=true];
162        BiometricAcquired biometric_acquired = 87;
163        BiometricAuthenticated biometric_authenticated = 88;
164        BiometricErrorOccurred biometric_error_occurred = 89;
165        // Atom number 90 is available for use.
166        BatteryHealthSnapshot battery_health_snapshot = 91;
167        SlowIo slow_io = 92;
168        BatteryCausedShutdown battery_caused_shutdown = 93;
169        PhoneServiceStateChanged phone_service_state_changed = 94;
170        PhoneStateChanged phone_state_changed = 95;
171        UserRestrictionChanged user_restriction_changed = 96;
172        SettingsUIChanged settings_ui_changed = 97;
173        ConnectivityStateChanged connectivity_state_changed = 98;
174        // TODO: service state change is very noisy shortly after boot, as well
175        // as at other transitions - coming out of doze, device plugged in, etc.
176        // Consider removing this if it becomes a problem
177        ServiceStateChanged service_state_changed = 99;
178        ServiceLaunchReported service_launch_reported = 100;
179        FlagFlipUpdateOccurred flag_flip_update_occurred = 101;
180        BinaryPushStateChanged binary_push_state_changed = 102;
181        DevicePolicyEvent device_policy_event = 103;
182        DocsUIFileOperationCanceledReported docs_ui_file_op_canceled =
183            104 [(log_from_module) = "docsui"];
184        DocsUIFileOperationCopyMoveModeReported
185            docs_ui_file_op_copy_move_mode_reported =
186            105 [(log_from_module) = "docsui"];
187        DocsUIFileOperationFailureReported docs_ui_file_op_failure =
188            106 [(log_from_module) = "docsui"];
189        DocsUIFileOperationReported docs_ui_provider_file_op =
190            107 [(log_from_module) = "docsui"];
191        DocsUIInvalidScopedAccessRequestReported
192            docs_ui_invalid_scoped_access_request =
193            108 [(log_from_module) = "docsui"];
194        DocsUILaunchReported docs_ui_launch_reported =
195            109 [(log_from_module) = "docsui"];
196        DocsUIRootVisitedReported docs_ui_root_visited =
197            110 [(log_from_module) = "docsui"];
198        DocsUIStartupMsReported docs_ui_startup_ms =
199            111 [(log_from_module) = "docsui"];
200        DocsUIUserActionReported docs_ui_user_action_reported =
201            112 [(log_from_module) = "docsui"];
202        WifiEnabledStateChanged wifi_enabled_state_changed = 113;
203        WifiRunningStateChanged wifi_running_state_changed = 114;
204        AppCompacted app_compacted = 115;
205        NetworkDnsEventReported network_dns_event_reported = 116 [(log_from_module) = "resolv"];
206        DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported =
207            117 [(log_from_module) = "docsui"];
208        DocsUIPickResultReported docs_ui_pick_result_reported =
209            118 [(log_from_module) = "docsui"];
210        DocsUISearchModeReported docs_ui_search_mode_reported =
211            119 [(log_from_module) = "docsui"];
212        DocsUISearchTypeReported docs_ui_search_type_reported =
213            120 [(log_from_module) = "docsui"];
214        DataStallEvent data_stall_event = 121 [(log_from_module) = "network_stack"];
215        RescuePartyResetReported rescue_party_reset_reported = 122;
216        SignedConfigReported signed_config_reported = 123;
217        GnssNiEventReported gnss_ni_event_reported = 124;
218        BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event = 125;
219        BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed = 126;
220        BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed = 127;
221        AppDowngraded app_downgraded = 128;
222        AppOptimizedAfterDowngraded app_optimized_after_downgraded = 129;
223        LowStorageStateChanged low_storage_state_changed = 130;
224        GnssNfwNotificationReported gnss_nfw_notification_reported = 131;
225        GnssConfigurationReported gnss_configuration_reported = 132;
226        UsbPortOverheatEvent usb_port_overheat_event_reported = 133;
227        NfcErrorOccurred nfc_error_occurred = 134;
228        NfcStateChanged nfc_state_changed = 135;
229        NfcBeamOccurred nfc_beam_occurred = 136;
230        NfcCardemulationOccurred nfc_cardemulation_occurred = 137;
231        NfcTagOccurred nfc_tag_occurred = 138;
232        NfcHceTransactionOccurred nfc_hce_transaction_occurred = 139;
233        SeStateChanged se_state_changed = 140;
234        SeOmapiReported se_omapi_reported = 141;
235        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported = 142;
236        AttentionManagerServiceResultReported attention_manager_service_result_reported = 143;
237        AdbConnectionChanged adb_connection_changed = 144;
238        SpeechDspStatReported speech_dsp_stat_reported = 145;
239        UsbContaminantReported usb_contaminant_reported = 146;
240        WatchdogRollbackOccurred watchdog_rollback_occurred = 147;
241        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected = 148;
242        BubbleUIChanged bubble_ui_changed = 149;
243        ScheduledJobConstraintChanged scheduled_job_constraint_changed = 150;
244        BluetoothActiveDeviceChanged bluetooth_active_device_changed = 151;
245        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed = 152;
246        BluetoothA2dpCodecConfigChanged bluetooth_a2dp_codec_config_changed = 153;
247        BluetoothA2dpCodecCapabilityChanged bluetooth_a2dp_codec_capability_changed = 154;
248        BluetoothA2dpAudioUnderrunReported bluetooth_a2dp_audio_underrun_reported = 155;
249        BluetoothA2dpAudioOverrunReported bluetooth_a2dp_audio_overrun_reported = 156;
250        BluetoothDeviceRssiReported bluetooth_device_rssi_reported = 157;
251        BluetoothDeviceFailedContactCounterReported bluetooth_device_failed_contact_counter_reported = 158;
252        BluetoothDeviceTxPowerLevelReported bluetooth_device_tx_power_level_reported = 159;
253        BluetoothHciTimeoutReported bluetooth_hci_timeout_reported = 160;
254        BluetoothQualityReportReported bluetooth_quality_report_reported = 161;
255        BluetoothDeviceInfoReported bluetooth_device_info_reported = 162;
256        BluetoothRemoteVersionInfoReported bluetooth_remote_version_info_reported = 163;
257        BluetoothSdpAttributeReported bluetooth_sdp_attribute_reported = 164;
258        BluetoothBondStateChanged bluetooth_bond_state_changed = 165;
259        BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported = 166;
260        BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported = 167;
261        ScreenTimeoutExtensionReported screen_timeout_extension_reported = 168;
262        ProcessStartTime process_start_time = 169;
263        PermissionGrantRequestResultReported permission_grant_request_result_reported =
264            170 [(log_from_module) = "permissioncontroller"];
265        BluetoothSocketConnectionStateChanged bluetooth_socket_connection_state_changed = 171;
266        DeviceIdentifierAccessDenied device_identifier_access_denied = 172;
267        BubbleDeveloperErrorReported bubble_developer_error_reported = 173;
268        AssistGestureStageReported assist_gesture_stage_reported = 174;
269        AssistGestureFeedbackReported assist_gesture_feedback_reported = 175;
270        AssistGestureProgressReported assist_gesture_progress_reported = 176;
271        TouchGestureClassified touch_gesture_classified = 177;
272        HiddenApiUsed hidden_api_used = 178 [(allow_from_any_uid) = true];
273        StyleUIChanged style_ui_changed = 179 [(log_from_module) = "style"];
274        PrivacyIndicatorsInteracted privacy_indicators_interacted =
275            180 [(log_from_module) = "permissioncontroller"];
276        AppInstallOnExternalStorageReported app_install_on_external_storage_reported = 181;
277        NetworkStackReported network_stack_reported = 182 [(log_from_module) = "network_stack"];
278        AppMovedStorageReported app_moved_storage_reported = 183;
279        BiometricEnrolled biometric_enrolled = 184;
280        SystemServerWatchdogOccurred system_server_watchdog_occurred = 185;
281        TombStoneOccurred tomb_stone_occurred = 186;
282        BluetoothClassOfDeviceReported bluetooth_class_of_device_reported = 187;
283        IntelligenceEventReported intelligence_event_reported =
284            188 [(log_from_module) = "intelligence"];
285        ThermalThrottlingSeverityStateChanged thermal_throttling_severity_state_changed = 189;
286        RoleRequestResultReported role_request_result_reported =
287            190 [(log_from_module) = "permissioncontroller"];
288        MediametricsAudiopolicyReported mediametrics_audiopolicy_reported = 191;
289        MediametricsAudiorecordReported mediametrics_audiorecord_reported = 192;
290        MediametricsAudiothreadReported mediametrics_audiothread_reported = 193;
291        MediametricsAudiotrackReported mediametrics_audiotrack_reported = 194;
292        MediametricsCodecReported mediametrics_codec_reported = 195;
293        MediametricsDrmWidevineReported mediametrics_drm_widevine_reported = 196;
294        MediametricsExtractorReported mediametrics_extractor_reported = 197;
295        MediametricsMediadrmReported mediametrics_mediadrm_reported = 198;
296        MediametricsNuPlayerReported mediametrics_nuplayer_reported = 199;
297        MediametricsRecorderReported mediametrics_recorder_reported = 200;
298        CarPowerStateChanged car_power_state_changed = 203;
299        GarageModeInfo garage_mode_info = 204;
300        TestAtomReported test_atom_reported = 205 [(log_from_module) = "cts"];
301        ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported = 206;
302        ContentCaptureServiceEvents content_capture_service_events = 207;
303        ContentCaptureSessionEvents content_capture_session_events = 208;
304        ContentCaptureFlushed content_capture_flushed = 209;
305        LocationManagerApiUsageReported location_manager_api_usage_reported = 210;
306        ReviewPermissionsFragmentResultReported review_permissions_fragment_result_reported =
307            211 [(log_from_module) = "permissioncontroller"];
308        RuntimePermissionsUpgradeResult runtime_permissions_upgrade_result =
309            212 [(log_from_module) = "permissioncontroller"];
310        GrantPermissionsActivityButtonActions grant_permissions_activity_button_actions =
311            213 [(log_from_module) = "permissioncontroller"];
312        LocationAccessCheckNotificationAction location_access_check_notification_action =
313            214 [(log_from_module) = "permissioncontroller"];
314        AppPermissionFragmentActionReported app_permission_fragment_action_reported =
315            215 [(log_from_module) = "permissioncontroller"];
316        AppPermissionFragmentViewed app_permission_fragment_viewed =
317            216 [(log_from_module) = "permissioncontroller"];
318        AppPermissionsFragmentViewed app_permissions_fragment_viewed =
319            217 [(log_from_module) = "permissioncontroller"];
320        PermissionAppsFragmentViewed permission_apps_fragment_viewed =
321            218  [(log_from_module) = "permissioncontroller"];
322    }
323
324    // Pulled events will start at field 10000.
325    // Next: 10062
326    oneof pulled {
327        WifiBytesTransfer wifi_bytes_transfer = 10000;
328        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
329        MobileBytesTransfer mobile_bytes_transfer = 10002;
330        MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
331        BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
332        KernelWakelock kernel_wakelock = 10004;
333        SubsystemSleepState subsystem_sleep_state = 10005;
334        CpuTimePerFreq cpu_time_per_freq = 10008;
335        CpuTimePerUid cpu_time_per_uid = 10009;
336        CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
337        WifiActivityInfo wifi_activity_info = 10011;
338        ModemActivityInfo modem_activity_info = 10012;
339        BluetoothActivityInfo bluetooth_activity_info = 10007;
340        ProcessMemoryState process_memory_state = 10013;
341        SystemElapsedRealtime system_elapsed_realtime = 10014;
342        SystemUptime system_uptime = 10015;
343        CpuActiveTime cpu_active_time = 10016;
344        CpuClusterTime cpu_cluster_time = 10017;
345        DiskSpace disk_space = 10018 [deprecated=true];
346        RemainingBatteryCapacity remaining_battery_capacity = 10019;
347        FullBatteryCapacity full_battery_capacity = 10020;
348        Temperature temperature = 10021;
349        BinderCalls binder_calls = 10022;
350        BinderCallsExceptions binder_calls_exceptions = 10023;
351        LooperStats looper_stats = 10024;
352        DiskStats disk_stats = 10025;
353        DirectoryUsage directory_usage = 10026;
354        AppSize app_size = 10027;
355        CategorySize category_size = 10028;
356        ProcStats proc_stats = 10029;
357        BatteryVoltage battery_voltage = 10030;
358        NumFingerprintsEnrolled num_fingerprints_enrolled = 10031;
359        DiskIo disk_io = 10032;
360        PowerProfile power_profile = 10033;
361        ProcStatsPkgProc proc_stats_pkg_proc = 10034;
362        ProcessCpuTime process_cpu_time = 10035;
363        NativeProcessMemoryState native_process_memory_state = 10036;
364        CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
365        OnDevicePowerMeasurement on_device_power_measurement = 10038;
366        DeviceCalculatedPowerUse device_calculated_power_use = 10039;
367        DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
368        DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
369        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
370        BatteryLevel battery_level = 10043;
371        BuildInformation build_information = 10044;
372        BatteryCycleCount battery_cycle_count = 10045;
373        DebugElapsedClock debug_elapsed_clock = 10046;
374        DebugFailingElapsedClock debug_failing_elapsed_clock = 10047;
375        NumFacesEnrolled num_faces_enrolled = 10048;
376        RoleHolder role_holder = 10049;
377        DangerousPermissionState dangerous_permission_state = 10050;
378        TrainInfo train_info = 10051;
379        TimeZoneDataInfo time_zone_data_info = 10052;
380        ExternalStorageInfo external_storage_info = 10053;
381        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
382        GpuStatsAppInfo gpu_stats_app_info = 10055;
383        SystemIonHeapSize system_ion_heap_size = 10056;
384        AppsOnExternalStorageInfo apps_on_external_storage_info = 10057;
385        FaceSettings face_settings = 10058;
386        CoolingDevice cooling_device = 10059;
387        AppOps app_ops = 10060;
388        ProcessSystemIonHeapSize process_system_ion_heap_size = 10061;
389    }
390
391    // DO NOT USE field numbers above 100,000 in AOSP.
392    // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
393    // Field numbers 200,000 and above are reserved for future use; do not use them at all.
394}
395
396/**
397 * This proto represents a node of an attribution chain.
398 * Note: All attribution chains are represented as a repeated field of type
399 * AttributionNode. It is understood that in such arrays, the order is that
400 * of calls, that is [A, B, C] if A calls B that calls C.
401 */
402message AttributionNode {
403    // The uid for a given element in the attribution chain.
404    optional int32 uid = 1;
405
406    // The (optional) string tag for an element in the attribution chain. If the
407    // element has no tag, it is encoded as an empty string.
408    optional string tag = 2;
409}
410
411message KeyValuePair {
412    optional int32 key = 1;
413    oneof value {
414        int32 value_int = 2;
415        int64 value_long = 3;
416        string value_str = 4;
417        float value_float = 5;
418    }
419}
420
421message KeyValuePairsAtom {
422    optional int32 uid = 1;
423    repeated KeyValuePair pairs = 2;
424}
425
426/*
427 * *****************************************************************************
428 * Below are all of the individual atoms that are logged by Android via statsd.
429 *
430 * RULES:
431 *   - The field ids for each atom must start at 1, and count upwards by 1.
432 *     Skipping field ids is not allowed.
433 *   - These form an API, so renaming, renumbering or removing fields is
434 *     not allowed between android releases.  (This is not currently enforced,
435 *     but there will be a tool to enforce this restriction).
436 *   - The types must be built-in protocol buffer types, namely, no sub-messages
437 *     are allowed (yet).  The bytes type is also not allowed.
438 *   - The CamelCase name of the message type should match the
439 *     underscore_separated name as defined in Atom.
440 *   - If an atom represents work that can be attributed to an app, there can
441 *     be exactly one AttributionChain field. It must be field number 1.
442 *   - A field that is a uid should be a string field, tagged with the [xxx]
443 *     annotation. The generated code on android will be represented by UIDs,
444 *     and those UIDs will be translated in xxx to those strings.
445 *
446 * CONVENTIONS:
447 *   - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
448 *   - If there is a UID, it goes first. Think in an object-oriented fashion.
449 * *****************************************************************************
450 */
451
452/**
453 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
454 * Logs when the Thermal service HAL notifies the throttling start/stop events.
455 *
456 * Logged from:
457 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
458 */
459message ThermalThrottlingStateChanged {
460    // The type of temperature being reported (CPU, GPU, SKIN, etc)
461    optional android.os.TemperatureTypeEnum sensor_type = 1;
462
463    // Throttling state, this field is DEPRECATED
464    enum State {
465        UNKNOWN = 0;
466        START = 1; // START indicated that throttling was triggered.
467        STOP = 2; // STOP indicates that throttling was cleared.
468    }
469    optional State state = 2;
470
471    optional float temperature = 3;
472}
473
474/**
475 * Logs when the screen state changes.
476 *
477 * Logged from:
478 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
479 */
480message ScreenStateChanged {
481    // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
482    optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
483}
484
485/**
486 * Logs that the process state of the uid, as determined by ActivityManager
487 * (i.e. the highest process state of that uid's processes) has changed.
488 *
489 * Logged from:
490 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
491 */
492message UidProcessStateChanged {
493    optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
494
495    // The state, from frameworks/base/core/proto/android/app/enums.proto.
496    optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
497}
498
499/**
500 * Logs process state change of a process, as per the activity manager.
501 *
502 * Logged from:
503 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
504 */
505message ProcessStateChanged {
506    optional int32 uid = 1;
507    optional string process_name = 2;
508    optional string package_name = 3;
509    // TODO: remove this when validation is done
510    optional int64 version = 5;
511    // The state, from frameworks/base/core/proto/android/app/enums.proto.
512    optional android.app.ProcessStateEnum state = 4;
513}
514
515/**
516 * Logs when ActivityManagerService sleep state is changed.
517 *
518 * Logged from:
519 *   frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
520 */
521message ActivityManagerSleepStateChanged {
522    // TODO: import frameworks proto
523    enum State {
524        UNKNOWN = 0;
525        ASLEEP = 1;
526        AWAKE = 2;
527    }
528    optional State state = 1 [(state_field_option).option = EXCLUSIVE];
529}
530
531/**
532 * Logs when system memory state changes.
533 *
534 * Logged from:
535 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
536 */
537message MemoryFactorStateChanged {
538    // TODO: import frameworks proto
539    enum State {
540        MEMORY_UNKNOWN = 0;
541        NORMAL = 1;     // normal.
542        MODERATE = 2;   // moderate memory pressure.
543        LOW = 3;        // low memory.
544        CRITICAL = 4;   // critical memory.
545
546    }
547    optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
548}
549
550/**
551 * Logs when app is using too much cpu, according to ActivityManagerService.
552 *
553 * Logged from:
554 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
555 */
556message ExcessiveCpuUsageReported {
557    optional int32 uid = 1;
558    optional string process_name = 2;
559    optional string package_name = 3;
560    // package version. TODO: remove this when validation is done
561    optional int64 version = 4;
562}
563
564/**
565 * Logs when a cached process is killed, along with its pss.
566 *
567 * Logged from:
568 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
569 */
570message CachedKillReported {
571    optional int32 uid = 1;
572    optional string process_name = 2;
573    optional string package_name = 3;
574    // TODO: remove this when validation is done
575    optional int64 version = 5;
576    optional int64 pss = 4;
577}
578
579/**
580 * Logs when memory stats of a process is reported.
581 *
582 * Logged from:
583 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
584 */
585message ProcessMemoryStatReported {
586    optional int32 uid = 1;
587    optional string process_name = 2;
588    optional string package_name = 3;
589    //TODO: remove this when validation is done
590    optional int64 version = 9;
591    optional int64 pss = 4;
592    optional int64 uss = 5;
593    optional int64 rss = 6;
594    enum Type {
595        ADD_PSS_INTERNAL_SINGLE = 0;
596        ADD_PSS_INTERNAL_ALL_MEM = 1;
597        ADD_PSS_INTERNAL_ALL_POLL = 2;
598        ADD_PSS_EXTERNAL = 3;
599        ADD_PSS_EXTERNAL_SLOW = 4;
600    }
601    optional Type type = 7;
602    optional int64 duration_millis = 8;
603}
604
605/**
606 * Logs that a process started, finished, crashed, or ANRed.
607 *
608 * Logged from:
609 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
610 */
611message ProcessLifeCycleStateChanged {
612    optional int32 uid = 1 [(is_uid) = true];
613
614    // The process name (usually same as the app name).
615    optional string process_name = 2;
616
617    // What lifecycle state the process changed to.
618    // This enum is specific to atoms.proto.
619    enum State {
620        FINISHED = 0;
621        STARTED = 1;
622        CRASHED = 2;
623    }
624    optional State state = 3;
625}
626
627/**
628 * Logs when the ble scan state changes.
629 *
630 * Logged from:
631 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
632 */
633message BleScanStateChanged {
634    repeated AttributionNode attribution_node = 1;
635
636    enum State {
637        OFF = 0;
638        ON = 1;
639        // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
640        RESET = 2;
641    }
642    optional State state = 2;
643
644    // Does the scan have a filter.
645    optional bool is_filtered = 3;
646    // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
647    optional bool is_first_match = 4;
648    // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
649    optional bool is_opportunistic = 5;
650}
651
652/**
653 * Logs reporting of a ble scan finding results.
654 *
655 * Logged from:
656 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
657 */
658// TODO: Consider also tracking per-scanner-id.
659message BleScanResultReceived {
660    repeated AttributionNode attribution_node = 1;
661
662    // Number of ble scan results returned.
663    optional int32 num_results = 2;
664}
665
666/**
667 * Logs when a sensor state changes.
668 *
669 * Logged from:
670 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
671 */
672message SensorStateChanged {
673    repeated AttributionNode attribution_node = 1;
674
675    // The id (int) of the sensor.
676    optional int32 sensor_id = 2;
677
678    enum State {
679        OFF = 0;
680        ON = 1;
681    }
682    optional State state = 3;
683}
684
685/**
686 * Logs when GPS state changes.
687 *
688 * Logged from:
689 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
690 */
691message GpsScanStateChanged {
692    repeated AttributionNode attribution_node = 1;
693
694    enum State {
695        OFF = 0;
696        ON = 1;
697    }
698    optional State state = 2;
699}
700
701/**
702 * Logs when GPS signal quality.
703 *
704 * Logged from:
705 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
706 */
707message GpsSignalQualityChanged {
708    optional android.server.location.GpsSignalQualityEnum level = 1;
709}
710
711
712/**
713 * Logs when a sync manager sync state changes.
714 *
715 * Logged from:
716 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
717 */
718message SyncStateChanged {
719    repeated AttributionNode attribution_node = 1;
720
721    // Name of the sync (as named in the app). Can be chosen at run-time.
722    optional string sync_name = 2;
723
724    enum State {
725        OFF = 0;
726        ON = 1;
727    }
728    optional State state = 3;
729}
730
731/*
732 * Deferred job stats.
733 *
734 * Logged from:
735 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
736*/
737message DeferredJobStatsReported {
738    repeated AttributionNode attribution_node = 1;
739
740    // Number of jobs deferred.
741    optional int32 num_jobs_deferred = 2;
742
743    // Time since the last job runs.
744    optional int64 time_since_last_job_millis = 3;
745}
746
747/**
748 * Logs when a job scheduler job state changes.
749 *
750 * Logged from:
751 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
752 */
753message ScheduledJobStateChanged {
754    repeated AttributionNode attribution_node = 1;
755
756    // Name of the job (as named in the app)
757    optional string job_name = 2;
758
759    enum State {
760        FINISHED = 0;
761        STARTED = 1;
762        SCHEDULED = 2;
763    }
764    optional State state = 3;
765
766    // The reason a job has stopped.
767    // This is only applicable when the state is FINISHED.
768    // The default value is STOP_REASON_UNKNOWN.
769    optional android.app.job.StopReasonEnum stop_reason = 4;
770
771    // The standby bucket of the app that scheduled the job. These match the framework constants
772    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
773    // already assigned 0.
774    enum Bucket {
775        UNKNOWN = -1;
776        ACTIVE = 0;
777        WORKING_SET = 1;
778        FREQUENT = 2;
779        RARE = 3;
780        NEVER = 4;
781    }
782    optional Bucket standby_bucket = 5 [default = UNKNOWN];
783
784    // The job id (as assigned by the app).
785    optional int32 job_id = 6;
786}
787
788/**
789 * Logs when the audio state changes.
790 *
791 * Logged from:
792 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
793 */
794message AudioStateChanged {
795    repeated AttributionNode attribution_node = 1;
796
797    enum State {
798        OFF = 0;
799        ON = 1;
800        // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
801        RESET = 2;
802    }
803    optional State state = 2;
804}
805
806/**
807 * Logs when the video codec state changes.
808 *
809 * Logged from:
810 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
811 */
812message MediaCodecStateChanged {
813    repeated AttributionNode attribution_node = 1;
814
815    enum State {
816        OFF = 0;
817        ON = 1;
818        // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
819        RESET = 2;
820    }
821    optional State state = 2;
822}
823
824/**
825 * Logs when the flashlight state changes.
826 *
827 * Logged from:
828 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
829 */
830message FlashlightStateChanged {
831    repeated AttributionNode attribution_node = 1;
832
833    enum State {
834        OFF = 0;
835        ON = 1;
836        // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
837        RESET = 2;
838    }
839    optional State state = 2;
840}
841
842/**
843 * Logs when the camera state changes.
844 *
845 * Logged from:
846 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
847 */
848message CameraStateChanged {
849    repeated AttributionNode attribution_node = 1;
850
851    enum State {
852        OFF = 0;
853        ON = 1;
854        // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
855        RESET = 2;
856    }
857    optional State state = 2;
858}
859
860/**
861 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
862 *
863 * Logged from:
864 *   TODO
865 */
866message WakelockStateChanged {
867    repeated AttributionNode attribution_node = 1;
868
869    // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
870    // From frameworks/base/core/proto/android/os/enums.proto.
871    optional android.os.WakeLockLevelEnum type = 2;
872
873    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
874    optional string tag = 3;
875
876    enum State {
877        RELEASE = 0;
878        ACQUIRE = 1;
879        CHANGE_RELEASE = 2;
880        CHANGE_ACQUIRE = 3;
881    }
882    optional State state = 4;
883}
884
885/**
886 * Logs when a partial wakelock is considered 'long' (over 1 min).
887 *
888 * Logged from:
889 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
890 */
891message LongPartialWakelockStateChanged {
892    repeated AttributionNode attribution_node = 1;
893
894    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
895    optional string tag = 2;
896
897    // TODO: I have no idea what this is.
898    optional string history_tag = 3;
899
900    enum State {
901        OFF = 0;
902        ON = 1;
903    }
904    optional State state = 4;
905}
906
907/**
908 * Logs when the device is interactive, according to the PowerManager Notifier.
909 *
910 * Logged from:
911 *   frameworks/base/services/core/java/com/android/server/power/Notifier.java
912 */
913message InteractiveStateChanged {
914    enum State {
915        OFF = 0;
916        ON = 1;
917    }
918    optional State state = 1;
919}
920
921/**
922 * Logs Battery Saver state change.
923 *
924 * Logged from:
925 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
926 */
927message BatterySaverModeStateChanged {
928    enum State {
929        OFF = 0;
930        ON = 1;
931    }
932    optional State state = 1;
933}
934
935/**
936 * Logs Doze mode state change.
937 *
938 * Logged from:
939 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
940 */
941message DeviceIdleModeStateChanged {
942    optional android.server.DeviceIdleModeEnum state = 1;
943}
944
945
946/**
947 * Logs state change of Doze mode including maintenance windows.
948 *
949 * Logged from:
950 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
951 */
952message DeviceIdlingModeStateChanged {
953    optional android.server.DeviceIdleModeEnum state = 1;
954}
955
956/**
957 * Logs screen brightness level.
958 *
959 * Logged from:
960 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
961 */
962message ScreenBrightnessChanged {
963    // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
964    optional int32 level = 1;
965}
966
967/**
968 * Logs battery level (percent full, from 0 to 100).
969 *
970 * Logged from:
971 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
972 */
973message BatteryLevelChanged {
974    // Battery level. Should be in [0, 100].
975    optional int32 battery_level = 1;
976}
977
978/**
979 * Logs change in charging status of the device.
980 *
981 * Logged from:
982 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
983 */
984message ChargingStateChanged {
985    // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
986    optional android.os.BatteryStatusEnum state = 1;
987}
988
989/**
990 * Logs whether the device is plugged in, and what power source it is using.
991 *
992 * Logged from:
993 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
994 */
995message PluggedStateChanged {
996    // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
997    optional android.os.BatteryPluggedStateEnum state = 1;
998}
999
1000/**
1001 * Logs when an app's wakeup alarm fires.
1002 *
1003 * Logged from:
1004 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1005 */
1006message WakeupAlarmOccurred {
1007    repeated AttributionNode attribution_node = 1;
1008
1009    // Name of the wakeup alarm.
1010    optional string tag = 2;
1011
1012    // Name of source package (for historical reasons, since BatteryStats tracked it).
1013    optional string package_name = 3;
1014
1015    // These enum values match the STANDBY_BUCKET_XXX constants defined in UsageStatsManager.java.
1016    enum Bucket {
1017        UNKNOWN = 0;
1018        EXEMPTED = 5;
1019        ACTIVE = 10;
1020        WORKING_SET = 20;
1021        FREQUENT = 30;
1022        RARE = 40;
1023        NEVER = 50;
1024    }
1025    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
1026    optional Bucket app_standby_bucket = 4;
1027}
1028
1029/**
1030 * Logs when an an app causes the mobile radio to change state.
1031 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
1032 *
1033 * Logged from:
1034 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1035 */
1036message MobileRadioPowerStateChanged {
1037    repeated AttributionNode attribution_node = 1;
1038
1039    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
1040    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1041}
1042
1043/**
1044 * Logs when an an app causes the wifi radio to change state.
1045 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
1046 *
1047 * Logged from:
1048 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1049 */
1050message WifiRadioPowerStateChanged {
1051    repeated AttributionNode attribution_node = 1;
1052
1053    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
1054    optional android.telephony.DataConnectionPowerStateEnum state = 2;
1055}
1056
1057/**
1058 * Logs kernel wakeup reasons and aborts.
1059 *
1060 * Logged from:
1061 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1062 */
1063message KernelWakeupReported {
1064    // Name of the kernel wakeup reason (or abort).
1065    optional string wakeup_reason_name = 1;
1066
1067    // Duration (in microseconds) for the wake-up interrupt to be serviced.
1068    optional int64 duration_micros = 2;
1069}
1070
1071/**
1072 * Logs when Wifi is toggled on/off.
1073 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
1074 *
1075 * Logged from:
1076 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1077 */
1078message WifiEnabledStateChanged {
1079    enum State {
1080        OFF = 0;
1081        ON = 1;
1082    }
1083    optional State state = 1;
1084}
1085
1086/**
1087 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
1088 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
1089 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
1090 *
1091 * Logged from:
1092 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
1093 */
1094message WifiRunningStateChanged {
1095    repeated AttributionNode attribution_node = 1;
1096
1097    enum State {
1098        OFF = 0;
1099        ON = 1;
1100    }
1101    optional State state = 2;
1102}
1103
1104/**
1105 * Logs wifi locks held by an app.
1106 *
1107 * Logged from:
1108 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1109 */
1110message WifiLockStateChanged {
1111    repeated AttributionNode attribution_node = 1;
1112
1113    enum State {
1114        OFF = 0;
1115        ON = 1;
1116    }
1117    optional State state = 2;
1118
1119    // WifiLock type, from frameworks/base/core/proto/android/wifi/enums.proto.
1120    optional android.net.wifi.WifiModeEnum mode = 3;
1121}
1122
1123/**
1124 * Logs wifi signal strength changes.
1125 *
1126 * Logged from:
1127 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
1128 */
1129message WifiSignalStrengthChanged {
1130    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1131    optional android.telephony.SignalStrengthEnum signal_strength = 1;
1132}
1133
1134/**
1135 * Logs wifi scans performed by an app.
1136 *
1137 * Logged from:
1138 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
1139 */
1140message WifiScanStateChanged {
1141    repeated AttributionNode attribution_node = 1;
1142
1143    enum State {
1144        OFF = 0;
1145        ON = 1;
1146    }
1147    optional State state = 2;
1148}
1149
1150/**
1151 * Logs wifi multicast locks held by an app
1152 *
1153 * Logged from:
1154 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
1155 */
1156message WifiMulticastLockStateChanged {
1157    repeated AttributionNode attribution_node = 1;
1158
1159    enum State {
1160        OFF = 0;
1161        ON = 1;
1162    }
1163    optional State state = 2;
1164
1165    optional string tag = 3;
1166}
1167
1168/**
1169 * Logs shutdown reason and duration on next boot.
1170 *
1171 * Logged from:
1172 *   frameworks/base/core/java/com/android/server/BootReceiver.java
1173 */
1174message ShutdownSequenceReported {
1175    // True if shutdown is for a reboot. Default: false if we do not know.
1176    optional bool reboot = 1;
1177
1178    // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
1179    optional string reason = 2;
1180
1181    // Beginning of shutdown time in ms using wall clock time since unix epoch.
1182    // Default: 0 if no start time received.
1183    optional int64 start_time_millis = 3;
1184
1185    // Duration of shutdown in ms. Default: 0 if no duration received.
1186    optional int64 duration_millis = 4;
1187}
1188
1189
1190/**
1191 * Logs boot reason and duration.
1192 *
1193 * Logged from:
1194 *   system/core/bootstat/bootstat.cpp
1195 */
1196message BootSequenceReported {
1197    // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
1198    // Default: "<EMPTY>" if not available.
1199    optional string bootloader_reason = 1;
1200
1201    // Reason for system boot. Eg. bootloader, reboot,userrequested
1202    // Default: "<EMPTY>" if not available.
1203    optional string system_reason = 2;
1204
1205    // End of boot time in ms from unix epoch using system wall clock.
1206    optional int64 end_time_millis = 3;
1207
1208    // Total boot duration in ms.
1209    optional int64 total_duration_millis = 4;
1210
1211    // Bootloader duration in ms.
1212    optional int64 bootloader_duration_millis = 5;
1213
1214    // Time since last boot in ms. Default: 0 if not available.
1215    optional int64 time_since_last_boot = 6;
1216}
1217
1218
1219/**
1220 * Logs call state and disconnect cause (if applicable).
1221 *
1222 * Logged from:
1223 *   packages/services/Telecomm/src/com/android/server/telecom/Call.java
1224 */
1225message CallStateChanged {
1226    // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
1227    // From frameworks/base/core/proto/android/telecomm/enums.proto.
1228    optional android.telecom.CallStateEnum call_state = 1;
1229
1230    // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
1231    // This value is only applicable when the call_state is DISCONNECTED, and
1232    // should always be UNKNOWN if the call_state is not DISCONNECTED.
1233    // From frameworks/base/core/proto/android/telecomm/enums.proto.
1234    optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
1235
1236    // True if the call is self-managed, which are apps that use the
1237    // telecom infrastructure to make their own calls.
1238    optional bool self_managed = 3;
1239
1240    // True if call is external. External calls are calls on connected Wear
1241    // devices but show up in Telecom so the user can pull them onto the device.
1242    optional bool external_call = 4;
1243}
1244
1245/**
1246 * Logs keyguard state. The keyguard is the lock screen.
1247 *
1248 * Logged from:
1249 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
1250 */
1251message KeyguardStateChanged {
1252    enum State {
1253        UNKNOWN = 0;
1254        // The keyguard is hidden when the phone is unlocked.
1255        HIDDEN = 1;
1256        // The keyguard is shown when the phone is locked (screen turns off).
1257        SHOWN= 2;
1258        // The keyguard is occluded when something is overlaying the keyguard.
1259        // Eg. Opening the camera while on the lock screen.
1260        OCCLUDED = 3;
1261    }
1262    optional State state = 1;
1263}
1264
1265/**
1266 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1267 * prompts the user to enter a password (pattern, pin, etc).
1268 *
1269 * Logged from:
1270 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1271 */
1272
1273message KeyguardBouncerStateChanged {
1274    enum State {
1275        UNKNOWN = 0;
1276        // Bouncer is hidden, either as a result of successfully entering the
1277        // password, screen timing out, or user going back to lock screen.
1278        HIDDEN = 1;
1279        // This is when the user is being prompted to enter the password.
1280        SHOWN = 2;
1281    }
1282    optional State state = 1;
1283}
1284
1285/**
1286 * Logs the result of entering a password into the keyguard bouncer.
1287 *
1288 * Logged from:
1289 *   frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1290 */
1291message KeyguardBouncerPasswordEntered {
1292    enum BouncerResult {
1293        UNKNOWN = 0;
1294        // The password entered was incorrect.
1295        FAILURE = 1;
1296        // The password entered was correct.
1297        SUCCESS = 2;
1298    }
1299    optional BouncerResult result = 1;
1300}
1301
1302/*
1303 * Logs changes to the configuration of the device. The configuration is defined
1304 * in frameworks/base/core/java/android/content/res/Configuration.java
1305 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1306 * Please go there to interpret the possible values each field can be.
1307 *
1308 * Logged from:
1309 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1310 */
1311message ResourceConfigurationChanged {
1312    // Bit mask of color capabilities of the screen.
1313    // Contains information about the color gamut and hdr mode of the screen.
1314    // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1315    optional int32 color_mode = 1;
1316
1317    // The target screen density being rendered to.
1318    // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1319    optional int32 density_dpi = 2;
1320
1321    // Current user preference for the scaling factor for fonts,
1322    // relative to the base density scaling.
1323    // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1324    optional float font_scale = 3;
1325
1326    // Flag indicating whether the hard keyboard is hidden.
1327    // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1328    optional int32 hard_keyboard_hidden = 4;
1329
1330    // The type of keyboard attached to the device.
1331    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1332    optional int32 keyboard = 5;
1333
1334    // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1335    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1336    optional int32 keyboard_hidden = 6;
1337
1338    // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1339    // 0 if undefined.
1340    // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1341    optional int32 mcc = 7;
1342
1343    // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1344    // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1345    // MNC_ZERO symbol defined in Configuration.java.
1346    // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1347    optional int32 mnc = 8;
1348
1349    // The kind of navigation available on the device.
1350    // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1351    optional int32 navigation = 9;
1352
1353    // Flag indicating whether the navigation is available.
1354    // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1355    optional int32 navigation_hidden = 10;
1356
1357    // Overall orientation of the screen.
1358    // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1359    optional int32 orientation = 11;
1360
1361    // The current height of the available screen space, in dp units.
1362    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1363    optional int32 screen_height_dp = 12;
1364
1365    // Bit mask of overall layout of the screen.
1366    // Contains information about screen size, whether the screen is wider/taller
1367    // than normal, whether the screen layout is right-tl-left or left-to-right,
1368    // and whether the screen has a rounded shape.
1369    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1370    optional int32 screen_layout = 13;
1371
1372    // Current width of the available screen space, in dp units.
1373    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1374    optional int32 screen_width_dp = 14;
1375
1376    // The smallest screen size an application will see in normal operation.
1377    // This is the smallest value of both screenWidthDp and screenHeightDp
1378    // in portrait and landscape.
1379    // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1380    optional int32 smallest_screen_width_dp = 15;
1381
1382    // The type of touch screen attached to the device.
1383    // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1384    optional int32 touchscreen = 16;
1385
1386    // Bit mask of the ui mode.
1387    // Contains information about the overall ui mode of the device.
1388    // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1389    // Also contains information about whether the device is in night mode.
1390    // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1391    optional int32 ui_mode = 17;
1392}
1393
1394
1395/**
1396 * Logs changes in the connection state of the mobile radio.
1397 *
1398 * Logged from:
1399 *    frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1400 */
1401message MobileConnectionStateChanged {
1402    // States are from the state machine DataConnection.java.
1403    enum State {
1404        UNKNOWN = 0;
1405        // The connection is inactive, or disconnected.
1406        INACTIVE = 1;
1407        // The connection is being activated, or connecting.
1408        ACTIVATING = 2;
1409        // The connection is active, or connected.
1410        ACTIVE = 3;
1411        // The connection is disconnecting.
1412        DISCONNECTING = 4;
1413        // The connection is disconnecting after creating a connection.
1414        DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1415    }
1416    optional State state  = 1;
1417    // For multi-sim phones, this distinguishes between the sim cards.
1418    optional int32 sim_slot_index = 2;
1419    // Used to identify the connection. Starts at 0 and increments by 1 for
1420    // every new network created. Resets whenever the device reboots.
1421    optional int32 data_connection_id = 3;
1422    // A bitmask for the capabilities of this connection.
1423    // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1424    // Default value (if we have no information): 0
1425    optional int64 capabilities = 4;
1426    // If this connection has internet.
1427    // This just checks if the DEFAULT bit of capabilities is set.
1428    optional bool has_internet = 5;
1429}
1430
1431/**
1432 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1433 *
1434 * Logged from:
1435 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1436 */
1437message MobileRadioTechnologyChanged {
1438    optional android.telephony.NetworkTypeEnum state = 1;
1439    // For multi-sim phones, this distinguishes between the sim cards.
1440    optional int32 sim_slot_index = 2;
1441}
1442
1443/**
1444 * Logs the VID and PID of any connected USB devices.
1445 *
1446 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1447 *
1448 * Logged by Vendor.
1449 */
1450message UsbDeviceAttached {
1451    optional int32 vid = 1;
1452    optional int32 pid = 2;
1453    optional bool has_audio = 3;
1454    optional bool has_hid = 4;
1455    optional bool has_storage = 5;
1456    enum State {
1457        STATE_DISCONNECTED = 0;
1458        STATE_CONNECTED = 1;
1459    }
1460    optional State state = 6;
1461    optional int64 last_connect_duration_millis = 7;
1462}
1463
1464
1465/**
1466 * Logs when Bluetooth is enabled and disabled.
1467 *
1468 * Logged from:
1469 *   services/core/java/com/android/server/BluetoothManagerService.java
1470 */
1471message BluetoothEnabledStateChanged {
1472    repeated AttributionNode attribution_node = 1;
1473    // Whether or not bluetooth is enabled on the device.
1474    enum State {
1475        UNKNOWN = 0;
1476        ENABLED = 1;
1477        DISABLED = 2;
1478    }
1479    optional State state = 2;
1480    // The reason for being enabled/disabled.
1481    // Eg. Airplane mode, crash, application request.
1482    optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1483    // If the reason is an application request, this will be the package name.
1484    optional string pkg_name = 4;
1485}
1486
1487/**
1488 * Logs when profiles on a Bluetooth device connects and disconnects.
1489 *
1490 * Logged from:
1491 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
1492 *
1493 * Next Tag: 5
1494 */
1495message BluetoothConnectionStateChanged {
1496    // The state of the connection.
1497    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1498    optional android.bluetooth.ConnectionStateEnum state = 1;
1499    // An identifier that can be used to match connect and disconnect events.
1500    // Currently is last two bytes of a hash of a device level ID and
1501    // the mac address of the bluetooth device that is connected.
1502    // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
1503    optional int32 obfuscated_id = 2 [deprecated = true];
1504    // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1505    // From android.bluetooth.BluetoothAdapter.java
1506    // Default: 0 when not used
1507    optional int32 bt_profile = 3;
1508    // An identifier that can be used to match events for this device.
1509    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1510    // Salt: Randomly generated 256 bit value
1511    // Hash algorithm: HMAC-SHA256
1512    // Size: 32 byte
1513    // Default: null or empty if the device identifier is not known
1514    optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
1515}
1516
1517/**
1518 * Logs when a Bluetooth device connects and disconnects over ACL
1519 *
1520 * Logged from:
1521 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1522 *
1523 * Next Tag: 3
1524 */
1525message BluetoothAclConnectionStateChanged {
1526    // An identifier that can be used to match events for this device.
1527    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1528    // Salt: Randomly generated 256 bit value
1529    // Hash algorithm: HMAC-SHA256
1530    // Size: 32 byte
1531    // Default: null or empty if the device identifier is not known
1532    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1533    // The state of the connection.
1534    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1535    optional android.bluetooth.ConnectionStateEnum state = 2;
1536}
1537
1538/**
1539 * Logs when a Bluetooth device connects and disconnects over SCO
1540 *
1541 * Logged from:
1542 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
1543 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
1544 *
1545 * Next Tag: 4
1546 */
1547message BluetoothScoConnectionStateChanged {
1548    // An identifier that can be used to match events for this device.
1549    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1550    // Salt: Randomly generated 256 bit value
1551    // Hash algorithm: HMAC-SHA256
1552    // Size: 32 byte
1553    // Default: null or empty if the device identifier is not known
1554    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1555    // The state of the connection.
1556    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1557    optional android.bluetooth.ConnectionStateEnum state = 2;
1558    // Codec used for this SCO connection
1559    // Default: UNKNOWN
1560    optional android.bluetooth.hfp.ScoCodec codec = 3;
1561}
1562
1563/**
1564 * Logged when active device of a profile changes
1565 *
1566 * Logged from:
1567 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1568 *     packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetService.java
1569 *     packages/apps/Bluetooth/src/com/android/bluetooth/hearingaid/HearingAidService.java
1570 */
1571message BluetoothActiveDeviceChanged {
1572    // The profile whose active device has changed. Eg. A2DP, HEADSET, HEARING_AID
1573    // From android.bluetooth.BluetoothProfile
1574    optional int32 bt_profile = 1;
1575    // An identifier that can be used to match events for this new active device.
1576    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1577    // Salt: Randomly generated 256 bit value
1578    // Hash algorithm: HMAC-SHA256
1579    // Size: 32 byte
1580    // Default: null or empty if there is no active device for this profile
1581    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
1582}
1583
1584// Logs when there is an event affecting Bluetooth device's link layer connection.
1585// - This event is triggered when there is a related HCI command or event
1586// - Users of this metrics can deduce Bluetooth device's connection state from these events
1587// - HCI commands are logged before the command is sent, after receiving command status, and after
1588//   receiving command complete
1589// - HCI events are logged when they arrive
1590//
1591// Low level log from system/bt
1592//
1593// Bluetooth classic commands:
1594// - CMD_CREATE_CONNECTION
1595// - CMD_DISCONNECT
1596// - CMD_CREATE_CONNECTION_CANCEL
1597// - CMD_ACCEPT_CONNECTION_REQUEST
1598// - CMD_REJECT_CONNECTION_REQUEST
1599// - CMD_SETUP_ESCO_CONNECTION
1600// - CMD_ACCEPT_ESCO_CONNECTION
1601// - CMD_REJECT_ESCO_CONNECTION
1602// - CMD_ENH_SETUP_ESCO_CONNECTION
1603// - CMD_ENH_ACCEPT_ESCO_CONNECTION
1604//
1605// Bluetooth low energy commands:
1606// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
1607// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
1608// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
1609// - CMD_BLE_CLEAR_WHITE_LIST
1610// - CMD_BLE_ADD_WHITE_LIST
1611// - CMD_BLE_REMOVE_WHITE_LIST
1612//
1613// Bluetooth classic events:
1614// - EVT_CONNECTION_COMP
1615// - EVT_CONNECTION_REQUEST
1616// - EVT_DISCONNECTION_COMP
1617// - EVT_ESCO_CONNECTION_COMP
1618// - EVT_ESCO_CONNECTION_CHANGED
1619//
1620// Bluetooth low energy meta events:
1621// - BLE_EVT_CONN_COMPLETE_EVT
1622// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
1623//
1624// Next tag: 10
1625message BluetoothLinkLayerConnectionEvent {
1626    // An identifier that can be used to match events for this device.
1627    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1628    // Salt: Randomly generated 256 bit value
1629    // Hash algorithm: HMAC-SHA256
1630    // Size: 32 byte
1631    // Default: null or empty if the device identifier is not known
1632    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1633    // Connection handle of this connection if available
1634    // Range: 0x0000 - 0x0EFF (12 bits)
1635    // Default: 0xFFFF if the handle is unknown
1636    optional int32 connection_handle = 2;
1637    // Direction of the link
1638    // Default: DIRECTION_UNKNOWN
1639    optional android.bluetooth.DirectionEnum direction = 3;
1640    // Type of this link
1641    // Default: LINK_TYPE_UNKNOWN
1642    optional android.bluetooth.LinkTypeEnum type = 4;
1643
1644    // Reason metadata for this link layer connection event, rules for interpretation:
1645    // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
1646    //    EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
1647    // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
1648    //    set and valid, ignore hci_ble_event
1649
1650    // HCI command associated with this event
1651    // Default: CMD_UNKNOWN
1652    optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
1653    // HCI event associated with this event
1654    // Default: EVT_UNKNOWN
1655    optional android.bluetooth.hci.EventEnum hci_event = 6;
1656    // HCI BLE meta event associated with this event
1657    // Default: BLE_EVT_UNKNOWN
1658    optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
1659    // HCI command status code if this is triggerred by hci_cmd
1660    // Default: STATUS_UNKNOWN
1661    optional android.bluetooth.hci.StatusEnum cmd_status = 8;
1662    // HCI reason code associated with this event
1663    // Default: STATUS_UNKNOWN
1664    optional android.bluetooth.hci.StatusEnum reason_code = 9;
1665}
1666
1667/**
1668 * Logs when a module is rolled back by Watchdog.
1669 *
1670 * Logged from: Rollback Manager
1671 */
1672message WatchdogRollbackOccurred {
1673    enum RollbackType {
1674        UNKNOWN = 0;
1675        ROLLBACK_INITIATE = 1;
1676        ROLLBACK_SUCCESS = 2;
1677        ROLLBACK_FAILURE = 3;
1678        ROLLBACK_BOOT_TRIGGERED = 4;
1679    }
1680    optional RollbackType rollback_type = 1;
1681
1682    optional string package_name = 2;
1683
1684    optional int32 package_version_code = 3;
1685}
1686
1687/**
1688 * Logs when there is a change in Bluetooth A2DP playback state
1689 *
1690 * Logged from:
1691 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1692 */
1693message BluetoothA2dpPlaybackStateChanged {
1694    // An identifier that can be used to match events for this device.
1695    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1696    // Salt: Randomly generated 256 bit value
1697    // Hash algorithm: HMAC-SHA256
1698    // Size: 32 byte
1699    // Default: null or empty if the device identifier is not known
1700    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1701    // Current playback state
1702    // Default: PLAYBACK_STATE_UNKNOWN
1703    optional android.bluetooth.a2dp.PlaybackStateEnum playback_state = 2;
1704    // Current audio coding mode
1705    // Default: AUDIO_CODING_MODE_UNKNOWN
1706    optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
1707}
1708
1709/**
1710 * Logs when there is a change in A2DP codec config for a particular remote device
1711 *
1712 * Logged from:
1713 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
1714 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1715 */
1716message BluetoothA2dpCodecConfigChanged {
1717    // An identifier that can be used to match events for this device.
1718    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1719    // Salt: Randomly generated 256 bit value
1720    // Hash algorithm: HMAC-SHA256
1721    // Size: 32 byte
1722    // Default: null or empty if the device identifier is not known
1723    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1724    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
1725    // Default SOURCE_CODEC_TYPE_INVALID
1726    optional int32 codec_type = 2;
1727    // Codec priroity, the higher the more preferred, -1 for disabled
1728    // Default: CODEC_PRIORITY_DEFAULT
1729    optional int32 codec_priority = 3;
1730    // Sample rate in Hz as defined by various SAMPLE_RATE_* constants in BluetoothCodecConfig
1731    // Default: SAMPLE_RATE_NONE
1732    optional int32 sample_rate = 4;
1733    // Bits per sample as defined by various BITS_PER_SAMPLE_* constants in BluetoothCodecConfig
1734    // Default: BITS_PER_SAMPLE_NONE
1735    optional int32 bits_per_sample = 5;
1736    // Channel mode as defined by various CHANNEL_MODE_* constants in BluetoothCodecConfig
1737    // Default: CHANNEL_MODE_NONE
1738    optional int32 channel_mode = 6;
1739    // Codec specific values
1740    // Default 0
1741    optional int64 codec_specific_1 = 7;
1742    optional int64 codec_specific_2 = 8;
1743    optional int64 codec_specific_3 = 9;
1744    optional int64 codec_specific_4 = 10;
1745}
1746
1747/**
1748 * Logs when there is a change in selectable A2DP codec capability for a paricular remote device
1749 * Each codec's capability is logged separately due to statsd restriction
1750 *
1751 * Logged from:
1752 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
1753 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
1754 */
1755message BluetoothA2dpCodecCapabilityChanged {
1756    // An identifier that can be used to match events for this device.
1757    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1758    // Salt: Randomly generated 256 bit value
1759    // Hash algorithm: HMAC-SHA256
1760    // Size: 32 byte
1761    // Default: null or empty if the device identifier is not known
1762    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1763    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
1764    // Default SOURCE_CODEC_TYPE_INVALID
1765    optional int32 codec_type = 2;
1766    // Codec priroity, the higher the more preferred, -1 for disabled
1767    // Default: CODEC_PRIORITY_DEFAULT
1768    optional int32 codec_priority = 3;
1769    // A bit field of supported sample rates as defined by various SAMPLE_RATE_* constants
1770    // in BluetoothCodecConfig
1771    // Default: empty and SAMPLE_RATE_NONE for individual item
1772    optional int32 sample_rate = 4;
1773    // A bit field of supported bits per sample as defined by various BITS_PER_SAMPLE_* constants
1774    // in BluetoothCodecConfig
1775    // Default: empty and BITS_PER_SAMPLE_NONE for individual item
1776    optional int32 bits_per_sample = 5;
1777    // A bit field of supported channel mode as defined by various CHANNEL_MODE_* constants in
1778    // BluetoothCodecConfig
1779    // Default: empty and CHANNEL_MODE_NONE for individual item
1780    optional int32 channel_mode = 6;
1781    // Codec specific values
1782    // Default 0
1783    optional int64 codec_specific_1 = 7;
1784    optional int64 codec_specific_2 = 8;
1785    optional int64 codec_specific_3 = 9;
1786    optional int64 codec_specific_4 = 10;
1787}
1788
1789/**
1790 * Logs when A2DP failed to read from PCM source.
1791 * This typically happens when audio HAL cannot supply A2DP with data fast enough for encoding.
1792 *
1793 * Logged from:
1794 *     system/bt
1795 */
1796message BluetoothA2dpAudioUnderrunReported {
1797    // An identifier that can be used to match events for this device.
1798    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1799    // Salt: Randomly generated 256 bit value
1800    // Hash algorithm: HMAC-SHA256
1801    // Size: 32 byte
1802    // Default: null or empty if the device identifier is not known
1803    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1804    // Encoding interval in nanoseconds
1805    // Default: 0
1806    optional int64 encoding_interval_nanos = 2;
1807    // Number of bytes of PCM data that could not be read from the source
1808    // Default: 0
1809    optional int32 num_missing_pcm_bytes = 3;
1810}
1811
1812/**
1813 * Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit
1814 * buffer queue is full and we have to drop data
1815 *
1816 * Logged from:
1817 *     system/bt
1818 */
1819message BluetoothA2dpAudioOverrunReported {
1820    // An identifier that can be used to match events for this device.
1821    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1822    // Salt: Randomly generated 256 bit value
1823    // Hash algorithm: HMAC-SHA256
1824    // Size: 32 byte
1825    // Default: null or empty if the device identifier is not known
1826    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1827    // Encoding interval in nanoseconds
1828    // Default: 0
1829    optional int64 encoding_interval_nanos = 2;
1830    // Number of buffers dropped in this event
1831    // Each buffer is encoded in one encoding interval and consists of multiple encoded frames
1832    // Default: 0
1833    optional int32 num_dropped_buffers = 3;
1834    // Number of encoded buffers dropped in this event
1835    // Default 0
1836    optional int32 num_dropped_encoded_frames = 4;
1837    // Number of encoded bytes dropped in this event
1838    // Default: 0
1839    optional int32 num_dropped_encoded_bytes = 5;
1840}
1841
1842/**
1843 * Logs when we receive reports regarding a device's RSSI value
1844 *
1845 * Logged from:
1846 *     system/bt
1847 */
1848message BluetoothDeviceRssiReported {
1849    // An identifier that can be used to match events for this device.
1850    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1851    // Salt: Randomly generated 256 bit value
1852    // Hash algorithm: HMAC-SHA256
1853    // Size: 32 byte
1854    // Default: null or empty if the device identifier is not known
1855    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1856    // Connection handle of this connection if available
1857    // Range: 0x0000 - 0x0EFF (12 bits)
1858    // Default: 0xFFFF if the handle is unknown
1859    optional int32 connection_handle = 2;
1860    // HCI command status code if this is triggerred by hci_cmd
1861    // Default: STATUS_UNKNOWN
1862    optional android.bluetooth.hci.StatusEnum hci_status = 3;
1863    // BR/EDR
1864    //   Range: -128 ≤ N ≤ 127 (signed integer)
1865    //   Units: dB
1866    // LE:
1867    //   Range: -127 to 20, 127 (signed integer)
1868    //   Units: dBm
1869    // Invalid when an out of range value is reported
1870    optional int32 rssi = 4;
1871}
1872
1873/**
1874 * Logs when we receive reports regarding how many consecutive failed contacts for a connection
1875 *
1876 * Logged from:
1877 *     system/bt
1878 */
1879message BluetoothDeviceFailedContactCounterReported {
1880    // An identifier that can be used to match events for this device.
1881    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1882    // Salt: Randomly generated 256 bit value
1883    // Hash algorithm: HMAC-SHA256
1884    // Size: 32 byte
1885    // Default: null or empty if the device identifier is not known
1886    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1887    // Connection handle of this connection if available
1888    // Range: 0x0000 - 0x0EFF (12 bits)
1889    // Default: 0xFFFF if the handle is unknown
1890    optional int32 connection_handle = 2;
1891    // HCI command status code if this is triggerred by hci_cmd
1892    // Default: STATUS_UNKNOWN
1893    optional android.bluetooth.hci.StatusEnum cmd_status = 3;
1894    // Number of consecutive failed contacts for a connection corresponding to the Handle
1895    // Range: uint16_t, 0-0xFFFF
1896    // Default: 0xFFFFF
1897    optional int32 failed_contact_counter = 4;
1898}
1899
1900/**
1901 * Logs when we receive reports regarding the tranmit power level used for a specific connection
1902 *
1903 * Logged from:
1904 *     system/bt
1905 */
1906message BluetoothDeviceTxPowerLevelReported {
1907    // An identifier that can be used to match events for this device.
1908    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
1909    // Salt: Randomly generated 256 bit value
1910    // Hash algorithm: HMAC-SHA256
1911    // Size: 32 byte
1912    // Default: null or empty if the device identifier is not known
1913    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
1914    // Connection handle of this connection if available
1915    // Range: 0x0000 - 0x0EFF (12 bits)
1916    // Default: 0xFFFF if the handle is unknown
1917    optional int32 connection_handle = 2;
1918    // HCI command status code if this is triggered by hci_cmd
1919    // Default: STATUS_UNKNOWN
1920    optional android.bluetooth.hci.StatusEnum hci_status = 3;
1921    // Range: -30 ≤ N ≤ 20
1922    // Units: dBm
1923    // Invalid when an out of range value is reported
1924    optional int32 transmit_power_level = 4;
1925}
1926
1927/**
1928 * Logs when Bluetooth controller failed to reply with command status within a timeout period after
1929 * receiving an HCI command from the host
1930 *
1931 * Logged from: system/bt
1932 */
1933message BluetoothHciTimeoutReported {
1934    // HCI command associated with this event
1935    // Default: CMD_UNKNOWN
1936    optional android.bluetooth.hci.CommandEnum hci_command = 1;
1937}
1938
1939/**
1940 * Logs when we receive Bluetooth Link Quality Report event from the controller
1941 * See Android Bluetooth HCI specification for more details
1942 *
1943 * Note: all count and bytes field are counted since last event
1944 *
1945 * Logged from: system/bt
1946 */
1947message BluetoothQualityReportReported {
1948    // Quality report ID
1949    // Original type: uint8_t
1950    // Default: BQR_ID_UNKNOWN
1951    optional android.bluetooth.hci.BqrIdEnum quality_report_id = 1;
1952    // Packet type of the connection
1953    // Original type: uint8_t
1954    // Default: BQR_PACKET_TYPE_UNKNOWN
1955    optional android.bluetooth.hci.BqrPacketTypeEnum packet_types = 2;
1956    // Connection handle of the connection
1957    // Original type: uint16_t
1958    optional int32 connection_handle = 3;
1959    // Performing Role for the connection
1960    // Original type: uint8_t
1961    optional int32 connection_role = 4;
1962    // Current Transmit Power Level for the connection. This value is the same as the controller's
1963    // response to the HCI_Read_Transmit_Power_Level HCI command
1964    // Original type: uint8_t
1965    optional int32 tx_power_level = 5;
1966    // Received Signal Strength Indication (RSSI) value for the connection. This value is an
1967    // absolute receiver signal strength value
1968    // Original type: int8_t
1969    optional int32 rssi = 6;
1970    // Signal-to-Noise Ratio (SNR) value for the connection. It is the average SNR of all the
1971    // channels used by the link currently
1972    // Original type: uint8_t
1973    optional int32 snr = 7;
1974    // Indicates the number of unused channels in AFH_channel_map
1975    // Original type: uint8_t
1976    optional int32 unused_afh_channel_count = 8;
1977    // Indicates the number of the channels which are interfered and quality is bad but are still
1978    // selected for AFH
1979    // Original type: uint8_t
1980    optional int32 afh_select_unideal_channel_count = 9;
1981    // Current Link Supervision Timeout Setting
1982    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
1983    // Original type: uint16_t
1984    optional int32 lsto = 10;
1985    // Piconet Clock for the specified Connection_Handle. This value is the same as the controller's
1986    // response to HCI_Read_Clock HCI command with the parameter "Which_Clock" of
1987    // 0x01 (Piconet Clock)
1988    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
1989    // Original type: uint32_t
1990    optional int64 connection_piconet_clock = 11;
1991    // The count of retransmission
1992    // Original type: uint32_t
1993    optional int64 retransmission_count = 12;
1994    // The count of no RX
1995    // Original type: uint32_t
1996    optional int64 no_rx_count = 13;
1997    // The count of NAK (Negative Acknowledge)
1998    // Original type: uint32_t
1999    optional int64 nak_count = 14;
2000    // Controller timestamp of last TX ACK
2001    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2002    // Original type: uint32_t
2003    optional int64 last_tx_ack_timestamp = 15;
2004    // The count of Flow-off (STOP)
2005    // Original type: uint32_t
2006    optional int64 flow_off_count = 16;
2007    // Controller timestamp of last Flow-on (GO)
2008    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
2009    // Original type: uint32_t
2010    optional int64 last_flow_on_timestamp = 17;
2011    // Buffer overflow count (how many bytes of TX data are dropped) since the last event
2012    // Original type: uint32_t
2013    optional int64 buffer_overflow_bytes = 18;
2014    // Buffer underflow count (in byte) since last event
2015    // Original type: uint32_t
2016    optional int64 buffer_underflow_bytes = 19;
2017}
2018
2019/**
2020 * Logs when a Bluetooth device's manufacturer information is learnt by the Bluetooth stack
2021 *
2022 * Notes:
2023 * - Each event can be partially filled as we might learn different pieces of device
2024 *   information at different time
2025 * - Multiple device info events can be combined to give more complete picture
2026 * - When multiple device info events tries to describe the same information, the
2027 *   later one wins
2028 *
2029 * Logged from:
2030 *     packages/apps/Bluetooth
2031 */
2032message BluetoothDeviceInfoReported {
2033    // An identifier that can be used to match events for this device.
2034    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2035    // Salt: Randomly generated 256 bit value
2036    // Hash algorithm: HMAC-SHA256
2037    // Size: 32 byte
2038    // Default: null or empty if the device identifier is not known
2039    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2040    // Where is this device info obtained from
2041    optional android.bluetooth.DeviceInfoSrcEnum source_type = 2;
2042    // Name of the data source
2043    // For EXTERNAL: package name of the data source
2044    // For INTERNAL: null for general case, component name otherwise
2045    optional string source_name = 3;
2046    // Name of the manufacturer of this device
2047    optional string manufacturer = 4;
2048    // Model of this device
2049    optional string model = 5;
2050    // Hardware version of this device
2051    optional string hardware_version = 6;
2052    // Software version of this device
2053    optional string software_version = 7;
2054}
2055
2056/**
2057 * Logs when we receive Bluetooth Read Remote Version Information Complete Event from the remote
2058 * device, as documented by the Bluetooth Core HCI specification
2059 * Reference: https://www.bluetooth.com/specifications/bluetooth-core-specification
2060 * Vol 2, Part E, Page 1118
2061 *
2062 * Logged from:
2063 *     system/bt
2064 */
2065message BluetoothRemoteVersionInfoReported {
2066    // Connection handle of the connection
2067    // Original type: uint16_t
2068    optional int32 connection_handle = 1;
2069    // HCI command status code
2070    // Default: STATUS_UNKNOWN
2071    optional android.bluetooth.hci.StatusEnum hci_status = 2;
2072    // 1 byte Version of current LMP in the remote controller
2073    optional int32 lmp_version = 3;
2074    // 2 bytes LMP manufacturer code of the remote controller
2075    // https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
2076    optional int32 lmp_manufacturer_code = 4;
2077    // 4 bytes subversion of the LMP in the remote controller
2078    optional int32 lmp_subversion = 5;
2079}
2080
2081/**
2082 * Logs when certain Bluetooth SDP attributes are discovered
2083 * Constant definitions are from:
2084 *     https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
2085 *
2086 * Current logged attributes:
2087 * - BluetoothProfileDescriptorList
2088 * - Supported Features Bitmask
2089 *
2090 * Logged from:
2091 *     system/bt
2092 */
2093message BluetoothSdpAttributeReported {
2094    // An identifier that can be used to match events for this device.
2095    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2096    // Salt: Randomly generated 256 bit value
2097    // Hash algorithm: HMAC-SHA256
2098    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2099    // Short form UUIDs used to identify Bluetooth protocols, profiles, and service classes
2100    // Original type: uint16_t
2101    optional int32 protocol_uuid = 2;
2102    // Short form UUIDs used to identify Bluetooth SDP attribute types
2103    // Original type: uint16_t
2104    optional int32 attribute_id = 3;
2105    // Attribute value for the particular attribute
2106    optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
2107}
2108
2109/**
2110 * Logs when bond state of a Bluetooth device changes
2111 *
2112 * Logged from:
2113 *     frameworks/base/core/java/android/bluetooth/BluetoothDevice.java
2114 *     packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2115 */
2116message BluetoothBondStateChanged {
2117    // An identifier that can be used to match events for this device.
2118    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2119    // Salt: Randomly generated 256 bit value
2120    // Hash algorithm: HMAC-SHA256
2121    // Size: 32 byte
2122    // Default: null or empty if the device identifier is not known
2123    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2124    // Preferred transport type to remote dual mode device
2125    // Default: TRANSPORT_AUTO means no preference
2126    optional android.bluetooth.TransportTypeEnum transport = 2;
2127    // The type of this Bluetooth device (Classic, LE, or Dual mode)
2128    // Default: UNKNOWN
2129    optional android.bluetooth.DeviceTypeEnum type = 3;
2130    // Current bond state (NONE, BONDING, BONDED)
2131    // Default: BOND_STATE_UNKNOWN
2132    optional android.bluetooth.BondStateEnum bond_state = 4;
2133    // Bonding sub state
2134    // Default: BOND_SUB_STATE_UNKNOWN
2135    optional android.bluetooth.BondSubStateEnum bonding_sub_state = 5;
2136    // Unbond Reason
2137    // Default: UNBOND_REASON_UNKNOWN
2138    optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
2139}
2140
2141/**
2142 * Logs there is an event related Bluetooth classic pairing
2143 *
2144 * Logged from:
2145 *     system/bt
2146 */
2147message BluetoothClassicPairingEventReported {
2148    // An identifier that can be used to match events for this device.
2149    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2150    // Salt: Randomly generated 256 bit value
2151    // Hash algorithm: HMAC-SHA256
2152    // Size: 32 byte
2153    // Default: null or empty if the device identifier is not known
2154    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2155    // Connection handle of this connection if available
2156    // Range: 0x0000 - 0x0EFF (12 bits)
2157    // Default: 0xFFFF if the handle is unknown
2158    optional int32 connection_handle = 2;
2159    // HCI command associated with this event
2160    // Default: CMD_UNKNOWN
2161    optional android.bluetooth.hci.CommandEnum hci_cmd = 3;
2162    // HCI event associated with this event
2163    // Default: EVT_UNKNOWN
2164    optional android.bluetooth.hci.EventEnum hci_event = 4;
2165    // HCI command status code if this is triggerred by hci_cmd
2166    // Default: STATUS_UNKNOWN
2167    optional android.bluetooth.hci.StatusEnum cmd_status = 5;
2168    // HCI reason code associated with this event
2169    // Default: STATUS_UNKNOWN
2170    optional android.bluetooth.hci.StatusEnum reason_code = 6;
2171    // A status value related to this specific event
2172    // Default: 0
2173    optional int64 event_value = 7;
2174}
2175
2176/**
2177 * Logs when there is an event related to Bluetooth Security Manager Protocol (SMP)
2178 *
2179 * Logged from:
2180 *     system/bt
2181 */
2182message BluetoothSmpPairingEventReported {
2183    // An identifier that can be used to match events for this device.
2184    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2185    // Salt: Randomly generated 256 bit value
2186    // Hash algorithm: HMAC-SHA256
2187    // Size: 32 byte
2188    // Default: null or empty if the device identifier is not known
2189    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2190    // SMP command sent or received over L2CAP
2191    // Default: CMD_UNKNOWN
2192    optional android.bluetooth.smp.CommandEnum smp_command = 2;
2193    // Whether this command is sent or received
2194    // Default: DIRECTION_UNKNOWN
2195    optional android.bluetooth.DirectionEnum direction = 3;
2196    // SMP failure reason code
2197    // Default: PAIRING_FAIL_REASON_DEFAULT
2198    optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
2199}
2200
2201/**
2202 * Logs when a Bluetooth socket’s connection state changed
2203 *
2204 * Logged from:
2205 *   system/bt
2206 */
2207message BluetoothSocketConnectionStateChanged {
2208    // An identifier that can be used to match events for this device.
2209    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2210    // Salt: Randomly generated 256 bit value
2211    // Hash algorithm: HMAC-SHA256
2212    // Size: 32 byte
2213    // Default: null or empty if this is a server listener socket
2214    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2215    // Temporary port of this socket for the current connection or session only
2216    // Default 0 when unknown or don't care
2217    optional int32 port = 2;
2218    // Socket type as mentioned in
2219    // frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
2220    // Default: SOCKET_TYPE_UNKNOWN
2221    optional android.bluetooth.SocketTypeEnum type = 3;
2222    // Socket connection state
2223    // Default: SOCKET_CONNECTION_STATE_UNKNOWN
2224    optional android.bluetooth.SocketConnectionstateEnum state = 4;
2225    // Number of bytes sent to remote device during this connection
2226    optional int64 tx_bytes = 5;
2227    // Number of bytes received from remote device during this connection
2228    optional int64 rx_bytes = 6;
2229    // Socket owner's UID
2230    optional int32 uid = 7 [(is_uid) = true];
2231    // Server port of this socket, if any. When both |server_port| and |port| fields are populated,
2232    // |port| must be spawned by |server_port|
2233    // Default 0 when unknown or don't care
2234    optional int32 server_port = 8;
2235    // Whether this is a server listener socket
2236    optional android.bluetooth.SocketRoleEnum is_server = 9;
2237}
2238
2239/**
2240 * Logs when Class of Device (CoD) value is learnt for a device during pairing or connection
2241 *
2242 * Logged from:
2243 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
2244 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
2245 *
2246 */
2247message BluetoothClassOfDeviceReported {
2248    // An identifier that can be used to match events for this device.
2249    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
2250    // Salt: Randomly generated 256 bit value
2251    // Hash algorithm: HMAC-SHA256
2252    // Size: 32 byte
2253    // Default: null or empty if this is a server listener socket
2254    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
2255    // Class of Device (CoD) value including both Major, Minor device class and service class
2256    // Defined in: https://www.bluetooth.com/specifications/assigned-numbers/baseband
2257    // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
2258    // Default: 0
2259    optional int32 class_of_device = 2;
2260}
2261
2262/**
2263 * Logs when something is plugged into or removed from the USB-C connector.
2264 *
2265 * Logged from:
2266 *  UsbService
2267 */
2268message UsbConnectorStateChanged {
2269    enum State {
2270        STATE_DISCONNECTED = 0;
2271        STATE_CONNECTED = 1;
2272    }
2273    optional State state = 1;
2274    optional string id = 2;
2275    // Last active session in ms.
2276    // 0 when the port is in connected state.
2277    optional int64 last_connect_duration_millis = 3;
2278}
2279
2280/**
2281 * Logs the reported speaker impedance.
2282 *
2283 * Logged from:
2284 *  Vendor audio implementation.
2285 */
2286message SpeakerImpedanceReported {
2287    optional int32 speaker_location = 1;
2288    optional int32 impedance = 2;
2289}
2290
2291/**
2292 * Logs the report of a failed hardware.
2293 *
2294 * Logged from:
2295 *  Vendor HALs.
2296 *
2297 */
2298message HardwareFailed {
2299    enum HardwareType {
2300        HARDWARE_FAILED_UNKNOWN = 0;
2301        HARDWARE_FAILED_MICROPHONE = 1;
2302        HARDWARE_FAILED_CODEC = 2;
2303        HARDWARE_FAILED_SPEAKER = 3;
2304        HARDWARE_FAILED_FINGERPRINT = 4;
2305    }
2306    optional HardwareType hardware_type = 1;
2307
2308   /**
2309    * hardware_location allows vendors to differentiate between multiple instances of
2310    * the same hardware_type.  The specific locations are vendor defined integers,
2311    * referring to board-specific numbering schemes.
2312    */
2313    optional int32 hardware_location = 2;
2314
2315    /**
2316     * failure_code is specific to the HardwareType of the failed hardware.
2317     * It should use one of the enum values defined below.
2318     */
2319    enum HardwareErrorCode {
2320        UNKNOWN = 0;
2321        COMPLETE = 1;
2322        SPEAKER_HIGH_Z = 2;
2323        SPEAKER_SHORT = 3;
2324        FINGERPRINT_SENSOR_BROKEN = 4;
2325        FINGERPRINT_TOO_MANY_DEAD_PIXELS = 5;
2326        DEGRADE = 6;
2327    }
2328    optional int32 failure_code = 3;
2329}
2330
2331/**
2332 * Log an event when the device has been physically dropped.
2333 * Reported from the /vendor partition.
2334 */
2335message PhysicalDropDetected {
2336    // Confidence that the event was actually a drop, 0 -> 100
2337    optional int32 confidence_pctg = 1;
2338    // Peak acceleration of the drop, in 1/1000s of a g.
2339    optional int32 accel_peak_thousandths_g = 2;
2340    // Duration of freefall in ms
2341    optional int32 freefall_time_millis = 3;
2342}
2343
2344/**
2345 * Log bucketed battery charge cycles.
2346 *
2347 * Each bucket represents cycles of the battery past
2348 * a given charge point.  For example, if 10 cycle buckets are
2349 * initialized, bucket 1 is the lowest 1/10th of the battery,
2350 * and bucket 10 is 100%.
2351 *
2352 * Logged from:
2353 * /sys/class/power_supply/bms/cycle_count, via Vendor.
2354 */
2355message ChargeCyclesReported {
2356    optional int32 cycle_bucket_1 = 1;
2357    optional int32 cycle_bucket_2 = 2;
2358    optional int32 cycle_bucket_3 = 3;
2359    optional int32 cycle_bucket_4 = 4;
2360    optional int32 cycle_bucket_5 = 5;
2361    optional int32 cycle_bucket_6 = 6;
2362    optional int32 cycle_bucket_7 = 7;
2363    optional int32 cycle_bucket_8 = 8;
2364    optional int32 cycle_bucket_9 = 9;
2365    optional int32 cycle_bucket_10 = 10;
2366}
2367
2368/**
2369 * Log battery health snapshot.
2370 *
2371 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
2372 * are snapshotted periodically over 24hrs.
2373 */
2374message BatteryHealthSnapshot {
2375    enum BatterySnapshotType {
2376        UNKNOWN = 0;
2377        MIN_TEMP = 1;         // Snapshot at min batt temp over 24hrs.
2378        MAX_TEMP = 2;         // Snapshot at max batt temp over 24hrs.
2379        MIN_RESISTANCE = 3;   // Snapshot at min batt resistance over 24hrs.
2380        MAX_RESISTANCE = 4;   // Snapshot at max batt resistance over 24hrs.
2381        MIN_VOLTAGE = 5;      // Snapshot at min batt voltage over 24hrs.
2382        MAX_VOLTAGE = 6;      // Snapshot at max batt voltage over 24hrs.
2383        MIN_CURRENT = 7;      // Snapshot at min batt current over 24hrs.
2384        MAX_CURRENT = 8;      // Snapshot at max batt current over 24hrs.
2385        MIN_BATT_LEVEL = 9;   // Snapshot at min battery level (SoC) over 24hrs.
2386        MAX_BATT_LEVEL = 10;  // Snapshot at max battery level (SoC) over 24hrs.
2387        AVG_RESISTANCE = 11;  // Snapshot at average battery resistance over 24hrs.
2388    }
2389    optional BatterySnapshotType type = 1;
2390    // Temperature, in 1/10ths of degree C.
2391    optional int32 temperature_deci_celsius = 2;
2392    // Voltage Battery Voltage, in microVolts.
2393    optional int32 voltage_micro_volt = 3;
2394    // Current Battery current, in microAmps.
2395    optional int32 current_micro_amps = 4;
2396    // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
2397    optional int32 open_circuit_micro_volt = 5;
2398    // Resistance Battery Resistance, in microOhms.
2399    optional int32 resistance_micro_ohm = 6;
2400    // Level Battery Level, as % of full.
2401    optional int32 level_percent = 7;
2402}
2403
2404/**
2405 * Log slow I/O operations on the primary storage.
2406 */
2407message SlowIo {
2408    // Classifications of IO Operations.
2409    enum IoOperation {
2410        UNKNOWN = 0;
2411        READ = 1;
2412        WRITE = 2;
2413        UNMAP = 3;
2414        SYNC = 4;
2415    }
2416    optional IoOperation operation = 1;
2417
2418    // The number of slow IO operations of this type over 24 hours.
2419    optional int32 count = 2;
2420}
2421
2422/**
2423 * Log battery caused shutdown with the last recorded voltage.
2424 */
2425message BatteryCausedShutdown {
2426    // The last recorded battery voltage prior to shutdown.
2427    optional int32 last_recorded_micro_volt = 1;
2428}
2429
2430/**
2431 * Logs when ThermalService receives throttling events.
2432 *
2433 * Logged from:
2434 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
2435 */
2436message ThermalThrottlingSeverityStateChanged {
2437    // The type of temperature being reported (CPU, GPU, SKIN, etc)
2438    optional android.os.TemperatureTypeEnum sensor_type = 1;
2439
2440    // The name of the temperature source. Eg. CPU0
2441    optional string sensor_name = 2;
2442
2443    // Temperature in tenths of a degree C.
2444    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
2445    optional int32 temperature_deci_celsius = 3;
2446
2447    // Relative severity of the throttling, see enum definition.
2448    optional android.os.ThrottlingSeverityEnum severity = 4;
2449}
2450
2451/**
2452 * Logs the duration of a davey (jank of >=700ms) when it occurs
2453 *
2454 * Logged from:
2455 *   frameworks/base/libs/hwui/JankTracker.cpp
2456 */
2457message DaveyOccurred {
2458    // The UID that logged this atom.
2459    optional int32 uid = 1 [(is_uid) = true];
2460
2461    // Amount of time it took to render the frame. Should be >=700ms.
2462    optional int64 jank_duration_millis = 2;
2463}
2464
2465/**
2466 * Logs phone signal strength changes.
2467 *
2468 * Logged from:
2469 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2470 */
2471message PhoneSignalStrengthChanged {
2472    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
2473    optional android.telephony.SignalStrengthEnum signal_strength = 1;
2474}
2475
2476
2477/**
2478 * Logs when the phone state, sim state or signal strength changes
2479 *
2480 * Logged from:
2481 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2482 */
2483message PhoneServiceStateChanged {
2484    optional android.telephony.ServiceStateEnum state = 1;
2485    optional android.telephony.SimStateEnum sim_state = 2;
2486    optional android.telephony.SignalStrengthEnum signal_strength = 3;
2487}
2488
2489/**
2490 * Logs when the phone becomes on or off.
2491 *
2492 * Logged from:
2493 *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
2494 */
2495message PhoneStateChanged {
2496    enum State {
2497        OFF = 0;
2498        ON = 1;
2499    }
2500    optional State state = 1;
2501}
2502
2503message LauncherUIChanged {
2504    optional android.stats.launcher.LauncherAction action = 1;
2505    optional android.stats.launcher.LauncherState src_state = 2;
2506    optional android.stats.launcher.LauncherState dst_state = 3;
2507    optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
2508    optional bool is_swipe_up_enabled = 5;
2509}
2510
2511message StyleUIChanged {
2512    optional android.stats.style.Action action = 1;
2513    optional int32 color_package_hash = 2;
2514    optional int32 font_package_hash  = 3;
2515    optional int32 shape_package_hash = 4;
2516    optional int32 clock_package_hash = 5;
2517    optional int32 launcher_grid = 6;
2518    optional int32 wallpaper_category_hash = 7;
2519    optional int32 wallpaper_id_hash = 8;
2520    optional int32 color_preference = 9;
2521    optional android.stats.style.LocationPreference location_preference = 10;
2522}
2523
2524/**
2525 * Logs when Settings UI has changed.
2526 *
2527 * Logged from:
2528 *   packages/apps/Settings
2529 */
2530message SettingsUIChanged {
2531    /**
2532     * Where this SettingsUIChange event comes from. For example, if
2533     * it's a PAGE_VISIBLE event, where the page is opened from.
2534     */
2535    optional android.app.settings.PageId attribution = 1;
2536
2537    /**
2538     * What the UI action is.
2539     */
2540    optional android.app.settings.Action action = 2;
2541
2542    /**
2543     * Where the action is happening
2544     */
2545    optional android.app.settings.PageId page_id = 3;
2546
2547    /**
2548     * What preference changed in this event.
2549     */
2550    optional string changed_preference_key = 4;
2551
2552    /**
2553     * The new value of the changed preference.
2554     */
2555    optional int64 changed_preference_int_value = 5;
2556}
2557
2558/**
2559 * Logs basic timing information about touch events.
2560 * Reported at most every 5 minutes while device is being interacted with.
2561 *
2562 * Logged from:
2563 *   frameworks/native/services/inputflinger
2564 */
2565message TouchEventReported {
2566    /**
2567     * The fields latency_{min|max|mean|stdev} represent minimum, maximum, mean,
2568     * and the standard deviation of latency between the kernel and framework
2569     * for touchscreen events. The units are microseconds.
2570     *
2571     * The number is measured as the difference between the time at which
2572     * the input event was received in the evdev driver,
2573     * and the time at which the input event was received in EventHub.
2574     */
2575    // Minimum value
2576    optional float latency_min_micros = 1;
2577    // Maximum value
2578    optional float latency_max_micros = 2;
2579    // Average value
2580    optional float latency_mean_micros = 3;
2581    // Standard deviation
2582    optional float latency_stdev_micros = 4;
2583    // Number of touch events (input_event) in this report
2584    optional int32 count = 5;
2585}
2586
2587/**
2588 * Logs gesture classification and timing information for touch events.
2589 *
2590 * Logged from:
2591 *   frameworks/base/core/java/android/view/GestureDetector.java
2592 *   frameworks/base/core/java/android/view/View.java
2593 */
2594message TouchGestureClassified {
2595    // The source of the classification (e.g. Java class name).
2596    optional string source = 1;
2597
2598    enum Classification {
2599        UNKNOWN_CLASSIFICATION = 0;
2600        SINGLE_TAP = 1;
2601        DOUBLE_TAP = 2;
2602        LONG_PRESS = 3;
2603        DEEP_PRESS = 4;
2604        SCROLL = 5;
2605    }
2606    // The classification of the gesture.
2607    optional Classification classification = 2;
2608
2609    // The interval from the start of a touch event stream until the
2610    // classification was made.
2611    optional int32 latency_millis = 3;
2612
2613    // The distance from the location of the first touch event to the
2614    // location of the touch event when the classification was made.
2615    optional float displacement_px = 4;
2616}
2617
2618/**
2619 * Logs that a setting was updated.
2620 * Logged from:
2621 *   frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
2622 * The tag and is_default allow resetting of settings to default values based on the specified
2623 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
2624 */
2625message SettingChanged {
2626    // The name of the setting.
2627    optional string setting = 1;
2628
2629    // The change being imposed on this setting. May represent a number, eg "3".
2630    optional string value = 2;
2631
2632    // The new value of this setting. For most settings, this is same as value. For some settings,
2633    // value is +X or -X where X represents an element in a set. For example, if the previous value
2634    // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
2635    // The +/- feature is currently only used for location_providers_allowed.
2636    optional string new_value = 3;
2637
2638    // The previous value of this setting.
2639    optional string prev_value = 4;
2640
2641    // The tag used with the is_default for resetting sets of settings. This is generally null.
2642    optional string tag = 5;
2643
2644    // True if this setting with tag should be resettable.
2645    optional bool is_default = 6;
2646
2647    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
2648    optional int32 user = 7;
2649
2650    enum ChangeReason {
2651        UPDATED = 1; // Updated can be an insertion or an update.
2652        DELETED = 2;
2653    }
2654    optional ChangeReason reason = 8;
2655}
2656
2657/**
2658 * Logs activity going to foreground or background
2659 *
2660 * Logged from:
2661  *   frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
2662 */
2663message ActivityForegroundStateChanged {
2664    optional int32 uid = 1 [(is_uid) = true];
2665    optional string pkg_name = 2;
2666    optional string class_name = 3;
2667
2668    enum State {
2669        BACKGROUND = 0;
2670        FOREGROUND = 1;
2671    }
2672    optional State state = 4;
2673}
2674
2675/**
2676 * Logs when a volume entered low Storage state.
2677 * Logged from:
2678 *      frameworks/base/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
2679 */
2680message LowStorageStateChanged {
2681    // Volume that ran out of storage.
2682    optional string volume_description = 1;
2683
2684    enum State {
2685        UNKNOWN = 0;
2686        OFF = 1;
2687        ON = 2;
2688    }
2689    optional State state = 2;
2690}
2691
2692/**
2693 * Logs when an app is downgraded.
2694 * Logged from:
2695 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
2696 */
2697message AppDowngraded {
2698    optional string package_name = 1;
2699    // Size of the package (all data) before being downgraded.
2700    optional int64 size_in_bytes_before = 2;
2701    // Size of the package (all data) after being downgraded.
2702    optional int64 size_in_bytes_after = 3;
2703
2704    optional bool aggressive = 4;
2705}
2706
2707/**
2708 * Logs when an app is optimized after being downgraded.
2709 * Logged from:
2710 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
2711 */
2712message AppOptimizedAfterDowngraded {
2713    optional string package_name = 1;
2714}
2715
2716/**
2717 * Logs whenever an app is installed on external storage.
2718 * Logged from:
2719        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
2720 */
2721message AppInstallOnExternalStorageReported {
2722    // The type of external storage.
2723    optional android.stats.storage.ExternalStorageType storage_type = 1;
2724    // The name of the package that is installed on the sd card.
2725    optional string package_name = 2;
2726}
2727
2728/**
2729 * Logs when an app crashes.
2730 * Logged from:
2731 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2732 */
2733message AppCrashOccurred {
2734    optional int32 uid = 1 [(is_uid) = true];
2735
2736    optional string event_type = 2;
2737
2738    // The name of the process.
2739    // system_server if it is not by an app
2740    optional string process_name = 3;
2741
2742    // The pid if available. -1 means not available.
2743    optional sint32 pid = 4;
2744
2745    optional string package_name = 5;
2746
2747    enum InstantApp {
2748        UNAVAILABLE = 0;
2749        FALSE = 1;
2750        TRUE = 2;
2751    }
2752    optional InstantApp is_instant_app = 6;
2753
2754    enum ForegroundState {
2755        UNKNOWN = 0;
2756        BACKGROUND = 1;
2757        FOREGROUND = 2;
2758    }
2759    optional ForegroundState foreground_state = 7;
2760
2761    optional android.server.ErrorSource error_source = 8;
2762}
2763
2764/**
2765 * Logs when a WTF (What a Terrible Failure) happened.
2766 * Logged from:
2767 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2768 */
2769message WTFOccurred {
2770    optional int32 uid = 1 [(is_uid) = true];
2771
2772    optional string tag = 2;
2773
2774    // The name of the process.
2775    // system_server if it is not by an app
2776    optional string process_name = 3;
2777
2778    // The pid if available. -1 means not available.
2779    optional sint32 pid = 4;
2780
2781    optional android.server.ErrorSource error_source = 5;
2782}
2783
2784/**
2785 * Logs when system server reports low memory.
2786 * Logged from:
2787 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2788 */
2789message LowMemReported {
2790}
2791
2792/**
2793 * Logs when an app ANR (App Not Responding) occurs.
2794 * Logged from:
2795 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
2796 */
2797message ANROccurred {
2798    optional int32 uid = 1 [(is_uid) = true];
2799
2800    optional string process_name = 2;
2801
2802    optional string short_component_name = 3;
2803
2804    optional string reason = 4;
2805
2806    enum InstantApp {
2807        UNAVAILABLE = 0;
2808        FALSE = 1;
2809        TRUE = 2;
2810    }
2811    optional InstantApp is_instant_app = 5;
2812
2813    enum ForegroundState {
2814        UNKNOWN = 0;
2815        BACKGROUND = 1;
2816        FOREGROUND = 2;
2817    }
2818    optional ForegroundState foreground_state = 6;
2819
2820    optional android.server.ErrorSource error_source = 7;
2821
2822    optional string package_name = 8;
2823}
2824
2825/**
2826 * Logs when the vibrator state changes.
2827 * Logged from:
2828 *      frameworks/base/services/core/java/com/android/server/VibratorService.java
2829 */
2830message VibratorStateChanged {
2831    repeated AttributionNode attribution_node = 1;
2832
2833    enum State {
2834        OFF = 0;
2835        ON = 1;
2836    }
2837    optional State state = 2;
2838
2839    // Duration (in milliseconds) requested to keep the vibrator on.
2840    // Only applicable for State == ON.
2841    optional int64 duration_millis = 3;
2842}
2843
2844/*
2845 * Allows other apps to push events into statsd.
2846 * Logged from:
2847 *      frameworks/base/core/java/android/util/StatsLog.java
2848 */
2849message AppBreadcrumbReported {
2850    // The uid of the application that sent this custom atom.
2851    optional int32 uid = 1 [(is_uid) = true];
2852
2853    // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
2854    optional int32 label = 2;
2855
2856    // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
2857    // predicates for the metrics).
2858    enum State {
2859        UNKNOWN = 0;
2860        UNSPECIFIED = 1;  // For events that are known to not represent START/STOP.
2861        STOP = 2;
2862        START = 3;
2863    }
2864    optional State state = 3;
2865}
2866
2867/**
2868 * Logs the wall-clock time when a significant wall-clock time shift occurs.
2869 * For example, this could be due to the user manually changing the time.
2870 *
2871 * Logged from:
2872 *   frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
2873 */
2874message WallClockTimeShifted {
2875    // New wall-clock time in milliseconds, according to System.currentTimeMillis().
2876    optional int64 wall_clock_timestamp_millis = 1;
2877}
2878
2879/**
2880 * Logs when statsd detects an anomaly.
2881 *
2882 * Logged from:
2883 *   frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
2884 */
2885message AnomalyDetected {
2886    // Uid that owns the config whose anomaly detection alert fired.
2887    optional int32 config_uid = 1 [(is_uid) = true];
2888
2889    // Id of the config whose anomaly detection alert fired.
2890    optional int64 config_id = 2;
2891
2892    // Id of the alert (i.e. name of the anomaly that was detected).
2893    optional int64 alert_id = 3;
2894}
2895
2896message AppStartOccurred {
2897    // The uid if available. -1 means not available.
2898    optional int32 uid = 1 [(is_uid) = true];
2899
2900    // The app package name.
2901    optional string pkg_name = 2;
2902
2903    enum TransitionType {
2904        UNKNOWN = 0;
2905        WARM = 1;
2906        HOT = 2;
2907        COLD = 3;
2908    }
2909    // The transition type.
2910    optional TransitionType type = 3;
2911
2912    // The activity name.
2913    optional string activity_name = 4;
2914
2915    // The name of the calling app. Empty if not set.
2916    optional string calling_pkg_name = 5;
2917
2918    // Whether the app is an instant app.
2919    optional bool is_instant_app = 6;
2920
2921    // Device uptime when activity started.
2922    optional int64 activity_start_millis = 7;
2923
2924    optional android.app.AppTransitionReasonEnum reason = 8;
2925
2926    optional int32 transition_delay_millis = 9;
2927    // -1 if not set.
2928    optional int32 starting_window_delay_millis = 10;
2929    // -1 if not set.
2930    optional int32 bind_application_delay_millis = 11;
2931    optional int32 windows_drawn_delay_millis = 12;
2932
2933    // Empty if not set.
2934    optional string launch_token = 13;
2935
2936    // The compiler filter used when when the package was optimized.
2937    optional int32 package_optimization_compilation_filter = 14;
2938
2939    // The reason why the package was optimized.
2940    optional int32 package_optimization_compilation_reason = 15;
2941}
2942
2943message AppStartCanceled {
2944    // The uid if available. -1 means not available.
2945    optional int32 uid = 1 [(is_uid) = true];
2946
2947    // The app package name.
2948    optional string pkg_name = 2;
2949
2950    enum TransitionType {
2951        UNKNOWN = 0;
2952        WARM = 1;
2953        HOT = 2;
2954        COLD = 3;
2955    }
2956    // The transition type.
2957    optional TransitionType type = 3;
2958
2959    // The activity name.
2960    optional string activity_name = 4;
2961}
2962
2963message AppStartFullyDrawn {
2964    // The uid if available. -1 means not available.
2965    optional int32 uid = 1 [(is_uid) = true];
2966
2967    // The app package name.
2968    optional string pkg_name = 2;
2969
2970    enum TransitionType {
2971        UNKNOWN = 0;
2972        WITH_BUNDLE = 1;
2973        WITHOUT_BUNDLE = 2;
2974    }
2975    // The transition type.
2976    optional TransitionType type = 3;
2977
2978    // The activity name.
2979    optional string activity_name = 4;
2980
2981    optional bool transition_process_running = 5;
2982
2983    // App startup time (until call to Activity#reportFullyDrawn()).
2984    optional int64 app_startup_time_millis = 6;
2985}
2986
2987/**
2988 * Logs a picture-in-picture action
2989 * Logged from:
2990 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2991 *      frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
2992 *      frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
2993 */
2994message PictureInPictureStateChanged {
2995    // -1 if it is not available
2996    optional int32 uid = 1 [(is_uid) = true];
2997
2998    optional string short_name = 2;
2999
3000    enum State {
3001        ENTERED = 1;
3002        EXPANDED_TO_FULL_SCREEN = 2;
3003        MINIMIZED = 3;
3004        DISMISSED = 4;
3005    }
3006    optional State state = 3;
3007}
3008
3009/**
3010 * Logs overlay action
3011 * Logged from:
3012 *     services/core/java/com/android/server/wm/Session.java
3013 */
3014message OverlayStateChanged {
3015    optional int32 uid = 1 [(is_uid) = true];
3016
3017    optional string package_name = 2;
3018
3019    optional bool using_alert_window = 3;
3020
3021    enum State {
3022        ENTERED = 1;
3023        EXITED = 2;
3024    }
3025    optional State state = 4;
3026}
3027
3028/*
3029 * Logs foreground service starts and stops.
3030 * Note that this is not when a service starts or stops, but when it is
3031 * considered foreground.
3032 * Logged from
3033 *     //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
3034 */
3035message ForegroundServiceStateChanged {
3036    optional int32 uid = 1 [(is_uid) = true];
3037    // package_name + "/" + class_name
3038    optional string short_name = 2;
3039
3040    enum State {
3041        ENTER = 1;
3042        EXIT = 2;
3043    }
3044    optional State state = 3;
3045}
3046
3047/**
3048 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
3049 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
3050 * attributed back to the parent (host) uid. One example is Chrome.
3051 *
3052 * Logged from:
3053 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3054 */
3055message IsolatedUidChanged {
3056    // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
3057    // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
3058    // This field is ignored when event == REMOVED.
3059    optional int32 parent_uid = 1;
3060
3061    optional int32 isolated_uid = 2;
3062
3063    // We expect an isolated uid to be removed before if it's used for another parent uid.
3064    enum Event {
3065        REMOVED = 0;
3066        CREATED = 1;
3067    }
3068    optional Event event = 3;
3069}
3070
3071/*
3072 * Logs the reception of an incoming network packet causing the main system to wake up for
3073 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
3074 * and processed by WakeupController.cpp.
3075 */
3076message PacketWakeupOccurred {
3077    // The uid owning the socket into which the packet was delivered, or -1 if the packet was
3078    // delivered nowhere.
3079    optional int32 uid = 1 [(is_uid) = true];
3080    // The interface name on which the packet was received.
3081    optional string iface = 2;
3082    // The ethertype value of the packet.
3083    optional int32 ethertype = 3;
3084    // String representation of the destination MAC address of the packet.
3085    optional string destination_hardware_address = 4;
3086    // String representation of the source address of the packet if this was an IP packet.
3087    optional string source_ip = 5;
3088    // String representation of the destination address of the packet if this was an IP packet.
3089    optional string destination_ip = 6;
3090    // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
3091    // field if this was an IPv6 packet. The range of possible values is the same for both IP
3092    // families.
3093    optional int32 ip_next_header = 7;
3094    // The source port if this was a TCP or UDP packet.
3095    optional int32 source_port = 8;
3096    // The destination port if this was a TCP or UDP packet.
3097    optional int32 destination_port = 9;
3098}
3099
3100/*
3101 * Logs the memory stats for an app on startup.
3102 * Logged from:
3103 *     frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3104 */
3105message AppStartMemoryStateCaptured {
3106    // The uid if available. -1 means not available.
3107    optional int32 uid = 1 [(is_uid) = true];
3108
3109    // The process name.
3110    optional string process_name = 2;
3111
3112    // The activity name.
3113    optional string activity_name = 3;
3114
3115    // # of page-faults
3116    optional int64 page_fault = 4;
3117
3118    // # of major page-faults
3119    optional int64 page_major_fault = 5;
3120
3121    // RSS
3122    optional int64 rss_in_bytes = 6;
3123
3124    // CACHE
3125    optional int64 cache_in_bytes = 7;
3126
3127    // SWAP
3128    optional int64 swap_in_bytes = 8;
3129}
3130
3131/*
3132 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
3133 * for LMK event.
3134 * Logged from:
3135 *      system/core/lmkd/lmkd.c
3136 */
3137message LmkStateChanged {
3138    enum State {
3139        UNKNOWN = 0;
3140        START = 1;
3141        STOP = 2;
3142    }
3143    optional State state = 1;
3144}
3145
3146/*
3147 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
3148 * Logged from:
3149 *      system/core/lmkd/lmkd.c
3150 */
3151message LmkKillOccurred {
3152    // The uid if available. -1 means not available.
3153    optional int32 uid = 1 [(is_uid) = true];
3154
3155    // The process name.
3156    optional string process_name = 2;
3157
3158    // oom adj score.
3159    optional int32 oom_adj_score = 3;
3160
3161    // # of page-faults
3162    optional int64 page_fault = 4;
3163
3164    // # of major page-faults
3165    optional int64 page_major_fault = 5;
3166
3167    // RSS
3168    optional int64 rss_in_bytes = 6;
3169
3170    // CACHE
3171    optional int64 cache_in_bytes = 7;
3172
3173    // SWAP
3174    optional int64 swap_in_bytes = 8;
3175
3176    // The elapsed real time of start of the process.
3177    optional int64 process_start_time_nanos = 9;
3178
3179    // Min oom adj score considered by lmkd.
3180    optional int32 min_oom_score = 10;
3181}
3182
3183/*
3184 * Logs when the ActivityManagerService detects that an app died.
3185 *
3186 * Logged from:
3187 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3188 */
3189message AppDied {
3190    // timestamp(elapsedRealtime) of record creation
3191    optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
3192}
3193
3194/**
3195 * An atom for generic metrics logging. Available from Android Q.
3196 */
3197message GenericAtom {
3198    // The uid of the application that sent this custom atom.
3199    optional int32 uid = 1 [(is_uid) = true];
3200
3201    // An event_id indicates the type of event.
3202    optional android.stats.EventType event_id = 2;
3203}
3204
3205/**
3206 * Logs when a biometric acquire event occurs.
3207 *
3208 * Logged from:
3209 *   frameworks/base/services/core/java/com/android/server/biometrics
3210 */
3211message BiometricAcquired {
3212    // Biometric modality that was acquired.
3213    optional android.hardware.biometrics.ModalityEnum modality = 1;
3214    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java.
3215    optional int32 user = 2;
3216    // If this acquire is for a crypto operation. e.g. Secure purchases, unlock password storage.
3217    optional bool is_crypto = 3;
3218    // Action that the device is performing. Acquired messages are only expected for enroll and
3219    // authenticate. Other actions may indicate an error.
3220    optional android.hardware.biometrics.ActionEnum action = 4;
3221    // The client that this acquisition was received for.
3222    optional android.hardware.biometrics.ClientEnum client = 5;
3223    // Acquired constants, e.g. ACQUIRED_GOOD. See constants defined by <Biometric>Manager.
3224    optional int32 acquire_info = 6;
3225    // Vendor-specific acquire info. Valid only if acquire_info == ACQUIRED_VENDOR.
3226    optional int32 acquire_info_vendor = 7;
3227    // Dictates if this message should trigger additional debugging.
3228    optional bool debug = 8;
3229}
3230
3231/**
3232 * Logs when a biometric authentication event occurs.
3233 *
3234 * Logged from:
3235 *   frameworks/base/services/core/java/com/android/server/biometrics
3236 */
3237message BiometricAuthenticated {
3238    // Biometric modality that was used.
3239    optional android.hardware.biometrics.ModalityEnum modality = 1;
3240    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
3241    optional int32 user = 2;
3242    // If this authentication is for a crypto operation. e.g. Secure purchases, unlock password
3243    // storage.
3244    optional bool is_crypto = 3;
3245    // The client that this acquisition was received for.
3246    optional android.hardware.biometrics.ClientEnum client = 4;
3247    // If authentication requires user confirmation. See BiometricPrompt's
3248    // setRequireConfirmation(bool) method.
3249    optional bool require_confirmation = 5;
3250
3251    enum State {
3252        UNKNOWN = 0;
3253        REJECTED = 1;
3254        PENDING_CONFIRMATION = 2;
3255        CONFIRMED = 3;
3256    }
3257
3258    // State of the current auth attempt.
3259    optional State state = 6;
3260    // Time it took to authenticate. For BiometricPrompt where setRequireConfirmation(false) is
3261    // specified and supported by the biometric modality, this is from the first ACQUIRED_GOOD to
3262    // AUTHENTICATED. for setRequireConfirmation(true), this is from PENDING_CONFIRMATION to
3263    // CONFIRMED.
3264    optional int64 latency_millis = 7;
3265    // Dictates if this message should trigger additional debugging.
3266    optional bool debug = 8;
3267}
3268
3269/**
3270 * Logs when a biometric error occurs.
3271 *
3272 * Logged from:
3273 *   frameworks/base/services/core/java/com/android/server/biometrics
3274 */
3275message BiometricErrorOccurred {
3276    // Biometric modality that was used.
3277    optional android.hardware.biometrics.ModalityEnum modality = 1;
3278    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
3279    optional int32 user = 2;
3280    // If this error is for a crypto operation. e.g. Secure purchases, unlock password storage.
3281    optional bool is_crypto = 3;
3282    // Action that the device is performing.
3283    optional android.hardware.biometrics.ActionEnum action = 4;
3284    // The client that this acquisition was received for.
3285    optional android.hardware.biometrics.ClientEnum client = 5;
3286    // Error constants. See constants defined by <Biometric>Manager. Enums won't work since errors
3287    // are unique to modality.
3288    optional int32 error_info = 6;
3289    // Vendor-specific error info. Valid only if acquire_info == ACQUIRED_VENDOR. These are defined
3290    // by the vendor and not specified by the HIDL interface.
3291    optional int32 error_info_vendor = 7;
3292    // Dictates if this message should trigger additional debugging.
3293    optional bool debug = 8;
3294}
3295
3296/**
3297 * Logs when a system health issue is detected.
3298 * Logged from:
3299 *   frameworks/base/services/core/java/com/android/server/biometrics
3300 */
3301message BiometricSystemHealthIssueDetected {
3302    // Biometric modality.
3303    optional android.hardware.biometrics.ModalityEnum modality = 1;
3304    // Type of issue detected.
3305    optional android.hardware.biometrics.IssueEnum issue = 2;
3306    // Dictates if this message should trigger additional debugging.
3307    optional bool debug = 3;
3308}
3309
3310/**
3311 * Logs when a biometric enrollment occurs.
3312 *
3313 * Logged from:
3314 *   frameworks/base/services/core/java/com/android/server/biometrics
3315 */
3316message BiometricEnrolled {
3317    // Biometric modality that was used.
3318    optional android.hardware.biometrics.ModalityEnum modality = 1;
3319    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
3320    optional int32 user = 2;
3321    // The amount of time the enrollment took in milliseconds.
3322    optional int64 latency_millis = 3;
3323    // Whether or not the enrollment was successful.
3324    optional bool success = 4;
3325}
3326
3327/*
3328 * Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
3329 */
3330message FlagFlipUpdateOccurred {
3331    // If the event is from a flag config package, specify the package name.
3332    optional string flag_flip_package_name = 1;
3333
3334    // The order id of the package
3335    optional int64 order_id = 2;
3336}
3337
3338/**
3339 * Potential experiment ids that goes with a train install.
3340 */
3341message TrainExperimentIds {
3342    repeated int64 experiment_id = 1;
3343}
3344
3345/*
3346 * Logs when a binary push state changes.
3347 * Logged by the installer via public api.
3348 */
3349message BinaryPushStateChanged {
3350    // Name of the train.
3351    optional string train_name = 1;
3352    // Version code for a "train" of packages that need to be installed atomically
3353    optional int64 train_version_code = 2;
3354    // After installation of this package, device requires a restart.
3355    optional bool requires_staging = 3;
3356    // Rollback should be enabled for this install.
3357    optional bool rollback_enabled = 4;
3358    // Requires low latency monitoring if possible.
3359    optional bool requires_low_latency_monitor = 5;
3360
3361    enum State {
3362        UNKNOWN = 0;
3363        INSTALL_REQUESTED = 1;
3364        INSTALL_STARTED = 2;
3365        INSTALL_STAGED_NOT_READY = 3;
3366        INSTALL_STAGED_READY = 4;
3367        INSTALL_SUCCESS = 5;
3368        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
3369        // and INSTALL_FAILURE_COMMIT.
3370        INSTALL_FAILURE = 6  [deprecated = true];
3371        // This enum is for installs that are manually cancelled via the Manual Update UI.
3372        INSTALL_CANCELLED = 7;
3373        INSTALLER_ROLLBACK_REQUESTED = 8;
3374        INSTALLER_ROLLBACK_INITIATED = 9;
3375        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
3376        INSTALLER_ROLLBACK_STAGED = 11;
3377        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
3378        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
3379        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
3380        INSTALLER_ROLLBACK_SUCCESS = 15;
3381        INSTALLER_ROLLBACK_FAILURE = 16;
3382        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
3383        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
3384        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
3385        INSTALL_STAGED_CANCEL_REQUESTED = 20;
3386        INSTALL_STAGED_CANCEL_SUCCESS = 21;
3387        INSTALL_STAGED_CANCEL_FAILURE = 22;
3388        INSTALL_FAILURE_DOWNLOAD = 23;
3389        INSTALL_FAILURE_STATE_MISMATCH = 24;
3390        INSTALL_FAILURE_COMMIT = 25;
3391    }
3392    optional State state = 6;
3393    // Possible experiment ids for monitoring this push.
3394    optional TrainExperimentIds experiment_ids = 7 [(log_mode) = MODE_BYTES];
3395    // user id
3396    optional int32 user_id = 8;
3397}
3398
3399/* Test atom, is not logged anywhere */
3400message TestAtomReported {
3401    repeated AttributionNode attribution_node = 1;
3402    optional int32 int_field = 2;
3403    optional int64 long_field = 3;
3404    optional float float_field = 4;
3405    optional string string_field = 5;
3406    optional bool boolean_field = 6;
3407    enum State {
3408        UNKNOWN = 0;
3409        OFF = 1;
3410        ON = 2;
3411    }
3412    optional State state = 7;
3413    optional TrainExperimentIds bytes_field = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
3414}
3415
3416/** Represents USB port overheat event. */
3417message UsbPortOverheatEvent {
3418    /* Temperature of USB port at USB plug event, in 1/10ths of degree C. */
3419    optional int32 plug_temperature_deci_c = 1;
3420
3421    /* Maximum temperature of USB port during overheat event, in 1/10ths of degree C. */
3422    optional int32 max_temperature_deci_c = 2;
3423
3424    /* Time between USB plug event and overheat threshold trip, in seconds. */
3425    optional int32 time_to_overheat_secs = 3;
3426
3427    /* Time between overheat threshold trip and hysteresis, in seconds. */
3428    optional int32 time_to_hysteresis_secs = 4;
3429
3430    /* Time between hysteresis and active mitigation ending, in seconds. */
3431    optional int32 time_to_inactive_secs = 5;
3432};
3433
3434/**
3435 * Logs total effective full charge and discharge cycles on a battery.
3436 * Here are some examples of one effective cycle:
3437 *   1) the battery charges from 0% to 100% and drains back to 0%,
3438 *   2) charging from 50% to 100% and draining back to 50% twice.
3439 * Pulled from:
3440 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
3441 */
3442message BatteryCycleCount {
3443    /* Number of total charge and discharge cycles on the system battery. */
3444    optional int32 cycle_count = 1;
3445}
3446
3447/**
3448 * Logs that external storage is mounted and information about it, the storage type (sd card/usb/
3449 * others), its type (public or private) and the size in bytes.
3450 * Pulled from:
3451 *   StatsCompanionService
3452 */
3453
3454message ExternalStorageInfo {
3455
3456    enum VolumeType {
3457        UNKNOWN = 0;
3458        PUBLIC = 1;
3459        PRIVATE = 2;
3460        OTHER = 3;
3461    }
3462
3463    // The type of external storage.
3464    optional android.stats.storage.ExternalStorageType storage_type = 1;
3465    // Type of the volume: TYPE_PUBLIC if portable and TYPE_PRIVATE if internal.
3466    optional VolumeType volume_type = 2;
3467    // Total size of the sd card in bytes.
3468    optional int64 size_bytes = 3;
3469}
3470
3471/*
3472 * Logs when a connection becomes available and lost.
3473 * Logged in StatsCompanionService.java
3474 */
3475message ConnectivityStateChanged {
3476  // Id of the network.
3477  optional int32 net_id = 1;
3478
3479  enum State {
3480    UNKNOWN = 0;
3481    CONNECTED = 1;
3482    DISCONNECTED = 2;
3483  }
3484  // Connected state of a network.
3485  optional State state = 2;
3486}
3487
3488/**
3489 * Logs when a service starts and stops.
3490 * Logged from:
3491 *   services/core/java/com/android/server/am/ActiveServices.java
3492 */
3493message ServiceStateChanged {
3494
3495    optional int32 uid = 1 [(is_uid) = true];
3496
3497    optional string package_name = 2;
3498
3499    optional string service_name = 3;
3500
3501    enum State {
3502        START = 1;
3503        STOP = 2;
3504    }
3505
3506    optional State state = 4;
3507}
3508
3509/**
3510 * Logs when a service is launched.
3511 * Logged from:
3512 *   services/core/java/com/android/server/am/ActiveServices.java
3513 */
3514message ServiceLaunchReported {
3515
3516    optional int32 uid = 1 [(is_uid) = true];
3517
3518    optional string package_name = 2;
3519
3520    optional string service_name = 3;
3521}
3522
3523/**
3524 * Logs when a hidden API is used.
3525 *
3526 * Logged from:
3527 *     libcore/libart/src/main/java/dalvik/system/VMRuntime.java
3528 */
3529message HiddenApiUsed {
3530    // The uid of the app making the hidden access.
3531    optional int32 uid = 1 [(is_uid) = true];
3532
3533    // Signature of the method or field accessed.
3534    optional string signature = 2;
3535
3536    enum AccessMethod {
3537        NONE = 0;
3538        REFLECTION = 1;
3539        JNI = 2;
3540        LINKING = 3;
3541    }
3542
3543    // Type of access.
3544    optional AccessMethod access_method = 3;
3545
3546    // Whether the access was prevented or not.
3547    optional bool access_denied = 4;
3548}
3549
3550/**
3551 * Logs user interaction with the Privacy Indicators added in Q. In particular:
3552 * - When user sees privacy chip
3553 * - When user clicks privacy chip
3554 * - How does the user exit the Privacy Dialog
3555 * Logged from:
3556 *   packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
3557 */
3558message PrivacyIndicatorsInteracted {
3559
3560    enum Type {
3561        UNKNOWN = 0;
3562        CHIP_VIEWED = 1;
3563        CHIP_CLICKED = 2;
3564        DIALOG_PRIVACY_SETTINGS = 3;
3565        DIALOG_DISMISS = 4;
3566        DIALOG_LINE_ITEM = 5;
3567    }
3568
3569    optional Type type = 1 [(state_field_option).option = EXCLUSIVE];
3570
3571    // Used if the type is LINE_ITEM
3572    optional string package_name = 2;
3573}
3574
3575/**
3576 * Logs information about a package that is moved from the internal to external storage and vice
3577 * versa.
3578 * It logs the package name, the type of the external storage where the package is installed
3579 * (if moved to external storage, or UNKNOWN if moved to internal storage),
3580 * and the move type: if it's from internal to external or the other way around.
3581 *
3582 * Logged from:
3583        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
3584 */
3585message AppMovedStorageReported {
3586    enum MoveType {
3587        UNKNOWN = 0;
3588        TO_EXTERNAL = 1;
3589        TO_INTERNAL = 2;
3590    }
3591    // The type of the external storage.
3592    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
3593    // The type of move.
3594    optional MoveType move_type = 2;
3595    // The name of the package that was moved.
3596    optional string package_name = 3;
3597}
3598
3599/**
3600 * Logs when system server watchdog occurs.
3601 * Logged from:
3602 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
3603 */
3604message SystemServerWatchdogOccurred {
3605    optional string subject = 1;
3606}
3607
3608/**
3609 * Logs when new file added to tombstones.
3610 * Logged from:
3611 *      frameworks/base/core/java/com/android/server/BootReceiver.java
3612 */
3613message TombStoneOccurred {
3614}
3615
3616/*
3617 * Information about a role request
3618 *
3619 * Logged from:
3620 *   packages/apps/PermissionController/src/com/android/packageinstaller/role/ui/RequestRoleFragment.java
3621 */
3622message RoleRequestResultReported {
3623    // UID of application requesting the role
3624    optional int32 requesting_uid = 1;
3625
3626    // Package name of application requesting the role
3627    optional string requesting_package_name = 2;
3628
3629    // The role to be granted
3630    optional string role_name = 3;
3631
3632    // The count of applications qualifying for the role
3633    optional int32 qualifying_count = 4;
3634
3635    // UID of application current granted the role
3636    optional int32 current_uid = 5;
3637
3638    // Package name of application current granted the role
3639    optional string current_package_name = 6;
3640
3641    // UID of another application that user chose to grant the role to, instead of the requesting
3642    // application
3643    optional int32 granted_another_uid = 7;
3644
3645    // Package name of another application that user chose to grant the role to, instead of the
3646    // requesting application
3647    optional string granted_another_package_name = 8;
3648
3649    enum Result {
3650        UNDEFINED = 0;
3651        // role request was ignored
3652        IGNORED = 1;
3653        // role request was ignored because it's already granted
3654        IGNORED_ALREADY_GRANTED = 2;
3655        // role request was ignored because the application isn't qualified
3656        IGNORED_NOT_QUALIFIED = 3;
3657        // role request was ignored because user said it should be always denied
3658        IGNORED_USER_ALWAYS_DENIED = 4;
3659        // role was granted by user action
3660        USER_GRANTED = 5;
3661        // role was denied by user action
3662        USER_DENIED = 6;
3663        // role was denied by user granting another application the role
3664        USER_DENIED_GRANTED_ANOTHER = 7;
3665        // role was denied and set to be always denied by the user
3666        USER_DENIED_WITH_ALWAYS = 8;
3667    }
3668    // The result of the role request
3669    optional Result result = 9;
3670}
3671
3672//////////////////////////////////////////////////////////////////////
3673// Pulled atoms below this line //
3674//////////////////////////////////////////////////////////////////////
3675
3676/**
3677 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
3678 *
3679 * Pulled from:
3680 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
3681 */
3682message WifiBytesTransfer {
3683    optional int32 uid = 1 [(is_uid) = true];
3684
3685    optional int64 rx_bytes = 2;
3686
3687    optional int64 rx_packets = 3;
3688
3689    optional int64 tx_bytes = 4;
3690
3691    optional int64 tx_packets = 5;
3692}
3693
3694/**
3695 * Pulls bytes transferred via wifi (separated by foreground and background usage).
3696 *
3697 * Pulled from:
3698 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
3699 */
3700message WifiBytesTransferByFgBg {
3701    optional int32 uid = 1 [(is_uid) = true];
3702
3703    // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
3704    optional bool is_foreground = 2;
3705
3706    optional int64 rx_bytes = 3;
3707
3708    optional int64 rx_packets = 4;
3709
3710    optional int64 tx_bytes = 5;
3711
3712    optional int64 tx_packets = 6;
3713}
3714
3715/**
3716 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
3717 *
3718 * Pulled from:
3719 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
3720 */
3721message MobileBytesTransfer {
3722    optional int32 uid = 1 [(is_uid) = true];
3723
3724    optional int64 rx_bytes = 2;
3725
3726    optional int64 rx_packets = 3;
3727
3728    optional int64 tx_bytes = 4;
3729
3730    optional int64 tx_packets = 5;
3731}
3732
3733/**
3734 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
3735 *
3736 * Pulled from:
3737 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
3738 */
3739message MobileBytesTransferByFgBg {
3740    optional int32 uid = 1 [(is_uid) = true];
3741
3742    // 1 denotes foreground and 0 denotes background. This is called Set in
3743    // NetworkStats.
3744    optional bool is_foreground = 2;
3745
3746    optional int64 rx_bytes = 3;
3747
3748    optional int64 rx_packets = 4;
3749
3750    optional int64 tx_bytes = 5;
3751
3752    optional int64 tx_packets = 6;
3753}
3754
3755/**
3756 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
3757 *
3758 * Pulled from:
3759 *   StatsCompanionService
3760 */
3761message BluetoothBytesTransfer {
3762    optional int32 uid = 1 [(is_uid) = true];
3763
3764    optional int64 rx_bytes = 2;
3765
3766    optional int64 tx_bytes = 3;
3767}
3768
3769/**
3770 * Pulls the kernel wakelock durations. This atom is adapted from
3771 * android/internal/os/KernelWakelockStats.java
3772 *
3773 * Pulled from:
3774 *   StatsCompanionService using KernelWakelockReader.
3775 */
3776message KernelWakelock {
3777    optional string name = 1;
3778
3779    optional int32 count = 2;
3780
3781    optional int32 version = 3;
3782
3783    optional int64 time_micros = 4;
3784}
3785
3786/**
3787 * Pulls low power state information. If power.stats HAL is not available, this
3788 * includes platform and subsystem sleep state information,
3789 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
3790 * as defined in:
3791 *   hardware/interfaces/power/1.0/types.hal
3792 *   hardware/interfaces/power/1.1/types.hal
3793 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
3794 * as defined in:
3795 *   hardware/interfaces/power/stats/1.0/types.hal
3796 */
3797message SubsystemSleepState {
3798    // Subsystem name
3799    optional string subsystem_name = 1;
3800    // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
3801    // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
3802    // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
3803    //    powerEntityStateName from the corresponding PowerEntityStateInfo.
3804    optional string subname = 2;
3805    // The number of times it entered, or voted for entering the sleep state
3806    optional uint64 count = 3;
3807    // The length of time spent in, or spent voting for, the sleep state
3808    optional uint64 time_millis = 4;
3809}
3810
3811/**
3812 * Pulls on-device power measurement information.
3813 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
3814 * Pulled from:
3815 *   frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
3816 */
3817message OnDevicePowerMeasurement {
3818    // Name of the subsystem (to which the rail belongs).
3819    optional string subsystem_name = 1;
3820
3821    // Rail name. The rail lies within the subsystem.
3822    optional string rail_name = 2;
3823
3824    // Time (in ms since boot) at which the rail energy value was measured.
3825    // This may differ slightly from the time that statsd logs this information.
3826    optional uint64 measurement_timestamp_millis = 3;
3827
3828    // Accumulated energy used via the rail since device boot in uWs.
3829    optional uint64 energy_microwatt_secs = 4;
3830}
3831
3832/**
3833 * Pulls Cpu time per frequency.
3834 * Pulls the time the cpu spend on the frequency index. Frequency index
3835 * starts from highest to lowest. The value should be monotonically
3836 * increasing since boot. However, if there is a cpu
3837 * hotplug event, the value would be reset as well.
3838 */
3839message CpuTimePerFreq {
3840    optional uint32 cluster = 1;
3841    optional uint32 freq_index = 2;
3842    optional uint64 time_millis = 3;
3843}
3844
3845/**
3846 * Pulls Cpu Time Per Uid.
3847 * Note that isolated process uid time should be attributed to host uids.
3848 */
3849message CpuTimePerUid {
3850    optional int32 uid = 1 [(is_uid) = true];
3851    optional uint64 user_time_micros = 2;
3852    optional uint64 sys_time_micros = 3;
3853}
3854
3855/**
3856 * Pulls Cpu Time Per Uid per frequency.
3857 * Note that isolated process uid time should be attributed to host uids.
3858 * For each uid, we order the time by descending frequencies.
3859 */
3860message CpuTimePerUidFreq {
3861    optional int32 uid = 1 [(is_uid) = true];
3862    optional uint32 freq_index = 2;
3863    optional uint64 time_millis = 3;
3864}
3865
3866/**
3867 * Pulls Wifi Controller Activity Energy Info
3868 */
3869message WifiActivityInfo {
3870    // timestamp(wall clock) of record creation
3871    optional uint64 timestamp_millis = 1;
3872    // stack reported state
3873    // TODO: replace this with proto enum
3874    optional int32 stack_state = 2;
3875    // tx time in millis
3876    optional uint64 controller_tx_time_millis = 3;
3877    // rx time in millis
3878    optional uint64 controller_rx_time_millis = 4;
3879    // idle time in millis
3880    optional uint64 controller_idle_time_millis = 5;
3881    // product of current(mA), voltage(V) and time(ms)
3882    optional uint64 controller_energy_used = 6;
3883}
3884
3885/**
3886 * Pulls Modem Activity Energy Info
3887 */
3888message ModemActivityInfo {
3889    // timestamp(wall clock) of record creation
3890    optional uint64 timestamp_millis = 1;
3891    // sleep time in millis.
3892    optional uint64 sleep_time_millis = 2;
3893    // idle time in millis
3894    optional uint64 controller_idle_time_millis = 3;
3895    /**
3896     * Tx power index
3897     * index 0 = tx_power < 0dBm
3898     * index 1 = 0dBm < tx_power < 5dBm
3899     * index 2 = 5dBm < tx_power < 15dBm
3900     * index 3 = 15dBm < tx_power < 20dBm
3901     * index 4 = tx_power > 20dBm
3902     */
3903    // tx time in ms at power level 0
3904    optional uint64 controller_tx_time_pl0_millis = 4;
3905    // tx time in ms at power level 1
3906    optional uint64 controller_tx_time_pl1_millis = 5;
3907    // tx time in ms at power level 2
3908    optional uint64 controller_tx_time_pl2_millis = 6;
3909    // tx time in ms at power level 3
3910    optional uint64 controller_tx_time_pl3_millis = 7;
3911    // tx time in ms at power level 4
3912    optional uint64 controller_tx_time_pl4_millis = 8;
3913    // rx time in ms at power level 5
3914    optional uint64 controller_rx_time_millis = 9;
3915    // product of current(mA), voltage(V) and time(ms)
3916    optional uint64 energy_used = 10;
3917}
3918
3919/**
3920 * Pulls Bluetooth Activity Energy Info
3921 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
3922 */
3923message BluetoothActivityInfo {
3924    // timestamp(wall clock) of record creation
3925    optional uint64 timestamp_millis = 1;
3926    // bluetooth stack state
3927    optional int32 bluetooth_stack_state = 2;
3928    // tx time in millis
3929    optional uint64 controller_tx_time_millis = 3;
3930    // rx time in millis
3931    optional uint64 controller_rx_time_millis = 4;
3932    // idle time in millis
3933    optional uint64 controller_idle_time_millis = 5;
3934    // product of current(mA), voltage(V) and time(ms)
3935    optional uint64 energy_used = 6;
3936}
3937
3938/*
3939 * Logs the memory stats for a process.
3940 *
3941 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
3942 */
3943message ProcessMemoryState {
3944    // The uid if available. -1 means not available.
3945    optional int32 uid = 1 [(is_uid) = true];
3946
3947    // The process name.
3948    // Usually package name, "system" for system server.
3949    // Provided by ActivityManagerService.
3950    optional string process_name = 2;
3951
3952    // Current OOM score adjustment. Value read from ProcessRecord.
3953    optional int32 oom_adj_score = 3;
3954
3955    // # of page-faults
3956    optional int64 page_fault = 4;
3957
3958    // # of major page-faults
3959    optional int64 page_major_fault = 5;
3960
3961    // RSS
3962    // Value is read from /proc/PID/status. Or from memory.stat, field
3963    // total_rss if per-app memory cgroups are enabled.
3964    optional int64 rss_in_bytes = 6;
3965
3966    // CACHE
3967    // Value is read from memory.stat, field total_cache if per-app memory
3968    // cgroups are enabled. Otherwise, 0.
3969    optional int64 cache_in_bytes = 7;
3970
3971    // SWAP
3972    // Value is read from memory.stat, field total_swap if per-app memory
3973    // cgroups are enabled. Otherwise, VmSwap from /proc/PID/status.
3974    optional int64 swap_in_bytes = 8;
3975
3976    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
3977    optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
3978
3979    // Elapsed real time when the process started.
3980    // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
3981    optional int64 start_time_nanos = 10;
3982
3983    // Anonymous page size plus swap size. Values are read from /proc/PID/status.
3984    optional int32 anon_rss_and_swap_in_kilobytes = 11;
3985}
3986
3987/*
3988 * Logs the memory stats for a native process (from procfs).
3989 *
3990 * Pulled from StatsCompanionService for selected native processes.
3991 */
3992message NativeProcessMemoryState {
3993    // The uid if available. -1 means not available.
3994    optional int32 uid = 1 [(is_uid) = true];
3995
3996    // The process name.
3997    // Value read from /proc/PID/cmdline.
3998    optional string process_name = 2;
3999
4000    // # of page-faults
4001    optional int64 page_fault = 3;
4002
4003    // # of major page-faults
4004    optional int64 page_major_fault = 4;
4005
4006    // RSS
4007    // Value read from /proc/PID/status.
4008    optional int64 rss_in_bytes = 5;
4009
4010    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always 0.
4011    optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
4012
4013    // Elapsed real time when the process started.
4014    // Value is read from /proc/PID/stat, field 22.
4015    optional int64 start_time_nanos = 7;
4016
4017    // SWAP
4018    // Value read from /proc/PID/status, field VmSwap.
4019    optional int64 swap_in_bytes = 8;
4020
4021    // Anonymous page size plus swap size. Values are read from /proc/PID/status.
4022    optional int32 anon_rss_and_swap_in_kilobytes = 9;
4023}
4024
4025/*
4026 * Logs the memory high-water mark for a process.
4027 *
4028 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
4029 * and for selected native processes.
4030 *
4031 * Pulling this atom resets high-water mark counters for all processes.
4032 */
4033message ProcessMemoryHighWaterMark {
4034    // The uid if available. -1 means not available.
4035    optional int32 uid = 1 [(is_uid) = true];
4036
4037    // The process name.
4038    // Usually package name or process cmdline.
4039    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
4040    optional string process_name = 2;
4041
4042    // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
4043    // /proc/PID/status.
4044    optional int64 rss_high_water_mark_in_bytes = 3;
4045}
4046
4047/*
4048 * Elapsed real time from SystemClock.
4049 */
4050message SystemElapsedRealtime {
4051    optional uint64 time_millis = 1;
4052}
4053
4054/*
4055 * Up time from SystemClock.
4056 */
4057message SystemUptime {
4058    // Milliseconds since the system was booted.
4059    // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
4060    // for external input).
4061    // It is not affected by clock scaling, idle, or other power saving mechanisms.
4062    optional uint64 uptime_millis = 1;
4063}
4064
4065/*
4066 * Reads from /proc/uid_concurrent_active_time which has the format:
4067 * active: X (X is # cores)
4068 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
4069 * [uid1]: [time-0] [time-1] [time-2] ... ...
4070 * ...
4071 * Time-N means the CPU time a UID spent running concurrently with N other processes.
4072 * The file contains a monotonically increasing count of time for a single boot.
4073 */
4074message CpuActiveTime {
4075    optional int32 uid = 1 [(is_uid) = true];
4076    optional uint64 time_millis = 2;
4077}
4078
4079/**
4080 * Reads from /proc/uid_concurrent_policy_time which has the format:
4081 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
4082 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
4083 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
4084 * ...
4085 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
4086 * The file contains a monotonically increasing count of time for a single boot.
4087 */
4088message CpuClusterTime {
4089    optional int32 uid = 1 [(is_uid) = true];
4090    optional int32 cluster_index = 2;
4091    optional uint64 time_millis = 3;
4092}
4093
4094/*
4095 * Pulls free disk space, for data, system partition and temporary directory.
4096 */
4097message DiskSpace {
4098    // available bytes in data partition
4099    optional uint64 data_available_bytes = 1;
4100    // available bytes in system partition
4101    optional uint64 system_available_bytes = 2;
4102    // available bytes in download cache or temp directories
4103    optional uint64 temp_available_bytes = 3;
4104}
4105
4106/**
4107 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
4108 *
4109 * Pulled from StatsCompanionService.java
4110 */
4111message RemainingBatteryCapacity {
4112    optional int32 charge_micro_ampere_hour = 1;
4113}
4114
4115/**
4116 * Pulls battery capacity, which is the battery capacity when full in uAh.
4117 * Pulled from:
4118 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
4119 */
4120message FullBatteryCapacity {
4121    optional int32 capacity_micro_ampere_hour = 1;
4122}
4123
4124/**
4125 * Pulls battery voltage.
4126 * Pulled from:
4127 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
4128 */
4129message BatteryVoltage {
4130    // The voltage of the battery, in millivolts.
4131    optional int32 voltage_millivolt = 1;
4132}
4133
4134/**
4135 * Pulls battery level (percent full, from 0 to 100).
4136 *
4137 * Pulled from:
4138 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
4139 */
4140message BatteryLevel {
4141    // Battery level. Should be in [0, 100].
4142    optional int32 battery_level = 1;
4143}
4144
4145/**
4146 * Pulls the temperature of various parts of the device.
4147 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
4148 *
4149 * Pulled from StatsCompanionService.java
4150 */
4151message Temperature {
4152    // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
4153    optional android.os.TemperatureTypeEnum sensor_location = 1;
4154
4155    // The name of the temperature source. Eg. CPU0
4156    optional string sensor_name = 2;
4157
4158    // Temperature in tenths of a degree C.
4159    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
4160    optional int32 temperature_deci_celsius = 3;
4161
4162    // Relative severity of the throttling, see enum definition.
4163    optional android.os.ThrottlingSeverityEnum severity = 4;
4164}
4165
4166/**
4167 * Pulls the statistics of calls to Binder.
4168 *
4169 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
4170 * config on the device.
4171 *
4172 * Next tag: 15
4173 */
4174message BinderCalls {
4175    // UID of the process responsible for the binder transaction. It will be set if the process
4176    // executing the binder transaction attribute the transaction to another uid using
4177    // Binder.setThreadWorkSource().
4178    //
4179    // If not set, the value will be -1.
4180    optional int32 uid = 1 [(is_uid) = true];
4181    // UID of the process executing the binder transaction.
4182    optional int32 direct_caller_uid = 14;
4183    // Fully qualified class name of the API call.
4184    //
4185    // This is a system server class name.
4186    //
4187    // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
4188    // gets recycled and we have isolated uids, we might attribute the data incorrectly.
4189    // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
4190    // commonly used APIs.
4191    optional string service_class_name = 2;
4192    // Method name of the API call. It can also be a transaction code if we cannot
4193    // resolve it to a name. See Binder#getTransactionName.
4194    //
4195    // This is a system server method name.
4196    optional string service_method_name = 3;
4197    // Total number of API calls.
4198    optional int64 call_count = 4;
4199    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
4200    optional bool screen_interactive = 13;
4201    // Total number of API calls we have data recorded for. If we collected data for all the calls,
4202    // call_count will be equal to recorded_call_count.
4203    //
4204    // If recorded_call_count is different than call_count, it means data collection has been
4205    // sampled. All the fields below will be sampled in this case.
4206    optional int64 recorded_call_count = 12;
4207    // Number of exceptions thrown by the API.
4208    optional int64 recorded_exception_count = 5;
4209    // Total latency of all API calls.
4210    // Average can be computed using total_latency_micros / recorded_call_count.
4211    optional int64 recorded_total_latency_micros = 6;
4212    // Maximum latency of one API call.
4213    optional int64 recorded_max_latency_micros = 7;
4214    // Total CPU usage of all API calls.
4215    // Average can be computed using total_cpu_micros / recorded_call_count.
4216    // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
4217    optional int64 recorded_total_cpu_micros = 8;
4218    // Maximum CPU usage of one API call.
4219    optional int64 recorded_max_cpu_micros = 9;
4220    // Maximum parcel reply size of one API call.
4221    optional int64 recorded_max_reply_size_bytes = 10;
4222    // Maximum parcel request size of one API call.
4223    optional int64 recorded_max_request_size_bytes = 11;
4224}
4225
4226/**
4227 * Pulls the statistics of exceptions during calls to Binder.
4228 *
4229 * Binder stats are cumulative from boot unless somebody reset the data using
4230 * > adb shell dumpsys binder_calls_stats --reset
4231 */
4232message BinderCallsExceptions {
4233    // Exception class name, e.g. java.lang.IllegalArgumentException.
4234    //
4235    // This is an exception class name thrown by the system server.
4236    optional string exception_class_name = 1;
4237    // Total number of exceptions.
4238    optional int64 exception_count = 2;
4239}
4240
4241/**
4242 * Pulls the statistics of message dispatching on HandlerThreads.
4243 *
4244 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
4245 * config on the device.
4246 *
4247 * Next tag: 11
4248 */
4249message LooperStats {
4250    // The uid that made a call to the System Server and caused the message to be enqueued.
4251    optional int32 uid = 1 [(is_uid) = true];
4252
4253    // Fully qualified class name of the handler target class.
4254    //
4255    // This field does not contain PII. This is a system server class name.
4256    optional string handler_class_name = 2;
4257
4258    // The name of the thread that runs the Looper.
4259    //
4260    // This field does not contain PII. This is a system server thread name.
4261    optional string looper_thread_name = 3;
4262
4263    // The name of the dispatched message.
4264    //
4265    // This field does not contain PII. This is a system server constant or class
4266    // name.
4267    optional string message_name = 4;
4268
4269    // Total number of successfully dispatched messages.
4270    optional int64 message_count = 5;
4271
4272    // Total number of messages that failed dispatching.
4273    optional int64 exception_count = 6;
4274
4275    // Total number of processed messages we have data recorded for. If we
4276    // collected data for all the messages, message_count will be equal to
4277    // recorded_message_count.
4278    //
4279    // If recorded_message_count is different than message_count, it means data
4280    // collection has been sampled. The fields below will be sampled in this case.
4281    optional int64 recorded_message_count = 7;
4282
4283    // Total latency of all processed messages.
4284    // Average can be computed using recorded_total_latency_micros /
4285    // recorded_message_count.
4286    optional int64 recorded_total_latency_micros = 8;
4287
4288    // Total CPU usage of all processed message.
4289    // Average can be computed using recorded_total_cpu_micros /
4290    // recorded_message_count. Total can be computed using
4291    // recorded_total_cpu_micros / recorded_message_count * message_count.
4292    optional int64 recorded_total_cpu_micros = 9;
4293
4294    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
4295    optional bool screen_interactive = 10;
4296
4297    // Max recorded CPU usage of all processed messages.
4298    optional int64 recorded_max_cpu_micros = 11;
4299
4300    // Max recorded latency of all processed messages.
4301    optional int64 recorded_max_latency_micros = 12;
4302
4303    // Total number of messages we tracked the dispatching delay for. If we
4304    // collected data for all the messages, message_count will be equal to
4305    // recorded_delay_message_count.
4306    //
4307    // If recorded_delay_message_count is different than message_count, it means data
4308    // collection has been sampled or/and not all messages specified the target dispatch time.
4309    // The fields below will be sampled in this case.
4310    optional int64 recorded_delay_message_count = 13;
4311
4312    // Total dispatching delay of all processed messages.
4313    // Calculated as a difference between the target dispatching time (Message.when)
4314    // and the actual dispatching time.
4315    // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
4316    optional int64 recorded_total_delay_millis = 14;
4317
4318    // Max dispatching delay of all processed messages.
4319    // Calculated as a difference between the target dispatching time (Message.when)
4320    // and the actual dispatching time.
4321    optional int64 recorded_max_delay_millis = 15;
4322}
4323
4324/**
4325 * Pulls disk information, such as write speed and latency.
4326 */
4327message DiskStats {
4328    // Time taken to open, write 512B to, and close a file.
4329    // -1 if error performing the check.
4330    optional int64 data_write_latency_millis = 1;
4331
4332    optional bool file_based_encryption = 2;
4333
4334    // Recent disk write speed in kB/s.
4335    // -1 if error querying storageed.
4336    // 0 if data is unavailable.
4337    optional int32 recent_disk_write_speed = 3;
4338}
4339
4340
4341/**
4342 * Free and total bytes of the Data, Cache, and System partition.
4343 */
4344message DirectoryUsage {
4345    enum Directory {
4346        UNKNOWN = 0;
4347        DATA = 1;
4348        CACHE = 2;
4349        SYSTEM = 3;
4350    }
4351    optional Directory directory = 1;
4352    optional int64 free_bytes = 2;
4353    optional int64 total_bytes = 3;
4354}
4355
4356
4357/**
4358 * Size of an application: apk size, data size, and cache size.
4359 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
4360 * Information is only reported for apps with the primary user (user 0).
4361 * Sizes are aggregated by package name.
4362 */
4363message AppSize {
4364    // Including uids will involve modifying diskstats logic.
4365    optional string package_name = 1;
4366    // App size in bytes. -1 if unavailable.
4367    optional int64 app_size_bytes = 2;
4368    // App data size in bytes. -1 if unavailable.
4369    optional int64 app_data_size_bytes = 3;
4370    // App cache size in bytes. -1 if unavailable.
4371    optional int64 app_cache_size_bytes = 4;
4372    // Time that the cache file was produced.
4373    // Uses System.currentTimeMillis(), which is wall clock time.
4374    optional int64 cache_time_millis = 5;
4375}
4376
4377
4378/**
4379 * Size of a particular category. Eg: photos, videos.
4380 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
4381 */
4382message CategorySize {
4383    enum Category {
4384        UNKNOWN = 0;
4385        APP_SIZE = 1;
4386        APP_DATA_SIZE = 2;
4387        APP_CACHE_SIZE = 3;
4388        PHOTOS = 4;
4389        VIDEOS = 5;
4390        AUDIO = 6;
4391        DOWNLOADS = 7;
4392        SYSTEM = 8;
4393        OTHER = 9;
4394    }
4395    optional Category category = 1;
4396    // Category size in bytes.
4397    optional int64 size_bytes = 2;
4398    // Time that the cache file was produced.
4399    // Uses System.currentTimeMillis(), which is wall clock time.
4400    optional int64 cache_time_millis = 3;
4401}
4402
4403/**
4404 * Pulls per uid I/O stats. The stats are cumulative since boot.
4405 *
4406 * Read/write bytes are I/O events from a storage device
4407 * Read/write chars are data requested by read/write syscalls, and can be
4408 *   satisfied by caching.
4409 *
4410 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
4411 */
4412message DiskIo {
4413    optional int32 uid = 1 [(is_uid) = true];
4414    optional int64 fg_chars_read = 2;
4415    optional int64 fg_chars_write = 3;
4416    optional int64 fg_bytes_read = 4;
4417    optional int64 fg_bytes_write = 5;
4418    optional int64 bg_chars_read = 6;
4419    optional int64 bg_chars_write = 7;
4420    optional int64 bg_bytes_read = 8;
4421    optional int64 bg_bytes_write = 9;
4422    optional int64 fg_fsync = 10;
4423    optional int64 bg_fsync= 11;
4424}
4425
4426
4427/**
4428 * Pulls the number of fingerprints for each user.
4429 *
4430 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
4431 */
4432message NumFingerprintsEnrolled {
4433    // The associated user. Eg: 0 for owners, 10+ for others.
4434    // Defined in android/os/UserHandle.java
4435    optional int32 user = 1;
4436    // Number of fingerprints registered to that user.
4437    optional int32 num_fingerprints_enrolled = 2;
4438}
4439
4440/**
4441 * Pulls the number of faces for each user.
4442 *
4443 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
4444 */
4445message NumFacesEnrolled {
4446    // The associated user. Eg: 0 for owners, 10+ for others.
4447    // Defined in android/os/UserHandle.java
4448    optional int32 user = 1;
4449    // Number of faces registered to that user.
4450    optional int32 num_faces_enrolled = 2;
4451}
4452/**
4453 * A mapping of role holder -> role
4454 */
4455message RoleHolder {
4456    // uid of the role holder
4457    optional int32 uid = 1 [(is_uid) = true];
4458
4459    // package name of the role holder
4460    optional string package_name = 2;
4461
4462    // the role held
4463    optional string role = 3;
4464}
4465
4466message AggStats {
4467    optional int64 min = 1;
4468
4469    optional int64 average = 2;
4470
4471    optional int64 max = 3;
4472}
4473
4474message ProcessStatsStateProto {
4475    optional android.service.procstats.ScreenState screen_state = 1;
4476
4477    optional android.service.procstats.MemoryState memory_state = 2;
4478
4479    // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
4480    // and not frameworks/base/core/java/android/app/ActivityManager.java
4481    optional android.service.procstats.ProcessState process_state = 3;
4482
4483    // Millisecond uptime duration spent in this state
4484    optional int64 duration_millis = 4;
4485
4486    // Millisecond elapsed realtime duration spent in this state
4487    optional int64 realtime_duration_millis = 9;
4488
4489    // # of samples taken
4490    optional int32 sample_size = 5;
4491
4492    // PSS is memory reserved for this process
4493    optional AggStats pss = 6;
4494
4495    // USS is memory shared between processes, divided evenly for accounting
4496    optional AggStats uss = 7;
4497
4498    // RSS is memory resident for this process
4499    optional AggStats rss = 8;
4500}
4501
4502// Next Tag: 7
4503message ProcessStatsProto {
4504    // Name of process.
4505    optional string process = 1;
4506
4507    // Uid of the process.
4508    optional int32 uid = 2;
4509
4510    // Information about how often kills occurred
4511    message Kill {
4512        // Count of excessive CPU kills
4513        optional int32 cpu = 1;
4514
4515        // Count of kills when cached
4516        optional int32 cached = 2;
4517
4518        // PSS stats during cached kill
4519        optional AggStats cached_pss = 3;
4520    }
4521    optional Kill kill = 3;
4522
4523    // Time and memory spent in various states.
4524    repeated ProcessStatsStateProto states = 5;
4525
4526    // Total time process has been running...  screen_state, memory_state, and process_state
4527    // will not be set.
4528    optional ProcessStatsStateProto total_running_state = 6;
4529}
4530
4531message PackageServiceOperationStatsProto {
4532    // Operate enum: Started, Foreground, Bound, Executing
4533    optional android.service.procstats.ServiceOperationState operation = 1;
4534
4535    // Number of times the service was in this operation.
4536    optional int32 count = 2;
4537
4538    // Information about a state the service can be in.
4539    message StateStats {
4540        // Screen state enum.
4541        optional android.service.procstats.ScreenState screen_state = 1;
4542        // Memory state enum.
4543        optional android.service.procstats.MemoryState memory_state = 2;
4544
4545        // duration in milliseconds.
4546        optional int64 duration_millis = 3;
4547        // Millisecond elapsed realtime duration spent in this state
4548        optional int64 realtime_duration_millis = 4;
4549    }
4550    repeated StateStats state_stats = 3;
4551}
4552
4553message PackageServiceStatsProto {
4554    // Name of service component.
4555    optional string service_name = 1;
4556
4557    // The operation stats.
4558    // The package_name, package_uid, package_version, service_name will not be set to save space.
4559    repeated PackageServiceOperationStatsProto operation_stats = 2;
4560}
4561
4562message PackageAssociationSourceProcessStatsProto {
4563    // Uid of the process.
4564    optional int32 process_uid = 1;
4565    // Process name.
4566    optional string process_name = 2;
4567    // Package name.
4568    optional string package_name = 7;
4569    // Total count of the times this association appeared.
4570    optional int32 total_count = 3;
4571
4572    // Millisecond uptime total duration this association was around.
4573    optional int64 total_duration_millis = 4;
4574
4575    // Total count of the times this association became actively impacting its target process.
4576    optional int32 active_count = 5;
4577
4578    // Information on one source in this association.
4579    message StateStats {
4580        // Process state enum.
4581        optional android.service.procstats.ProcessState process_state = 1;
4582        // Millisecond uptime duration spent in this state
4583        optional int64 duration_millis = 2;
4584        // Millisecond elapsed realtime duration spent in this state
4585        optional int64 realtime_duration_mmillis = 3;
4586    }
4587    repeated StateStats active_state_stats = 6;
4588}
4589
4590message PackageAssociationProcessStatsProto {
4591    // Name of the target component.
4592    optional string component_name = 1;
4593    // Information on one source in this association.
4594    repeated PackageAssociationSourceProcessStatsProto sources = 2;
4595}
4596
4597
4598message ProcessStatsPackageProto {
4599    // Name of package.
4600    optional string package = 1;
4601
4602    // Uid of the package.
4603    optional int32 uid = 2;
4604
4605    // Version of the package.
4606    optional int64 version = 3;
4607
4608    // Stats for each process running with the package loaded in to it.
4609    repeated ProcessStatsProto process_stats = 4;
4610
4611    // Stats for each of the package's services.
4612    repeated PackageServiceStatsProto service_stats = 5;
4613
4614    // Stats for each association with the package.
4615    repeated PackageAssociationProcessStatsProto association_stats = 6;
4616}
4617
4618message ProcessStatsSectionProto {
4619    // Elapsed realtime at start of report.
4620    optional int64 start_realtime_millis = 1;
4621
4622    // Elapsed realtime at end of report.
4623    optional int64 end_realtime_millis = 2;
4624
4625    // CPU uptime at start of report.
4626    optional int64 start_uptime_millis = 3;
4627
4628    // CPU uptime at end of report.
4629    optional int64 end_uptime_millis = 4;
4630
4631    // System runtime library. e.g. "libdvm.so", "libart.so".
4632    optional string runtime = 5;
4633
4634    // whether kernel reports swapped pss.
4635    optional bool has_swapped_pss = 6;
4636
4637    // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
4638    enum Status {
4639        STATUS_UNKNOWN = 0;
4640        STATUS_COMPLETE = 1;
4641        STATUS_PARTIAL = 2;
4642        STATUS_SHUTDOWN = 3;
4643        STATUS_SYSPROPS = 4;
4644    }
4645    repeated Status status = 7;
4646
4647    // Number of pages available of various types and sizes, representation fragmentation.
4648    repeated ProcessStatsAvailablePagesProto available_pages = 10;
4649
4650    // Stats for each process.
4651    repeated ProcessStatsProto process_stats = 8;
4652
4653    // Stats for each package.
4654    repeated ProcessStatsPackageProto package_stats = 9;
4655}
4656
4657message ProcessStatsAvailablePagesProto {
4658    // Node these pages are in (as per /proc/pagetypeinfo)
4659    optional int32 node = 1;
4660
4661    // Zone these pages are in (as per /proc/pagetypeinfo)
4662    optional string zone = 2;
4663
4664    // Label for the type of these pages (as per /proc/pagetypeinfo)
4665    optional string label = 3;
4666
4667    // Distribution of number of pages available by order size.  First entry in array is
4668    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
4669    repeated int32 pages_per_order = 4;
4670}
4671
4672/**
4673 * Pulled from ProcessStatsService.java
4674 */
4675message ProcStats {
4676    optional ProcessStatsSectionProto proc_stats_section = 1;
4677}
4678
4679/**
4680 * Pulled from ProcessStatsService.java
4681 */
4682message ProcStatsPkgProc {
4683    optional ProcessStatsSectionProto proc_stats_section = 1;
4684}
4685
4686message PowerProfileProto {
4687    optional double cpu_suspend = 1;
4688
4689    optional double cpu_idle = 2;
4690
4691    optional double cpu_active = 3;
4692
4693    message CpuCluster {
4694        optional int32 id = 1;
4695        optional double cluster_power = 2;
4696        optional int32 cores = 3;
4697        repeated int64 speed = 4;
4698        repeated double core_power = 5;
4699    }
4700
4701    repeated CpuCluster cpu_cluster = 40;
4702
4703    optional double wifi_scan = 4;
4704
4705    optional double wifi_on = 5;
4706
4707    optional double wifi_active = 6;
4708
4709    optional double wifi_controller_idle = 7;
4710
4711    optional double wifi_controller_rx = 8;
4712
4713    optional double wifi_controller_tx = 9;
4714
4715    repeated double wifi_controller_tx_levels = 10;
4716
4717    optional double wifi_controller_operating_voltage = 11;
4718
4719    optional double bluetooth_controller_idle = 12;
4720
4721    optional double bluetooth_controller_rx = 13;
4722
4723    optional double bluetooth_controller_tx = 14;
4724
4725    optional double bluetooth_controller_operating_voltage = 15;
4726
4727    optional double modem_controller_sleep = 16;
4728
4729    optional double modem_controller_idle = 17;
4730
4731    optional double modem_controller_rx = 18;
4732
4733    repeated double modem_controller_tx = 19;
4734
4735    optional double modem_controller_operating_voltage = 20;
4736
4737    optional double gps_on = 21;
4738
4739    repeated double gps_signal_quality_based = 22;
4740
4741    optional double gps_operating_voltage = 23;
4742
4743    optional double bluetooth_on = 24;
4744
4745    optional double bluetooth_active = 25;
4746
4747    optional double bluetooth_at_cmd = 26;
4748
4749    optional double ambient_display = 27;
4750
4751    optional double screen_on = 28;
4752
4753    optional double radio_on = 29;
4754
4755    optional double radio_scanning = 30;
4756
4757    optional double radio_active = 31;
4758
4759    optional double screen_full = 32;
4760
4761    optional double audio = 33;
4762
4763    optional double video = 34;
4764
4765    optional double flashlight = 35;
4766
4767    optional double memory = 36;
4768
4769    optional double camera = 37;
4770
4771    optional double wifi_batched_scan = 38;
4772
4773    optional double battery_capacity = 39;
4774}
4775
4776/**
4777 * power_profile.xml and other constants for power model calculations.
4778 * Pulled from PowerProfile.java
4779 */
4780message PowerProfile {
4781    optional PowerProfileProto power_profile = 1;
4782}
4783
4784/**
4785 * Logs when a user restriction was added or removed.
4786 *
4787 * Logged from:
4788 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
4789 */
4790message UserRestrictionChanged {
4791    // The raw string of the user restriction as defined in UserManager.
4792    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
4793    optional string restriction = 1;
4794    // Whether the restriction is enabled or disabled.
4795    optional bool enabled = 2;
4796}
4797
4798/**
4799 * Pulls process user time and system time. Puller takes a snapshot of all pids
4800 * in the system and returns cpu stats for those that are working at the time.
4801 * Dead pids will be dropped. Kernel processes are excluded.
4802 * Min cool-down is 5 sec.
4803 */
4804message ProcessCpuTime {
4805    optional int32 uid = 1 [(is_uid) = true];
4806
4807    optional string process_name = 2;
4808    // Process cpu time in user space, cumulative from boot/process start
4809    optional int64 user_time_millis = 3;
4810    // Process cpu time in system space, cumulative from boot/process start
4811    optional int64 system_time_millis = 4;
4812}
4813
4814/**
4815 * Pulls the CPU usage for each thread.
4816 *
4817 * Read from /proc/$PID/task/$TID/time_in_state files.
4818 *
4819 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
4820 * time_in_state files not being present on some phones, have not been addressed. These should be
4821 * considered before a public release.
4822 */
4823message CpuTimePerThreadFreq {
4824    // UID that owns the process.
4825    optional int32 uid = 1 [(is_uid) = true];
4826    // ID of the process.
4827    optional int32 process_id = 2;
4828    // ID of the thread.
4829    optional int32 thread_id = 3;
4830    // Name of the process taken from `/proc/$PID/cmdline`.
4831    optional string process_name = 4;
4832    // Name of the thread taken from `/proc/$PID/task/$TID/comm`
4833    optional string thread_name = 5;
4834
4835    // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
4836    // are given in KHz, and time is given in milliseconds since the thread started. All eight
4837    // frequencies are given here as the alternative is sending eight separate atoms. This method
4838    // significantly reduces the amount of data created
4839    optional int32 frequency1_khz = 6;
4840    optional int32 time1_millis = 7;
4841    optional int32 frequency2_khz = 8;
4842    optional int32 time2_millis = 9;
4843    optional int32 frequency3_khz = 10;
4844    optional int32 time3_millis = 11;
4845    optional int32 frequency4_khz = 12;
4846    optional int32 time4_millis = 13;
4847    optional int32 frequency5_khz = 14;
4848    optional int32 time5_millis = 15;
4849    optional int32 frequency6_khz = 16;
4850    optional int32 time6_millis = 17;
4851    optional int32 frequency7_khz = 18;
4852    optional int32 time7_millis = 19;
4853    optional int32 frequency8_khz = 20;
4854    optional int32 time8_millis = 21;
4855}
4856
4857/**
4858 * Pulls information about the device's build.
4859 */
4860message BuildInformation {
4861    // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
4862    // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
4863    optional string fingerprint = 1;
4864
4865    // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
4866    optional string brand = 2;
4867
4868    // Build.PRODUCT. The name of the overall product.
4869    optional string product = 3;
4870
4871    // Build.DEVICE. The name of the industrial design.
4872    optional string device = 4;
4873
4874    // Build.VERSION.RELEASE. The user-visible version string.  E.g., "1.0" or "3.4b5" or "bananas".
4875    optional string version_release = 5;
4876
4877    // Build.ID. E.g. a label like "M4-rc20".
4878    optional string id = 6;
4879
4880    // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
4881    // represent this build.
4882    optional string version_incremental = 7;
4883
4884    // Build.TYPE. The type of build, like "user" or "eng".
4885    optional string type = 8;
4886
4887    // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
4888    optional string tags = 9;
4889}
4890
4891/**
4892 * Logs information about mismatched caller for content capture.
4893 *
4894 * Logged from:
4895 *   frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java
4896 */
4897message ContentCaptureCallerMismatchReported {
4898    optional string intended_package = 1;
4899    optional string calling_package = 2;
4900}
4901
4902/**
4903 * Logs information about content capture service events.
4904 *
4905 * Logged from:
4906 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
4907 */
4908message ContentCaptureServiceEvents {
4909    // The type of event.
4910    enum Event {
4911        UNKNOWN = 0;
4912        ON_CONNECTED = 1;
4913        ON_DISCONNECTED = 2;
4914        SET_WHITELIST = 3;
4915        SET_DISABLED = 4;
4916        ON_USER_DATA_REMOVED = 5;
4917    }
4918    optional Event event = 1;
4919    // component/package of content capture service.
4920    optional string service_info = 2;
4921    // component/package of target.
4922    // it's a concatenated list of component/package for SET_WHITELIST event
4923    // separated by " ".
4924    optional string target_info = 3;
4925}
4926
4927/**
4928 * Logs information about content capture session events.
4929 *
4930 * Logged from:
4931 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
4932 */
4933message ContentCaptureSessionEvents {
4934    // The type of event.
4935    enum Event {
4936        UNKNOWN = 0;
4937        ON_SESSION_STARTED = 1;
4938        ON_SESSION_FINISHED = 2;
4939        SESSION_NOT_CREATED = 3;
4940    }
4941    optional int32 session_id = 1;
4942    optional Event event = 2;
4943    // (n/a on session finished)
4944    optional int32 state_flags = 3;
4945    // component/package of content capture service.
4946    optional string service_info = 4;
4947    // component/package of app.
4948    // (n/a on session finished)
4949    optional string app_info = 5;
4950    optional bool is_child_session = 6;
4951}
4952
4953/**
4954 * Logs information about session being flushed.
4955 *
4956 * Logged from:
4957 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
4958 */
4959message ContentCaptureFlushed {
4960    optional int32 session_id = 1;
4961    // component/package of content capture service.
4962    optional string service_info = 2;
4963    // component/package of app.
4964    optional string app_info = 3;
4965    // session start/finish events
4966    optional int32 child_session_started = 4;
4967    optional int32 child_session_finished = 5;
4968    // count of view events.
4969    optional int32 view_appeared_count = 6;
4970    optional int32 view_disappeared_count = 7;
4971    optional int32 view_text_changed_count = 8;
4972
4973    // Flush stats.
4974    optional int32 max_events = 9;
4975    optional int32 idle_flush_freq = 10;
4976    optional int32 text_flush_freq = 11;
4977    optional int32 flush_reason = 12;
4978}
4979
4980/**
4981 * Pulls on-device BatteryStats power use calculations for the overall device.
4982 */
4983message DeviceCalculatedPowerUse {
4984    // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
4985    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
4986    // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
4987    optional int64 computed_power_nano_amp_secs = 1;
4988}
4989
4990/**
4991 * Pulls on-device BatteryStats power use calculations broken down by uid.
4992 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
4993 * that is attributed to non-uid items. They must all be included to get the total power use.
4994 */
4995message DeviceCalculatedPowerBlameUid {
4996    // Uid being blamed. Note: isolated uids have already been mapped to host uid.
4997    optional int32 uid = 1 [(is_uid) = true];
4998
4999    // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
5000    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
5001    optional int64 power_nano_amp_secs = 2;
5002}
5003
5004/**
5005 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
5006 * drain type.
5007 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
5008 * is attributed uids. They must all be included to get the total power use.
5009 */
5010message DeviceCalculatedPowerBlameOther {
5011    // The type of item whose power use is being reported.
5012    enum DrainType {
5013        AMBIENT_DISPLAY = 0;
5014        // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
5015        BLUETOOTH = 2;
5016        CAMERA = 3;
5017        // Cell-standby
5018        CELL = 4;
5019        FLASHLIGHT = 5;
5020        IDLE = 6;
5021        MEMORY = 7;
5022        // Amount that total computed drain exceeded the drain estimated using the
5023        // battery level changes and capacity.
5024        OVERCOUNTED = 8;
5025        PHONE = 9;
5026        SCREEN = 10;
5027        // Amount that total computed drain was below the drain estimated using the
5028        // battery level changes and capacity.
5029        UNACCOUNTED = 11;
5030        // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
5031        WIFI = 13;
5032    }
5033    optional DrainType drain_type = 1;
5034
5035    // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
5036    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
5037    optional int64 power_nano_amp_secs = 2;
5038}
5039
5040/**
5041 * Logs device policy features.
5042 *
5043 * Logged from:
5044 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
5045 *   packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
5046 */
5047message DevicePolicyEvent {
5048    // The event id - unique for each event.
5049    optional android.stats.devicepolicy.EventId event_id = 1;
5050    // The admin package name.
5051    optional string admin_package_name = 2;
5052    // A generic integer parameter.
5053    optional int32 integer_value = 3;
5054    // A generic boolean parameter.
5055    optional bool boolean_value = 4;
5056    // A parameter specifying a time period in milliseconds.
5057    optional uint64 time_period_millis = 5;
5058    // A parameter specifying a list of package names, bundle extras or string parameters.
5059    optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
5060}
5061
5062/**
5063 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
5064 *
5065 * Logged from:
5066 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5067 */
5068message DocsUILaunchReported {
5069    optional android.stats.docsui.LaunchAction launch_action = 1;
5070    optional bool has_initial_uri = 2;
5071    optional android.stats.docsui.MimeType mime_type = 3;
5072    optional android.stats.docsui.Root initial_root = 4;
5073}
5074
5075/**
5076 * Logs root/app visited event in file managers/picker. Call this when the user
5077 * taps on root/app in hamburger menu.
5078 *
5079 * Logged from:
5080 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5081 */
5082message DocsUIRootVisitedReported {
5083    optional android.stats.docsui.ContextScope scope = 1;
5084    optional android.stats.docsui.Root root = 2;
5085}
5086
5087/**
5088 * Logs file operation stats. Call this when a file operation has completed.
5089 *
5090 * Logged from:
5091 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5092 */
5093message DocsUIFileOperationReported {
5094    optional android.stats.docsui.Provider provider = 1;
5095    optional android.stats.docsui.FileOperation file_op = 2;
5096}
5097
5098/**
5099 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
5100 * mode.
5101 *
5102 * Logged from:
5103 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5104 */
5105message DocsUIFileOperationCopyMoveModeReported {
5106    optional android.stats.docsui.FileOperation file_op = 1;
5107    optional android.stats.docsui.CopyMoveOpMode mode = 2;
5108}
5109
5110
5111/**
5112 * Logs file sub operation stats. Call this when a file operation has failed.
5113 *
5114 * Logged from:
5115 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5116 */
5117message DocsUIFileOperationFailureReported {
5118    optional android.stats.docsui.Authority authority = 1;
5119    optional android.stats.docsui.SubFileOperation sub_op = 2;
5120}
5121
5122/**
5123* Logs the cancellation of a file operation. Call this when a job is canceled
5124*
5125* Logged from:
5126*     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5127*/
5128message DocsUIFileOperationCanceledReported {
5129    optional android.stats.docsui.FileOperation file_op = 1;
5130}
5131
5132/**
5133 * Logs startup time in milliseconds.
5134 *
5135 * Logged from:
5136 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5137 */
5138message DocsUIStartupMsReported {
5139    optional int32 startup_millis = 1;
5140}
5141
5142/**
5143 * Logs the action that was started by user.
5144 *
5145 * Logged from:
5146 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5147 */
5148message DocsUIUserActionReported {
5149    optional android.stats.docsui.UserAction action = 1;
5150}
5151
5152/**
5153 * Logs the invalid type when invalid scoped access is requested.
5154 *
5155 * Logged from:
5156 *     package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
5157 */
5158message DocsUIInvalidScopedAccessRequestReported {
5159    optional android.stats.docsui.InvalidScopedAccess type = 1;
5160}
5161
5162/**
5163 * Logs the package name that launches docsui picker mode.
5164 *
5165 * Logged from:
5166 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5167 */
5168message DocsUIPickerLaunchedFromReported {
5169    optional string package_name = 1;
5170}
5171
5172/**
5173 * Logs the search type.
5174 *
5175 * Logged from:
5176 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5177 */
5178message DocsUISearchTypeReported {
5179    optional android.stats.docsui.SearchType search_type = 1;
5180}
5181
5182/**
5183 * Logs the search mode.
5184 *
5185 * Logged from:
5186 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5187 */
5188message DocsUISearchModeReported {
5189    optional android.stats.docsui.SearchMode search_mode = 1;
5190}
5191
5192/**
5193 * Logs the pick result information.
5194 *
5195 * Logged from:
5196 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
5197 */
5198message DocsUIPickResultReported {
5199    optional int32 total_action_count = 1;
5200    optional int64 duration_millis = 2;
5201    optional int32 file_count= 3;
5202    optional bool is_searching = 4;
5203    optional android.stats.docsui.Root picked_from = 5;
5204    optional android.stats.docsui.MimeType mime_type = 6;
5205    optional int32 repeatedly_pick_times = 7;
5206}
5207
5208/**
5209 * Logs when an app's memory is compacted.
5210 *
5211 * Logged from:
5212 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5213 */
5214message AppCompacted {
5215  // The pid of the process being compacted.
5216  optional int32 pid = 1;
5217
5218  // The name of the process being compacted.
5219  optional string process_name = 2;
5220
5221  // The type of compaction.
5222  enum Action {
5223    UNKNOWN = 0;
5224    SOME = 1;
5225    FULL = 2;
5226    PERSISTENT = 3;
5227    BFGS = 4;
5228  }
5229  optional Action action = 3;
5230
5231  // Total RSS in kilobytes consumed by the process prior to compaction.
5232  optional int64 before_rss_total_kilobytes = 4;
5233
5234  // File RSS in kilobytes consumed by the process prior to compaction.
5235  optional int64 before_rss_file_kilobytes = 5;
5236
5237  // Anonymous RSS in kilobytes consumed by the process prior to compaction.
5238  optional int64 before_rss_anon_kilobytes = 6;
5239
5240  // Swap in kilobytes consumed by the process prior to compaction.
5241  optional int64 before_swap_kilobytes = 7;
5242
5243  // Total RSS in kilobytes consumed by the process after compaction.
5244  optional int64 after_rss_total_kilobytes = 8;
5245
5246  // File RSS in kilobytes consumed by the process after compaction.
5247  optional int64 after_rss_file_kilobytes = 9;
5248
5249  // Anonymous RSS in kilobytes consumed by the process after compaction.
5250  optional int64 after_rss_anon_kilobytes = 10;
5251
5252  // Swap in kilobytes consumed by the process after compaction.
5253  optional int64 after_swap_kilobytes = 11;
5254
5255  // The time taken to perform compaction in milliseconds.
5256  optional int64 time_to_compact_millis = 12;
5257
5258  // The last compaction action performed for this app.
5259  optional Action last_action = 13;
5260
5261  // The last time that compaction was attempted on this process in milliseconds
5262  // since boot, not including sleep (see SystemClock.uptimeMillis()).
5263  optional int64 last_compact_timestamp_ms_since_boot = 14;
5264
5265  // The "setAdj" (i.e. previous) oom_score_adj at the time of compaction.
5266  optional int32 oom_score_adj = 15;
5267
5268  // The process state at the time of compaction.
5269  optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];
5270
5271  // Free ZRAM in kilobytes before compaction.
5272  optional int64 before_zram_free_kilobytes = 17;
5273
5274  // Free ZRAM in kilobytes after compaction.
5275  optional int64 after_zram_free_kilobytes = 18;
5276}
5277
5278/**
5279 * Logs a DNS lookup operation initiated by the system resolver on behalf of an application
5280 * invoking native APIs such as getaddrinfo() or Java APIs such as Network#getAllByName().
5281 *
5282 * The NetworkDnsEventReported message represents the entire lookup operation, which may
5283 * result one or more queries to the recursive DNS resolvers. Those are individually logged
5284 * in DnsQueryEvents to enable computing error rates and network latency and timeouts
5285 * broken up by query type, transport, network interface, etc.
5286 */
5287message NetworkDnsEventReported {
5288    optional android.stats.dnsresolver.EventType event_type = 1;
5289
5290    optional android.stats.dnsresolver.ReturnCode return_code = 2;
5291
5292    // The latency in microseconds of the entire DNS lookup operation.
5293    optional int32 latency_micros = 3;
5294
5295    // Only valid for event_type = EVENT_GETADDRINFO.
5296    optional int32 hints_ai_flags = 4;
5297
5298    // Flags passed to android_res_nsend() defined in multinetwork.h
5299    // Only valid for event_type = EVENT_RESNSEND.
5300    optional int32 res_nsend_flags = 5;
5301
5302    optional android.stats.dnsresolver.Transport network_type = 6;
5303
5304    // The DNS over TLS mode on a specific netId.
5305    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7;
5306
5307    // Additional pass-through fields opaque to statsd.
5308    // The DNS resolver Mainline module can add new fields here without requiring an OS update.
5309    optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES];
5310}
5311
5312/**
5313 * Logs when a data stall event occurs.
5314 *
5315 * Log from:
5316 *     frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
5317 */
5318message DataStallEvent {
5319    // Data stall evaluation type.
5320    // See frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
5321    // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
5322    optional int32 evaluation_type = 1;
5323    // See definition in data_stall_event.proto.
5324    optional com.android.server.connectivity.ProbeResult validation_result = 2;
5325    // See definition in data_stall_event.proto.
5326    optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
5327    // See definition in data_stall_event.proto.
5328    optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
5329    // See definition in data_stall_event.proto.
5330    optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
5331    // See definition in data_stall_event.proto.
5332    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
5333}
5334
5335/*
5336 * Logs when RescueParty resets some set of experiment flags.
5337 *
5338 * Logged from:
5339 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
5340 */
5341message RescuePartyResetReported {
5342    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
5343    optional int32 rescue_level = 1;
5344}
5345
5346/**
5347 * Logs when signed config is received from an APK, and if that config was applied successfully.
5348 * Logged from:
5349 *   frameworks/base/services/core/java/com/android/server/signedconfig/SignedConfigService.java
5350 */
5351message SignedConfigReported {
5352    enum Type {
5353        UNKNOWN_TYPE = 0;
5354        GLOBAL_SETTINGS = 1;
5355    }
5356    optional Type type = 1;
5357
5358    // The final status of the signed config received.
5359    enum Status {
5360        UNKNOWN_STATUS = 0;
5361        APPLIED = 1;
5362        BASE64_FAILURE_CONFIG = 2;
5363        BASE64_FAILURE_SIGNATURE = 3;
5364        SECURITY_EXCEPTION = 4;
5365        INVALID_CONFIG = 5;
5366        OLD_CONFIG = 6;
5367        SIGNATURE_CHECK_FAILED = 7;
5368        NOT_APPLICABLE = 8;
5369        SIGNATURE_CHECK_FAILED_PROD_KEY_ABSENT = 9;
5370    }
5371    optional Status status = 2;
5372
5373    // The version of the signed config processed.
5374    optional int32 version = 3;
5375
5376    // The package name that the config was extracted from.
5377    optional string from_package = 4;
5378
5379    enum Key {
5380        NO_KEY = 0;
5381        DEBUG = 1;
5382        PRODUCTION = 2;
5383    }
5384    // Which key was used to verify the config.
5385    optional Key verified_with = 5;
5386}
5387
5388/*
5389 * Logs GNSS Network-Initiated (NI) location events.
5390 *
5391 * Logged from:
5392 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
5393 */
5394message GnssNiEventReported {
5395    // The type of GnssNiEvent.
5396    enum EventType {
5397        UNKNOWN = 0;
5398        NI_REQUEST = 1;
5399        NI_RESPONSE = 2;
5400    }
5401    optional EventType event_type = 1;
5402
5403    // An ID generated by HAL to associate NI notifications and UI responses.
5404    optional int32 notification_id = 2;
5405
5406    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
5407    optional android.server.location.GnssNiType ni_type = 3;
5408
5409    // NI requires notification.
5410    optional bool need_notify = 4;
5411
5412    // NI requires verification.
5413    optional bool need_verify = 5;
5414
5415    // NI requires privacy override, no notification/minimal trace.
5416    optional bool privacy_override = 6;
5417
5418    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
5419    // seconds.
5420    optional int32 timeout = 7;
5421
5422    // Default response when timeout.
5423    optional android.server.location.GnssUserResponseType default_response = 8;
5424
5425    // String representing the requester of the network inititated location request.
5426    optional string requestor_id = 9;
5427
5428    // Notification message text string representing the service(for eg. SUPL-service) who sent the
5429    // network initiated location request.
5430    optional string text = 10;
5431
5432    // requestorId decoding scheme.
5433    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;
5434
5435    // Notification message text decoding scheme.
5436    optional android.server.location.GnssNiEncodingType text_encoding = 12;
5437
5438    // True if SUPL ES is enabled.
5439    optional bool is_supl_es_enabled = 13;
5440
5441    // True if GNSS location is enabled.
5442    optional bool is_location_enabled = 14;
5443
5444    // GNSS NI responses which define the response in NI structures.
5445    optional android.server.location.GnssUserResponseType user_response = 15;
5446}
5447
5448/**
5449 * Logs GNSS non-framework (NFW) location notification.
5450 *
5451 * Logged from:
5452 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
5453 */
5454message GnssNfwNotificationReported {
5455    // Package name of the Android proxy application representing the non-framework entity that
5456    // requested location. Set to empty string if unknown.
5457    optional string proxy_app_package_name = 1;
5458
5459    // Protocol stack that initiated the non-framework location request.
5460    optional android.server.location.NfwProtocolStack protocol_stack = 2;
5461
5462    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
5463    // set to empty string. This field is opaque to the framework and used for logging purposes.
5464    optional string other_protocol_stack_name = 3;
5465
5466    // Source initiating/receiving the location information.
5467    optional android.server.location.NfwRequestor requestor = 4;
5468
5469    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
5470    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
5471    // and used for logging purposes.
5472    optional string requestor_id = 5;
5473
5474    // Indicates whether location information was provided for this request.
5475    optional android.server.location.NfwResponseType response_type = 6;
5476
5477    // True if the device is in user initiated emergency session.
5478    optional bool in_emergency_mode = 7;
5479
5480    // True if cached location is provided.
5481    optional bool is_cached_location = 8;
5482
5483    // True if proxy app permission mismatch between framework and GNSS HAL.
5484    optional bool is_permission_mismatched = 9;
5485}
5486
5487/**
5488 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
5489 *
5490 * Logged from:
5491 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
5492 */
5493message GnssConfigurationReported {
5494    // SUPL host name.
5495    optional string supl_host = 1;
5496
5497    // SUPL port number.
5498    optional int32 supl_port = 2;
5499
5500    // C2K host name.
5501    optional string c2k_host = 3;
5502
5503    // C2K port number.
5504    optional int32 c2k_port = 4;
5505
5506    // The SUPL version requested by Carrier.
5507    optional int32 supl_ver = 5;
5508
5509    // The SUPL mode.
5510    optional android.server.location.SuplMode supl_mode = 6;
5511
5512    // True if NI emergency SUPL restrictions is enabled.
5513    optional bool supl_es = 7;
5514
5515    // LTE Positioning Profile settings
5516    optional android.server.location.LppProfile lpp_profile = 8;
5517
5518    // Positioning protocol on A-Glonass system.
5519    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;
5520
5521    // True if emergency PDN is used. Otherwise, regular PDN is used.
5522    optional bool use_emergency_pdn_for_emergency_supl= 10;
5523
5524    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
5525    optional android.server.location.GpsLock gps_lock = 11;
5526
5527    // Number of seconds to extend the emergency session duration post emergency call.
5528    optional int32 es_extension_sec = 12;
5529
5530    // The full list of package names of proxy Android applications representing the non-framework
5531    // location access entities (on/off the device) for which the framework user has granted
5532    // non-framework location access permission. The package names are concatenated in one string
5533    // with spaces as separators.
5534    optional string enabled_proxy_app_package_name_list = 13;
5535}
5536
5537/**
5538 * Logs when a NFC device's error occurred.
5539 * Logged from:
5540 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
5541 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
5542 */
5543message NfcErrorOccurred {
5544    enum Type {
5545        UNKNOWN = 0;
5546        CMD_TIMEOUT = 1;
5547        ERROR_NOTIFICATION = 2;
5548        AID_OVERFLOW = 3;
5549    }
5550    optional Type type = 1;
5551    // If it's nci cmd timeout, log the timeout command.
5552    optional uint32 nci_cmd = 2;
5553
5554    optional uint32 error_ntf_status_code = 3;
5555}
5556
5557/**
5558 * Logs when a NFC device's state changed event
5559 * Logged from:
5560 *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
5561 */
5562message NfcStateChanged {
5563    enum State {
5564        UNKNOWN = 0;
5565        OFF = 1;
5566        ON = 2;
5567        ON_LOCKED = 3; // Secure Nfc enabled.
5568        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
5569    }
5570    optional State state = 1;
5571}
5572
5573/**
5574 * Logs when a NFC Beam Transaction occurred.
5575 * Logged from:
5576 *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
5577 */
5578message NfcBeamOccurred {
5579    enum Operation {
5580        UNKNOWN = 0;
5581        SEND = 1;
5582        RECEIVE = 2;
5583    }
5584    optional Operation operation = 1;
5585}
5586
5587/**
5588 * Logs when a NFC Card Emulation Transaction occurred.
5589 * Logged from:
5590 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
5591 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
5592 */
5593message NfcCardemulationOccurred {
5594    enum Category {
5595        UNKNOWN = 0;
5596        HCE_PAYMENT = 1;
5597        HCE_OTHER = 2;
5598        OFFHOST = 3;
5599    }
5600    // Transaction belongs to HCE payment or HCE other category, or offhost.
5601    optional Category category = 1;
5602    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
5603    optional string se_name = 2;
5604}
5605
5606/**
5607 * Logs when a NFC Tag event occurred.
5608 * Logged from:
5609 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
5610 */
5611message NfcTagOccurred {
5612    enum Type {
5613        UNKNOWN = 0;
5614        URL = 1;
5615        BT_PAIRING = 2;
5616        PROVISION = 3;
5617        WIFI_CONNECT = 4;
5618        APP_LAUNCH = 5;
5619        OTHERS = 6;
5620    }
5621    optional Type type = 1;
5622}
5623
5624/**
5625 * Logs when Hce transaction triggered
5626 * Logged from:
5627 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
5628 */
5629message NfcHceTransactionOccurred {
5630    // The latency period(in microseconds) it took for the first HCE data
5631    // exchange.
5632    optional uint32 latency_micros = 1;
5633}
5634
5635/**
5636 * Logs when SecureElement state event changed
5637 * Logged from:
5638 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
5639 */
5640message SeStateChanged {
5641    enum State {
5642        UNKNOWN = 0;
5643        INITIALIZED = 1;
5644        DISCONNECTED = 2;
5645        CONNECTED = 3;
5646        HALCRASH = 4;
5647    }
5648    optional State state = 1;
5649
5650    optional string state_change_reason = 2;
5651    // SIMx or eSEx.
5652    optional string terminal = 3;
5653}
5654
5655/**
5656 * Information about a permission grant request
5657 */
5658message PermissionGrantRequestResultReported {
5659    // unique value identifying an API call. A API call might result in multiple of these atoms
5660    optional int64 request_id = 1;
5661
5662    // UID of package requesting the permission grant
5663    optional int32 requesting_uid = 2 [(is_uid) = true];
5664
5665    // Name of package requesting the permission grant
5666    optional string requesting_package_name = 3;
5667
5668    // The permission to be granted
5669    optional string permission_name = 4;
5670
5671    // If the permission was explicitly requested via the API or added by the system
5672    optional bool is_implicit = 5;
5673
5674    enum Result {
5675        UNDEFINED = 0;
5676        // permission request was ignored
5677        IGNORED = 1;
5678        // permission request was ignored because it was user fixed
5679        IGNORED_USER_FIXED = 2;
5680        // permission request was ignored because it was policy fixed
5681        IGNORED_POLICY_FIXED = 3;
5682        // permission was granted by user action
5683        USER_GRANTED = 4;
5684        // permission was automatically granted
5685        AUTO_GRANTED = 5;
5686        // permission was denied by user action
5687        USER_DENIED = 6;
5688        // permission was denied with prejudice by the user
5689        USER_DENIED_WITH_PREJUDICE = 7;
5690        // permission was automatically denied
5691        AUTO_DENIED = 8;
5692        // permission request was ignored because permission is restricted
5693        IGNORED_RESTRICTED_PERMISSION = 9;
5694    }
5695    // The result of the permission grant
5696    optional Result result = 6;
5697}
5698
5699/**
5700 * Logs when Omapi API used
5701 * Logged from:
5702 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
5703 */
5704message SeOmapiReported {
5705    enum Operation {
5706        UNKNOWN = 0;
5707        OPEN_CHANNEL = 1;
5708    }
5709    optional Operation operation = 1;
5710    // SIMx or eSEx.
5711    optional string terminal = 2;
5712
5713    optional string package_name = 3;
5714}
5715
5716/**
5717  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
5718  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
5719  * Logged from:
5720  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
5721  */
5722message BroadcastDispatchLatencyReported {
5723    optional int64 dispatch_latency_millis = 1;
5724}
5725
5726/**
5727   * Logs AttentionManagerService attention check result.
5728   *
5729   * Logged from:
5730   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
5731   */
5732message AttentionManagerServiceResultReported {
5733    // See core/java/android/service/attention/AttentionService.java
5734    enum AttentionCheckResult {
5735        UNKNOWN = 20;
5736        ATTENTION_SUCCESS_ABSENT = 0;
5737        ATTENTION_SUCCESS_PRESENT = 1;
5738        ATTENTION_FAILURE_UNKNOWN = 2;
5739        ATTENTION_FAILURE_CANCELLED = 3;
5740        ATTENTION_FAILURE_PREEMPTED = 4;
5741        ATTENTION_FAILURE_TIMED_OUT = 5;
5742        ATTENTION_FAILURE_CAMERA_PERMISSION_ABSENT = 6;
5743    }
5744    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
5745}
5746
5747/**
5748 * Logs when an adb connection changes state.
5749 *
5750 * Logged from:
5751 *     frameworks/base/services/core/java/com/android/server/adb/AdbDebuggingManager.java
5752 */
5753message AdbConnectionChanged {
5754    // The last time this system connected via adb, or 0 if the 'always allow' option was not
5755    // previously selected for this system.
5756    optional int64 last_connection_time_millis = 1;
5757
5758    // The time in ms within which a subsequent connection from an 'always allow' system is allowed
5759    // to reconnect via adb without user interaction.
5760    optional int64 auth_window_millis = 2;
5761
5762    // The state of the adb connection from frameworks/base/core/proto/android/debug/enums.proto.
5763    optional android.debug.AdbConnectionStateEnum state = 3;
5764
5765    // True if the 'always allow' option was selected for this system.
5766    optional bool always_allow = 4;
5767}
5768
5769/*
5770 * Logs the reported speech DSP status.
5771 *
5772 * Logged from:
5773 *  Vendor audio implementation.
5774 */
5775message SpeechDspStatReported {
5776    // The total Speech DSP uptime in milliseconds.
5777    optional int32 total_uptime_millis = 1;
5778    // The total Speech DSP downtime in milliseconds.
5779    optional int32 total_downtime_millis = 2;
5780    optional int32 total_crash_count = 3;
5781    optional int32 total_recover_count = 4;
5782}
5783
5784/**
5785 * Logs USB connector contaminant status.
5786 *
5787 * Logged from: USB Service.
5788 */
5789message UsbContaminantReported {
5790    optional string id = 1;
5791    optional android.service.usb.ContaminantPresenceStatus status = 2;
5792}
5793
5794/**
5795 * This atom is for debugging purpose.
5796 */
5797message DebugElapsedClock {
5798    // Monotically increasing value for each pull.
5799    optional int64 pull_count = 1;
5800    // Time from System.elapsedRealtime.
5801    optional int64 elapsed_clock_millis = 2;
5802    // Time from System.elapsedRealtime.
5803    optional int64 same_elapsed_clock_millis = 3;
5804    // Diff between current elapsed time and elapsed time from previous pull.
5805    optional int64 elapsed_clock_diff_millis = 4;
5806
5807    enum Type {
5808      TYPE_UNKNOWN = 0;
5809      ALWAYS_PRESENT = 1;
5810      PRESENT_ON_ODD_PULLS = 2;
5811    }
5812    // Type of behavior for the pulled data.
5813    optional Type type = 5;
5814}
5815
5816/**
5817 * This atom is for debugging purpose.
5818 */
5819message DebugFailingElapsedClock {
5820    // Monotically increasing value for each pull.
5821    optional int64 pull_count = 1;
5822    // Time from System.elapsedRealtime.
5823    optional int64 elapsed_clock_millis = 2;
5824    // Time from System.elapsedRealtime.
5825    optional int64 same_elapsed_clock_millis = 3;
5826    // Diff between current elapsed time and elapsed time from previous pull.
5827    optional int64 elapsed_clock_diff_millis = 4;
5828}
5829
5830/** Logs System UI bubbles event changed.
5831 *
5832 * Logged from:
5833 *     frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles
5834 */
5835message BubbleUIChanged {
5836
5837    // The app package that is posting the bubble.
5838    optional string package_name = 1;
5839
5840    // The notification channel that is posting the bubble.
5841    optional string notification_channel = 2;
5842
5843    // The notification id associated with the posted bubble.
5844    optional int32 notification_id = 3;
5845
5846    // The position of the bubble within the bubble stack.
5847    optional int32 position = 4;
5848
5849    // The total number of bubbles within the bubble stack.
5850    optional int32 total_number = 5;
5851
5852    // User interactions with the bubble.
5853    enum Action {
5854        UNKNOWN = 0;
5855        POSTED = 1;
5856        UPDATED = 2;
5857        EXPANDED = 3;
5858        COLLAPSED = 4;
5859        DISMISSED = 5;
5860        STACK_DISMISSED = 6;
5861        STACK_MOVED = 7;
5862        HEADER_GO_TO_APP = 8;
5863        HEADER_GO_TO_SETTINGS = 9;
5864        PERMISSION_OPT_IN = 10;
5865        PERMISSION_OPT_OUT = 11;
5866        PERMISSION_DIALOG_SHOWN = 12;
5867        SWIPE_LEFT = 13;
5868        SWIPE_RIGHT = 14;
5869        STACK_EXPANDED = 15;
5870        FLYOUT = 16;
5871    }
5872    optional Action action = 6;
5873
5874    // Normalized screen position of the bubble stack. The range is between 0 and 1.
5875    optional float normalized_x_position = 7;
5876    optional float normalized_y_position = 8;
5877
5878    // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
5879    optional bool is_unread = 9;
5880
5881    // Whether the bubble is an on-going one.
5882    optional bool is_ongoing = 10;
5883
5884    // Whether the bubble is produced by an app running in foreground.
5885    optional bool is_foreground = 11;
5886}
5887
5888/**
5889  * Logs System UI bubbles developer errors.
5890  *
5891  * Logged from:
5892  *   frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
5893  */
5894message BubbleDeveloperErrorReported {
5895
5896    // The app package that is posting the bubble.
5897    optional string package_name = 1;
5898
5899    // Bubble developer error type enums.
5900    enum Error {
5901        UNKNOWN = 0;
5902        ACTIVITY_INFO_MISSING = 1;
5903        ACTIVITY_INFO_NOT_RESIZABLE = 2;
5904        DOCUMENT_LAUNCH_NOT_ALWAYS = 3;
5905    }
5906    optional Error error = 2 [default = UNKNOWN];
5907}
5908
5909/**
5910 * Logs that a constraint for a scheduled job has changed.
5911 *
5912 * Logged from:
5913 *     frameworks/base/services/core/java/com/android/server/job/controllers/JobStatus.java
5914 */
5915message ScheduledJobConstraintChanged {
5916    repeated AttributionNode attribution_node = 1;
5917
5918    // Name of the job.
5919    optional string job_name = 2;
5920
5921    optional com.android.server.job.ConstraintEnum constraint = 3;
5922
5923    enum State {
5924        UNKNOWN = 0;
5925        UNSATISFIED = 1;
5926        SATISFIED = 2;
5927    }
5928    optional State state = 4;
5929}
5930
5931/**
5932 * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
5933 * returns true.
5934 *
5935 * Logged from:
5936 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
5937 */
5938message ScreenTimeoutExtensionReported {
5939    // Describes how many times in a row did the power manager reset the screen off timeout.
5940    optional uint32 consecutive_timeout_extended_count = 1;
5941}
5942
5943/*
5944* Logs number of milliseconds it takes to start a process.
5945* The definition of app process start time is from the app launch time to
5946* the time that Zygote finished forking the app process and loaded the
5947* application package's java classes.
5948
5949* This metric is different from AppStartOccurred which is for foreground
5950* activity only.
5951
5952* ProcessStartTime can report all processes (both foreground and background)
5953* start time.
5954*
5955* Logged from:
5956*   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5957*/
5958message ProcessStartTime {
5959    // The uid of the ProcessRecord.
5960    optional int32 uid = 1 [(is_uid) = true];
5961
5962    // The process pid.
5963    optional int32 pid = 2;
5964
5965    // The process name.
5966    // Usually package name, "system" for system server.
5967    // Provided by ActivityManagerService.
5968    optional string process_name = 3;
5969
5970    enum StartType {
5971        UNKNOWN = 0;
5972        WARM = 1;
5973        HOT = 2;
5974        COLD = 3;
5975    }
5976
5977    // The start type.
5978    optional StartType type = 4;
5979
5980    // The elapsed realtime at the start of the process.
5981    optional int64 process_start_time_millis = 5;
5982
5983    // Number of milliseconds it takes to reach bind application.
5984    optional int32 bind_application_delay_millis = 6;
5985
5986    // Number of milliseconds it takes to finish start of the process.
5987    optional int32 process_start_delay_millis = 7;
5988
5989    // hostingType field in ProcessRecord, the component type such as "activity",
5990    // "service", "content provider", "broadcast" or other strings.
5991    optional string hosting_type = 8;
5992
5993    // hostingNameStr field in ProcessRecord. The component class name that runs
5994    // in this process.
5995    optional string hosting_name = 9;
5996}
5997
5998/**
5999 * Track Media Codec usage
6000 * Logged from:
6001 *   frameworks/av/media/libstagefright/MediaCodec.cpp
6002 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
6003 */
6004message MediametricsCodecReported {
6005    optional int64 timestamp_nanos = 1;
6006    optional string package_name = 2;
6007    optional int64 package_version_code = 3;
6008    optional int64 media_apex_version = 4;
6009
6010    optional android.stats.mediametrics.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6011}
6012
6013/**
6014 * Track Media Extractor (pulling video/audio streams out of containers) usage
6015 * Logged from:
6016 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
6017 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
6018 */
6019message MediametricsExtractorReported {
6020    optional int64 timestamp_nanos = 1;
6021    optional string package_name = 2;
6022    optional int64 package_version_code = 3;
6023    optional int64 media_apex_version = 4;
6024
6025    optional android.stats.mediametrics.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6026}
6027
6028/**
6029 * Track how we arbitrate between microphone/input requests.
6030 * Logged from
6031 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
6032 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
6033 */
6034message MediametricsAudiopolicyReported {
6035    optional int64 timestamp_nanos = 1;
6036    optional string package_name = 2;
6037    optional int64 package_version_code = 3;
6038    optional int64 media_apex_version = 4;
6039
6040    optional android.stats.mediametrics.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6041}
6042
6043/**
6044 * Track how we arbitrate between microphone requests.
6045 * Logged from
6046 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
6047 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
6048 */
6049message MediametricsAudiorecordReported {
6050    optional int64 timestamp_nanos = 1;
6051    optional string package_name = 2;
6052    optional int64 package_version_code = 3;
6053    optional int64 media_apex_version = 4;
6054
6055    optional android.stats.mediametrics.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6056}
6057
6058/**
6059 * Track how we arbitrate between microphone/input requests.
6060 * Logged from
6061 *   frameworks/av/media/libnblog/ReportPerformance.cpp
6062 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
6063 */
6064message MediametricsAudiothreadReported {
6065    optional int64 timestamp_nanos = 1;
6066    optional string package_name = 2;
6067    optional int64 package_version_code = 3;
6068    optional int64 media_apex_version = 4;
6069
6070    optional android.stats.mediametrics.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6071}
6072
6073/**
6074 * Track how we arbitrate between microphone/input requests.
6075 * Logged from
6076 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
6077 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
6078 */
6079message MediametricsAudiotrackReported {
6080    optional int64 timestamp_nanos = 1;
6081    optional string package_name = 2;
6082    optional int64 package_version_code = 3;
6083    optional int64 media_apex_version = 4;
6084
6085    optional android.stats.mediametrics.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6086}
6087
6088/**
6089 * Track information about DRM framework performance
6090 * Logged from
6091 *   frameworks/av/drm/libmediadrm/DrmHal.cpp
6092 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
6093 */
6094message MediametricsMediadrmReported {
6095    optional int64 timestamp_nanos = 1;
6096    optional string package_name = 2;
6097    optional int64 package_version_code = 3;
6098    optional int64 media_apex_version = 4;
6099
6100    // vendor+description tell about which DRM plugin is in use on this device
6101    optional string vendor = 5;
6102    optional string description = 6;
6103    // from frameworks/av/drm/libmediadrm/protos/metrics.proto
6104    optional bytes framework_stats = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
6105}
6106
6107/**
6108 * Track information about the widevine DRM plugin performance
6109 * Logged from
6110 *   vendor/widevine/libwvdrmengine/cdm/metrics
6111 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
6112 */
6113message MediametricsDrmWidevineReported {
6114    optional int64 timestamp_nanos = 1;
6115    optional string package_name = 2;
6116    optional int64 package_version_code = 3;
6117    optional int64 media_apex_version = 4;
6118
6119    optional bytes vendor_specific_stats = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6120}
6121
6122/**
6123 * Track information about recordings (e.g. camcorder)
6124 * Logged from
6125 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
6126 *   frameworks/av/services/mediaanalytics/statsd_recorder.cpp
6127 */
6128message MediametricsRecorderReported {
6129    optional int64 timestamp_nanos = 1;
6130    optional string package_name = 2;
6131    optional int64 package_version_code = 3;
6132    optional int64 media_apex_version = 4;
6133
6134    optional android.stats.mediametrics.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6135}
6136
6137/**
6138 * Track Media Player usage
6139 * Logged from:
6140 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
6141 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
6142 */
6143message MediametricsNuPlayerReported {
6144    optional int64 timestamp_nanos = 1;
6145    optional string package_name = 2;
6146    optional int64 package_version_code = 3;
6147    optional int64 media_apex_version = 4;
6148
6149    optional android.stats.mediametrics.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
6150}
6151
6152/**
6153 * State of a dangerous permission requested by a package
6154 */
6155message DangerousPermissionState {
6156    // Name of the permission
6157    optional string permission_name = 1;
6158
6159    // Uid of the package
6160    optional int32 uid = 2 [(is_uid) = true];
6161
6162    // Package requesting the permission
6163    optional string package_name = 3;
6164
6165    // If the permission is granted to the uid
6166    optional bool is_granted = 4;
6167
6168    // Permission flags as per android.content.pm.PermissionFlags
6169    optional int32 permission_flags = 5;
6170}
6171
6172/**
6173 * Logs when a package is denied access to a device identifier based on the new access requirements.
6174 *
6175 * Logged from:
6176 *     frameworks/base/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
6177 */
6178message DeviceIdentifierAccessDenied {
6179    // The name of the package denied access to the requested device identifier.
6180    optional string package_name = 1;
6181
6182    // The name of the device identifier method the package attempted to invoke.
6183    optional string method_name = 2;
6184
6185    // True if the package is preinstalled.
6186    optional bool is_preinstalled = 3;
6187
6188    // True if the package is privileged.
6189    optional bool is_priv_app = 4;
6190}
6191
6192/**
6193 * Pulls the ongoing mainline install train version code.
6194 * Pulled from StatsCompanionService
6195 */
6196message TrainInfo {
6197    optional int64 train_version_code = 1;
6198
6199    optional TrainExperimentIds train_experiment_id = 2;
6200
6201    optional string train_name = 3;
6202
6203    enum Status {
6204        UNKNOWN = 0;
6205        INSTALL_REQUESTED = 1;
6206        INSTALL_STARTED = 2;
6207        INSTALL_STAGED_NOT_READY = 3;
6208        INSTALL_STAGED_READY = 4;
6209        INSTALL_SUCCESS = 5;
6210        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
6211        // and INSTALL_FAILURE_COMMIT.
6212        INSTALL_FAILURE = 6  [deprecated = true];
6213        // This enum is for installs that are manually cancelled via the Manual Update UI.
6214        INSTALL_CANCELLED = 7;
6215        INSTALLER_ROLLBACK_REQUESTED = 8;
6216        INSTALLER_ROLLBACK_INITIATED = 9;
6217        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
6218        INSTALLER_ROLLBACK_STAGED = 11;
6219        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
6220        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
6221        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
6222        INSTALLER_ROLLBACK_SUCCESS = 15;
6223        INSTALLER_ROLLBACK_FAILURE = 16;
6224        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
6225        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
6226        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
6227        INSTALL_STAGED_CANCEL_REQUESTED = 20;
6228        INSTALL_STAGED_CANCEL_SUCCESS = 21;
6229        INSTALL_STAGED_CANCEL_FAILURE = 22;
6230        INSTALL_FAILURE_DOWNLOAD = 23;
6231        INSTALL_FAILURE_STATE_MISMATCH = 24;
6232        INSTALL_FAILURE_COMMIT = 25;
6233    }
6234    optional Status status = 4;
6235}
6236
6237/**
6238 * Logs the gesture stage changed event.
6239 *
6240 * Logged from:
6241 *   frameworks/base/packages/SystemUI/
6242 */
6243message AssistGestureStageReported {
6244    optional android.hardware.sensor.assist.AssistGestureStageEnum gesture_stage = 1;
6245}
6246
6247/**
6248 * Logs the feedback type.
6249 *
6250 * Logged from:
6251 *   frameworks/base/packages/SystemUI/
6252 */
6253message AssistGestureFeedbackReported {
6254    // Whether or not the gesture was used.
6255    optional android.hardware.sensor.assist.AssistGestureFeedbackEnum feedback_type = 1;
6256}
6257
6258/**
6259 * Logs the progress.
6260 *
6261 * Logged from:
6262 *   frameworks/base/packages/SystemUI/
6263 */
6264message AssistGestureProgressReported {
6265    // [0,100] progress for the assist gesture.
6266    optional int32 progress = 1;
6267}
6268
6269/*
6270 * Information about the time zone data on a device.
6271 */
6272message TimeZoneDataInfo {
6273    // A version identifier for the data set on device. e.g. "2018i"
6274    optional string tzdb_version = 1;
6275}
6276
6277/**
6278 * Logs the GPU stats global health information.
6279 *
6280 * Logged from:
6281 *   frameworks/native/services/gpuservice/gpustats/
6282 */
6283message GpuStatsGlobalInfo {
6284    // Package name of the gpu driver.
6285    optional string driver_package_name = 1;
6286
6287    // Version name of the gpu driver.
6288    optional string driver_version_name = 2;
6289
6290    // Version code of the gpu driver.
6291    optional int64 driver_version_code = 3;
6292
6293    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
6294    optional int64 driver_build_time = 4;
6295
6296    // Total count of the gl driver gets loaded.
6297    optional int64 gl_loading_count = 5;
6298
6299    // Total count of the gl driver fails to be loaded.
6300    optional int64 gl_loading_failure_count = 6;
6301
6302    // Total count of the Vulkan driver gets loaded.
6303    optional int64 vk_loading_count = 7;
6304
6305    // Total count of the Vulkan driver fails to be loaded.
6306    optional int64 vk_loading_failure_count = 8;
6307
6308    // Api version of the system Vulkan driver.
6309    optional int32 vulkan_version = 9;
6310
6311    // Api version of the system CPU Vulkan driver.
6312    optional int32 cpu_vulkan_version = 10;
6313
6314    // Api version of the system GLES driver.
6315    optional int32 gles_version = 11;
6316
6317    // Total count of the angle driver gets loaded.
6318    optional int64 angle_loading_count = 12;
6319
6320    // Total count of the angle driver fails to be loaded.
6321    optional int64 angle_loading_failure_count = 13;
6322}
6323
6324/**
6325 * GPU driver loading time info.
6326 */
6327message GpuDriverLoadingTime {
6328    // List of all the driver loading times for this app. The list size is
6329    // capped at 50.
6330    repeated int64 driver_loading_time = 1;
6331}
6332
6333/**
6334 * Logs the GPU stats per app health information.
6335 *
6336 * Logged from:
6337 *   frameworks/native/services/gpuservice/gpustats/
6338 */
6339message GpuStatsAppInfo {
6340    // Package name of the application that loads the gpu driver. Total number
6341    // of different packages is capped at 100.
6342    optional string app_package_name = 1;
6343
6344    // Version code of the gpu driver this app loads.
6345    optional int64 driver_version_code = 2;
6346
6347    // gl driver loading time info.
6348    optional GpuDriverLoadingTime gl_driver_loading_time = 3
6349            [(android.os.statsd.log_mode) = MODE_BYTES];
6350
6351    // Vulkan driver loading time info.
6352    optional GpuDriverLoadingTime vk_driver_loading_time = 4
6353            [(android.os.statsd.log_mode) = MODE_BYTES];
6354
6355    // Angle driver loading time info.
6356    optional GpuDriverLoadingTime angle_driver_loading_time = 5
6357            [(android.os.statsd.log_mode) = MODE_BYTES];
6358
6359    // CPU Vulkan implementation is in use.
6360    optional bool cpu_vulkan_in_use = 6;
6361}
6362
6363/*
6364 * Logs the size of the system ion heap.
6365 *
6366 * Pulled from StatsCompanionService.
6367 */
6368message SystemIonHeapSize {
6369    // Size of the system ion heap in bytes.
6370    optional int64 size_in_bytes = 1;
6371}
6372
6373/*
6374 * Logs the per-process size of the system ion heap.
6375 *
6376 * Pulled from StatsCompanionService.
6377 */
6378message ProcessSystemIonHeapSize {
6379    // The uid if available. -1 means not available.
6380    optional int32 uid = 1 [(is_uid) = true];
6381
6382    // The process name (from /proc/PID/cmdline).
6383    optional string process_name = 2;
6384
6385    // Sum of sizes of all allocations.
6386    optional int32 total_size_in_kilobytes = 3;
6387
6388    // Number of allocations.
6389    optional int32 allocation_count = 4;
6390
6391    // Size of the largest allocation.
6392    optional int32 max_size_in_kilobytes = 5;
6393}
6394
6395/**
6396 * Push network stack events.
6397 *
6398 * Log from:
6399 *     frameworks/base/packages/NetworkStack/
6400 */
6401message NetworkStackReported {
6402    // The id that indicates the event reported from NetworkStack.
6403    optional int32 event_id = 1;
6404    // The data for the reported events.
6405    optional android.stats.connectivity.NetworkStackEventData network_stack_event = 2 [(log_mode) = MODE_BYTES];
6406}
6407
6408/**
6409 * Logs the apps that are installed on the external storage.
6410 * Pulled from:
6411 *   StatsCompanionService
6412 */
6413message AppsOnExternalStorageInfo {
6414    // The type of the external storage.
6415    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
6416    // The name of the package that is installed on the external storage.
6417    optional string package_name = 2;
6418}
6419
6420/**
6421 * Logs the settings related to Face.
6422 * Logged from:
6423 *   frameworks/base/services/core/java/com/android/server/stats
6424 */
6425message FaceSettings {
6426    // Whether or not face unlock is allowed on Keyguard.
6427    optional bool unlock_keyguard_enabled = 1;
6428    // Whether or not face unlock dismisses the Keyguard.
6429    optional bool unlock_dismisses_keyguard = 2;
6430    // Whether or not face unlock requires attention.
6431    optional bool unlock_attention_required = 3;
6432    // Whether or not face unlock is allowed for apps (through BiometricPrompt).
6433    optional bool unlock_app_enabled = 4;
6434    // Whether or not face unlock always requires user confirmation.
6435    optional bool unlock_always_require_confirmation = 5;
6436    // Whether or not a diverse set of poses are required during enrollment.
6437    optional bool unlock_diversity_required = 6;
6438}
6439
6440/**
6441 * Logs cooling devices maintained by the kernel.
6442 *
6443 * Pulled from StatsCompanionService.java
6444 */
6445message CoolingDevice {
6446    // The type of cooling device being reported. Eg. CPU, GPU...
6447    optional android.os.CoolingTypeEnum device_location = 1;
6448    // The name of the cooling device source. Eg. CPU0
6449    optional string device_name = 2;
6450    // Current throttle state of the cooling device. The value can any unsigned
6451    // integer between 0 and max_state defined in its driver. 0 means device is
6452    // not in throttling, higher value means deeper throttling.
6453    optional int32 state = 3;
6454}
6455
6456/**
6457 * Intelligence has several counter-type events that don't warrant a
6458 * full separate atom. These are primarily API call counters but also include
6459 * counters for feature usage and specific failure modes.
6460 *
6461 * Logged from the Intelligence mainline module.
6462 */
6463message IntelligenceEventReported {
6464  optional android.stats.intelligence.EventType event_id = 1;
6465  optional android.stats.intelligence.Status status = 2;
6466}
6467
6468/**
6469 * Logs when Car Power state changed.
6470 *
6471 * Logged from:
6472 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
6473 */
6474message CarPowerStateChanged {
6475    // States come from CpmsState in CarPowerManagementService.java.
6476    enum State {
6477       WAIT_FOR_VHAL = 0;
6478       ON = 1;
6479       SHUTDOWN_PREPARE = 2;
6480       WAIT_FOR_FINISH = 3;
6481       SUSPEND = 4;
6482       SIMULATE_SLEEP = 5;
6483    }
6484    optional State state = 1;
6485}
6486
6487/**
6488 * Logs whether GarageMode is entered.
6489 *
6490 * Logged from:
6491 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
6492 */
6493message GarageModeInfo {
6494    // Whether GarageMode is entered.
6495    optional bool is_garage_mode = 1;
6496}
6497
6498/**
6499 * Historical app ops data per package.
6500 */
6501message AppOps {
6502    // Uid of the package requesting the op
6503    optional int32 uid = 1 [(is_uid) = true];
6504
6505    // Nmae of the package performing the op
6506    optional string package_name = 2;
6507
6508    // operation id; maps to the OP_* constants in AppOpsManager.java
6509    optional int32 op_id = 3;
6510
6511    // The number of times the op was granted while the app was in the
6512    // foreground (only for trusted requests)
6513    optional int64 trusted_foreground_granted_count = 4;
6514
6515    // The number of times the op was granted while the app was in the
6516    // background (only for trusted requests)
6517    optional int64 trusted_background_granted_count = 5;
6518
6519    // The number of times the op was rejected while the app was in the
6520    // foreground (only for trusted requests)
6521    optional int64 trusted_foreground_rejected_count = 6;
6522
6523    // The number of times the op was rejected while the app was in the
6524    // background (only for trusted requests)
6525    optional int64 trusted_background_rejected_count = 7;
6526
6527    // For long-running operations, total duration of the operation
6528    // while the app was in the foreground (only for trusted requests)
6529    optional int64 trusted_foreground_duration_millis = 8;
6530
6531    // For long-running operations, total duration of the operation
6532    // while the app was in the background (only for trusted requests)
6533    optional int64 trusted_background_duration_millis = 9;
6534}
6535
6536/**
6537 * Location Manager API Usage information(e.g. API under usage,
6538 * API call's parameters).
6539 * Logged from:
6540 *  frameworks/base/services/core/java/com/android/server/LocationManagerService.java
6541 */
6542message LocationManagerApiUsageReported {
6543
6544    // Indicating if usage starts or usage ends.
6545    optional android.stats.location.UsageState state = 1;
6546
6547    // LocationManagerService's API in use.
6548    // We can identify which API from LocationManager is
6549    // invoking current LMS API by the combination of
6550    // API parameter(e.g. is_listener_null, is_intent_null,
6551    // is_location_request_null)
6552    optional android.stats.location.LocationManagerServiceApi api_in_use = 2;
6553
6554    // Name of the package calling the API.
6555    optional string calling_package_name = 3;
6556
6557    // Type of the location provider.
6558    optional android.stats.location.ProviderType provider = 4;
6559
6560    // Quality of the location request
6561    optional android.stats.location.LocationRequestQuality quality = 5;
6562
6563    // The desired interval for active location updates, in milliseconds.
6564    // Bucketized to reduce cardinality.
6565    optional android.stats.location.LocationRequestIntervalBucket bucketized_interval = 6;
6566
6567    // Minimum distance between location updates, in meters.
6568    // Bucketized to reduce cardinality.
6569    optional android.stats.location.SmallestDisplacementBucket
6570            bucketized_smallest_displacement = 7;
6571
6572    // The number of location updates.
6573    optional int64 num_updates = 8;
6574
6575    // The request expiration time, in millisecond since boot.
6576    // Bucketized to reduce cardinality.
6577    optional android.stats.location.ExpirationBucket
6578            bucketized_expire_in = 9;
6579
6580    // Type of Callback passed in for this API.
6581    optional android.stats.location.CallbackType callback_type = 10;
6582
6583    // The radius of the central point of the alert
6584    // region, in meters. Only for API REQUEST_GEOFENCE.
6585    // Bucketized to reduce cardinality.
6586    optional android.stats.location.GeofenceRadiusBucket bucketized_radius = 11;
6587
6588    // Activity Importance of API caller.
6589    // Categorized to 3 types that are interesting from location's perspective.
6590    optional android.stats.location.ActivityImportance activiy_importance = 12;
6591}
6592
6593/**
6594 * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
6595 */
6596message ReviewPermissionsFragmentResultReported {
6597    // unique value identifying a permission group change. A permission group change might result
6598    // in multiple of these atoms
6599    optional int64 change_id = 1;
6600
6601    // UID of package the permission belongs to
6602    optional int32 uid = 2 [(is_uid) = true];
6603
6604    // Name of package the permission belongs to
6605    optional string package_name = 3;
6606
6607    // The permission to be granted
6608    optional string permission_name = 4;
6609
6610    // The result of the permission grant
6611    optional bool permission_granted = 5;
6612}
6613
6614/**
6615* Information about results of permission upgrade by RuntimePermissionsUpgradeController
6616* Logged from: RuntimePermissionUpdgradeController
6617*/
6618message RuntimePermissionsUpgradeResult {
6619    // Permission granted as result of upgrade
6620    optional string permission_name = 1;
6621
6622    // UID of package granted permission
6623    optional int32 uid = 2 [(is_uid) = true];
6624
6625    // Name of package granted permission
6626    optional string package_name = 3;
6627}
6628
6629/**
6630* Information about a buttons presented in GrantPermissionsActivty and choice made by user
6631*/
6632message GrantPermissionsActivityButtonActions {
6633    // Permission granted as result of upgrade
6634    optional string permission_group_name = 1;
6635
6636    // UID of package granted permission
6637    optional int32 uid = 2 [(is_uid) = true];
6638
6639    // Name of package requesting permission
6640    optional string package_name = 3;
6641
6642    // Buttons presented in the dialog - bit flags, bit numbers are in accordance with
6643    // LABEL_ constants in GrantPermissionActivity.java
6644    optional int32 buttons_presented = 4;
6645
6646    // Button clicked by user - same as bit flags in buttons_presented with only single bit set
6647    optional int32 button_clicked = 5;
6648}
6649
6650/**
6651 * Information about LocationAccessCheck notification presented to user
6652 */
6653message LocationAccessCheckNotificationAction {
6654
6655    // id which identifies single session of user interacting with permission controller
6656    optional int64 session_id = 1;
6657
6658    // Uid of package for which location access check is presented
6659    optional int32 package_uid = 2;
6660
6661    // Name of package for which location access check is presented
6662    optional string package_name = 3;
6663
6664    enum Result {
6665        UNDEFINED = 0;
6666        // notification was presented to the user
6667        NOTIFICATION_PRESENTED = 1;
6668        // notification was declined by the user
6669        NOTIFICATION_DECLINED = 2;
6670        // notification was clicked by the user
6671        NOTIFICATION_CLICKED = 3;
6672    }
6673
6674    // View / interaction recorded
6675    optional Result result = 4;
6676}
6677
6678/**
6679 * Information about a permission grant or revoke made by user inside AppPermissionFragment
6680 */
6681message AppPermissionFragmentActionReported {
6682    // id which identifies single session of user interacting with permission controller
6683    optional int64 session_id = 1;
6684
6685    // unique value identifying a permission group change. A permission group change might result
6686    // in multiple of these atoms
6687    optional int64 change_id = 2;
6688
6689    // UID of package the permission belongs to
6690    optional int32 uid = 3 [(is_uid) = true];
6691
6692    // Name of package the permission belongs to
6693    optional string package_name = 4;
6694
6695    // The permission to be granted
6696    optional string permission_name = 5;
6697
6698    // The result of the permission grant
6699    optional bool permission_granted = 6;
6700}
6701
6702/**
6703* Information about a AppPermissionFragment viewed by user
6704*/
6705message AppPermissionFragmentViewed {
6706    // id which identifies single session of user interacting with permission controller
6707    optional int64 session_id = 1;
6708
6709    // UID of package for which permissions are viewed
6710    optional int32 uid = 2 [(is_uid) = true];
6711
6712    // Name of package for which permissions are viewed
6713    optional string package_name = 3;
6714
6715    // Permission group viewed
6716    optional string permission_group_name = 4;
6717}
6718
6719/**
6720* Information about a AppPermissionsFragment viewed by user
6721*/
6722message AppPermissionsFragmentViewed {
6723    // id which identifies single session of user interacting with permission controller
6724    optional int64 session_id = 1;
6725
6726    // id which identifies single view as every view might have several logging records
6727    // with different package information attached
6728    optional int64 view_id = 2;
6729
6730    // Permission group viewed
6731    optional string permission_group_name = 3;
6732
6733    // UID of package for which permissions are viewed
6734    optional int32 uid = 4 [(is_uid) = true];
6735
6736    // Name of package for which permissions are viewed
6737    optional string package_name = 5;
6738
6739    // Category in which permission is included
6740    enum Category {
6741      UNDEFINED = 0;
6742      ALLOWED = 1;
6743      ALLOWED_FOREGROUND = 2;
6744      DENIED = 3;
6745    }
6746    optional Category category = 6;
6747}
6748
6749/**
6750* Information about a PermissionAppsFragment viewed by user.
6751* Logged from ui/handheld/PermissionAppsFragment.java
6752*/
6753message PermissionAppsFragmentViewed {
6754    // id which identifies single session of user interacting with permission controller
6755    optional int64 session_id = 1;
6756
6757    // id which identifies single view as every view might have several logging records
6758    // with different package information attached
6759    optional int64 view_id = 2;
6760
6761    // Permission group viewed
6762    optional string permission_group_name = 3;
6763
6764    // UID of package for which permissions are viewed
6765    optional int32 uid = 4 [(is_uid) = true];
6766
6767    // Name of package for which permissions are viewed
6768    optional string package_name = 5;
6769
6770    // Category in which app is included
6771    enum Category {
6772        UNDEFINED = 0;
6773        ALLOWED = 1;
6774        ALLOWED_FOREGROUND = 2;
6775        DENIED = 3;
6776    }
6777    optional Category category = 6;
6778}
6779